Is it possible to obtain the scan timer value from the stack?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RoHe_4370821
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hi,

I'm developing a master application and wish to synchronize to a slave, which has a characteristic from which I may obtain it's advertisment timing.

Is there any way to obtain the scan timer value from the ble central stack, please? If not, I will have to identify and record the time that blecen_Scan() is called by the application and do the timing with the fine timer instead.

Regards

0 Likes
1 Solution

Hi RoHe_4370821 ,

Sorry that I missed to respond to your last query.

However there is no direct way for that . You may have to set a variable and track in the timer call back. I don't see any other way.

Regards,

Anjana

View solution in original post

5 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi RoHe_4370821 ,


Could you please clarify the query ?

What do you mean by scan timer value? Do you mean scanning interval / scan time out value of your Central device ? or the time at which when your Central found out the advertising device ? Can you please clarify ?

Regards,

Anjana

0 Likes

Hi Anjana,

I mean the scanning interval / scan time out value of my Central device.

Regards,
Rab

0 Likes

Hi RoHe_4370821 ,

You can set the scan interval and duration of your BLE Central device by the changing the structure parameters of BLE_CEN_CFG ( /WICED-Smart-SDK/include/blecen.h )

In hello_client example , they are using default parameters as below. You may change as per your application requirement:

// Blecen default parameters.  Change if appropriate

    //blecen_cen_cfg.scan_type                = HCIULP_ACTIVE_SCAN;

    //blecen_cen_cfg.scan_adr_type            = HCIULP_PUBLIC_ADDRESS;

    //blecen_cen_cfg.scan_filter_policy       = HCIULP_SCAN_FILTER_POLICY_WHITE_LIST_NOT_USED;

    //blecen_cen_cfg.filter_duplicates        = HCIULP_SCAN_DUPLICATE_FILTER_ON;

    //blecen_cen_cfg.init_filter_policy       = HCIULP_INITIATOR_FILTER_POLICY_WHITE_LIST_NOT_USED;

    //blecen_cen_cfg.init_addr_type           = HCIULP_PUBLIC_ADDRESS;

    //blecen_cen_cfg.high_scan_interval       = 96;       // slots

    //blecen_cen_cfg.low_scan_interval        = 2048;     // slots

    //blecen_cen_cfg.high_scan_window         = 48;       // slots

    //blecen_cen_cfg.low_scan_window          = 18;       // slots

    //blecen_cen_cfg.high_scan_duration       = 30;       // seconds

    //blecen_cen_cfg.low_scan_duration        = 300;      // seconds 

    //blecen_cen_cfg.high_conn_min_interval   = 40;       // frames

    //blecen_cen_cfg.low_conn_min_interval    = 400;      // frames

    //blecen_cen_cfg.high_conn_max_interval   = 56;       // frames

    //blecen_cen_cfg.low_conn_max_interval    = 560;      // frames

    //blecen_cen_cfg.high_conn_latency        = 0;        // number of connection event

    //blecen_cen_cfg.low_conn_latency         = 0;        // number of connection event

    //blecen_cen_cfg.high_supervision_timeout = 10;       // N * 10ms

    //blecen_cen_cfg.low_supervision_timeout  = 100;      // N * 10ms

    //blecen_cen_cfg.conn_min_event_len       = 0;        // slots

    //blecen_cen_cfg.conn_max_event_len       = 0;        // slots

Regards,

Anjana

0 Likes

Hi Anjana,

Yes, I understand that I may set values for these things.

What I'm looking for is to obtain the value of the timer that results in a call to the userTimercb. For example, in the hello_client example there is hello_client_timer_callback() which has a case for BLEAPP_APP_TIMER_SCAN. How may I access the value of the timer that will result in this callback being called with this argument, please? Is there a way to read the timer value, or is this hidden from the application?

I'd like for my application to be able to read a variable that shows how long it had been scanning when a connection is made.
E.g. If the application begins scanning at t=0, then connection is made at t=500ms, then I know it has scanned for 500ms prior to the connection_up event. I can use a variable within the fine_timer along with some flags to do this. But, it would be cleaner if I could just read the scan timer value directly, if possible.

Regards,

Rab

0 Likes

Hi RoHe_4370821 ,

Sorry that I missed to respond to your last query.

However there is no direct way for that . You may have to set a variable and track in the timer call back. I don't see any other way.

Regards,

Anjana