public CommandResponse PerformCommand(ICommand command) { command.Dump(); byte[] rawCommand = command.ToByteArray(); byte[] rawCommandWithLength = new byte[rawCommand.Length + 1]; rawCommandWithLength[0] = (byte)(rawCommand.Length + 1); Buffer.BlockCopy(rawCommand, 0, rawCommandWithLength, 1, rawCommand.Length); byte[] response = PerformRawCommand(rawCommandWithLength); CommandResponse commandResponse = new CommandResponse(response); commandResponse.Dump(); return commandResponse; }
public PollingCommnadResponse(CommandResponse commandResponse) { _commandResponse = commandResponse; byte[] responseBytes = _commandResponse.GetActualResponseBytes(); _responseCode = responseBytes[0]; _idm = new byte[8]; Buffer.BlockCopy(responseBytes, 1, _idm, 0, 8); _pmm = new byte[8]; Buffer.BlockCopy(responseBytes, 9, _pmm, 0, 8); if(responseBytes.Length > 17){ _requestData = new byte[2]; Buffer.BlockCopy(responseBytes, 17, _requestData, 0, 2); }else{ _requestData = new byte[0]; } }