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

how to get the data on server side in mesh

hi ...

I am working on mesh 3.1 version . I have used light switch example . In this case , i am sending the character in generic_onoff_set_cb , and changed from bool to character on client side . Now what are the change on server side , in order  to get the character from client to server . on server side i need to get the same data . 

Thanks

pspavi

Parents
  • Hi,

    I noticed that you already created a ticket with the same question: https://devzone.nordicsemi.com/f/nordic-q-a/53053/how-to-send-string-from-client-to-particular-server-in-mesh

    Have you taken a look at the thread that Joakim suggested? 

    I would also suggest you to continue in that thread instead of creating multiple threads about same question.

  • You shouldn't need to change anything on the server side to receive the message from the client.

    Have a look at this callback on the server: mesh_evt_cb. Whenever the NRF_MESH_EVT_MESSAGE_RECEIVED event occurs, the mesh_msg_handle() function gets called. This function, which is defined in access.c, handles all incoming mesh messages on the server side.

    https://devzone.nordicsemi.com/f/nordic-q-a/31256/receiving-simple-message-mesh/123576

  • hi

    mttrinh i am using mesh 3.1 version sdk . i have done somechanges please check here, correct me if i am wrong.

    static void button_event_handler(uint32_t button_number)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
    
        uint32_t status = NRF_SUCCESS;
        generic_onoff_set_params_t set_params;
        model_transition_t transition_params;
        static uint8_t tid = 0;
    
        /* Button 1: On, Button 2: Off, Client[0]
         * Button 2: On, Button 3: Off, Client[1]
         */
    
        switch(button_number)
        {
            case 0:
            case 2:
                set_params.on_off = 32;
                break;
    
            case 1:
            case 3:
                set_params.on_off = 8;
                break;
        }
    
        set_params.tid = tid++;
        transition_params.delay_ms = APP_CONFIG_ONOFF_DELAY_MS;
        transition_params.transition_time_ms = APP_CONFIG_ONOFF_TRANSITION_TIME_MS;
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Sending msg: ONOFF SET %d\n", set_params.on_off);
    
        switch (button_number)
        {
            case 0:
            case 1:
                /* Demonstrate acknowledged transaction, using 1st client model instance */
                /* In this examples, users will not be blocked if the model is busy */
                (void)access_model_reliable_cancel(m_clients[0].model_handle);
                status = generic_onoff_client_set(&m_clients[0], &set_params, &transition_params);
                hal_led_pin_set(BSP_LED_0, set_params.on_off);
                break;
    
            case 2:
            case 3:
                /* Demonstrate un-acknowledged transaction, using 2nd client model instance */
                status = generic_onoff_client_set_unack(&m_clients[1], &set_params,
                                                        &transition_params, APP_UNACK_MSG_REPEAT_COUNT);
                hal_led_pin_set(BSP_LED_1, set_params.on_off);
                break;
        }

    then generic_onoff_common.h file changed the bool to uint8_t and generic_onoff_client.c  file modified the  message_set_packet_create 

    p_set->on_off = p_params->on_off ;
    p_set->tid = p_params->tid; 

    thats all . it is correct or wrong ?

    explanation for above , i want to sent the integer from client to server when i press the button the respective integer has to go . 

     

    Thanks 

    pspavi

  • how to pass 150 bytes from client to server for the latest version ..

Reply Children
No Data
Related