| 1 | #pragma once |
| 2 | /* |
| 3 | * This file is part of the libCEC(R) library. |
| 4 | * |
| 5 | * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved. |
| 6 | * libCEC(R) is an original work, containing original code. |
| 7 | * |
| 8 | * libCEC(R) is a trademark of Pulse-Eight Limited. |
| 9 | * |
| 10 | * This program is dual-licensed; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 | * |
| 24 | * |
| 25 | * Alternatively, you can license this library under a commercial license, |
| 26 | * please contact Pulse-Eight Licensing for more information. |
| 27 | * |
| 28 | * For more information contact: |
| 29 | * Pulse-Eight Licensing <license@pulse-eight.com> |
| 30 | * http://www.pulse-eight.com/ |
| 31 | * http://www.pulse-eight.net/ |
| 32 | */ |
| 33 | |
| 34 | #ifndef CECEXPORTS_H_ |
| 35 | #define CECEXPORTS_H_ |
| 36 | |
| 37 | #include <string> |
| 38 | #include <stdint.h> |
| 39 | #include <vector> |
| 40 | |
| 41 | #if !defined(DECLSPEC) |
| 42 | #if defined(_WIN32) || defined(_WIN64) |
| 43 | #include <windows.h> |
| 44 | #if defined DLL_EXPORT |
| 45 | #define DECLSPEC __declspec(dllexport) |
| 46 | #else |
| 47 | #define DECLSPEC __declspec(dllimport) |
| 48 | #endif |
| 49 | #else |
| 50 | #define DECLSPEC |
| 51 | #endif |
| 52 | #endif |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | extern "C" { |
| 56 | namespace CEC { |
| 57 | #endif |
| 58 | #define CEC_MIN_VERSION 4 |
| 59 | #define CEC_LIB_VERSION 4 |
| 60 | #define CEC_SETTLE_DOWN_TIME 1000 |
| 61 | #define CEC_BUTTON_TIMEOUT 500 |
| 62 | |
| 63 | typedef std::vector<uint8_t> cec_frame; |
| 64 | |
| 65 | typedef enum cec_user_control_code |
| 66 | { |
| 67 | CEC_USER_CONTROL_CODE_SELECT = 0x00, |
| 68 | CEC_USER_CONTROL_CODE_UP = 0x01, |
| 69 | CEC_USER_CONTROL_CODE_DOWN = 0x02, |
| 70 | CEC_USER_CONTROL_CODE_LEFT = 0x03, |
| 71 | CEC_USER_CONTROL_CODE_RIGHT = 0x04, |
| 72 | CEC_USER_CONTROL_CODE_RIGHT_UP = 0x05, |
| 73 | CEC_USER_CONTROL_CODE_RIGHT_DOWN = 0x06, |
| 74 | CEC_USER_CONTROL_CODE_LEFT_UP = 0x07, |
| 75 | CEC_USER_CONTROL_CODE_LEFT_DOWN = 0x08, |
| 76 | CEC_USER_CONTROL_CODE_ROOT_MENU = 0x09, |
| 77 | CEC_USER_CONTROL_CODE_SETUP_MENU = 0x0A, |
| 78 | CEC_USER_CONTROL_CODE_CONTENTS_MENU = 0x0B, |
| 79 | CEC_USER_CONTROL_CODE_FAVORITE_MENU = 0x0C, |
| 80 | CEC_USER_CONTROL_CODE_EXIT = 0x0D, |
| 81 | CEC_USER_CONTROL_CODE_NUMBER0 = 0x20, |
| 82 | CEC_USER_CONTROL_CODE_NUMBER1 = 0x21, |
| 83 | CEC_USER_CONTROL_CODE_NUMBER2 = 0x22, |
| 84 | CEC_USER_CONTROL_CODE_NUMBER3 = 0x23, |
| 85 | CEC_USER_CONTROL_CODE_NUMBER4 = 0x24, |
| 86 | CEC_USER_CONTROL_CODE_NUMBER5 = 0x25, |
| 87 | CEC_USER_CONTROL_CODE_NUMBER6 = 0x26, |
| 88 | CEC_USER_CONTROL_CODE_NUMBER7 = 0x27, |
| 89 | CEC_USER_CONTROL_CODE_NUMBER8 = 0x28, |
| 90 | CEC_USER_CONTROL_CODE_NUMBER9 = 0x29, |
| 91 | CEC_USER_CONTROL_CODE_DOT = 0x2A, |
| 92 | CEC_USER_CONTROL_CODE_ENTER = 0x2B, |
| 93 | CEC_USER_CONTROL_CODE_CLEAR = 0x2C, |
| 94 | CEC_USER_CONTROL_CODE_NEXT_FAVORITE = 0x2F, |
| 95 | CEC_USER_CONTROL_CODE_CHANNEL_UP = 0x30, |
| 96 | CEC_USER_CONTROL_CODE_CHANNEL_DOWN = 0x31, |
| 97 | CEC_USER_CONTROL_CODE_PREVIOUS_CHANNEL = 0x32, |
| 98 | CEC_USER_CONTROL_CODE_SOUND_SELECT = 0x33, |
| 99 | CEC_USER_CONTROL_CODE_INPUT_SELECT = 0x34, |
| 100 | CEC_USER_CONTROL_CODE_DISPLAY_INFORMATION = 0x35, |
| 101 | CEC_USER_CONTROL_CODE_HELP = 0x36, |
| 102 | CEC_USER_CONTROL_CODE_PAGE_UP = 0x37, |
| 103 | CEC_USER_CONTROL_CODE_PAGE_DOWN = 0x38, |
| 104 | CEC_USER_CONTROL_CODE_POWER = 0x40, |
| 105 | CEC_USER_CONTROL_CODE_VOLUME_UP = 0x41, |
| 106 | CEC_USER_CONTROL_CODE_VOLUME_DOWN = 0x42, |
| 107 | CEC_USER_CONTROL_CODE_MUTE = 0x43, |
| 108 | CEC_USER_CONTROL_CODE_PLAY = 0x44, |
| 109 | CEC_USER_CONTROL_CODE_STOP = 0x45, |
| 110 | CEC_USER_CONTROL_CODE_PAUSE = 0x46, |
| 111 | CEC_USER_CONTROL_CODE_RECORD = 0x47, |
| 112 | CEC_USER_CONTROL_CODE_REWIND = 0x48, |
| 113 | CEC_USER_CONTROL_CODE_FAST_FORWARD = 0x49, |
| 114 | CEC_USER_CONTROL_CODE_EJECT = 0x4A, |
| 115 | CEC_USER_CONTROL_CODE_FORWARD = 0x4B, |
| 116 | CEC_USER_CONTROL_CODE_BACKWARD = 0x4C, |
| 117 | CEC_USER_CONTROL_CODE_STOP_RECORD = 0x4D, |
| 118 | CEC_USER_CONTROL_CODE_PAUSE_RECORD = 0x4E, |
| 119 | CEC_USER_CONTROL_CODE_ANGLE = 0x50, |
| 120 | CEC_USER_CONTROL_CODE_SUB_PICTURE = 0x51, |
| 121 | CEC_USER_CONTROL_CODE_VIDEO_ON_DEMAND = 0x52, |
| 122 | CEC_USER_CONTROL_CODE_ELECTRONIC_PROGRAM_GUIDE = 0x53, |
| 123 | CEC_USER_CONTROL_CODE_TIMER_PROGRAMMING = 0x54, |
| 124 | CEC_USER_CONTROL_CODE_INITIAL_CONFIGURATION = 0x55, |
| 125 | CEC_USER_CONTROL_CODE_PLAY_FUNCTION = 0x60, |
| 126 | CEC_USER_CONTROL_CODE_PAUSE_PLAY_FUNCTION = 0x61, |
| 127 | CEC_USER_CONTROL_CODE_RECORD_FUNCTION = 0x62, |
| 128 | CEC_USER_CONTROL_CODE_PAUSE_RECORD_FUNCTION = 0x63, |
| 129 | CEC_USER_CONTROL_CODE_STOP_FUNCTION = 0x64, |
| 130 | CEC_USER_CONTROL_CODE_MUTE_FUNCTION = 0x65, |
| 131 | CEC_USER_CONTROL_CODE_RESTORE_VOLUME_FUNCTION = 0x66, |
| 132 | CEC_USER_CONTROL_CODE_TUNE_FUNCTION = 0x67, |
| 133 | CEC_USER_CONTROL_CODE_SELECT_MEDIA_FUNCTION = 0x68, |
| 134 | CEC_USER_CONTROL_CODE_SELECT_AV_INPUT_FUNCTION = 0x69, |
| 135 | CEC_USER_CONTROL_CODE_SELECT_AUDIO_INPUT_FUNCTION = 0x6A, |
| 136 | CEC_USER_CONTROL_CODE_POWER_TOGGLE_FUNCTION = 0x6B, |
| 137 | CEC_USER_CONTROL_CODE_POWER_OFF_FUNCTION = 0x6C, |
| 138 | CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION = 0x6D, |
| 139 | CEC_USER_CONTROL_CODE_F1_BLUE = 0x71, |
| 140 | CEC_USER_CONTROL_CODE_F2_RED = 0X72, |
| 141 | CEC_USER_CONTROL_CODE_F3_GREEN = 0x73, |
| 142 | CEC_USER_CONTROL_CODE_F4_YELLOW = 0x74, |
| 143 | CEC_USER_CONTROL_CODE_F5 = 0x75, |
| 144 | CEC_USER_CONTROL_CODE_DATA = 0x76, |
| 145 | CEC_USER_CONTROL_CODE_MAX = 0x76, |
| 146 | CEC_USER_CONTROL_CODE_UNKNOWN |
| 147 | } cec_user_control_code; |
| 148 | |
| 149 | typedef enum cec_logical_address |
| 150 | { |
| 151 | CECDEVICE_UNKNOWN = -1, //not a valid logical address |
| 152 | CECDEVICE_TV, |
| 153 | CECDEVICE_RECORDINGDEVICE1, |
| 154 | CECDEVICE_RECORDINGDEVICE2, |
| 155 | CECDEVICE_TUNER1, |
| 156 | CECDEVICE_PLAYBACKDEVICE1, |
| 157 | CECDEVICE_AUDIOSYSTEM, |
| 158 | CECDEVICE_TUNER2, |
| 159 | CECDEVICE_TUNER3, |
| 160 | CECDEVICE_PLAYBACKDEVICE2, |
| 161 | CECDEVICE_RECORDINGDEVICE3, |
| 162 | CECDEVICE_TUNER4, |
| 163 | CECDEVICE_PLAYBACKDEVICE3, |
| 164 | CECDEVICE_RESERVED1, |
| 165 | CECDEVICE_RESERVED2, |
| 166 | CECDEVICE_FREEUSE, |
| 167 | CECDEVICE_UNREGISTERED = 15, |
| 168 | CECDEVICE_BROADCAST = 15 |
| 169 | } cec_logical_address; |
| 170 | |
| 171 | typedef enum cec_opcode |
| 172 | { |
| 173 | CEC_OPCODE_ACTIVE_SOURCE = 0x82, |
| 174 | CEC_OPCODE_IMAGE_VIEW_ON = 0x04, |
| 175 | CEC_OPCODE_TEXT_VIEW_ON = 0x0D, |
| 176 | CEC_OPCODE_INACTIVE_SOURCE = 0x9D, |
| 177 | CEC_OPCODE_REQUEST_ACTIVE_SOURCE = 0x85, |
| 178 | CEC_OPCODE_ROUTING_CHANGE = 0x80, |
| 179 | CEC_OPCODE_ROUTING_INFORMATION = 0x81, |
| 180 | CEC_OPCODE_SET_STREAM_PATH = 0x86, |
| 181 | CEC_OPCODE_STANDBY = 0x36, |
| 182 | CEC_OPCODE_RECORD_OFF = 0x0B, |
| 183 | CEC_OPCODE_RECORD_ON = 0x09, |
| 184 | CEC_OPCODE_RECORD_STATUS = 0x0A, |
| 185 | CEC_OPCODE_RECORD_TV_SCREEN = 0x0F, |
| 186 | CEC_OPCODE_CLEAR_ANALOGUE_TIMER = 0x33, |
| 187 | CEC_OPCODE_CLEAR_DIGITAL_TIMER = 0x99, |
| 188 | CEC_OPCODE_CLEAR_EXTERNAL_TIMER = 0xA1, |
| 189 | CEC_OPCODE_SET_ANALOGUE_TIMER = 0x34, |
| 190 | CEC_OPCODE_SET_DIGITAL_TIMER = 0x97, |
| 191 | CEC_OPCODE_SET_EXTERNAL_TIMER = 0xA2, |
| 192 | CEC_OPCODE_SET_TIMER_PROGRAM_TITLE = 0x67, |
| 193 | CEC_OPCODE_TIMER_CLEARED_STATUS = 0x43, |
| 194 | CEC_OPCODE_TIMER_STATUS = 0x35, |
| 195 | CEC_OPCODE_CEC_VERSION = 0x9E, |
| 196 | CEC_OPCODE_GET_CEC_VERSION = 0x9F, |
| 197 | CEC_OPCODE_GIVE_PHYSICAL_ADDRESS = 0x83, |
| 198 | CEC_OPCODE_GET_MENU_LANGUAGE = 0x91, |
| 199 | CEC_OPCODE_REPORT_PHYSICAL_ADDRESS = 0x84, |
| 200 | CEC_OPCODE_SET_MENU_LANGUAGE = 0x32, |
| 201 | CEC_OPCODE_DECK_CONTROL = 0x42, |
| 202 | CEC_OPCODE_DECK_STATUS = 0x1B, |
| 203 | CEC_OPCODE_GIVE_DECK_STATUS = 0x1A, |
| 204 | CEC_OPCODE_PLAY = 0x41, |
| 205 | CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS = 0x08, |
| 206 | CEC_OPCODE_SELECT_ANALOGUE_SERVICE = 0x92, |
| 207 | CEC_OPCODE_SELECT_DIGITAL_SERVICE = 0x93, |
| 208 | CEC_OPCODE_TUNER_DEVICE_STATUS = 0x07, |
| 209 | CEC_OPCODE_TUNER_STEP_DECREMENT = 0x06, |
| 210 | CEC_OPCODE_TUNER_STEP_INCREMENT = 0x05, |
| 211 | CEC_OPCODE_DEVICE_VENDOR_ID = 0x87, |
| 212 | CEC_OPCODE_GIVE_DEVICE_VENDOR_ID = 0x8C, |
| 213 | CEC_OPCODE_VENDOR_COMMAND = 0x89, |
| 214 | CEC_OPCODE_VENDOR_COMMAND_WITH_ID = 0xA0, |
| 215 | CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN = 0x8A, |
| 216 | CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP = 0x8B, |
| 217 | CEC_OPCODE_SET_OSD_STRING = 0x64, |
| 218 | CEC_OPCODE_GIVE_OSD_NAME = 0x46, |
| 219 | CEC_OPCODE_SET_OSD_NAME = 0x47, |
| 220 | CEC_OPCODE_MENU_REQUEST = 0x8D, |
| 221 | CEC_OPCODE_MENU_STATUS = 0x8E, |
| 222 | CEC_OPCODE_USER_CONTROL_PRESSED = 0x44, |
| 223 | CEC_OPCODE_USER_CONTROL_RELEASE = 0x45, |
| 224 | CEC_OPCODE_GIVE_DEVICE_POWER_STATUS = 0x8F, |
| 225 | CEC_OPCODE_REPORT_POWER_STATUS = 0x90, |
| 226 | CEC_OPCODE_FEATURE_ABORT = 0x00, |
| 227 | CEC_OPCODE_ABORT = 0xFF, |
| 228 | CEC_OPCODE_GIVE_AUDIO_STATUS = 0x71, |
| 229 | CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D, |
| 230 | CEC_OPCODE_REPORT_AUDIO_STATUS = 0x7A, |
| 231 | CEC_OPCODE_SET_SYSTEM_AUDIO_MODE = 0x72, |
| 232 | CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST = 0x70, |
| 233 | CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS = 0x7E, |
| 234 | CEC_OPCODE_SET_AUDIO_RATE = 0x9A |
| 235 | } cec_opcode; |
| 236 | |
| 237 | typedef enum cec_log_level |
| 238 | { |
| 239 | CEC_LOG_DEBUG = 0, |
| 240 | CEC_LOG_NOTICE, |
| 241 | CEC_LOG_WARNING, |
| 242 | CEC_LOG_ERROR |
| 243 | } cec_log_level; |
| 244 | |
| 245 | typedef struct cec_log_message |
| 246 | { |
| 247 | std::string message; |
| 248 | cec_log_level level; |
| 249 | } cec_log_message; |
| 250 | |
| 251 | typedef struct cec_keypress |
| 252 | { |
| 253 | cec_user_control_code keycode; |
| 254 | unsigned int duration; |
| 255 | } cec_keypress; |
| 256 | |
| 257 | typedef struct cec_adapter |
| 258 | { |
| 259 | std::string path; |
| 260 | std::string comm; |
| 261 | } cec_adapter; |
| 262 | |
| 263 | typedef struct cec_command |
| 264 | { |
| 265 | cec_logical_address source; |
| 266 | cec_logical_address destination; |
| 267 | cec_opcode opcode; |
| 268 | cec_frame parameters; |
| 269 | } cec_command; |
| 270 | |
| 271 | //default physical address 1.0.0.0 |
| 272 | #define CEC_DEFAULT_PHYSICAL_ADDRESS 0x1000 |
| 273 | |
| 274 | #ifdef __cplusplus |
| 275 | }; |
| 276 | |
| 277 | #include "CECExportsCpp.h" |
| 278 | #include "CECExportsC.h" |
| 279 | }; |
| 280 | #else |
| 281 | #include "CECExportsC.h" |
| 282 | #endif |
| 283 | |
| 284 | #endif /* CECEXPORTS_H_ */ |