nRF5 SDK for Mesh v4.2.0
sensor_common.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef SENSOR_COMMON_H__
39 #define SENSOR_COMMON_H__
40 
41 #include <stdint.h>
42 
43 
53 #define SENSOR_COMPANY_ID (0xFFFF)
54 
55 /* See "@tagMeshDevPr, section 4.1.3". 0 is a prohibited value for property ID, so it can represent
56  * "no property id" without concern for a collision.
57  */
58 #define SENSOR_NO_PROPERTY_ID (0)
59 
60 /* "@tagMeshDevPr"
61  */
62 /* Motion Sensed Property
63  */
64 #define SENSOR_MOTION_SENSED_PROPERTY_ID (0x0042)
65 /* "Presence Detected Property
66  */
67 #define SENSOR_PRESENCE_DETECT_PROPERTY_ID (0x004D)
68 
69 /* @tagMeshMdlSp section 4.1.1 descriptor is 8 bytes
70  */
71 #define SENSOR_DESCRIPTOR_MSG_SIZE (8)
72 
73 typedef uint8_t * sensor_property_data_size_t;
74 
82 typedef struct
83 {
86  uint16_t property_id;
88 
89 
92 typedef struct
93 {
96  uint16_t property_id;
98 
101 typedef struct
102 {
105  uint16_t property_id;
107 
110 typedef struct
111 {
114  uint16_t property_id;
117  uint16_t * setting_property_ids;
119 
122 typedef struct
123 {
126  uint16_t property_id;
129  uint16_t setting_property_id;
131 
134 typedef struct
135 {
138  uint16_t property_id;
144  uint8_t setting_raw;
146 
149 typedef struct
150 {
153  uint16_t property_id;
159  uint8_t setting_access;
162  uint8_t setting_raw;
164 
167 typedef struct
168 {
171  uint16_t property_id;
173 
175 typedef struct
176 {
179  uint16_t property_id;
182  uint8_t raw_value_x;
184 
187 typedef struct
188 {
191  uint16_t property_id;
194  uint8_t raw_value_x;
197  uint8_t column_width;
200  uint8_t raw_value_y;
202 
205 typedef struct
206 {
209  uint16_t property_id;
212  uint8_t raw_value_x1;
215  uint8_t raw_value_x2;
217 
220 typedef struct
221 {
224  uint16_t property_id;
227  uint8_t raw_value_x_n;
230  uint8_t column_width_n;
233  uint8_t raw_value_y_n;
235 
236 /* just the property id in the error return
237  */
238 #define SENSOR_SERIES_ERR_MSG_SIZE (2)
239 #define SENSOR_CADENCE_ERR_MSG_SIZE (2)
240 #define SENSOR_SETTINGS_ERR_MSG_SIZE (2)
241 #define SENSOR_SETTING_ERR_MSG_SIZE (4)
242 #define SENSOR_DESCRIPTOR_ERR_MSG_SIZE (2)
243 
246 typedef struct
247 {
250  uint16_t property_id;
265  uint8_t update_interval;
267 
268 
270 #endif /* SENSOR_COMMON_H__ */
Parameters for the Sensor Get message.
uint16_t property_id
< Sensor property ID
uint16_t property_id
< Sensor property ID
Definition: sensor_common.h:86
uint8_t raw_value_x_n
The nth column width.
Parameters for the Sensor Series Status message.
uint16_t setting_property_id
Raw value for the setting.
uint16_t negative_tolerance
Sampling function applied to measured sensor values.
uint8_t sampling_function
Period over which measurement is taken in seconds.
Parameters for the Sensor Cadence Get message.
Definition: sensor_common.h:92
Parameters for the Sensor Series Get message.
Parameters for the Sensor Settings Get message.
uint16_t positive_tolerance
12-bit value for possible negative sensor error
uint16_t property_id
< Property ID for sensor
uint8_t raw_value_x
Raw value representing the width of the column (Optional)
uint16_t property_id
< Sensor property ID
uint16_t property_id
< Sensor property ID
uint16_t property_id
< Sensor property ID
Definition: sensor_common.h:96
Parameters for the Sensor Settings Status message.
uint16_t property_id
< Sensor property ID
uint8_t measurement_period
Interval between measurement updates in seconds.
uint16_t property_id
< Sensor property ID
Parameters for the Sensor Setting Set message.
uint8_t column_width_n
The nth column height.
uint8_t raw_value_x1
Raw value identifying an ending column.
uint8_t setting_access
Raw value for the setting.
uint8_t column_width
Raw value representing the height of the column on the Y axis.
uint16_t property_id
< Sensor property ID
Parameters for the Sensor Column Get message.
Parameters for the Sensor Setting Get message.
Parameters for the Sensor Column Status message.
Parameters for the Sensor Setting Status message.
uint16_t setting_property_id
Read/Write access rights for the setting (Optional)
uint16_t property_id
< Identifies a sensor
Unpacked message structure typedefs are used for API interfaces and for implementing model code...
Definition: sensor_common.h:82
uint16_t property_id
< Sensor property ID
Sensor Descriptor - the sensor-specific sensor descriptor.
uint16_t property_id
< Sensor property ID
uint16_t property_id
< Identifies a sensor and the Y axis

Documentation feedback | Developer Zone | Subscribe | Updated