options for NRF.setAdvertising?

Posted on
  • Hello ,
    I have read the Reference for the NRF.setAdvertising , and something is missing for me.
    For example

    to return battery level at 95%, do:
    NRF.setAdvertising({
      0x180F : [95]
    });
    Or you could report the current temperature:
    setInterval(function() {
      NRF.setAdvertising({
        0x1809 : [Math.round(E.getTemperature())]
      });
    }, 30000);
    

    but how do I get this data ?
    also where is the lines I can edit ? which options I can use\edit?

    is there a list of thing I can use?

    also
    when I scan my device I can see that the MAC is

    16:17:18:20:ac:a0 random

    why is it?
    what is the different between
    Public,statis,random?
    what do I need to use?

    Thanks,

  • but how do I get this data ?

    What data? The number like 0x180f? Check out the link to the Bluetooth SIG in http://www.espruino.com/About+Bluetooth+­LE#uuids

    why is it? can I change the MAC of the device ?

    Each device has its own MAC address - that's how it works, like Ethernet/WiFi/etc.

    You can change it with NRF.setAddress but it's not recommended.

  • let me explain myself:

    1. 0x180f - where this came from ? in the link you sent there is no refernce to this
      is this something unique to espruino? or it's a known bluethooth information?

    2. I want to be able to scan and advertise my device at the same time .
      so if I'm correct I need to use 2 devices , one for scanning all the time , and 1 sending my data
      is it true?
      or I can use only 1 and do some manipulation in the timing?
      I don't need that someone will connect me - just to show I'm alive .
      I have try to use this function:

    NRF.setAdvertising({},{name:"test1",conn­ectable:"false",scannable :"false",interval:1000});
    

    but I;m steel able to connect to "test1" - why?

    3 . I want to change my own MAC for testing issue , so I will know which MAC I'm testing,
    more easy for me - this is the reason.

  • 0x180f

    Fourth line down on https://www.bluetooth.com/specifications­/gatt/services/

    want to be able to scan and advertise my device at the same time .

    That's fine, it happens automatically. This post from a few days ago is just what you need: http://forum.espruino.com/conversations/­346289/#comment15233728

    I have try to use this function but I;m steel able to connect to

    Are you sure it's actually executing? That should definitely stop connecting. You could also see http://www.espruino.com/BLE+Security

    1. great , this is what I looked for .
      so for example : when I connect my "tws i7" to my phone I see the battery is 80% .
      so they are sending the 0x180F ?

    2. I will do as it say in the post you sent me , and see everything is OK .

    Thanks ,

  • so they are sending the 0x180F ?

    Probably, yes

  • Thanks ,

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

options for NRF.setAdvertising?

Posted by Avatar for David1234321 @David1234321

Actions