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

sensor data on mesh

Hi,

I would like to add sensor data in mesh network to be able to send data in certain intervals. How is it possible when I create a sensor model for mesh client and server. I started with light switch model.

How do I read this data on server side ?

Parents
  • So you want to a node that implements the server model to read a sensor at a regular interval and then publish this sensor data to the rest of the mesh? If that is the case then you can set up an application timer to trigger the measurement like in an ordinary nRF5 SDK example and then use access_model_publish() to publish a status message like the SIMPLE_ON_OFF_OPCODE_STATUS that contains the sensor data.

  • Hi,

    First a disclaimer: I'm totally new to this and have very limited knowledge on the subject so bear with me please.

    That being said, I'm trying to do the same thing, sending custom data (sensor data for example) from the servers to the client (in both the light switch and the PB remote example) and then displaying it in the RTT viewer. My understanding so far is that something like the following is enough to send data:

    // declaring variable
    static uint8_t myMSG[ACCESS_MESSAGE_LENGTH_MAX] = "--- this is my msg ---\n";
    access_message_tx_t customMSG;
    
    // preparing data to be sent
    customMSG.opcode.opcode = SIMPLE_ON_OFF_OPCODE_STATUS;
    customMSG.opcode.company_id = ACCESS_COMPANY_ID_NORDIC;
    customMSG.p_buffer = (const uint8_t *) &myMSG;
    customMSG.length = sizeof(myMSG);
    
    // sending it
    ERROR_CHECK(access_model_publish(m_server.model_handle,&customMSG));

    Now my questions:

    1- Is this code correct?

    2- How to handle this message on the client and display it?

    3- Is there anywhere where I can find working code for this?

Reply
  • Hi,

    First a disclaimer: I'm totally new to this and have very limited knowledge on the subject so bear with me please.

    That being said, I'm trying to do the same thing, sending custom data (sensor data for example) from the servers to the client (in both the light switch and the PB remote example) and then displaying it in the RTT viewer. My understanding so far is that something like the following is enough to send data:

    // declaring variable
    static uint8_t myMSG[ACCESS_MESSAGE_LENGTH_MAX] = "--- this is my msg ---\n";
    access_message_tx_t customMSG;
    
    // preparing data to be sent
    customMSG.opcode.opcode = SIMPLE_ON_OFF_OPCODE_STATUS;
    customMSG.opcode.company_id = ACCESS_COMPANY_ID_NORDIC;
    customMSG.p_buffer = (const uint8_t *) &myMSG;
    customMSG.length = sizeof(myMSG);
    
    // sending it
    ERROR_CHECK(access_model_publish(m_server.model_handle,&customMSG));

    Now my questions:

    1- Is this code correct?

    2- How to handle this message on the client and display it?

    3- Is there anywhere where I can find working code for this?

Children
Related