Most recent activity
-
Thanks @Gordon!
I guessed it could be a limitation also because that bulb has a lot of custom UUIDs.
I will try the battery trick but in this case i think it will be better to use array index as i already did, so i am sure i will point to the right service/characteristic. -
-
Hi all,
since i got my 2 Pucks, i am doing some experiment with BLE devices.
I was tempted and i've bought an Awox BLE Color Bulb, but i'm having problem getting Primary Services.
I am only able to use the first Primary Service "33160fb9-5b27-4e70-b0f8-ff411e3ae078" and its characteristic "217887f8-0af2-4002-9c05-24c9ecf71600", where sending 0 or 1 will turn the bulb off/on.
There are at least 2 other Primary Service (discovered with nRF Connect), 1 for warm light brightness and 1 for RGB lights.
Trying to use one of these, i receive the error on command gatt.PrimaryService("fff6fe25-469d-42bc-9179-b3a093f19032")Uncaught Error: Unhandled promise rejection: Error: Too many custom UUIDs already
If i try gatt.PrimaryServices(), i get this
[ BluetoothRemoteGATTService { "uuid": "0x1800", "isPrimary": true, "start_handle": 1, "end_handle": 11 }, BluetoothRemoteGATTService { "uuid": "0x1801", "isPrimary": true, "start_handle": 12, "end_handle": 15 }, BluetoothRemoteGATTService { "uuid": "0x180a", "isPrimary": true, "start_handle": 16, "end_handle": 30 }, BluetoothRemoteGATTService { "uuid": "0x0000[vendor]", "isPrimary": true, "start_handle": 31, "end_handle": 49 }, BluetoothRemoteGATTService { "uuid": "0x0000[vendor]", "isPrimary": true, "start_handle": 50, "end_handle": 64 }, BluetoothRemoteGATTService { "uuid": "0x0000[vendor]", "isPrimary": true, "start_handle": 65, "end_handle": 85 }, BluetoothRemoteGATTService { "uuid": "0x0000[vendor]", "isPrimary": true, "start_handle": 86, "end_handle": 65535 } ]
Actually, yesterday i could correctly see at least the first PrimaryService UUID ("33160fb9-5b27-4e70-b0f8-ff411e3ae078"), so the only way i found to access other services is using gatt.PrimaryServices() and then use the array index of the service i need instead of using for example gatt.PrimaryService("fff6fe25-469d-42bc-9179-b3a093f19032")
This is the portion of the (dirty) code i am using, just for testing purpose
function connectToBulb(){ console.log("Connecting to bulb..."); NRF.connect("98:7b:f3:77:a4:23").then(function(g){ connected = true; digitalPulse(LED3, 1, 500); gatt = g; return gatt.getPrimaryServices(); }).then(function(service){ return service[4].getCharacteristics(); // Equals to "fff6fe25-469d-42bc-9179-b3a093f19032" }).then(function(c){ c[1].writeValue(0x7F); // Equals to "d8da934c-3d8f-4bdf-9230-f61295b69570" }); }
while using gatt.PrimaryService("fff6fe25-469d-42bc-9179-b3a093f19032") or gatt.getCharacteristic("d8da934c-3d8f-4bdf-9230-f61295b69570") are returning me the mentioned error.
Am i doing something wrong?
-
-
-
I have the same issue if "Save on send" is enabled.
function tempTo2a6e(temp) { var f = parseFloat(temp.toFixed(2)) * 100; if (tempTo2a6e.buf === undefined) tempTo2a6e.buf = new Uint8Array(2); tempTo2a6e.buf[0] = f & 0xff; tempTo2a6e.buf[1] = f >> 8 & 0xff; return tempTo2a6e.buf; } NRF.on('connect', function(){ digitalPulse(LED2, 1, 250); }); NRF.setServices({ 0x181A: { // Health Thermometer 0x2A6E: { // Temperature readable: true, value : tempTo2a6e(E.getTemperature()) }}, 0x180F : { // Battery Service 0x2A19: { // Battery Level readable: true, notify: true, value : [Puck.getBatteryPercentage()] }}}); setInterval(function(){ NRF.updateServices({ 0x181A: { // Health Thermometer 0x2A6E: { // Temperature value : tempTo2a6e(E.getTemperature()) }}, 0x180F: { 0x2A19: { value : [Puck.getBatteryPercentage()] } } }); }, 60000);
After few seconds, i get this error:
Writing...ERROR: Prompt not detected - upload failed. Trying to
recover... Compressed 32000 bytes to 956 Checking... Flash Magic Byte
is wrong There were 1 errors! Uncaught InternalError: Timeout on
jshFlashErasePage at line 1 col 1005 ...\n }\n });\n},
60000);");load(); -
@dklinkman your code works very well! Thank you!
-
Great find @dklinkman! I will try this tonight!
There is a free plugin for DroidScript and Puck.js