Skip to main content

How to dynamic modify Connection Interval

1 year ago

How to dynamic modify Connection Interval

Posted byalex.jian0 points 3 replies
0 upvotes

HI All

I need some advice for modify Connection Interval

I want modify Connection Interval when device get data from host

so what should i do??

1 year ago

PM_Dialog

Hi alex.jian,

You can use Connection Update Parameters. Let me quickly describe you how the procedure goes on:

The peripheral device, which is advertising, assumes the role of a slave device, while the scanner device, which is searching for a device to connect to, assumes the role of a master device upon a connection process. The latter, is responsible for performing various mandatory actions including which channel to transmit and what event interval to use. However, following a successful connection, the slave device can propose its own preferred parameters (connection interval, supervision time-out etc) via an update connection parameter request. After that, the master responds to the slave if its demands has been approved. To do so, the peripheral device sends connection parameter update request, the negotiation procedure will happen over the air, if the commend is approved, a connection parameter updated event will take place. Please refer to Bluetooth LE specifications for getting more information regarding Update Connection Parameters.

The user_gapm_conf structure keeps the user’s configurations and the device upon connection will have the connection interval from this structure. The user_connection_param_conf keeps the connection parameter update configuration. The connection intervals are defined by the central, so what you can do, is to issue a connection update request and the central will decide if it will accept the connection parameters that you have requested. If the current parameters don’t match will send a request to the central in order to update the connection parameters (the request is sent 10 seconds after the connection is established), so if the central accepts the parameters the connection will change to the specified values in the user_connection_param_conf structure. Please also check param_update_request_timer_cb() callback in our SDK examples.

Thanks, PM_Dialog

1 year ago

alex.jian 0 points

HI Dialog

I program my project base on DSPS example

so I program function as below

void app_easy_gap_param_update_ConnInterval(float min,float max,uint16_t latency,float timeout)
{

struct gapc_param_update_cmd* cmd;
if (param_update_cmd[conn_idx] == NULL)
{

cmd = app_param_update_msg_create(conn_idx);
ASSERT_WARNING (conn_idx < APP_EASY_GAP_MAX_CONNECTION);
param_update_cmd[conn_idx] = cmd;

cmd->intv_max = MS_TO_DOUBLESLOTS(min);
cmd->intv_min = MS_TO_DOUBLESLOTS(max);
cmd->latency = latency;
cmd->time_out = MS_TO_TIMERUNITS(timeout);
cmd->ce_len_min = user_connection_param_conf.ce_len_min;
cmd->ce_len_max = user_connection_param_conf.ce_len_max;
}

app_param_update_msg_send(cmd);
param_update_cmd[conn_idx] = NULL;

}

i use this function when Device get Data

Is this right way???

1 year ago

PM_Dialog

Hi alex.jian

We have taken this offline for the forum, and someone has already reached out to you directly in your registered email address. As mentioned before, the connection interval is decided by Central. For your case the Central is the iOS. So for the interval update, we would suggest them to use the app_easy_gap_param_update_start() API in your application.

Thanks, PM_Dialog