From 8aeacd7478406f75b825ea1b3ed71ffe1983a5d1 Mon Sep 17 00:00:00 2001 From: Hrishikesh Dhayagude Date: Wed, 8 Jan 2020 22:28:25 +0800 Subject: [PATCH] ESP-BLE-Mesh: Printf the current on/off state to the application during the GET request --- .../ble_mesh_node/onoff_server/main/ble_mesh_demo_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/ble_mesh_demo_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/ble_mesh_demo_main.c index 31e45ce45d..4d185f7450 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/ble_mesh_demo_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/main/ble_mesh_demo_main.c @@ -208,6 +208,7 @@ static void example_ble_mesh_provisioning_cb(esp_ble_mesh_prov_cb_event_t event, static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_event_t event, esp_ble_mesh_generic_server_cb_param_t *param) { + esp_ble_mesh_gen_onoff_srv_t *srv; ESP_LOGI(TAG, "event 0x%02x, opcode 0x%04x, src 0x%04x, dst 0x%04x", event, param->ctx.recv_op, param->ctx.addr, param->ctx.recv_dst); @@ -223,6 +224,8 @@ static void example_ble_mesh_generic_server_cb(esp_ble_mesh_generic_server_cb_ev case ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT: ESP_LOGI(TAG, "ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT"); if (param->ctx.recv_op == ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET) { + srv = param->model->user_data; + ESP_LOGI(TAG, "onoff 0x%02x", srv->state.onoff); example_handle_gen_onoff_msg(param->model, ¶m->ctx, NULL); } break;