function transformToDevice(peripheral) {
  const { uuid, address, advertisement, connectable } = peripheral;
  const externalId = `bluetooth:${uuid}`;

  const device = {
    name: (advertisement && encodeParamValue(advertisement.localName)) || address || uuid,
    external_id: externalId,
    selector: externalId,
    features: [],
    params: [],
  };

  if (!connectable) {
    setDeviceParam(device, PARAMS.LOADED, 'true');
  }

  addSelector(device);

  return device;
}
@description Transform Noble peripheral to Gladys Bluetooth peripheral.
@param {object} peripheral - Bluetooth peripheral.
@returns {object} Peripheral transformed for Gladys.
@example
transformToDevice({});