Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
pktparser(parser_packet) performs content interpretation on the byte sequence converted by serparser performs content interpretation on the byte sequence converted by serparser.
The above example interprets standard application 0x81 message. parser_ser object converts the message input from Serial into a byte string. This byte string is first identified by identify_packet_type()
to determine the type of the message E_PKT
. Once the message type is determined, the message is parsed by .parse<TwePacketTwelite>()
. The parsed result will be of type TwePacketTwelite
, and .use<TwePacketTwelite>()
is the procedure to extract this object. The TwePacketTwelite
type is a class, but it refers to its member variables directly as a structure.
Parses a sequence of bytes.
The T
specifies the packet type to be parsed. For example, TwePacketTwelite
is specified for 0x81 messages in standard applications.
p
and e
specify the next to the beginning and the end of the byte sequence.
The return value is of type E_PKT
. In case of an error, E_PKT::PKT_ERROR
is returned.
Returns a reference to an object corresponding to the packet type of the interpreted byte sequence. It can be called if parse<T>
was executed beforehand and there were no errors.
The T
can be the same type as the one executed with parse<T>
, or a TwePacket
from which only basic information can be obtained.
Determines the type of packet using the packet data byte sequence as input. The return value is E_PKT.
If the packet cannot be interpreted as a specific packet, E_PKT::PKT_ERROR
is returned.
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
.
packet type definition
Corresponds to the following packet
Corresponds to the ASCII format output by the Parent Node of App_Wings.
Name | Description |
---|---|
PKT_ERROR
TwePacket does not contain meaningful data such as before packet interpretation or packet type cannot be identified.
PKT_TWELITE
0x81 command of the standard application App_Twelite is interpreted.
PKT_PAL
Interpret serial format of TWELITE PAL
PKT_APPIO
UART message of remote control application App_IO products/ TWE-APPS/App_IO/uart.html) interpreted by the remote control application App_IO.
PKT_APPUART
Extended format of the serial communication application App_UART products/ TWE-APPS/App_Uart/mode_format.html) is interpreted.
PKT_APPTAG
The UART message of the wireless tag application App_Tag is interpreted. The sensor specific part is not interpreted and the byte string is reported as payload.
PKT_ACT_STD
Output format used in Act (Act) sample, etc.