NHS31xx SW API
app_demo_dpa_sensormonitor/inc/msghandler_protocol.h
1 /*
2  * Copyright 2018-2020 NXP
3  * This software is owned or controlled by NXP and may only be used strictly
4  * in accordance with the applicable license terms. By expressly accepting
5  * such terms or by downloading, installing, activating and/or otherwise using
6  * the software, you are agreeing that you have read, and that you agree to
7  * comply with and are bound by, such license terms. If you do not agree to
8  * be bound by the applicable license terms, then you may not retain, install,
9  * activate or otherwise use the software.
10  */
11 
12 #ifndef __MSGHANDLER_PROTOCOL_H_
13 #define __MSGHANDLER_PROTOCOL_H_
14 
23 #include "msg/msg.h"
24 #include "accel/accel_params.h"
25 
26 /* -------------------------------------------------------------------------------- */
27 
33 #define APP_MSG_ERR_TSEN 0x1000E
34 
42 #define APP_MSG_MIN_TEMPERATURE -400
43 
51 #define APP_MSG_MAX_TEMPERATURE 850
52 
60 #define APP_MSG_TEMPERATURE_PLACEHOLDER_VALUE (APP_MSG_MAX_TEMPERATURE + 1)
61 
66 #define APP_MSG_DELAY_START_INDEFINITELY 0xFFFFFFFF
67 
73 #define APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE 232
74 #if APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE > 255
75  #error APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE must fit in one byte for APP_MSG_ID_GETMEASUREMENTS
76 #endif
77 
84 #define APP_MSG_SIZEOFEVENT_IN_RESPONSE(info, data) \
85  (((((info) & EVENT_INFO_INDEX) == EVENT_INFO_INDEX) * 2) \
86  + ((((info) & EVENT_INFO_TIMESTAMP) == EVENT_INFO_TIMESTAMP) * 4) \
87  + (((info) & EVENT_INFO_ENUM) == EVENT_INFO_ENUM) \
88  + ((((info) & EVENT_INFO_DATA) == EVENT_INFO_DATA) * (data)))
89 
95 #define APP_MSG_MAX_EVENTS_IN_RESPONSE(size) (505 / (size))
96 
100 typedef enum APP_MSG_ID {
112 
125 
135 
146 
156 
166 
176 
191 
202 
205 } APP_MSG_ID_T;
206 
217 typedef enum APP_MSG_EVENT {
220 
223 
226 
229 
232 
235 
238 
241 
244 
251 
264 
277 
280 
283 
286 
289 
292 
295 
298 
301 
304 
307 
310 
313 
317 
322 typedef enum EVENT_INFO {
330 
338 
346  EVENT_INFO_ENUM = 1 << 2,
347 
356  EVENT_INFO_DATA = 1 << 3,
357 
363 
370 
376 
386 } EVENT_INFO_T;
387 
392 typedef enum APP_MSG_PERIODICDATA_TYPE_S {
393  APP_MSG_PERIODICDATA_TYPE_TEMPERATURE = 0x01,
398 
403  APP_MSG_PERIODICDATA_TYPE_ALL = APP_MSG_PERIODICDATA_TYPE_TEMPERATURE | APP_MSG_PERIODICDATA_TYPE_HUMIDITY
405 
410 typedef enum APP_MSG_PERIODICDATA_FORMAT_S {
420 
432 
439 typedef enum APP_MSG_TSEN_RESOLUTION {
447 
448 /* -------------------------------------------------------------------------------- */
449 
450 #pragma pack(push, 1)
451 
453 typedef struct APP_MSG_CMD_GETMEASUREMENTS_S {
462  uint16_t offset;
464 
466 typedef struct APP_MSG_CMD_SETCONFIG_S {
470  uint32_t currentTime;
471 
477  uint16_t interval;
478 
492  uint32_t startDelay;
493 
506  uint32_t runningTime;
507 
516  int16_t validMinimum;
517 
526  int16_t validMaximum;
528 
530 typedef struct APP_MSG_CMD_MEASURETEMPERATURE_S {
531  uint8_t resolution;
533 
535 typedef struct APP_MSG_CMD_GETEVENTS_S {
545  uint16_t index;
546 
553  uint32_t eventMask;
554 
561  uint8_t info;
563 
565 typedef struct APP_MSG_CMD_SETACCELCONFIG_S {
574 
583 
592 
602 
604 typedef struct APP_MSG_CMD_GETPERIODICDATA_S {
613  uint8_t which;
614 
620  uint8_t format;
621 
637  uint16_t offset;
639 
640 /* ------------------------------------------------------------------------- */
641 
695 typedef struct APP_MSG_RESPONSE_GETMEASUREMENTS_S {
700  uint32_t result;
701 
707  uint16_t offset;
708 
719  uint8_t count;
720 
728  uint8_t zero[3];
729 
730  //int16_t data[count];
732 
734 typedef struct APP_MSG_RESPONSE_GETCONFIG_S {
739  uint32_t result;
740 
741  /* -------------------------------------------------------------------------------- */
742 
744  uint32_t configTime;
745 
747  uint16_t interval;
748 
750  uint32_t startDelay;
751 
753  uint32_t runningTime;
754 
756  int16_t validMinimum;
757 
759  int16_t validMaximum;
760 
761  /* -------------------------------------------------------------------------------- */
762 
764  int16_t attainedMinimum;
765 
767  int16_t attainedMaximum;
768 
770  uint16_t count;
771 
779  uint32_t status;
780 
782  uint32_t startTime;
783 
803  uint32_t currentTime;
805 
807 typedef struct APP_MSG_RESPONSE_MEASURETEMPERATURE_S {
812  uint32_t result;
813 
814  int16_t temperature;
816 
900 typedef struct APP_MSG_RESPONSE_GETEVENTS_S {
905  uint16_t index;
906 
912  uint32_t eventMask;
913 
923  uint8_t info;
924 
940  uint16_t count;
941 
942  //uint8_t data[...]; - extra information per event, as indicated in the info struct member
944 
946 typedef struct APP_MSG_RESPONSE_GETACCELCONFIG_S {
951  uint32_t result;
952 
961 
970 
979 
988 
989  uint16_t shockEventCount;
991  uint16_t shakeEventCount;
992  uint16_t tiltEventCount;
994 
996 typedef struct APP_MSG_RESPONSE_GETPERIODICDATA_S {
1001  uint32_t result;
1002 
1007  uint8_t which;
1008 
1010  uint8_t format;
1011 
1033  uint16_t offset;
1034 
1035  //byte data[...];
1037 
1038 #pragma pack(pop)
1039 
1040 #endif
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:279
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:145
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:337
ACCEL_TILT_PARAMS_T tilt
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:600
ACCEL_VIBRATION_PARAMS_T vibration
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:591
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:300
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:285
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:282
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:240
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:225
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:430
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:394
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:165
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:201
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:346
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:243
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:375
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:443
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:440
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:228
ACCEL_SHAKE_PARAMS_T shake
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:582
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:315
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:276
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:288
uint32_t result
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:951
EVENT_INFO_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:322
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:444
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:385
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:306
uint16_t shockEventCount
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:989
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:303
uint16_t tiltEventCount
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:992
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:250
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:403
APP_MSG_EVENT_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:217
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:175
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:204
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:356
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:231
APP_MSG_ID_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:100
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:234
Definition: accel_params.h:121
Definition: accel_params.h:26
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:155
Definition: accel_params.h:65
Definition: accel_params.h:90
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:124
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:237
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:263
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:329
APP_MSG_TSEN_RESOLUTION_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:439
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:397
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:297
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:190
uint16_t vibrationEventCount
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:990
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:222
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:291
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:312
APP_MSG_PERIODICDATA_FORMAT_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:410
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:442
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:565
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:946
ACCEL_SHOCK_PARAMS_T shock
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:573
uint16_t shakeEventCount
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:991
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:441
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:309
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:362
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:419
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:445
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:538
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:629
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:668
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:503
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:508
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:426
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:439
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:881
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:369
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:294
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:741
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:834
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:134
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:111
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:219
APP_MSG_PERIODICDATA_TYPE_T
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:392