Hi,
I'm using a modified version of the light_switch example to control a RGB led on Mesh SDK 2.0.1.
I already managed to control the led by using 3 variables for each color (red, green and blue). So, from the "SET" I'm done (except for the status_reply).
Now I want to be able to use the "GET" to know the actual value of the 3 variables on the server side.
I modified the reply_status function as follow:
static void reply_status(const simple_on_off_server_t * p_server, const access_message_rx_t * p_message, uint8_t current_red_dt_cycle, uint8_t current_green_dt_cycle, uint8_t current_blue_dt_cycle) { simple_on_off_msg_status_t status; //status.present_on_off = present_on_off ? 1 : 0; status.current_red_dt_cycle = current_red_dt_cycle; status.current_green_dt_cycle = current_green_dt_cycle; status.current_blue_dt_cycle = current_blue_dt_cycle; access_message_tx_t reply; reply.opcode.opcode = SIMPLE_ON_OFF_OPCODE_STATUS; reply.opcode.company_id = SIMPLE_ON_OFF_COMPANY_ID; reply.p_buffer = (const uint8_t *) &status; reply.length = sizeof(status); reply.force_segmented = false; reply.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT; (void) access_model_reply(p_server->model_handle, p_message, &reply); }
Accordingly I modified the simple_on_off_msg_status_t struct in simple_on_off_common.h:
typedef struct __attribute((packed)) { uint8_t current_red_dt_cycle; uint8_t current_green_dt_cycle; /**< Current state. */ uint8_t current_blue_dt_cycle; } simple_on_off_msg_status_t;
Now, my problem is that I couldn't figure out how to pass the 3 variable values when calling the reply_status function on the handle_get_cb, and also how the get_cb works...
Another question is how will I return the 3 values on the main.c when executing the on_off_server_get_cb function?
BR,
Paulo Zacarias