#ifndef CECEXPORTS_H_
#define CECEXPORTS_H_
-#include <string>
#include <stdint.h>
-#include <vector>
+#include <string.h>
#if !defined(DECLSPEC)
#if defined(_WIN32) || defined(_WIN64)
extern "C" {
namespace CEC {
#endif
- #define CEC_MIN_VERSION 2
- #define CEC_LIB_VERSION 3
+ #define CEC_MIN_VERSION 5
+ #define CEC_LIB_VERSION 5
#define CEC_SETTLE_DOWN_TIME 1000
-
- typedef std::vector<uint8_t> cec_frame;
+ #define CEC_BUTTON_TIMEOUT 500
typedef enum cec_user_control_code
{
typedef struct cec_log_message
{
- std::string message;
+ char message[1024];
cec_log_level level;
+ int64_t time;
} cec_log_message;
typedef struct cec_keypress
unsigned int duration;
} cec_keypress;
- typedef struct cec_device
+ typedef struct cec_adapter
+ {
+ char path[1024];
+ char comm[1024];
+ } cec_adapter;
+
+ typedef struct cec_frame
{
- std::string path;
- std::string comm;
- } cec_device;
+ uint8_t data[20];
+ uint8_t size;
+
+ void shift(uint8_t iShiftBy)
+ {
+ if (iShiftBy >= size)
+ {
+ clear();
+ }
+ else
+ {
+ for (uint8_t iPtr = 0; iPtr < size; iPtr++)
+ data[iPtr] = (iPtr + iShiftBy < size) ? data[iPtr + iShiftBy] : 0;
+ size = (uint8_t) (size - iShiftBy);
+ }
+ }
+
+ void push_back(uint8_t add)
+ {
+ if (size < 20)
+ data[size++] = add;
+ }
+
+ void clear(void)
+ {
+ memset(data, 0, sizeof(data));
+ size = 0;
+ }
+ } cec_frame;
typedef struct cec_command
{
cec_logical_address destination;
cec_opcode opcode;
cec_frame parameters;
+
+ void clear(void)
+ {
+ source = CECDEVICE_UNKNOWN;
+ destination = CECDEVICE_UNKNOWN;
+ opcode = CEC_OPCODE_FEATURE_ABORT;
+ parameters.clear();
+ };
} cec_command;
+ typedef enum cec_vendor_id
+ {
+ CEC_VENDOR_SAMSUNG = 240,
+ CEC_VENDOR_UNKNOWN = 0
+ } vendor_id;
+
+ static const char *CECVendorIdToString(const uint64_t iVendorId)
+ {
+ switch (iVendorId)
+ {
+ case CEC_VENDOR_SAMSUNG:
+ return "Samsung";
+ default:
+ return "Unknown";
+ }
+ }
+
//default physical address 1.0.0.0
#define CEC_DEFAULT_PHYSICAL_ADDRESS 0x1000