-
• #2
What you're doing looks fine. The
180D
service might be in a scan response packet - so if the iPhone isn't doing active scanning it wouldn't pick it up.I guess another option (especially if you're targeting iPhone) might be to make Puck.js emulate an iBeacon? That could (afaik) directly link to your app.
Do the LEDs flash as you'd expect? Is the blue one to indicate connection state flashing, so you know
IdeConnect
is getting called ok? -
• #3
Leds flash as expected. Long press makes it blink blue, but nothing shows up in the "whants to pair" list of the IDE.
Yes! iBeacon was my first attempt but iBeacon wont provide any method of identifying unique identifiers and separating them.
e.g When monitoring for iBeacons in the background with uuid=123
the triggerd event when iBeacon is in range dosen´t contain major or minor.https://github.com/Polidea/react-native-ble-plx/wiki/Bluetooth-Scanning
-
• #4
When monitoring for iBeacons in the background with uuid=123 the triggerd event when iBeacon is in range dosen´t contain major or minor.
Wow, that's annoying - I thought that was the whole point.
What about switching to iBeacon only when there's an alert?
If you use something like the nRF connect app on the phone, what does it show for the Puck when it's back in connectable mode?
I guess it might be worth explicitly setting
connectable:true
again? Also the IDE works based on an advertised NUS service (in the scan response packet) but also just the name as a fallback. If the name doesn't begin withPuck.js
it's possible it may not pick it up if it hasn't been able to read the NUS service UUID. -
• #5
I managed to get it to work by cleaning out all code and using the button press examples from Music Controller. And then just add the advertising code bit. It might have been a problem with the broadcast message being to long.
function setBleBroadcastingDistress(){ clearTimeout(); NRF.setServices({ 'b2fb58a0-8452-402a-8435-eedf397464a9' : { 0x5AFE : { value : true, readable : true } } }, { advertise: [ 'b2fb58a0-8452-402a-8435-eedf397464a9' ], uart: false }); NRF.setAdvertising( { 0x1815 : pressIdentifier } , { name: 'ALERT!', showName: true }); digitalWrite(LED1, 1); setTimeout(function(){ digitalWrite(LED1,0 ); setBleBroadcastingNormal(); }, 10000); }
Then advertise another UUID when everything is normal.
For IDE mode this was enough.
function ideConnect(){ NRF.setServices(undefined, { uart: true }); NRF.setAdvertising({},{ name: 'IDE', showName: true }); }
I will add the connectable:true as you suggested.
Thanks!
Goal: Im trying to create a puck that advertises a distress-call ( panic / sos button) and gets picked up by any phone with the corresponding app installed.
So simply advertising som data and then change som specific advertising data when the button is pressed.
While developing a long press will make the puck go back into a state where it can connect to the web IDE.
I have 2 problems at the moment.
1 When doing a long press the puck is not able to reconnect with the IDE.
2 The app finds the puck but the serviceUUIDs list is empty. This list need to have at least one entry for iphone to let it be discovered in the background.
Data retrived in the app :
Puck Code: