43 #include "generic_onoff_server.h" 44 #include "app_timer.h" 88 #define APP_ONOFF_SERVER_DEF(_name, _force_segmented, _mic_size, _set_cb, _get_cb) \ 89 APP_TIMER_DEF(_name ## _timer); \ 90 static app_onoff_server_t _name = \ 92 .server.settings.force_segmented = _force_segmented, \ 93 .server.settings.transmic_size = _mic_size, \ 94 .p_timer_id = &_name ## _timer, \ 95 .onoff_set_cb = _set_cb, \ 96 .onoff_get_cb = _get_cb \ 189 uint32_t
app_onoff_init(app_onoff_server_t * p_server, uint8_t element_index);
bool present_onoff
Present value of the OnOff state.
bool value_updated
Internal variable.
void(* app_onoff_get_cb_t)(const app_onoff_server_t *p_server, bool *p_present_onoff)
Application state read callback prototype.
void app_onoff_status_publish(app_onoff_server_t *p_server)
Initiates value fetch from the user application by calling a get callback, updates internal state...
app_onoff_state_t state
Internal variable.
void(* app_onoff_set_cb_t)(const app_onoff_server_t *p_server, bool onoff)
Application state set callback prototype.
uint32_t app_onoff_init(app_onoff_server_t *p_server, uint8_t element_index)
Initializes the behavioral module for the generic OnOff model.
app_timer_id_t const * p_timer_id
APP timer instance pointer.
generic_onoff_server_t server
OnOff server model interface context structure.
Internal structure to hold state and timing information.
Application level structure holding the OnOff server model context and OnOff state representation...
uint32_t last_rtc_counter
Internal variable.
app_onoff_get_cb_t onoff_get_cb
Callback to be called for requesting current value from the user application.
uint32_t delay_ms
Time to delay the processing of received SET message.
uint32_t remaining_time_ms
Remaining time to reach target_onoff.
app_onoff_set_cb_t onoff_set_cb
Callaback to be called for informing the user application to update the value.
bool target_onoff
Target value of the OnOff state, as received from the model interface.