38 #ifndef APP_SENSOR_UTILS_H__ 39 #define APP_SENSOR_UTILS_H__ 42 #include "model_common.h" 44 #include "app_sensor.h" 45 #include "sensor_utils.h" 49 typedef bool (*sensor_in_fast_region_t)(sensor_cadence_t *);
50 typedef bool (*sensor_delta_trigger_fast_t)(sensor_cadence_t *);
51 typedef uint16_t (*cadence_value_marshall_t)(sensor_cadence_t *, uint8_t *, uint16_t);
55 list_node_t list_node;
92 uint8_t * sensor_marshalled_entry_parse(uint8_t * p_data_buf,
94 uint8_t * p_data_length,
95 uint16_t * p_property_id,
96 uint8_t ** pp_data_value);
108 uint8_t sensor_percentage8_create(uint8_t value, uint8_t b_exp);
118 uint8_t sensor_percentage8_parse(uint8_t value, uint8_t * p_b_exp);
133 sensor_cadence_t * sensor_cadence_create(uint16_t
property_id,
154 bool sensor_cadence_set(app_sensor_server_t *
p_server,
157 sensor_cadence_status_msg_pkt_t * p_out,
158 uint16_t * p_out_bytes);
170 void sensor_cadence_get(app_sensor_server_t *
p_server,
172 sensor_cadence_status_msg_pkt_t * p_out,
173 uint16_t * p_out_bytes);
183 void sensor_cadence_to_buffer_serialize(sensor_cadence_t * p_cadence,
203 sensor_cadence_t * sensor_cadence_to_buffer_deserialize(uint8_t * p_in_buffer,
205 uint8_t * p_out_buffer,
206 uint16_t * p_out_bytes);
214 void sensor_initialize(app_sensor_server_t *
p_server);
226 app_sensor_server_t * sensor_list_activate(app_sensor_server_t *
p_server,
227 sensor_status_msg_pkt_t * p_out,
228 uint16_t * p_out_bytes);
239 void sensor_activate(app_sensor_server_t *
p_server,
241 sensor_status_msg_pkt_t * p_out,
242 uint16_t * p_out_bytes);
251 uint32_t sensor_cadence_publication_abort(app_sensor_server_t *
p_server);
uint16_t marshalled_bytes
The marshalled value size.
uint16_t range_value_bytes_allocated
buffer size for value arrays
cadence_value_marshall_t value_marshall
Function to marshall the data in the supplied buffer into correct format.
sensor_in_fast_region_t in_fast_region
Function returning whether the value is in the fast cadence region.
uint8_t * p_previous_value
The previous sensor value.
Message format for the Sensor Cadence Set/Set Unacknowledged message (partial) 4.2.4 Sensor Cadence Set Sensor Cadence Set is an acknowledged message used to set the Sensor Cadence state of an element (see Section 4.1.3).
uint16_t delta_value_bytes_allocated
buffer size for delta arrays
Structure for model timers.
model_timer_t timer
For providing cadence.
uint8_t fast_period_exponent
Fast cadence exponent.
uint8_t trigger_type
Fast cadence trigger type.
sensor_delta_trigger_fast_t delta_trigger_fast
Function returning whether the delta should trigger fast cadence.
uint8_t min_interval_exponent
Minimum cadence interval.
model_timer_t min_interval_timer
For enforcing status min interval.
uint8_t * p_current_value
The current sensor value.
uint8_t * p_fast_cadence_high
Value for fast cadence range.
uint8_t * p_fast_cadence_low
Value for fast cadence range.
bool min_interval_publication_pending
Has a publication been scheduled waiting for min interval to expire.
uint8_t * p_trigger_delta_down
Value triggers fast cadence.
app_sensor_server_t * p_server
Identifies the owning server.
uint16_t property_id
Sensor property ID.
uint8_t * p_trigger_delta_up
Value triggers fast cadence.