BluetoothRemoteGATTCharacteristic
å©ç¨å¯è½æ§ã¯éå®ç
ãã®æ©è½ã¯ãã¼ã¹ã©ã¤ã³ã§ã¯ããã¾ãããæãåºã使ç¨ããã¦ãããã©ã¦ã¶ã¼ã®ä¸é¨ã§åä½ãã¾ããã
Experimental: ããã¯å®é¨çãªæ©è½ã§ãã
æ¬çªã§ä½¿ç¨ããåã«ãã©ã¦ã¶ã¼äºææ§ä¸è¦§è¡¨ããã§ãã¯ãã¦ãã ããã
Web Bluetooth API ã® BluetoothRemoteGattCharacteristic ã¤ã³ã¿ã¼ãã§ã¤ã¹ã¯ãGATT ãã£ã©ã¯ã¿ãªã¹ãã£ãã¯ã表ãã¾ããããã¯ãå¨è¾ºæ©å¨ã®ãµã¼ãã¹ã«é¢ãã詳細æ
å ±ãæä¾ããåºæ¬çãªãã¼ã¿è¦ç´ ã§ãã
ã¤ã³ã¹ã¿ã³ã¹ããããã£
BluetoothRemoteGATTCharacteristic.serviceèªåå°ç¨-
ãã®ãã£ã©ã¯ã¿ãªã¹ãã£ãã¯ãå±ãã
BluetoothRemoteGATTServiceãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.uuidèªåå°ç¨-
ãã®ãã£ã©ã¯ã¿ãªã¹ãã£ãã¯ã® UUID ã表ãæååãè¿ãã¾ãããã¨ãã°ãHeart Rate Measurement characteristic ã¯
'00002a37-0000-1000-8000-00805f9b34fb'ã§ãã BluetoothRemoteGATTCharacteristic.propertiesèªåå°ç¨-
ãã®ãã£ã©ã¯ã¿ãªã¹ãã£ãã¯ã®ããããã£ãè¿ãã¾ãã
BluetoothRemoteGATTCharacteristic.valueèªåå°ç¨-
ç¾å¨ãã£ãã·ã¥ããã¦ãããã£ã©ã¯ã¿ãªã¹ãã£ãã¯ã®å¤ã§ãããã®å¤ã¯ããã£ã©ã¯ã¿ãªã¹ãã£ãã¯ã®å¤ãèªã¾ãããããã¼ãã£ãã£ã±ã¼ã·ã§ã³ãã¤ã³ãã£ã±ã¼ã·ã§ã³ã«ãã£ã¦æ´æ°ãããã¨æ´æ°ããã¾ãã
ã¤ãã³ã
oncharacteristicvaluechanged-
characteristicvaluechangedã¤ãã³ãç¨ã®ã¤ãã³ããã³ãã©ã¼ã§ãã
ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ãã
BluetoothRemoteGATTCharacteristic.getDescriptor()-
æå®ã®ãã£ã¹ã¯ãªãã¿ã¼ UUID ã«å¯¾å¿ããæåã®
BluetoothRemoteGATTDescriptorã§è§£æ±ºããPromiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.getDescriptors()-
æå®ã®ãã£ã¹ã¯ãªãã¿ã¼ UUID ã«å¯¾å¿ãããã¹ã¦ã®
BluetoothRemoteGATTDescriptorãªãã¸ã§ã¯ãã®Arrayã§è§£æ±ºããPromiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.readValue()-
å©ç¨å¯è½ã§å¯¾å¿ãã¦ããã°ã
valueããããã£ã®è¤è£½ãæ ¼ç´ãããDataViewã§è§£æ±ºããPromiseãè¿ãã¾ããããã§ãªãå ´åã¯ãã¨ã©ã¼ãæãã¾ãã BluetoothRemoteGATTCharacteristic.writeValue(value)-
valueããããã£ã渡ãããArrayBufferã«æ ¼ç´ããããã¤ãåã«è¨å®ããWriteCharacteristicValue(this=this, value=value, response="optional") ãå¼ã³åºããçµæã®Promiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.writeValueWithResponse(value)-
valueããããã£ã渡ãããArrayBufferã«æ ¼ç´ããããã¤ãåã«è¨å®ããWriteCharacteristicValue(this=this, value=value, response="required") ãå¼ã³åºããçµæã®Promiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse(value)-
valueããããã£ã渡ãããArrayBufferã«æ ¼ç´ããããã¤ãåã«è¨å®ããWriteCharacteristicValue(this=this, value=value, response="never") ãå¼ã³åºããçµæã®Promiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.startNotifications()-
navigator.bluetoothãæ´»åä¸ã®ãã¼ãã£ãã£ã±ã¼ã·ã§ã³ã³ã³ããã¹ãã«è¿½å ãããã解決ããPromiseãè¿ãã¾ãã BluetoothRemoteGATTCharacteristic.stopNotifications()-
navigator.bluetoothãæ´»åä¸ã®ãã¼ãã£ãã£ã±ã¼ã·ã§ã³ã³ã³ããã¹ãããåé¤ãããã解決ããPromiseãè¿ãã¾ãã
仿§æ¸
| 仿§æ¸ |
|---|
| Web Bluetooth > # bluetoothgattcharacteristic-interface > |