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

can a privisoner know a node is not alive? if possible, how to do it?

Hi,Nordic Teams:

 I have  emergent proble ,can you help me?

1.in light_switch example provisioner,there is some code below:

/**** Model related callbacks ****/
static void app_health_event_cb(const health_client_t * p_client, const health_client_evt_t * p_event)
{  
     __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "%s...event->type:%d\n",__FUNCTION__,p_event->type);
    switch (p_event->type)
    {
        case HEALTH_CLIENT_EVT_TYPE_CURRENT_STATUS_RECEIVED:
            __LOG(LOG_SRC_APP,
                  LOG_LEVEL_INFO,
                  "Node 0x%04x alive with %u active fault(s), RSSI: %d\n",
                  p_event->p_meta_data->src.value,
                  p_event->data.fault_status.fault_array_length,
                  ((p_event->p_meta_data->p_core_metadata->source == NRF_MESH_RX_SOURCE_SCANNER)
                       ? p_event->p_meta_data->p_core_metadata->params.scanner.rssi
                       : 0));
            break;
        case HEALTH_CLIENT_EVT_TYPE_FAULT_STATUS_RECEIVED:

            break;
            
        case HEALTH_CLIENT_EVT_TYPE_PERIOD_STATUS_RECEIVED:
             __LOG(LOG_SRC_APP,
                  LOG_LEVEL_INFO,
                  "Node 0x%04x alive , RSSI: %d\n",
                  p_event->p_meta_data->src.value,
                  ((p_event->p_meta_data->p_core_metadata->source == NRF_MESH_RX_SOURCE_SCANNER)
                       ? p_event->p_meta_data->p_core_metadata->params.scanner.rssi
                       : 0));

            break;
            
        case HEALTH_CLIENT_EVT_TYPE_ATTENTION_STATUS_RECEIVED:

            break;
            
        case HEALTH_CLIENT_EVT_TYPE_TIMEOUT:

            break;
            
        case HEALTH_CLIENT_EVT_TYPE_CANCELLED:

            break;
                
        default:
            break;
    }
}

2.when provisoning ,we can setup a node to perioid publish the health msg,like below:

 /* Configure the publication parameters for the Health server: */
        case NODE_SETUP_CONFIG_PUBLICATION_HEALTH:
        {
            config_publication_state_t pubstate = {0};
            pubstate.element_address = m_current_node_addr;
            pubstate.publish_address.type = NRF_MESH_ADDRESS_TYPE_UNICAST;
            pubstate.publish_address.value = PROVISIONER_ADDRESS;
            pubstate.appkey_index = 0;
            pubstate.frendship_credential_flag = false;
            pubstate.publish_ttl = 255;//(SERVER_NODE_COUNT > NRF_MESH_TTL_MAX ? NRF_MESH_TTL_MAX : SERVER_NODE_COUNT);
            pubstate.publish_period.step_num = 3;
            pubstate.publish_period.step_res = ACCESS_PUBLISH_RESOLUTION_1S ;//ACCESS_PUBLISH_RESOLUTION_10S;
            pubstate.retransmit_count = 0;
            pubstate.retransmit_interval = 0;
            pubstate.model_id.company_id = ACCESS_COMPANY_ID_NONE;
            pubstate.model_id.model_id =  HEALTH_SERVER_MODEL_ID;
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Setting publication address for the health server to 0x%04x\n", pubstate.publish_address.value);
            status = config_client_model_publication_set(&pubstate);

            static const access_status_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, ARRAY_SIZE(exp_status), exp_status);
            break;
        }

3.one setup scucess , the provisoner can receive  the msg from node.But the  problem is when reboot the node ,the provisoner can not receive the msg any more, how to solve this?

4.besides, can provisoner knows the node is not alive? for example ,when the node is power down.

Parents Reply Children
No Data
Related