public override byte[] ToByteArray() { var stream = new MemoryStream(); stream.WriteByte((byte)CommandId); stream.WriteByte(FrameId); stream.Write(Destination.Address64.GetAddress(), 0, 8); stream.Write(Destination.Address16.GetAddress(), 0, 2); stream.WriteByte(RemoteOptions); var cmd = ((ATAttribute)Command.GetAttr()).ATCommand.ToCharArray(); stream.WriteByte((byte)cmd[0]); stream.WriteByte((byte)cmd[1]); if (hasValue) { var v = value.ToByteArray(); stream.Write(v, 0, v.Length); } return(stream.ToArray()); }
public override byte[] ToByteArray() { var stream = new MemoryStream(); stream.WriteByte((byte)CommandId); stream.WriteByte(FrameId); var cmd = ((ATAttribute)atCommand.GetAttr()).ATCommand.ToCharArray(); stream.WriteByte((byte)cmd[0]); stream.WriteByte((byte)cmd[1]); if (hasValue) { var v = value.ToByteArray(); stream.Write(v, 0, v.Length); } return(stream.ToArray()); }