Most recent activity
-
Hi
I'm testing the ADV_IND associated to a sensing service definition as follow
NRF.setServices({ // Configuring the Envrionmental Sensing Service 0x181A: { // Configure Temperature Characteristics 0x2A6E: { readable: true, notify: true, writeable: false, } } }); NRF.setAdvertising( [ {0x181A : [Puck.light()]}], {interval:500} );
I've controlled that the service is well defined into the GATT
I receive ADV_IND perdiodically as expectedMy problem is that the Service Data value does not change at all. Egal to 0 !!
I've check several thingsThe Puck.light() is Ok as the following code works fine
setInterval(function() { print (Puck.light()); }, 500);
I've tried to replace the Puck.light() by
- new Float32Array([Puck.light() * 100]).buffer or - new Int16Array([E.getTemperature() * 100]).buffer
The value is not = 0 but does not change neither ..
Any idea ?
Other option to get this sensing value ? -
- 13 comments
- 4,050 views
-
-
Hi
For the Advertising issue I recap from the begining with the code such as we are on the same page:
Here is the code that I've loaded on my puck (latest version)NRF.setServices({ // Configuring the Envrionmental Sensing Service 0x181A: { // Configure Temperature Characteristics 0x2A6E: { readable: true, notify: true, writeable: false, value: new Int16Array([E.getTemperature() * 100]).buffer } } // Make Envrionmental Sensing Service known }, {advertise: ['0x181A']});
The puck.js documentation (https://www.espruino.com/Reference#l_NRF_setServices) states that a connection is required to get the ADV_IND.
So I used the NRF connect Android App (latest version), activated my BLE sniffer and connected to the puck
On the trace I see the CONNECT_REQ but no ADV_IND with the temperatureWhat is wrong ? is there an error in the doc and the "advertise" option does not work this way ?
Thanks for your answer
Regards
Vpl -
Hi,
Regarding this advertising behavior that does not work for me, I'm refering to this part of the documentation https://www.espruino.com/Reference#l_NRF_setServices
It is said hereJust creating a service doesn't mean that the service will be advertised. It will only be available after a device connects. To advertise, specify the UUIDs you wish to advertise in the advertise field of the second options argument. For example this will create and advertise a heart rate service:
NRF.setServices({ 0x180D: { // heart_rate 0x2A37: { // heart_rate_measurement notify: true, value : [0x06, heartrate], } } }, { advertise: [ '180D' ] })
In my code (provided earlier in this post) I'm replicating exactly the same things but does not work
What do I do wrongly ?
Regards
Vpl -
Hi
Thanks very much for your answer
I've tested different thingsMy firmware is 2v04
I've tested a simple advertisement using the setAdvertising like thatNRF.setAdvertising( [ {0x180F : new Int16Array([E.getTemperature() * 100]).buffer} ], { interval:300 } );
I get ADV_IND as expected with period SCAN_REQ/SCAN_RESP.
Perfect this is what I was looking for. THanksNevertheless in the puck documentation it is written that we should get a similar behavior with the following code
NRF.setServices({ // Configuring the Envrionmental Sensing Service 0x181A: { // Configure Temperature Characteristics 0x2A6E: { readable: true, notify: true, writeable: false, value: new Int16Array([E.getTemperature() * 100]).buffer } } // Make Envrionmental Sensing Service known }, {advertise: ['0x181A']});
I've tested but DO NOT get any advertising. It is mentioned to be connected to the device. I've tried with the NRF Tool (android) to connect but no advertisement
Is it a bug or a wrong coding ?
By the way (not a priority but questioning)
The only thing I've noticed is that the battery level does not change .. A bit surprised as when I run this codesetInterval(function() { print (E.getBattery()); }, 500);
I get a variable battery level with 5/10% change at each sample
I've tried to change in the SetAdvertising with
Puck.getBatteryPercentage()
But same problem.
Thanks for your support and help
I'm developing labs for students and this puck.js is really a nice piece of Hw for training !!Regards
Vpl -
Hi
I've updated the firmware to the latest version 2.v04
Then I've reloaded the service as above.
Connecting with Nrf Connect (android) I can see as you the 0x181A sensing serviceThen in the documentation they mention that the advertisement cannot be seen outside of a connection
So running my sniffer I've connected to the puck.js from NrfConnect
I can see The CONNECT_REQ then various Read-by-group req to discover the GATT characteristiques
then a bunch of empty PDU to maintain the connection open I guess.
But no adverstisement at all
At the end I get again the ADV_IND with just the device NameI suspect an issue somewhere or an error in the doc or a wrong usage ?
Any idea and help ?
Thanks a lot
Vpl
-
Hi gordon
Thanks for your answer
I don't follow you. I've tried also to use the
to eliminate this question of value between 0 à 1 as an integer. But the value I get, in the ADV_IND does not change neither !!
I've looked again at the http://www.espruino.com/Reference#l_NRF_setAdvertising but do no see really what is wrong in my code.
By the way I've not used the following code that is proposed in the puck.js API documentation because to me, the setInterval is redundant to the setAdvertising. The NRF.setAdvertising is already arming the advertising mechanism and their is no way to use a setInterval() to do the same again ...
I Am wrong ?
Vpl