From 7e77bd782c1f6621b8244fa60a518e27c23422d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Lenart?= Date: Fri, 12 Jul 2019 16:26:58 +0200 Subject: [PATCH] Add Descriptor class and implement all descriptor's related methods in JS with type information. --- docs/index.html | 2287 +++++++++++++++++++++++++++++++++++------ documentation.yml | 1 + src/BleManager.js | 283 ++++- src/BleModule.js | 218 +++- src/Characteristic.js | 36 + src/Descriptor.js | 84 ++ src/Service.js | 54 + 7 files changed, 2639 insertions(+), 324 deletions(-) create mode 100644 src/Descriptor.js diff --git a/docs/index.html b/docs/index.html index 2cb80692..00834621 100644 --- a/docs/index.html +++ b/docs/index.html @@ -190,6 +190,12 @@

react-native-ble-plx

#characteristicsForDevice +
  • + #descriptorsForDevice +
  • +
  • @@ -214,6 +220,18 @@

    react-native-ble-plx

    #monitorCharacteristicForDevice
  • +
  • + #readDescriptorForDevice +
  • + +
  • + #writeDescriptorForDevice +
  • + @@ -444,6 +462,12 @@

    react-native-ble-plx

    #characteristics +
  • + #descriptorsForCharacteristic +
  • +
  • @@ -468,6 +492,18 @@

    react-native-ble-plx

    #monitorCharacteristic
  • +
  • + #readDescriptorForCharacteristic +
  • + +
  • + #writeDescriptorForCharacteristic +
  • + @@ -562,6 +598,12 @@

    react-native-ble-plx

    #value +
  • + #descriptors +
  • +
  • @@ -586,6 +628,100 @@

    react-native-ble-plx

    #monitor
  • +
  • + #readDescriptor +
  • + +
  • + #writeDescriptor +
  • + + + + + + + + + + +
  • + Descriptor + + + + + + +
    +
    +
    + + descriptorsForDevice(deviceIdentifier, serviceUUID, characteristicUUID) +
    +
    + @@ -4255,34 +4491,23 @@

    - - - - - - - - - -
    +
    +
    +
    + + readDescriptorForDevice(deviceIdentifier, serviceUUID, characteristicUUID, descriptorUUID, transactionId) +
    +
    + + + + + + + +
    Returns
    + Promise<Descriptor>: + Promise which emits first +Descriptor + object matching specified +UUID paths. Latest value of +Descriptor + will be stored inside returned object. + + + + + + + + + + + + + + +
    + + + + +
    +
    +
    + + writeDescriptorForDevice(deviceIdentifier, serviceUUID, characteristicUUID, descriptorUUID, valueBase64, transactionId) +
    +
    + +
    + + + + + + + + + + +
    + + +
    + +

    + Device +

    + + +
    + + +

    Device instance which can be retrieved only by calling +bleManager.startDeviceScan().

    + + + +
    new Device(nativeDevice: NativeDevice, manager: BleManager)
    + + + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + nativeDevice (NativeDevice) + Native device properties + +
    + +
    + +
    +
    + manager (BleManager) + BleManager + handle + +
    + +
    + +
    + + + + + + + + + @@ -6447,11 +6918,11 @@

    -
    +
    - readCharacteristic(characteristicUUID, transactionId) + descriptorsForCharacteristic(characteristicUUID)
    -
    -
    - transactionId (TransactionId?) - optional -transactionId - which can be used in - -bleManager.cancelTransaction() - function. - -
    - -
    -
    @@ -6511,13 +6968,15 @@

    Returns
    - Promise<Characteristic>: - Promise which emits first -Characteristic - object matching specified -UUID path. Latest value of + Promise<Array<Descriptor>>: + Promise which emits array of +Descriptor + objects which are +discovered for this +Service + in specified Characteristic - will be stored inside returned object. +. @@ -6537,11 +6996,11 @@

    -
    +
    - writeCharacteristicWithResponse(characteristicUUID, valueBase64, transactionId) + readCharacteristic(characteristicUUID, transactionId)
    -
    -
    - valueBase64 (Base64) - Value in Base64 format. - -
    - -
    -
    transactionId (TransactionId?) @@ -6614,7 +7064,9 @@

    Promise which emits first Characteristic object matching specified -UUID path. Latest value of characteristic may not be stored inside returned object. +UUID path. Latest value of +Characteristic + will be stored inside returned object. @@ -6634,11 +7086,11 @@

    -
    +
    - writeCharacteristicWithoutResponse(characteristicUUID, valueBase64, transactionId) + writeCharacteristicWithResponse(characteristicUUID, valueBase64, transactionId)
    -
    +
    - monitorCharacteristic(characteristicUUID, listener, transactionId) + writeCharacteristicWithoutResponse(characteristicUUID, valueBase64, transactionId)
    -
    - - - - -

    - - - -
    +
    +
    +
    + + monitorCharacteristic(characteristicUUID, listener, transactionId) +
    +
    + +
    -
    +
    - id + readDescriptorForCharacteristic(characteristicUUID, descriptorUUID, transactionId)
    -
    +
    - uuid + writeDescriptorForCharacteristic(characteristicUUID, descriptorUUID, valueBase64, transactionId)
    -
    -
    -
    - - serviceID -
    -
    - -

    Service's ID to which characteristic belongs

    - - -
    serviceID
    - +
    + + + +
    + -

    +

    + +

    + Characteristic +

    + + +
    + + +

    Characteristic object.

    + + + +
    new Characteristic(nativeCharacteristic: NativeCharacteristic, manager: BleManager)
    + + + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + nativeCharacteristic (NativeCharacteristic) + NativeCharacteristic + +
    + +
    + +
    +
    + manager (BleManager) + BleManager + +
    + +
    + +
    + + + + + + + + + + + + + +
    Instance Members
    +
    + +
    +
    +
    + + id +
    +
    + +
    + +
    +
    +
    + + uuid +
    +
    + +
    + +
    +
    +
    + + serviceID +
    +
    + +
    + +
    +
    +
    + + isReadable +
    +
    + +
    + +
    +
    +
    + + isWritableWithResponse +
    +
    + +
    + +
    +
    +
    + + isWritableWithoutResponse +
    +
    + +
    + +
    +
    +
    + + isNotifiable +
    +
    + +
    + +
    +
    +
    + + isNotifying +
    +
    + +
    + +
    +
    +
    + + isIndicatable +
    +
    + +
    + +
    +
    +
    + + value +
    +
    + +
    + +
    +
    +
    + + descriptors() +
    +
    + +
    + +
    +
    +
    + + read(transactionId) +
    +
    + +
    + +
    +
    +
    + + writeWithResponse(valueBase64, transactionId) +
    +
    + +
    + +
    +
    +
    + + writeWithoutResponse(valueBase64, transactionId) +
    +
    + +
    + +
    +
    +
    + + monitor(listener, transactionId) +
    +
    + +
    + +
    +
    +
    + + readDescriptor(descriptorUUID, transactionId) +
    +
    + +
    + +
    +
    +
    + + writeDescriptor(descriptorUUID, valueBase64, transactionId) +
    +
    +
    -
    -
    -
    - - isReadable -
    -
    - -

    True if characteristic can be read

    + +
    + + + +
    + + +
    + +

    + Descriptor +

    + + +
    + + +

    Descriptor object.

    -
    isReadable
    +
    new Descriptor(nativeDescriptor: NativeDescriptor, manager: BleManager)
    -

    - Type: - boolean -

    - @@ -7206,9 +8908,28 @@

    +
    Parameters
    +
    + +
    +
    + nativeDescriptor (NativeDescriptor) + NativeDescriptor - +
    + +
    + +
    +
    + manager (BleManager) + BleManager +
    + +
    + +
    @@ -7220,16 +8941,16 @@

    -

    - - -
    +
    Instance Members
    +
    + +
    - isWritableWithResponse + id
    -
    +
    - isWritableWithoutResponse + uuid
    -
    +
    - isNotifiable + characteristicID
    -
    +
    - isNotifying + characteristicUUID
    -
    +
    - isIndicatable + serviceID
    -
    +
    - value + serviceUUID
    -
    +
    - read(transactionId) + deviceID
    -
    +
    - writeWithResponse(valueBase64, transactionId) + value
    -
    +
    - writeWithoutResponse(valueBase64, transactionId) + read(transactionId)