Extended Commands: Decode generic responses

This commit is contained in:
Paul Hollinsky
2022-04-15 21:35:40 -04:00
parent 103f938d69
commit 2e3b738e76
5 changed files with 70 additions and 0 deletions
@@ -0,0 +1,37 @@
#ifndef __EXTENDEDRESPONSEMESSAGE_H_
#define __EXTENDEDRESPONSEMESSAGE_H_
#ifdef __cplusplus
#include "icsneo/communication/message/message.h"
#include "icsneo/communication/command.h"
namespace icsneo {
class ExtendedResponseMessage : public Message {
public:
ExtendedResponseMessage(ExtendedCommand cmd, ExtendedResponse resp)
: Message(Message::Type::ExtendedResponse), command(cmd), response(resp) {}
const ExtendedCommand command;
const ExtendedResponse response;
#pragma pack(push, 1)
struct ResponseHeader {
ExtendedCommand command;
uint16_t length;
};
struct PackedGenericResponse {
ResponseHeader header;
ExtendedCommand command; // `header.command` is ExtendedCommand::GenericReturn, this is the real command
ExtendedResponse returnCode;
};
#pragma pack(pop)
};
}
#endif // __cplusplus
#endif
@@ -28,6 +28,7 @@ public:
FlexRayControl = 0x8006,
EthernetPhyRegister = 0x8007,
LogicalDiskInfo = 0x8008,
ExtendedResponse = 0x8009,
};
Message(Type t) : type(t) {}
@@ -71,6 +72,9 @@ public:
#define ICSNEO_MESSAGE_TYPE_DEVICE_VERSION (0x8004)
#define ICSNEO_MESSAGE_TYPE_MAIN51 (0x8005)
#define ICSNEO_MESSAGE_TYPE_FLEXRAY_CONTROL (0x8006)
#define ICSNEO_MESSAGE_TYPE_ETHERNET_PHY_REGISTER (0x8007)
#define ICSNEO_MESSAGE_TYPE_LOGICAL_DISK_INFO (0x8008)
#define ICSNEO_MESSAGE_TYPE_EXTENDED_RESPONSE (0x8009)
#endif // __ICSNEOC_H_