Package com.marswars.proxy_server
Class TimesyncResponse
java.lang.Object
com.marswars.proxy_server.TimesyncResponse
- All Implemented Interfaces:
Packet
Packet handler for time synchronization responses.
Provides functionality to create and serialize timesync response packets
containing server timing information for precision time coordination.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData structure containing time synchronization response information.Nested classes/interfaces inherited from interface com.marswars.proxy_server.Packet
Packet.Timestamp -
Field Summary
FieldsFields inherited from interface com.marswars.proxy_server.Packet
HEADER_SIZE, ID_IDX, PACKET_ID_IDX, TIME_NSEC_IDX, TIME_SEC_IDX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a timesync response for the given request with current server timestamps.deserialize(byte[] data) Deserializes a byte array into a TimesyncResponseData object.static byte[]Serializes a TimesyncResponseData into a byte array for transmission.
-
Field Details
-
TYPE_ID
public static final int TYPE_ID- See Also:
-
-
Constructor Details
-
TimesyncResponse
public TimesyncResponse()
-
-
Method Details
-
serialize
Serializes a TimesyncResponseData into a byte array for transmission.- Parameters:
response- the response data to serialize- Returns:
- byte array representing the serialized response packet
-
deserialize
Deserializes a byte array into a TimesyncResponseData object.- Parameters:
data- the byte array to deserialize- Returns:
- TimesyncResponseData object with parsed information
- Throws:
IllegalArgumentException- if data length is invalid
-
createResponse
public static TimesyncResponse.TimesyncResponseData createResponse(TimesyncRequest.TimesyncRequestData request) Creates a timesync response for the given request with current server timestamps.- Parameters:
request- the original timesync request data- Returns:
- TimesyncResponseData with current server timestamps
-