python-TSIP API¶
While the low-level and high-level API are implemented in separate modules both are also directly accessible by importing the top-level tsip module.
High-level API¶
High-level API.
-
class
tsip.hlapi.
Packet
(*fields)[source]¶ TSIP packet.
Check the TSIP reference documentation for the description of individual packets.
The argument(s) to Packet() can be either individual values, a single tuple or a single list.
Examples:
>>> pkt = Packet(0x1f) # Request software versions. >>> pkt = Packet(0x1e, 0x4b) # Request cold-start. >>> pkt = Packet( (0x23, -37.1, 144.1, 10.0) ) # Set initial position (tuple). >>> pkt = Packet( [0x8e, 0x4f, 0.1] ) # Set PPS with to 0.1s (list)
Low-level API¶
Low-level API.
-
tsip.llapi.
frame
(data)[source]¶ Add leading DLE and trailing DLE/ETX to data.
Parameters: data (Binary string.) – TSIP data without leading DLE and trailing DLE/ETX. Returns: TSIP data with leading DLE and trailing DLE/ETX added. Raise: ValueError
if data already starts with DLE and ends in DLE/ETX.
-
tsip.llapi.
is_framed
(packet)[source]¶ Check whether a packet contains leading DLE and trailing DLE/ETX.
Parameters: packet (Binary string.) – TSIP packet with or without leading DLE and trailing DLE/ETX. Returns: True
if leading DLE and trailing DLE/ETX are still present,False
otherwise.
-
tsip.llapi.
stuff
(packet)[source]¶ Add byte stuffing to TSIP packet. :param packet: TSIP packet with byte stuffing. The packet must already
have been stripped or ValueError will be raised.Returns: Packet with byte stuffing.
-
tsip.llapi.
unframe
(packet)[source]¶ Strip leading DLE and trailing DLE/ETX from packet.
Parameters: packet (Binary string.) – TSIP packet with leading DLE and trailing DLE/ETX. Returns: TSIP packet with leading DLE and trailing DLE/ETX removed. Raise: ValueError
if packet does not start with DLE and end in DLE/ETX.