namespace RoboidControl { /// /// A message communicating the network ID for that participant /// public class NetworkIdMsg : IMessage { /// /// The message ID /// public const byte Id = 0xA1; /// /// The length of the message /// public const byte length = 2; /// /// The network ID for the participant /// public byte networkId; /// /// Create a new message for sending /// /// The network ID for the participant public NetworkIdMsg(byte networkId) { this.networkId = networkId; } /// @copydoc Passer::RoboidControl::IMessage::IMessage(byte[] buffer) public NetworkIdMsg(byte[] buffer) { this.networkId = buffer[1]; } /// @copydoc Passer::RoboidControl::IMessage::Serialize public override byte Serialize(ref byte[] buffer) { if (buffer.Length < NetworkIdMsg.length) return 0; buffer[0] = NetworkIdMsg.Id; buffer[1] = this.networkId; return NetworkIdMsg.length; } } }