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

Proxy Server Publish Issue

Based on Mesh SDK 2.1.1.

I use light switch proxy client & proxy server to test server publish function.

But when I use the phone setting network, I found that the client's publish & subscribe settings, the server's publish function can be used correctly.

If the client only sets subscribe and doesn't set publish,the server's publish function can't be used.

Can I set the client's subscribe and server's publish separately to use the publish function?

client set publish & subscribeclient only set subscribe

left figure : client set publish & subscribe

right figure : client only set subscribe

Server set publish

figure : server set publish

  • Tanks your answer. I have a question.

    In simple_on_off_client.c 

    uint32_t simple_on_off_client_set_unreliable(simple_on_off_client_t * p_client, bool on_off, uint8_t repeats)
    {
        simple_on_off_msg_set_unreliable_t set_unreliable;
        set_unreliable.on_off = on_off ? 1 : 0;
        set_unreliable.tid = m_tid++;
    
        access_message_tx_t message;
        message.opcode.opcode = SIMPLE_ON_OFF_OPCODE_SET_UNRELIABLE;
        message.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
        message.p_buffer = (const uint8_t*) &set_unreliable;
        message.length = sizeof(set_unreliable);
        message.force_segmented = false;
        message.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;
    
        uint32_t status = NRF_SUCCESS;
        for (uint8_t i = 0; i < repeats; ++i)
        {
            message.access_token = nrf_mesh_unique_token_get();
            status = access_model_publish(p_client->model_handle, &message);
            if (status != NRF_SUCCESS)
            {
                break;
            }
        }
        return status;
    }

    this function use access_model_publish() to publish data to the server.

    In simple_on_off_server.c

    uint32_t simple_on_off_server_status_publish(simple_on_off_server_t * p_server, bool value)
    {
        simple_on_off_msg_status_t status;
        status.present_on_off = value ? 1 : 0;
        access_message_tx_t msg;
        msg.opcode.opcode = SIMPLE_ON_OFF_OPCODE_STATUS;
        msg.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID;
        msg.p_buffer = (const uint8_t *) &status;
        msg.length = sizeof(status);
        msg.force_segmented = false;
        msg.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;
        msg.access_token = nrf_mesh_unique_token_get();
        return access_model_publish(p_server->model_handle, &msg);
    }
    

    this function also use access_model_publish() to publish data to the client.

    Both function are use access_model_publish(). Why the  former can publish unicast or group address, the latter only publish unicast address?

    What is the difference between the two function?

  • You are correct. From reading the mesh spec, it does seem that you are able to publish a status message to a group address:

    However, the way the generic on off server model on the server is configured, it will send the status message back to the client.

    The main difference between the two functions is that the client generic on off model sends a set message, whereas the server generic on off model sends a status message.

Related