Documentation
¶
Index ¶
- func EstimatePacketCount(data []byte) int
- func GetPacketType(packet []byte) (byte, error)
- func GetSerialNumber(packet []byte) (uint16, error)
- func HasCompletePacket(data []byte) bool
- func SplitPackets(data []byte) (packets [][]byte, residue []byte, err error)
- func ValidatePacketStructure(packet []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimatePacketCount ¶
EstimatePacketCount estimates the number of complete packets in the data This is a quick check without full parsing
func GetPacketType ¶
GetPacketType returns the protocol number from a packet Returns 0 and error if packet is invalid
func GetSerialNumber ¶
GetSerialNumber extracts the serial number from a packet Serial number is always 2 bytes before CRC
func HasCompletePacket ¶
HasCompletePacket quickly checks if the data contains at least one complete packet
func SplitPackets ¶
SplitPackets splits concatenated packets from a TCP stream GPS devices often send multiple packets in a single TCP write, or packets may be fragmented across multiple reads.
Returns: - packets: Complete packets found in the data - residue: Incomplete packet data to be prepended to next read - error: Any error encountered during splitting
Example:
Input: [CompletePacket1][CompletePacket2][PartialPacket3] Output: packets=[Packet1, Packet2], residue=[PartialPacket3]
func ValidatePacketStructure ¶
ValidatePacketStructure performs basic structural validation on a packet without decoding the full content
Types ¶
This section is empty.