# wx.getBLEDeviceCharacteristics(Object object)

Start from base library version 1.1.0. Please remaining backward compatible.

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6

Get all the features of a service on a Bluetooth low-power device (characteristic)。

# parameter

# Object object

attribute type Default values Required Introductions
deviceId string yes Bluetooth Device id。 Need has passed wx.createBLEConnection Establish a connection
serviceId string yes Bluetooth Service UUID。 Need to call first wx.getBLEDeviceServices Obtain
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.success callback

# parameter
# Object res
attribute type Introductions
characteristics Array.&ltObject&gt Equipment Feature List

res.characteristics Structure

attribute type Introductions
uuid string Bluetooth device feature UUID
properties Object Type of operation supported by this feature

properties Structure

attribute type Introductions
read boolean Does this feature support read operation
write boolean Does this feature support write operation
notify boolean Does this feature support notify operation
indicate boolean Does this feature support indicate operation

# error

Error code Error message Introductions
0 ok normal
-1 already connect Connected
10000 not init Uninitialized Bluetooth adapter
10001 not available The current Bluetooth adapter is not available
10002 No device Specified device not found
10003 connection fail Connection failure
10004 No service Specified service not found
10005 No characteristic Did not find the specified signature.
10006 No connection Current connection disconnected
10007 property not support Current feature does not support this operation
10008 system error All other system reported anomalies
10009 system not support Android System specific, system version below 4.3 Not supported WAS
10012 operate time out Connection Timeout
10013 invalid_data Connect deviceId Is empty or incorrectly formatted

# sample code

Preview with Developer Tool

wx.getBLEDeviceCharacteristics({
  // Here. deviceId Need has passed wx.createBLEConnection Establish a link with the corresponding device
  deviceId,
  // Here. serviceId Need to wx.getBLEDeviceServices Get in interface
  serviceId,
  success (res) {
    console.log('device getBLEDeviceCharacteristics:', res.characteristics)
  }
})