#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 1
- #define CEC_LIB_VERSION 2
+ #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
{
CECDEVICE_BROADCAST = 15
} cec_logical_address;
+ typedef enum cec_opcode
+ {
+ CEC_OPCODE_ACTIVE_SOURCE = 0x82,
+ CEC_OPCODE_IMAGE_VIEW_ON = 0x04,
+ CEC_OPCODE_TEXT_VIEW_ON = 0x0D,
+ CEC_OPCODE_INACTIVE_SOURCE = 0x9D,
+ CEC_OPCODE_REQUEST_ACTIVE_SOURCE = 0x85,
+ CEC_OPCODE_ROUTING_CHANGE = 0x80,
+ CEC_OPCODE_ROUTING_INFORMATION = 0x81,
+ CEC_OPCODE_SET_STREAM_PATH = 0x86,
+ CEC_OPCODE_STANDBY = 0x36,
+ CEC_OPCODE_RECORD_OFF = 0x0B,
+ CEC_OPCODE_RECORD_ON = 0x09,
+ CEC_OPCODE_RECORD_STATUS = 0x0A,
+ CEC_OPCODE_RECORD_TV_SCREEN = 0x0F,
+ CEC_OPCODE_CLEAR_ANALOGUE_TIMER = 0x33,
+ CEC_OPCODE_CLEAR_DIGITAL_TIMER = 0x99,
+ CEC_OPCODE_CLEAR_EXTERNAL_TIMER = 0xA1,
+ CEC_OPCODE_SET_ANALOGUE_TIMER = 0x34,
+ CEC_OPCODE_SET_DIGITAL_TIMER = 0x97,
+ CEC_OPCODE_SET_EXTERNAL_TIMER = 0xA2,
+ CEC_OPCODE_SET_TIMER_PROGRAM_TITLE = 0x67,
+ CEC_OPCODE_TIMER_CLEARED_STATUS = 0x43,
+ CEC_OPCODE_TIMER_STATUS = 0x35,
+ CEC_OPCODE_CEC_VERSION = 0x9E,
+ CEC_OPCODE_GET_CEC_VERSION = 0x9F,
+ CEC_OPCODE_GIVE_PHYSICAL_ADDRESS = 0x83,
+ CEC_OPCODE_GET_MENU_LANGUAGE = 0x91,
+ CEC_OPCODE_REPORT_PHYSICAL_ADDRESS = 0x84,
+ CEC_OPCODE_SET_MENU_LANGUAGE = 0x32,
+ CEC_OPCODE_DECK_CONTROL = 0x42,
+ CEC_OPCODE_DECK_STATUS = 0x1B,
+ CEC_OPCODE_GIVE_DECK_STATUS = 0x1A,
+ CEC_OPCODE_PLAY = 0x41,
+ CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS = 0x08,
+ CEC_OPCODE_SELECT_ANALOGUE_SERVICE = 0x92,
+ CEC_OPCODE_SELECT_DIGITAL_SERVICE = 0x93,
+ CEC_OPCODE_TUNER_DEVICE_STATUS = 0x07,
+ CEC_OPCODE_TUNER_STEP_DECREMENT = 0x06,
+ CEC_OPCODE_TUNER_STEP_INCREMENT = 0x05,
+ CEC_OPCODE_DEVICE_VENDOR_ID = 0x87,
+ CEC_OPCODE_GIVE_DEVICE_VENDOR_ID = 0x8C,
+ CEC_OPCODE_VENDOR_COMMAND = 0x89,
+ CEC_OPCODE_VENDOR_COMMAND_WITH_ID = 0xA0,
+ CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN = 0x8A,
+ CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP = 0x8B,
+ CEC_OPCODE_SET_OSD_STRING = 0x64,
+ CEC_OPCODE_GIVE_OSD_NAME = 0x46,
+ CEC_OPCODE_SET_OSD_NAME = 0x47,
+ CEC_OPCODE_MENU_REQUEST = 0x8D,
+ CEC_OPCODE_MENU_STATUS = 0x8E,
+ CEC_OPCODE_USER_CONTROL_PRESSED = 0x44,
+ CEC_OPCODE_USER_CONTROL_RELEASE = 0x45,
+ CEC_OPCODE_GIVE_DEVICE_POWER_STATUS = 0x8F,
+ CEC_OPCODE_REPORT_POWER_STATUS = 0x90,
+ CEC_OPCODE_FEATURE_ABORT = 0x00,
+ CEC_OPCODE_ABORT = 0xFF,
+ CEC_OPCODE_GIVE_AUDIO_STATUS = 0x71,
+ CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D,
+ CEC_OPCODE_REPORT_AUDIO_STATUS = 0x7A,
+ CEC_OPCODE_SET_SYSTEM_AUDIO_MODE = 0x72,
+ CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST = 0x70,
+ CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS = 0x7E,
+ CEC_OPCODE_SET_AUDIO_RATE = 0x9A
+ } cec_opcode;
+
typedef enum cec_log_level
{
CEC_LOG_DEBUG = 0,
typedef struct cec_log_message
{
- std::string message;
+ char message[1024];
cec_log_level level;
} cec_log_message;
unsigned int duration;
} cec_keypress;
- typedef struct cec_device
+ typedef struct cec_adapter
{
- std::string path;
- std::string comm;
- } cec_device;
+ char path[1024];
+ char comm[1024];
+ } cec_adapter;
+
+ typedef struct cec_frame
+ {
+ uint8_t data[20];
+ uint8_t size;
+
+ void shift(uint8_t num)
+ {
+ for (uint8_t iPtr = 0; iPtr < num; iPtr++)
+ data[iPtr] = iPtr + num < size ? data[iPtr + num] : 0;
+ size -= num;
+ }
+
+ 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 source;
+ 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;
//default physical address 1.0.0.0
#define CEC_DEFAULT_PHYSICAL_ADDRESS 0x1000