I am trying to implement the Simple On Off Server model in an existing project. In main.c I did the following:
1. In models_init_cb(), I added the following lines:
m_server.get_cb = on_off_server_get_cb; m_server.set_cb = on_off_server_set_cb; ERROR_CHECK(simple_on_off_server_init(&m_server, 0)); ERROR_CHECK(access_model_subscription_list_alloc(m_server.model_handle));
2. I add callback functions in main.c:
static bool on_off_server_get_cb(const simple_on_off_server_t * p_server) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Got GET command"); printf("in get"); //return hal_led_pin_get(BSP_LED_1); } static bool on_off_server_set_cb(const simple_on_off_server_t * p_server, bool value) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Got SET command to %u\n", value); printf("in set"); //hal_led_pin_set(BSP_LED_1, value); return value; }
3. I instantiate m_server towards top of the main.c file:
static simple_on_off_server_t m_server;
My program is running without errors, but when I control the model using an app, I am getting callback in proxy.c it seems, but no callback is triggered in my main.c
How do I get callback in main.c?