Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This structure is used to store the values of 3-axis accelerometers, but procedures have been added to increase convenience when stored in a container class.
Generates an iterator that accesses an element on the X, Y, or Z axis using the iterator of the container class containing axis_xyzt
as a parameter.
In the example below, buf.begin()
and buf.end()
are used as iterators for the X axis in the algorithm std::minmax_element
.
This function generates a virtual container class from which one of the XYZ axes of the container class containing axis_xyzt
is taken. Only the begin()
and end()
methods are implemented in this generated class. The iterator that can be obtained by these begin()
and end()
methods is the same as the iterator in the previous section get_axis_{x,y,z}_iter().
API return value class that wraps 32-bit type. MSB (bit31) is a flag for failure or success. bit0..30 is used to store the return value.
The default constructor is constructed with a combination of false
and 0
.
It can also be explicitly constructed with bool
and uint32_t
types as parameters.
Since the constructor of type bool
is implemented, you can use true
/false
as follows.
Return true
if 1
is set in MSB.
Return true
if MSB is 0
.
Obtain the value part of bit0..30.
This class is a wrapper class for the tsTxDataApp
structure of the TWENET C library, and objects of derived classes based on this class are obtained from network behaviors or on_tx_comp()
.
This is done by the network behavior .prepare_tx_packet()
.
In the above example, the_twelite.network.use<NWK_SIMPLE>()
retrieves an object of the network behavior. The object pkt
is created by .prepare_tx_packet()
of this object. It is a derived class of packet_tx
, although the type name is inferred by auto&&.
This pkt
object first returns true
or false
in the if()
. A false
return occurs when the queue for sending is full and no more requests can be added.
Various settings are configured in the radio packet to deliver the packet to the destination, including destination information. To configure the settings, an object containing the settings is given as the right-hand side value of the << operator.
The following is a description of the objects used for configuration.
The availability and implications of each setting depend on the network behavior specification.
Specify the destination address addr
. See the Network Behavior specification for the destination address value.
<NWK_SIMPLE>
An address set with an MSB (bit31=0x80000000
) means that it is addressed to the serial number of the radio module. 0x00
. 0xFE means that the address is addressed to the child module (0x01
...0xEF
). 0xFE means broadcast to the child (
0x01...
0xEF), and
0xFF` means broadcast to both the parent and the child.
Specifies the number of retransmissions. The number of retransmissions is specified by u8count. force_retry is a setting to retransmit a specified number of times regardless of whether the transmission is successful or not.
<NWK_SIMPLE>
ネットワークビヘイビア<NWK_SIMPLE>
では、同じ内容のパケットをu8count+1
回送信します。 force_retry
の設定は無視されます。
Sets the delay between sending packets and the retransmission interval. Specify two values, u16DelayMin
and u16DelayMax
, in milliseconds [ms]. Transmission will be started at some point during this interval after a transmission request is made. Specify the retransmission interval as the value of u16RetryDur
in milliseconds[ms]. The retransmission interval is constant.
The transmission process may not start at the specified timing due to internal processing. In addition, IEEE802.15.4 processing also causes time blurring before packets are created. These timing blurs are an effective means of avoiding packet collisions in many systems.
Strict timing of packet transmission should be considered an exception due to the nature of the IEEE802.15.4 standard.
<NWK_SIMPLE>
This specification is valid.
If the same packet is retransmitted and arrives more than 1 second after the first transmission, it is not deduplicated because a new packet has arrived. The same packet may be received after 1 second due to a longer retransmission interval or packet arrival delay in relay. You can configure the handling of duplicate packets by initializing the <NWK_SIMPLE>
behavior.
This setting requests that packet transmission be performed "as quickly as possible." Packet transmission processing in TWENET is performed from the TickTimer, which runs every 1 ms. By setting this parameter, the packet transmission request is processed as soon as possible after the request is made. Of course, any setting other than tx_packet_delay(0,0,0)
is a meaningless specification.
If other packet transmission processing is in progress, it will be processed as usual.
<NWK_SIMPLE>
This designation is valid.
In wireless packet communications, there is a transmission method in which a short radio message called ACK (ACK) is obtained from the destination after the transmission is completed to indicate that the transmission was successful. By setting this option, transmission with ACK is performed.
<NWK_SIMPLE>
This specification is VALID for <NWK_SIMPLE>
. It will result in a compile error. <NWK_SIMPLE>
is intended to implement a simple working relay network and does not communicate with ACK.
Specify broadcast.
<NWK_SIMPLE>
This specification is VALID for <NWK_SIMPLE>
. It will result in a compile error.
Specify the destination address tx_addr(0xFF)
(broadcast) or tx_addr(0xFE)
(broadcast to the child) instead.
Specify the type ID of the TWENET radio packet that can be 0..7.
<NWK_SIMPLE>
This specification is VALID for <NWK_SIMPLE>
. It will result in a compile error.
`` uses type ID internally. Users cannot use it.
Specified as a template argument of a container class (smplbuf
, smplque
) to allocate or specify an area of memory to be used internally.
This class is not called directly from user code, but is used internally to declare containers.
In alloc_attach
and alloc_heap
, initialization methods (init_???()
) must be executed according to the memory allocation class.
Initialize with buffer p
and size n
.
Returns the size of the buffer.
This method is used to generate a compile error, like static_assert
, for a method call description that is different from the expected alloc class.
If the packet cannot be interpreted as a specific packet, E_PKT::PKT_ERROR
is returned.
packet type definition
Corresponds to the following packet
Corresponds to the ASCII format output by the Parent Node of App_Wings.
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.
Class Name | Contents |
---|---|
Determines the type of packet using the packet data byte sequence as input. The return value is .
Name | Description |
---|
pktparser(parser_packet) performs content interpretation on the byte sequence converted by performs content interpretation on the byte sequence converted by .
The above example interprets . parser_ser object converts the message input from Serial into a byte string. This byte string is first identified by to determine the type of the message . 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.
alloc_attach<T>
specify an already existing buffer
alloc_local<T, int N>
statically allocate a buffer of N bytes internally
alloc_heap<T>
allocate a buffer of the specified size in the heap
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.
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.
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.
PKT_ERROR | TwePacket does not contain meaningful data such as before packet interpretation or packet type cannot be identified. |
PKT_TWELITE |
PKT_PAL |
PKT_APPIO |
PKT_APPUART |
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 |
of the standard application App_Twelite is interpreted.
Interpret serial format of
of remote control application products/ TWE-APPS/App_IO/uart.html) interpreted by the remote control application .
of the serial communication application products/ TWE-APPS/App_Uart/mode_format.html) is interpreted.
Output format used in sample, etc.
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
.