W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
根據(jù)指定的外圍設(shè)備 UUID 及其服務(wù) UUID 和特征 UUID 監(jiān)聽數(shù)據(jù)回發(fā)
setNotify({params}, callback(ret, err))
peripheralUUID:
serviceUUID
characteristicUUID
ret:
{
status: true , //布爾類型;是否獲取數(shù)據(jù),true|false
characteristic:{ //JSON對象;獲取監(jiān)聽的特征的信息
uuid: '', //字符串類型;特征的 UUID
serviceUUID: '', //字符串類型;服務(wù)的 UUID
value: , //字符串類型;特征的值
permissions: '', //字符串類型;特征的權(quán)限,取值范圍如下:
//readable:
//writeable:
//readEncryptionRequired:
//writeEncryptionRequired:
propertie: '' //字符串類型;特征的屬性,取值范圍如下:
//broadcast:
//read:
//writeWithoutResponse:
//write:
//notify:
//indicate:
//authenticatedSignedWrites:
//extendedProperties:
//notifyEncryptionRequired:
//indicateEncryptionRequired:
}
}
err:
{
code: 1 //數(shù)字類型;連接失敗時返回錯誤碼,取值范圍如下:
//-1:未知錯誤
//1:peripheralUUID 為空
//2:serviceUUID 為空
//3:characteristicUUID 為空
//4:未找到指定特征(characteristic)
//5:未找到指定服務(wù)(service)
//6:尚未搜索到該藍牙設(shè)備
}
var ble = api.require('ble');
ble.setNotify({
peripheralUUID: '',
serviceUUID: '',
characteristicUUID: ''
}, function(ret) {
if (ret) {
api.alert({ msg: JSON.stringify(ret) });
}
});
iOS系統(tǒng),Android系統(tǒng)
可提供的1.0.0及更高版本
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: