This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Changing APP_ADV_INTERVAL when scan request detected

Hi,

I'm making a peripheral device that needs to minimise battery usage.  

My device is essentially a beacon but it allows temporary connections to send a stream of data before closing the connection. I do not think I have enough battery to allow permanent connections that follow the apple design guidelines (220 mAh coin cell and >1 year longevity)

I was surprised to discover that android phones won't reliably connect if APP_ADV_INTERVAL is 10 seconds. With my old samsung S5 I need to reduce the interval to around 2 seconds. 

I have an accelerometer so I was planning to rapidly advertise when the user shakes the device. But maybe it would be better to change the advertising interval when a scan request is detected. Is this possible? Can I detect when my device transmits a scan response? Or is there another mechanism to support this?

Thanks in advance for your help.

-JasonR

Parents
  • I added this to my ble_evt_handler

            case BLE_GAP_EVT_SCAN_REQ_REPORT:
                printf("BLE_GAP_EVT_SCAN_REQ_REPORT rssi =  %d \n", p_ble_evt->evt.gap_evt.params.scan_req_report.rssi);
                break;
    

    but it doesn't get hit when I scan for the peripheral with my android phone. 

    Do I need to enable the event "BLE_GAP_EVT_SCAN_REQ_REPORT"? I cannot find mention of it in the s140 softdevice docs

Reply
  • I added this to my ble_evt_handler

            case BLE_GAP_EVT_SCAN_REQ_REPORT:
                printf("BLE_GAP_EVT_SCAN_REQ_REPORT rssi =  %d \n", p_ble_evt->evt.gap_evt.params.scan_req_report.rssi);
                break;
    

    but it doesn't get hit when I scan for the peripheral with my android phone. 

    Do I need to enable the event "BLE_GAP_EVT_SCAN_REQ_REPORT"? I cannot find mention of it in the s140 softdevice docs

Children
No Data
Related