HdlcFrameGetNext(ByteBuffer, Int32, String, Int32) Method
Returns the next frame of type 3 from rawData, starting at index startIndex. The terminating flag could not be returned if
multiple frames are linked together. Procedure skips any starting bytes before starting flag (7E). Procedure updates startIndex to the beginning
of a next frame.
Namespace: OddPrg.Protocols.HdlcAssembly: OddPrg.Frames.Hdlc (in OddPrg.Frames.Hdlc.dll) Version: 1.0.0.2 (1.0.0.2)
public static ByteBuffer GetNext(
ByteBuffer rawData,
out int startIndex,
out string errorMessage,
ref int i
)
- rawData ByteBuffer
- Data received from a server (meter).
- startIndex Int32
- Returns the starting index of the frame in rawData. The index is valid only if procedure retuns non-null value.
- errorMessage String
- Null if frame is successfully returned. Otherwise error message describing why the frame was not returned.
- i Int32
- Starting index to search frame. It is updated to point to the next frame start.
ByteBuffer
Returns a HDLC frame from the beginning of data. If data does not start with a valid HDLC frame, it returns null.
Valid HDLC frame means:
1) It starts with STARTING_FLAG
2) It has the minimal length of 3 bytes to check starting flag and frame format
3) It has the frame format of type 3
4) The length from frame format field matches the length of the frame
5) It ends with STARTING_FLAG