The TwePacketAppUart
class is the format in which the extended format of the App_UART is received by the parent and repeater application App_Wings.
Various information in the packet data is stored in DataAppUART
after parse<TwePacketUART>()
execution.
The simple format cannot be interpreted. parse<TwePacketUART>()
returns E_PKT::PKT_ERROR
. To check the contents, refer to the original byte sequence directly.
The payload
is the data part, but the method of data storage changes depending on the macro definition.
If MWX_PARSER_PKT_APPUART_FIXED_BUF
is compiled with the value 0
, payload
refers directly to the byte sequence for packet analysis. If the value of the original byte sequence is changed, the data in payload
will be destroyed.
If you define the value of MWX_PARSER_PKT_APPUART_FIXED_BUF
to be greater than 0
, the payload
will allocate a buffer of that value (bytes). However, if the data of the serial message exceeds the buffer size, parse<TwePacketAppUART>()
fails and returns E_PKT::PKT_ERROR
.
The TwePacketTwelite
class is a standard application 0x81 command of App_Twelite, which is an interpretation of the TwePacketTwelite
class.
Various information in the packet data is stored in DataTwelite
after parse<TwePacketTwelite>()
is executed.
It is a base class of packet type, but the member structure common
contains address information and other common information.
This is used when you want to get minimum information such as address information when you want to store mixed types as pktparser type in arrays, etc.
The TwePacketPal
class interprets TWELITE PAL packet data. This class handles TWELITE PAL (sensor data and other upstream data) commonly.
PAL common data is defined in DataPal
.
Generator functions are provided to retrieve data specific to each PAL sensor board.
Although the packet data structure of PAL differs depending on the connected sensors, etc., DataPal
holds the data structure of the common part.
The PAL packet data structure consists of two blocks: the common part for all PALs and the individual data part. The individual data part does not interpret the packet, but stores it as is. To simplify handling, data exceeding 32 bytes is stored in dynamically allocated uptr_snsdata
.
The individual data parts are stored in a structure whose base class is PalBase
. This structure is generated by the generator function defined in TwePacketPal
.
If the size fits in MWX_PARSER_PKT_APPPAL_FIXED_BUF
when parse<TwePacketPAL>()
is executed, a separate sensor object is generated.
If it does not fit, a reference to the byte sequence used for analysis is stored in au8snsdata
. In this case, if the data in the byte string used for analysis is rewritten, sensor-specific objects cannot be generated.
All data structures for each sensor in PAL inherit from PalBase
. The sensor data storage status u32StoredMask
is included.
PAL events are information that is sent when certain conditions are met by processing sensor information, rather than directly from sensors. For example, when an acceleration sensor detects a certain level of acceleration from a stationary state.
If event data exists, it can be determined by .is_PalEvent()
of TwePacketPal
being true
, and .get_PalEvent()
will yield a PalEvent
data structure.
Generator functions are used to extract various types of data from sensor PAL.
To use the generator function, first determine if pkt
is an event (.is_PalEvent()
). If it is an event, it has get_PalEvent()
. Otherwise, it creates an object according to u8palpcb
.
If .u8palpcb==E_PAL_PCB::MAG
, the data PalMag
of the open/close sensor pal is taken.
If .u8palpcb==E_PAL_PCB::AMB
, the data PalAmb
of the environmental sensor pal is taken.
If .u8palpcb==E_PAL_PCB::MOT
, the data PalMot
of the operating sensor pal is taken.
Extracts a PalEvent
(PAL event) if .is_PalEvent()
is true
.
The TwePacketAppIO
class interprets the standard app serial message (0x81) of App_IO The TwePacketAppIO
class is the one that interprets the
Various information in the packet data is stored in DataTwelite
after parse<TwePacketIO>()
execution.