W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
根據(jù)指定的外圍設(shè)備 UUID 及其服務(wù) UUID 和特征 UUID 寫數(shù)據(jù)
writeValueForCharacteristic({params}, callback(ret, err))
peripheralUUID:
serviceUUID
characteristicUUID
value
writeType
ret:
{
status: true , //布爾類型;是否發(fā)送成功,true|false
characteristic:{ //JSON對象;獲取監(jiān)聽的特征的信息
uuid: '', //字符串類型;特征的 UUID
serviceUUID: '', //字符串類型;服務(wù)的 UUID
permissions: '', //字符串類型;特征的權(quán)限,取值范圍如下:
//readable:
//writeable:
//readEncryptionRequired:
//writeEncryptionRequired:
propertie: '' //字符串類型;特征的屬性,取值范圍如下:
//broadcast:
//read:
//writeWithoutResponse:
//write:
//notify:
//indicate:
//authenticatedSignedWrites:
//extendedProperties:
//notifyEncryptionRequired:
//indicateEncryptionRequired:
}
}
err:
{
code: 1 //數(shù)字類型;失敗時(shí)返回錯(cuò)誤碼,取值范圍如下:
//-1:未知錯(cuò)誤
//1:peripheralUUID 為空
//2:serviceUUID 為空
//3:characteristicUUID 為空
//4:value 為空
//5:未找到指定特征(characteristic)
//6:未找到指定服務(wù)(service)
//7:尚未搜索到該藍(lán)牙設(shè)備
}
var ble = api.require('ble');
ble.writeValueForCharacteristic({
peripheralUUID: '',
serviceUUID: '',
characteristicUUID: '',
value: ''
}, 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號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: