Hi!!! we are developing bluetooth mesh, we have a function that send a message to nodes when we press a board button (nrf52 dk), all works fine,
but if we call the same function programmatically the function is also called but doesnt work correctly. (We use the generic onoff client example project)
There is anyway to simulate pressing button?
a part of my code on main.c...
static void sendMessage(generic_onoff_set_params_t set_params, model_transition_t transition_params){
uint32_t status = NRF_SUCCESS;
(void)access_model_reliable_cancel(m_clients[0].model_handle);
generic_onoff_set_params_t p = set_params;
status = generic_onoff_client_set(&m_clients[0], &p, &transition_params);
}
static generic_onoff_set_params_t getParams(void){
generic_onoff_set_params_t set_params;
static uint8_t tid = 0;
globalTid = tid;
int aux = (tid++) + 1;
sendIndex++;
set_params.tid = sendIndex+1;
set_params.from_g = true;
set_params.ginfo.update_flag=false;
set_params.ginfo.beacons_length=5;
set_params.on_off = APP_STATE_ON;
return set_params;
}
static model_transition_t getTransitionParams(void){
model_transition_t transition_params;
transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;
transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;
return transition_params;
}
static void breq (){
generic_onoff_set_params_t p = getParams();
uint32_t status = NRF_SUCCESS;
p.b->mac[0]='#';
sendMessage(p,getTransitionParams());
}
static void button_event_handler(uint32_t button_number){
switch (button_number){
case 0:
break;
case 1:
breq(); // <----------------------This is the function that we call programmatycally and doesnt work if the function is not called by pressing button
break;
}
}
Thank you