Unit:
AxPacket
Description:
The TApxDataPacket component provides automatic data packet delivery from the incoming data stream, based on simple properties set in the component.
A data packet can be thought of as an advanced data trigger. Packets automatically collect data from the incoming data stream based on criteria specified in the properties of the data packet component, and deliver the data when the criteria have been met. As opposed to traditional data triggers, data packets do their own buffering. This means that data packets do not have the same limitation as data triggers (that data may no longer be available in the input buffer for processing when the data trigger fires).
Data packets are typically used in place of data triggers when the data you are looking for has a fixed length or starts and ends with a known string of data. These conditions can be set in the data packet component at design time or run time.
There is no limit on the number of data packet components for a port. However, any incoming character can be part of only one data packet. The first enabled data packet that has its start condition met takes ownership of all incoming data until the packet is complete. If a data packet times out, the data it has collected up to that point is made available to any other enabled data packets for the port.
The TApxDataPacket component has a component editor where all properties can conveniently be set at once. The component editor can be invoked by right-clicking on the context menu of the component.
The Packet Start Condition defines the start of the packet. The option is given to start the packet as soon as any data is received or data collection can be started when a particular string is received.
Refer to the StartCond and StartString properties for more information on starting a packet.
The Packet End Condition defines when the packet is complete. Packet completion can either occur after a certain number of characters have been received, or when a particular string is received to terminate the packet. If both types of conditions are defined, the first condition met will cause the packet delivery event to fire.
Refer to the EndCond, EndString, and PacketSize properties.
The additional properties define details about how the packet should operate. Following is a list of these details:
·Should the packet be initially enabled?
·Should the packet automatically re-enable after having been received (the default is that it disables itself)?
·Should the packet be ignored on the start and end strings?
·Should the start and end strings be included in the packet delivered in the OnPacket events?
·Should the packet collection logic time out for this packet and, if so, what the timeout period should be?
Refer to the AutoEnable, IgnoreCase, IncludeStrings, and TimeOut properties for more information on these additional properties.