Device Monitoring Studio - Monitor, log and analyze data coming through PC ports and connections
Docs

Predefined Fields

Several predefined fields and functions are available for a custom protocol. This topic lists all those predefined components.

Common Predefined Identifiers

This section lists predefined fields available in all components: USB, Serial and Network:

packet_ordinal
A packet number (integer value). The very first packet has number 0. All subsequent packets have increasing numbers.
entry_time
Packet time stamp. This is the same format as in FILETIME structure (that is, it is a 64-bit unsigned integer representing the number of 100-nanosecond intervals since January 1, 1601). The time is UTC time.
packet_size
The size of the packet, including packet header.
current_offset
This pseudo field represents the offset from the beginning of the packet to the currently binding field. See current_offset for more information.
device_source
For multi-source session, this field contains the device ordinal (counting from zero). For other session types, this field is always zero.

Serial Monitor and Serial Bridge

Serial Monitor and Serial Bridge add the following predefined fields:

packet_type

A value from PacketType enumeration (std_serialdefs.h). May be one of the following values:

ConstantDescription
PACKET_CONDISCONNECTPort connection/disconnection packet.
PACKET_GENERALGeneral packet. Contains either sent (written) or received (read) data.
PACKET_CREATEPort open packet.
PACKET_IOI/O Request packet.
is_packet_up
Boolean value which equals true if this packet is captured on its way UP or equals false if it is captured on its way DOWN.
sending_device
Used in Serial Bridge monitoring sessions. Equals to zero for first device and equals to one for the second device.

The following global functions are available:

get_communications_mode()

Returns the current monitoring session's communication mode. See ECommunicationType enumeration defined in std_serialdefs.h. May be one of the following values:

ConstantDescription
GENERAL_COMMUNICATIONNo special communication mode is set.
PPP_COMMUNICATIONPPP communication mode is configured for a session.
X0D_COMMUNICATION“One packet a line” communication mode is configured for a session.
MODBUS_COMMUNICATIONMODBUS communication mode is configured for a session.
modbus_is_request_read()
Returns true if “Parse requests on WRITE (responses on READ)” global setting is checked, false otherwise.
modbus_get_use_rtu()
Returns true if RTU mode is configured for MODBUS in settings, false otherwise.

USB Monitor

USB Monitor adds the following predefined fields and functions:

event_type

USB packet type. May be one of the following values:

ConstantDescription
EVENT_URBUSB Request Block. Custom protocol should mainly focus on this packet type.
EVENT_DEVICECONNECTEDDevice connection packet.
EVENT_DEVICEDISCONNECTEDDevice disconnection packet.
EVENT_DEVICESURPRISEREMOVALDevice surprise removal packet.
EVENT_DEVICEQUERYIDDevice Query ID packet.
EVENT_DEVICEQUERYTEXTDevice Query Text packet.
EVENT_PIPEINFOInternal packet used to report updated configuration descriptor to the USB Monitor. Should be ignored by custom protocol.
EVENT_QUERYINTERFACEDevice Query Interface packet.
is_packet_up
Boolean value which equals true if this packet is captured on its way UP or false if it is captured on its way DOWN.
usb_get_vendor_name(vendorId)
Resolves the USB vendor id to the vendor name. Returns a string.
usb_get_model_name(vendorId, modelId)
Resolves the USB model id to the device name. Returns a string.

Network Monitor

Network Monitor adds the following predefined fields:

fragment_no
Packet number for a fragment packet. If the current packet is not a fragment, this field equals to LONG_MAX.
process_id
ID of the process initiating the request.
is_send_packet
true for Send packets and false for Receive packets.