收藏
回答

想问下BLE中this.+下划线属性是什么意思 ?

wx.getBLEDeviceCharacteristics({

deviceId,

serviceId,

success: (res) => {

console.log('getBLEDeviceCharacteristics success', res.characteristics)

for (let i = 0; i < res.characteristics.length; i++) {

let item = res.characteristics[i]

if (item.properties.read) {

wx.readBLECharacteristicValue({

deviceId,

serviceId,

characteristicId: item.uuid,

})

}

if (item.properties.write) {

this.canWrite = true

this._deviceId = deviceId


this._serviceId = serviceId

this._characteristicId = item.uuid

//this.writeBLECharacteristicValue()

}

回答关注问题邀请回答
收藏

2 个回答

  • 茜茜又困了🐽
    茜茜又困了🐽
    2022-09-07

    给this对象内该属性赋值,可以随便定义(关键字除外)

    2022-09-07
    有用
    回复
  • 小黎
    小黎
    2022-09-07

    就一个变量名啊

    2022-09-07
    有用
    回复
登录 后发表内容