mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-09-20 07:58:39 +02:00
Communication: Add GenericAPIDataMessage and GenericAPIStatusMessage types
This commit is contained in:
committed by
Kyle Schwarz
parent
3aaacb6cc8
commit
936566170f
@@ -0,0 +1,44 @@
|
||||
#ifndef __GENERICAPIDATAMESSAGE_H_
|
||||
#define __GENERICAPIDATAMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class GenericAPIDataMessage : public Message {
|
||||
public:
|
||||
static constexpr size_t GENERIC_API_BUFFER_SIZE = 513;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct GenericAPIDataHeader {
|
||||
uint16_t bufferLength;
|
||||
uint8_t apiIndex;
|
||||
uint8_t instance;
|
||||
uint8_t functionId;
|
||||
};
|
||||
|
||||
struct GenericAPIDataPacket
|
||||
{
|
||||
GenericAPIDataHeader header;
|
||||
uint8_t buffer[GENERIC_API_BUFFER_SIZE];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static std::shared_ptr<GenericAPIDataMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
|
||||
GenericAPIDataMessage() : Message(Type::GenericAPIData) {}
|
||||
|
||||
uint8_t functionId;
|
||||
std::vector<uint8_t> buffer;
|
||||
};
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __GENERICAPIDATAMESSAGE_H_
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef __GENERICAPISTATUSMESSAGE_H_
|
||||
#define __GENERICAPISTATUSMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class GenericAPIStatusMessage : public Message {
|
||||
public:
|
||||
#pragma pack(push, 2)
|
||||
struct GenericAPIStatusResponsePacket
|
||||
{
|
||||
uint8_t apiIndex;
|
||||
uint8_t instance;
|
||||
uint8_t functionId;
|
||||
uint8_t functionError;
|
||||
uint8_t callbackError;
|
||||
uint8_t finishedProcessing;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static std::shared_ptr<GenericAPIStatusMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
|
||||
GenericAPIStatusMessage() : Message(Type::GenericAPIStatus) {}
|
||||
|
||||
uint8_t functionId;
|
||||
bool finishedProcessing;
|
||||
uint8_t functionError;
|
||||
uint8_t callbackError;
|
||||
};
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __GENERICAPISTATUSMESSAGE_H_
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
ClientId = 0x8017,
|
||||
AllMACAddresses = 0x8018,
|
||||
SPIPortKeyOperation = 0x8019,
|
||||
GenericAPIData = 0x8020,
|
||||
GenericAPIStatus = 0x8021,
|
||||
};
|
||||
|
||||
Message(Type t) : type(t) {}
|
||||
|
||||
Reference in New Issue
Block a user