The TMReadPacket API call reads a Universal Data Packet (UDP) starting on 'start_page' in a 1-Wire device. The data is placed into 'read_buffer' up to a maximum of 'max_read' bytes. Returns a read count length greater than or equal to 0 for success or one of the TRANSPORT error values for a failure. See the description of the Universal Data Packet.
For a description of the above types, see the TMEX Type Descriptions.
Parameters
session_handle
Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.
state_buffer
Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.
start_page
Specifies the page that the packet begins at. A CRC-16 verified packet always starts at the beginning of a page boundary. The valid range of a start page depends on the device type. Current 1-Wire devices range from 0 to 256 pages.
read_buffer
Specifies a pointer to a memory location that will contain the data that is read. The size of the buffer must be at least ‘max_read’ bytes long.
Max_read
Specifies the maximum number of bytes that can be placed in the ‘read_buffer’. An TRANSPORT error code will be returned if the packet on the 1-Wire device is larger than the provided buffer.
Return Value
>=0 => length of valid data read
<0 => TMEX Transport Error Return Code
See Also