This release includes adding 20 BLE device support and more robust communication with obniz device.
Contents
New Support Devices
BLE
- ENERTALK
- iBS01
- iBS01RG
- iBS01T
- iBS02IR
- iBS02PIR
- iBS03_iBS04
- iBS03T
- iBS03TP
- iBS04i
- LogttaAccel
- LogttaAD
- LogttaCO2
- LogttaTemp
- MINEW_S1
- REX_BTPM25V
- RS_SEEK3
- scbtgaaac
- uprism
- cir415a
- tm530
- tm551
Improvements
Common
- async/await response waiting functions now throw errors when obniz gone to offline or over timeout secs.
await obniz.spi0.writeWait([0x00]); // => will throw if obniz gone to offline or timeout occure.
- i2c now throw error on i2c error occured.
const arr = await obniz.i2c0.readWait(0x11, 0x03); // => will throw if target is not connected or NAK responded.
BLE
- ble.scan.start() and ble.scan.end() is now deprecated. Use startWait() and endWait()
- ble.scan.onfinish() receive error object when scan fails some reason
obniz.ble.initWait(); // will throw error if fails.
obniz.ble.scan.onfind = (peripheral) => {
}
obniz.ble.scan.onfinish = (peripherals, error) => {
if (error) {
// some thing error occured like obniz went to offline.
}
}
await obniz.ble.scan.startWait(); // will throw error if start fails
- peripheral.ondisconnect now pass
reasonarugument. - ADD key pharase pairing support
await obniz.ble.initWait({});
obniz.ble.scan.onfind = function(peripheral){
if(peripheral.localName == "my peripheral"){
peripheral.onconnect = async function(){
console.log("success");
let passkeyCallback = await ()=>{
//HTML prompt
let number = prompt("Please type passkey code.");
return number;
}
// pairing with user input passkey.
await peripheral.pairingWait({passkeyCallback});
}
await peripheral.connectWait();
}
}
obniz.ble.scan.start();