NHS31xx msg - Message Handler Protocol
app_demo_dp_tlogger/inc/msghandler_protocol.h
1 /*
2  * Copyright 2015-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 
22 #include "msg/msg.h"
23 
24 /* -------------------------------------------------------------------------------- */
25 
31 #define APP_MSG_ERR_TSEN 0x1000E
32 
40 #define APP_MSG_MIN_TEMPERATURE -400
41 
49 #define APP_MSG_MAX_TEMPERATURE 850
50 
58 #define APP_MSG_TEMPERATURE_PLACEHOLDER_VALUE (APP_MSG_MAX_TEMPERATURE + 1)
59 
64 #define APP_MSG_DELAY_START_INDEFINITELY 0xFFFFFFFF
65 
71 #define APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE 232
72 #if APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE > 255
73  #error APP_MSG_MAX_TEMPERATURE_VALUES_IN_RESPONSE must fit in one byte for APP_MSG_ID_GETMEASUREMENTS
74 #endif
75 
82 #define APP_MSG_SIZEOFEVENT_IN_RESPONSE(info, data) \
83  (((((info) & EVENT_INFO_INDEX) == EVENT_INFO_INDEX) * 2) \
84  + ((((info) & EVENT_INFO_TIMESTAMP) == EVENT_INFO_TIMESTAMP) * 4) \
85  + (((info) & EVENT_INFO_ENUM) == EVENT_INFO_ENUM) \
86  + ((((info) & EVENT_INFO_DATA) == EVENT_INFO_DATA) * (data)))
87 
93 #define APP_MSG_MAX_EVENTS_IN_RESPONSE(size) (505 / (size))
94 
98 typedef enum APP_MSG_ID {
110 
123 
133 
144 
154 
164 
175 
178 } APP_MSG_ID_T;
179 
190 typedef enum APP_MSG_EVENT {
193 
196 
199 
202 
205 
208 
211 
214 
217 
224 
237 
250 
253 
256 
259 
262 
265 
268 
271 
274 
277 
280 
283 
286 
290 
295 typedef enum EVENT_INFO {
303 
311 
319  EVENT_INFO_ENUM = 1 << 2,
320 
329  EVENT_INFO_DATA = 1 << 3,
330 
336 
343 
349 
359 } EVENT_INFO_T;
360 
365 typedef enum APP_MSG_PERIODICDATA_TYPE_S {
366  APP_MSG_PERIODICDATA_TYPE_TEMPERATURE = 0x01,
371 
376  APP_MSG_PERIODICDATA_TYPE_ALL = APP_MSG_PERIODICDATA_TYPE_TEMPERATURE | APP_MSG_PERIODICDATA_TYPE_HUMIDITY
378 
383 typedef enum APP_MSG_PERIODICDATA_FORMAT_S {
393 
405 
412 typedef enum APP_MSG_TSEN_RESOLUTION {
420 
421 /* -------------------------------------------------------------------------------- */
422 
423 #pragma pack(push, 1)
424 
426 typedef struct APP_MSG_CMD_GETMEASUREMENTS_S {
435  uint16_t offset;
437 
439 typedef struct APP_MSG_CMD_SETCONFIG_S {
443  uint32_t currentTime;
444 
450  uint16_t interval;
451 
465  uint32_t startDelay;
466 
479  uint32_t runningTime;
480 
489  int16_t validMinimum;
490 
499  int16_t validMaximum;
501 
503 typedef struct APP_MSG_CMD_MEASURETEMPERATURE_S {
504  uint8_t resolution;
506 
508 typedef struct APP_MSG_CMD_GETEVENTS_S {
518  uint16_t index;
519 
526  uint32_t eventMask;
527 
534  uint8_t info;
536 
538 typedef struct APP_MSG_CMD_GETPERIODICDATA_S {
547  uint8_t which;
548 
554  uint8_t format;
555 
571  uint16_t offset;
573 
574 /* ------------------------------------------------------------------------- */
575 
629 typedef struct APP_MSG_RESPONSE_GETMEASUREMENTS_S {
634  uint32_t result;
635 
641  uint16_t offset;
642 
653  uint8_t count;
654 
662  uint8_t zero[3];
663 
664  //int16_t data[count];
666 
668 typedef struct APP_MSG_RESPONSE_GETCONFIG_S {
673  uint32_t result;
674 
675  /* -------------------------------------------------------------------------------- */
676 
678  uint32_t configTime;
679 
681  uint16_t interval;
682 
684  uint32_t startDelay;
685 
687  uint32_t runningTime;
688 
690  int16_t validMinimum;
691 
693  int16_t validMaximum;
694 
695  /* -------------------------------------------------------------------------------- */
696 
699 
702 
704  uint16_t count;
705 
713  uint32_t status;
714 
716  uint32_t startTime;
717 
737  uint32_t currentTime;
739 
741 typedef struct APP_MSG_RESPONSE_MEASURETEMPERATURE_S {
746  uint32_t result;
747 
748  int16_t temperature;
750 
834 typedef struct APP_MSG_RESPONSE_GETEVENTS_S {
839  uint16_t index;
840 
846  uint32_t eventMask;
847 
857  uint8_t info;
858 
874  uint16_t count;
875 
876  //uint8_t data[...]; - extra information per event, as indicated in the info struct member
878 
879 
881 typedef struct APP_MSG_RESPONSE_GETPERIODICDATA_S {
886  uint32_t result;
887 
892  uint8_t which;
893 
895  uint8_t format;
896 
918  uint16_t offset;
919 
920  //byte data[...];
922 
923 #pragma pack(pop)
924 
925 #endif
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:392
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:207
uint32_t runningTime
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:479
uint16_t interval
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:450
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:236
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:413
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:122
APP_MSG_ID_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:98
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:204
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:276
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:417
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:348
APP_MSG_TSEN_RESOLUTION_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:412
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:163
int16_t validMaximum
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:499
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:174
uint16_t index
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:518
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:414
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:213
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: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:741
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:834
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:881
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:426
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:439
int16_t attainedMinimum
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:698
APP_MSG_PERIODICDATA_TYPE_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:365
APP_MSG_PERIODICDATA_FORMAT_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:383
uint32_t startDelay
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:465
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:223
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:273
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:329
uint32_t currentTime
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:443
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:376
uint8_t which
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:547
uint32_t startTime
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:716
uint8_t count
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:653
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:132
uint16_t count
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:704
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:335
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:285
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:418
uint32_t result
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:634
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:252
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:310
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:195
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:370
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:415
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:255
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:270
int16_t temperature
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:748
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:279
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:177
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:416
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:109
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:201
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:282
uint32_t eventMask
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:526
uint32_t configTime
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:678
int16_t attainedMaximum
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:701
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:358
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:403
uint8_t resolution
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:504
uint8_t info
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:534
uint8_t format
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:554
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:216
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:143
uint16_t offset
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:435
int16_t validMinimum
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:489
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:267
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:210
EVENT_INFO_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:295
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:367
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:342
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:192
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:302
uint32_t status
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:713
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:264
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:198
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:153
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:288
APP_MSG_EVENT_T
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:190
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:261
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:319
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:249
Definition: app_demo_dp_tlogger/inc/msghandler_protocol.h:258