/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Command"/> class.
		/// </summary>
		/// <param name='type'>
		/// The command type. Can be a system command, direct command or reply command
		/// </param>
		/// <param name='commandByte'>
		/// The command byte
		/// </param>
		/// <param name='reply'>
		/// If set to <c>true</c> the NXT will send a reply
		/// </param>
		public Command(CommandType type, CommandByte commandByte, bool reply)
		{
			commandType = type;
			this.commandByte = commandByte;
			if (reply){
				replyRequired = true;
				dataArr.Add((byte)type);
			}
			else{
				replyRequired = false;
				dataArr.Add((byte)((byte) type | 0x80));
			}
			dataArr.Add((byte)commandByte);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Command"/> class using an array of bytes
		/// </summary>
		/// <param name='data'>
		/// The data to be used for the command
		/// </param>
		public Command(byte [] data){
			if(data.Length < 2){
				throw new System.ArgumentException("Invalid NXT Command");
			}
			for(int i = 0; i < data.Length; i++)
				dataArr.Add(data[i]);
			try{
				commandType = (CommandType) (data[0] & 0x7f);
				commandByte = (CommandByte) data[1];
			}
			catch(Exception){
				throw new System.ArgumentException("Invalid NXT Command");
			}
			replyRequired = !Convert.ToBoolean(data[0]&0x80);

		}
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Reply"/> class without payload with an error code
		/// </summary>
		/// <param name='type'>
		/// The command type. Can be a system command, direct command or reply command
		/// </param>
		/// <param name='command'>
		/// The command byte
		/// </param>
		/// <param name='errorCode'>
		/// Error code
		/// </param>
		public Reply(CommandType type, CommandByte command, byte errorCode):this(type,command,null,errorCode){

		} 
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Reply"/> class without payload and errors
		/// </summary>
		/// <param name='type'>
		/// The command type. Can be a system command, direct command or reply command
		/// </param>
		/// <param name='command'>
		/// The command byte
		/// </param>
		public Reply(CommandType type, CommandByte command):this(type,command,null,0){

		}
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Reply"/> class without errors
		/// </summary>
		/// <param name='type'>
		/// The command type. Can be a system command, direct command or reply command
		/// </param>
		/// <param name='command'>
		/// The command byte
		/// </param>
		/// <param name='data'>
		/// Byte array to be used for reply payload
		/// </param>
		public Reply(CommandType type, CommandByte command, byte[] data):this(type,command,data,0){

		}
		/// <summary>
		/// Initializes a new instance of the <see cref="MonoBrick.NXT.Reply"/> class.
		/// </summary>
		/// <param name='type'>
		/// The command type. Can be a system command, direct command or reply command
		/// </param>
		/// <param name='command'>
		/// The command byte
		/// </param>
		/// <param name='data'>
		/// Byte array to be used for reply payload
		/// </param>
		/// <param name='errorCode'>
		/// Error code
		/// </param>
		public Reply(CommandType type, CommandByte command, byte[] data, byte errorCode){
			if(data!= null)
				dataArray = new byte[data.Length+3];
			else
				dataArray = new byte[3];
			dataArray[0] = (byte) type;
			dataArray[1] = (byte) command;
			dataArray[2] = errorCode;
			if(data != null){
				for(int i = 0; i < data.Length; i++){
					dataArray[i+3] = data[i];
				}
			}
		}