NHS31xx SW API
app_demo_dpahu_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 
82 #define APP_MSG_MAX_HUMIDITY_VALUES_IN_RESPONSE 465
83 
89 #define APP_MSG_MAX_COMBINED_VALUES_IN_RESPONSE 155
90 
97 #define APP_MSG_SIZEOFEVENT_IN_RESPONSE(info, data) \
98  (((((info) & EVENT_INFO_INDEX) == EVENT_INFO_INDEX) * 2) \
99  + ((((info) & EVENT_INFO_TIMESTAMP) == EVENT_INFO_TIMESTAMP) * 4) \
100  + (((info) & EVENT_INFO_ENUM) == EVENT_INFO_ENUM) \
101  + ((((info) & EVENT_INFO_DATA) == EVENT_INFO_DATA) * (data)))
102 
108 #define APP_MSG_MAX_EVENTS_IN_RESPONSE(size) (505 / (size))
109 
113 typedef enum APP_MSG_ID {
125 
138 
148 
159 
169 
179 
189 
204 
215 
224 
241 
244 } APP_MSG_ID_T;
245 
256 typedef enum APP_MSG_EVENT {
259 
262 
265 
268 
271 
274 
277 
280 
283 
290 
303 
316 
319 
322 
325 
328 
331 
334 
337 
340 
343 
346 
349 
352 
356 
361 typedef enum EVENT_INFO {
369 
377 
385  EVENT_INFO_ENUM = 1 << 2,
386 
395  EVENT_INFO_DATA = 1 << 3,
396 
402 
409 
415 
425 } EVENT_INFO_T;
426 
431 typedef enum APP_MSG_PERIODICDATA_TYPE_S {
432  APP_MSG_PERIODICDATA_TYPE_TEMPERATURE = 0x01,
437 
442  APP_MSG_PERIODICDATA_TYPE_ALL = APP_MSG_PERIODICDATA_TYPE_TEMPERATURE | APP_MSG_PERIODICDATA_TYPE_HUMIDITY
444 
449 typedef enum APP_MSG_PERIODICDATA_FORMAT_S {
459 
471 
478 typedef enum APP_MSG_TSEN_RESOLUTION {
486 
487 /* -------------------------------------------------------------------------------- */
488 
489 #pragma pack(push, 1)
490 
492 typedef struct APP_MSG_CMD_GETMEASUREMENTS_S {
501  uint16_t offset;
503 
505 typedef struct APP_MSG_CMD_SETCONFIG_S {
509  uint32_t currentTime;
510 
516  uint16_t interval;
517 
531  uint32_t startDelay;
532 
545  uint32_t runningTime;
546 
555  int16_t validMinimum;
556 
565  int16_t validMaximum;
567 
569 typedef struct APP_MSG_CMD_MEASURETEMPERATURE_S {
570  uint8_t resolution;
572 
574 typedef struct APP_MSG_CMD_GETEVENTS_S {
584  uint16_t index;
585 
592  uint32_t eventMask;
593 
600  uint8_t info;
602 
604 typedef struct APP_MSG_CMD_SETACCELCONFIG_S {
612  ACCEL_SHOCK_PARAMS_T shock;
613 
621  ACCEL_SHAKE_PARAMS_T shake;
622 
630  ACCEL_VIBRATION_PARAMS_T vibration;
631 
639  ACCEL_TILT_PARAMS_T tilt;
641 
643 typedef struct APP_MSG_CMD_GETPERIODICDATA_S {
652  uint8_t which;
653 
659  uint8_t format;
660 
676  uint16_t offset;
678 
680 typedef struct APP_MSG_CMD_SETHUMIDITYCONFIG_S {
681  /* uint16_t interval cannot be set. The interval as set in #APP_MSG_CMD_SETCONFIG_T.interval is re-used. */
682  /* uint32_t startDelay cannot be set. The interval as set in #APP_MSG_CMD_SETCONFIG_T.startDelay is re-used. */
683  /* uint32_t runningTime cannot be set. The interval as set in #APP_MSG_CMD_SETCONFIG_T.runningTime is re-used. */
684 
693  uint16_t validMinimum;
694 
703  uint16_t validMaximum;
705 
706 /* ------------------------------------------------------------------------- */
707 
761 typedef struct APP_MSG_RESPONSE_GETMEASUREMENTS_S {
766  uint32_t result;
767 
773  uint16_t offset;
774 
785  uint8_t count;
786 
794  uint8_t zero[3];
795 
796  //int16_t data[count];
798 
800 typedef struct APP_MSG_RESPONSE_GETCONFIG_S {
805  uint32_t result;
806 
807  /* -------------------------------------------------------------------------------- */
808 
810  uint32_t configTime;
811 
813  uint16_t interval;
814 
816  uint32_t startDelay;
817 
819  uint32_t runningTime;
820 
822  int16_t validMinimum;
823 
825  int16_t validMaximum;
826 
827  /* -------------------------------------------------------------------------------- */
828 
830  int16_t attainedMinimum;
831 
833  int16_t attainedMaximum;
834 
836  uint16_t count;
837 
845  uint32_t status;
846 
848  uint32_t startTime;
849 
869  uint32_t currentTime;
871 
873 typedef struct APP_MSG_RESPONSE_MEASURETEMPERATURE_S {
878  uint32_t result;
879 
880  int16_t temperature;
882 
966 typedef struct APP_MSG_RESPONSE_GETEVENTS_S {
971  uint16_t index;
972 
978  uint32_t eventMask;
979 
989  uint8_t info;
990 
1006  uint16_t count;
1007 
1008  //uint8_t data[...]; - extra information per event, as indicated in the info struct member
1010 
1012 typedef struct APP_MSG_RESPONSE_GETACCELCONFIG_S {
1017  uint32_t result;
1018 
1026  ACCEL_SHOCK_PARAMS_T shock;
1027 
1035  ACCEL_SHAKE_PARAMS_T shake;
1036 
1044  ACCEL_VIBRATION_PARAMS_T vibration;
1045 
1053  ACCEL_TILT_PARAMS_T tilt;
1054 
1055  uint16_t shockEventCount;
1056  uint16_t vibrationEventCount;
1057  uint16_t shakeEventCount;
1058  uint16_t tiltEventCount;
1060 
1062 typedef struct APP_MSG_RESPONSE_GETPERIODICDATA_S {
1067  uint32_t result;
1068 
1073  uint8_t which;
1074 
1076  uint8_t format;
1077 
1099  uint16_t offset;
1100 
1101  //byte data[...];
1103 
1105 typedef struct APP_MSG_RESPONSE_GETHUMIDITYCONFIG_S {
1110  uint32_t result;
1111 
1113  uint16_t validMinimum;
1114 
1116  uint16_t validMaximum;
1117 
1120 
1124 
1125 #pragma pack(pop)
1126 
1127 #endif
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:318
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:158
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:376
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:339
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:324
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:321
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:279
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:264
APP_MSG_PERIODICDATA_TYPE_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:431
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:469
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:433
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:178
uint16_t attainedMinimum
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:1119
uint32_t result
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:1110
APP_MSG_ID_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:113
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:214
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:385
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:282
EVENT_INFO_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:361
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:414
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:482
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:479
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:267
uint16_t validMaximum
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:703
uint16_t attainedMaximum
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:1122
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:354
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:315
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:327
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:483
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:424
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:345
uint16_t validMinimum
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:693
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:342
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:289
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:442
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:680
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:1105
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:240
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:188
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:243
APP_MSG_TSEN_RESOLUTION_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:478
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:395
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:223
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:270
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:273
Definition: accel_params.h:121
Definition: accel_params.h:26
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:168
Definition: accel_params.h:65
Definition: accel_params.h:90
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:137
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:276
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:302
APP_MSG_PERIODICDATA_FORMAT_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:449
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:368
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:436
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:336
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:203
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:261
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:330
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:351
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:481
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:565
Definition: app_demo_dpa_sensormonitor/inc/msghandler_protocol.h:946
APP_MSG_EVENT_T
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:256
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:480
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:348
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:401
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:458
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:484
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_dpahu_sensormonitor/inc/msghandler_protocol.h:408
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:333
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:741
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:834
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:147
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:124
Definition: app_demo_dpahu_sensormonitor/inc/msghandler_protocol.h:258