| 48 | CommandTransaction::~CommandTransaction() {} |
| 49 | |
| 50 | bool CommandTransaction::execute(const CommandBase& command, Result& result) |
| 51 | { |
| 52 | result.resize(command.maxResponseLength()); |
| 53 | response_complete_result_.resize(ResponseCompleteLength); |
| 54 | |
| 55 | // send command |
| 56 | if (!send(command)) |
| 57 | return false; |
| 58 | |
| 59 | // receive response data |
| 60 | if(command.maxResponseLength() > 0) |
| 61 | { |
| 62 | if (!receive(result, command.minResponseLength())) |
| 63 | return false; |
| 64 | if (isResponseCompleteResult(result, command.sequence())) |
| 65 | { |
| 66 | LOG_ERROR << "received premature response complete!"; |
| 67 | return false; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // receive response complete |
| 72 | if (!receive(response_complete_result_, ResponseCompleteLength)) |
| 73 | return false; |
| 74 | if (!isResponseCompleteResult(response_complete_result_, command.sequence())) |
| 75 | { |
| 76 | LOG_ERROR << "missing response complete!"; |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | bool CommandTransaction::send(const CommandBase& command) |
| 84 | { |
nothing calls this directly
no test coverage detected