This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can a broadcaster application be notified of a scan request ?

Other Parts Discussed in Thread: CC2540

Hello,

I am using the CC2540 together with TI BLE 1.3.

One device runs the SimpleBLEObserver application, the other one the SimpleBLEBroadcaster.

I have modified the Observer so that it performs active scans. The broadcaster receives the scan request and responds with a scan response all right, but I would like the broadcaster application to be made aware that the device received a scan request (I don't need any other information, just the info that a device has been scanning it).

Is there a way to do that ? Is it possible to register a notifier ?

I tried using an RSSI notifier but it appears to work only when in a connection.

Thanks and best regards,

Damien

  • Hello Damien,

    Welcome to the Forum!

    The Broadcaster and Observer roles are something I have not played with yet.  When I get back to my PC I will have a look at them.

    In the meantime, from the code for the other roles, there is a case statement when the device changes states as in peripheralStateNotificationCB.  When a scan request or response is made, you should be able to set a flag during that state to indicate the device has responded to a scan request.  It would then know it was scanned.

    Thanks,

  • Dear greenja,

    Thank you very much for your reply. Following your suggestion, I started looking for such an event but I couldn't find it neither in the application, nor in the profile (also looked in the peripheral role).

    What king of event would it be most likely ? HCI, L2CAP ? I also looked there but haven't found yet.

    Best regards,
    Damien

  • I believe the defines for the allowable states can be found in the gap.h file.  If not, double click on one of the states that are in your file and then right click and select go to definition of xxx.  That will take you to the proper file.

    Thanks,

  • Hi greenja

    I found the gaprole_States_t enum, but can't find a type means getting the scan request. 

    i want to get the scan request notification, so i can do some operations without connection after get trgger from slave device.

    Hoping your reply. Thanks very much. :)

    /**
     * GAP Broadcaster Role States.
     */
    typedef enum
    {
      GAPROLE_INIT = 0,                       //!< Waiting to be started
      GAPROLE_STARTED,                        //!< Started but not advertising
      GAPROLE_ADVERTISING,                    //!< Currently Advertising
      GAPROLE_WAITING,                        //!< Device is started but not advertising, is in waiting period before advertising again
      GAPROLE_ERROR                           //!< Error occurred - invalid state
    } gaprole_States_t;

  • SimpleBLEPeripheral has an example of setting a GAP callback routine that passes the GAP state as a parameter.  That GAP state should have the connection states you are looking for.

  • I am also looking for a notification of receiving a Scan Request but a GAP state does not allow me to see what the contents of the Scan Request.

  • Hi,

    You can't find out whether you were scanned or not. While it's technically feasible to find out, this is not a part of the BLE stack library.

    BR,
    Aslak

  • Hi Aslak,

    Do you know if this issue will be solved soon?

    It should be easy to add this function to the stack, since HCI_EXT_AdvEventNoticeCmd already works.

  • i am still hoping for this function, it is very useful to do something after receive request scan without connection.