Options
All
  • Public
  • Public/Protected
  • All
Menu

Device instance which can be retrieved only by calling {@link #blemanagerstartdevicescan|bleManager.startDeviceScan()}.

Hierarchy

  • Device

Implements

  • NativeDevice

Index

Constructors

Private constructor

  • new Device(nativeDevice: NativeDevice, manager: BleManager): Device
  • Private constructor used to create Device object.

    Parameters

    • nativeDevice: NativeDevice

      Native device properties

    • manager: BleManager

      {@link BleManager} handle

    Returns Device

Properties

id

id: string

Device identifier: MAC address on Android and UUID on iOS.

isConnectable

isConnectable: null | boolean

Is device connectable. [iOS only]

localName

localName: null | string

User friendly name of device.

manufacturerData

manufacturerData: null | string

Device's custom manufacturer data. Its format is defined by manufacturer.

mtu

mtu: number

Current Maximum Transmission Unit for this device. When device is not connected default value of 23 is used.

name

name: null | string

Device name if present

overflowServiceUUIDs

overflowServiceUUIDs: null | string[]

List of overflow service UUIDs. [iOS only]

rssi

rssi: null | number

Current Received Signal Strength Indication of device

serviceData

serviceData: null | {}

Map of service UUIDs (as keys) with associated data (as values).

serviceUUIDs

serviceUUIDs: null | string[]

List of available services visible during scanning.

solicitedServiceUUIDs

solicitedServiceUUIDs: null | string[]

List of solicited service UUIDs.

txPowerLevel

txPowerLevel: null | number

Transmission power level of device.

Methods

cancelConnection

  • cancelConnection(): Promise<Device>
  • {@link #blemanagercanceldeviceconnection|bleManager.cancelDeviceConnection()} with partially filled arguments.

    Returns Promise<Device>

    Returns closed Device when operation is successful.

characteristicsForService

  • characteristicsForService(serviceUUID: string): Promise<Characteristic[]>
  • {@link #blemanagercharacteristicsfordevice|bleManager.characteristicsForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    Returns Promise<Characteristic[]>

    Promise which emits array of {@link Characteristic} objects which are discovered for a Device in specified {@link Service}.

connect

  • connect(options?: ConnectionOptions): Promise<Device>
  • {@link #blemanagerconnecttodevice|bleManager.connectToDevice()} with partially filled arguments.

    Parameters

    • Optional options: ConnectionOptions

      Platform specific options for connection establishment. Not used currently.

    Returns Promise<Device>

    Connected Device object if successful.

descriptorsForService

  • descriptorsForService(serviceUUID: string, characteristicUUID: string): Promise<Descriptor[]>
  • {@link #blemanagerdescriptorsfordevice|bleManager.descriptorsForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    Returns Promise<Descriptor[]>

    Promise which emits array of {@link Descriptor} objects which are discovered for this {@link Characteristic}.

discoverAllServicesAndCharacteristics

  • discoverAllServicesAndCharacteristics(transactionId?: string): Promise<Device>
  • {@link #blemanagerdiscoverallservicesandcharacteristicsfordevice|bleManager.discoverAllServicesAndCharacteristicsForDevice()} with partially filled arguments.

    Parameters

    • Optional transactionId: string

      Transaction handle used to cancel operation

    Returns Promise<Device>

    Promise which emits Device object if all available services and characteristics have been discovered.

isConnected

  • isConnected(): Promise<boolean>
  • {@link #blemanagerisdeviceconnected|bleManager.isDeviceConnected()} with partially filled arguments.

    Returns Promise<boolean>

    Promise which emits true if device is connected, and false otherwise.

monitorCharacteristicForService

  • monitorCharacteristicForService(serviceUUID: string, characteristicUUID: string, listener: (error: null | BleError, characteristic: null | Characteristic) => void, transactionId?: string): Subscription
  • {@link #blemanagermonitorcharacteristicfordevice|bleManager.monitorCharacteristicForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    • listener: (error: null | BleError, characteristic: null | Characteristic) => void

      callback which emits {@link Characteristic} objects with modified value for each notification.

        • (error: null | BleError, characteristic: null | Characteristic): void
        • Parameters

          • error: null | BleError
          • characteristic: null | Characteristic

          Returns void

    • Optional transactionId: string

      optional transactionId which can be used in {@link #blemanagercanceltransaction|bleManager.cancelTransaction()} function.

    Returns Subscription

    Subscription on which remove() function can be called to unsubscribe.

onDisconnected

  • onDisconnected(listener: (error: null | BleError, device: Device) => void): Subscription
  • {@link #blemanagerondevicedisconnected|bleManager.onDeviceDisconnected()} with partially filled arguments.

    Parameters

    • listener: (error: null | BleError, device: Device) => void

      callback returning error as a reason of disconnection if available and Device object. If an error is null, that means the connection was terminated by {@link #blemanagercanceldeviceconnection|bleManager.cancelDeviceConnection()} call.

    Returns Subscription

    Subscription on which remove() function can be called to unsubscribe.

readCharacteristicForService

  • readCharacteristicForService(serviceUUID: string, characteristicUUID: string, transactionId?: string): Promise<Characteristic>
  • {@link #blemanagerreadcharacteristicfordevice|bleManager.readCharacteristicForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    • Optional transactionId: string

      optional transactionId which can be used in {@link #blemanagercanceltransaction|bleManager.cancelTransaction()} function.

    Returns Promise<Characteristic>

    Promise which emits first {@link Characteristic} object matching specified UUID paths. Latest value of {@link Characteristic} will be stored inside returned object.

readDescriptorForService

  • readDescriptorForService(serviceUUID: string, characteristicUUID: string, descriptorUUID: string, transactionId?: string): Promise<Descriptor>
  • {@link #blemanagerreaddescriptorfordevice|bleManager.readDescriptorForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    • descriptorUUID: string

      {@link Descriptor} UUID.

    • Optional transactionId: string

      optional transactionId which can be used in {@link #blemanagercanceltransaction|cancelTransaction()} function.

    Returns Promise<Descriptor>

    Promise which emits first {@link Descriptor} object matching specified UUID paths. Latest value of {@link Descriptor} will be stored inside returned object.

readRSSI

  • readRSSI(transactionId?: string): Promise<Device>
  • {@link #blemanagerreadrssifordevice|bleManager.readRSSIForDevice()} with partially filled arguments.

    Parameters

    • Optional transactionId: string

      Transaction handle used to cancel operation.

    Returns Promise<Device>

    This device with updated RSSI value.

requestConnectionPriority

  • requestConnectionPriority(connectionPriority: ConnectionPriority, transactionId?: string): Promise<Device>
  • {@link #blemanagerrequestconnectionpriorityfordevice|bleManager.requestConnectionPriorityForDevice()} with partially filled arguments.

    Parameters

    • connectionPriority: ConnectionPriority
    • Optional transactionId: string

      Transaction handle used to cancel operation.

    Returns Promise<Device>

    Connected device.

requestMTU

  • requestMTU(mtu: number, transactionId?: string): Promise<Device>
  • {@link #blemanagerrequestmtufordevice|bleManager.requestMTUForDevice()} with partially filled arguments.

    Parameters

    • mtu: number
    • Optional transactionId: string

      Transaction handle used to cancel operation.

    Returns Promise<Device>

    Device with updated MTU size. Default value is 23.

services

  • services(): Promise<Service[]>
  • {@link #blemanagerservicesfordevice|bleManager.servicesForDevice()} with partially filled arguments.

    Returns Promise<Service[]>

    Promise which emits array of {@link Service} objects which are discovered by this device.

writeCharacteristicWithResponseForService

  • writeCharacteristicWithResponseForService(serviceUUID: string, characteristicUUID: string, valueBase64: string, transactionId?: string): Promise<Characteristic>
  • {@link #blemanagerwritecharacteristicwithresponsefordevice|bleManager.writeCharacteristicWithResponseForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    • valueBase64: string

      Value in Base64 format.

    • Optional transactionId: string

      optional transactionId which can be used in {@link #blemanagercanceltransaction|bleManager.cancelTransaction()} function.

    Returns Promise<Characteristic>

    Promise which emits first {@link Characteristic} object matching specified UUID paths. Latest value of characteristic may not be stored inside returned object.

writeCharacteristicWithoutResponseForService

  • writeCharacteristicWithoutResponseForService(serviceUUID: string, characteristicUUID: string, valueBase64: string, transactionId?: string): Promise<Characteristic>
  • {@link #blemanagerwritecharacteristicwithoutresponsefordevice|bleManager.writeCharacteristicWithoutResponseForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      {@link Characteristic} UUID.

    • valueBase64: string

      Value in Base64 format.

    • Optional transactionId: string

      optional transactionId which can be used in {@link #blemanagercanceltransaction|bleManager.cancelTransaction()} function.

    Returns Promise<Characteristic>

    Promise which emits first {@link Characteristic} object matching specified UUID paths. Latest value of characteristic may not be stored inside returned object.

writeDescriptorForService

  • writeDescriptorForService(serviceUUID: string, characteristicUUID: string, descriptorUUID: string, valueBase64: string, transactionId?: string): Promise<Descriptor>
  • {@link #blemanagerwritedescriptorfordevice|bleManager.writeDescriptorForDevice()} with partially filled arguments.

    Parameters

    • serviceUUID: string

      {@link Service} UUID.

    • characteristicUUID: string

      Characteristic UUID

    • descriptorUUID: string

      Descriptor UUID

    • valueBase64: string

      Value to be set coded in Base64

    • Optional transactionId: string

      Transaction handle used to cancel operation

    Returns Promise<Descriptor>

    Descriptor which saved passed value.

Generated using TypeDoc