*/
extern "C" DECLSPEC void * CECInit(const char *strDeviceName, CEC::cec_device_type_list devicesTypes);
-/*!
- * @deprecated Please use CECInit() instead
- * @brief Load the CEC adapter library.
- * @param strDeviceName How to present this device to other devices.
- * @param iLogicalAddress The logical of this device. PLAYBACKDEVICE1 by default.
- * @param iPhysicalAddress The physical address of this device. 0x1000 by default.
- * @return An instance of ICECAdapter or NULL on error.
- */
-extern "C" DECLSPEC void * CECCreate(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
-
/*!
* @brief Unload the CEC adapter library.
*/
extern "C" {
#endif
-#ifdef __cplusplus
-extern DECLSPEC int cec_init(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress);
-#else
-extern DECLSPEC int cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress);
-#endif
-
#ifdef __cplusplus
extern DECLSPEC int cec_init_typed(const char *strDeviceName, CEC::cec_device_type_list devicesTypes);
#else
extern DECLSPEC int cec_init_typed(const char *strDeviceName, cec_device_type_list devicesTypes);
#endif
-
extern DECLSPEC void cec_destroy(void);
extern DECLSPEC int cec_open(const char *strPort, uint32_t iTimeout);
HINSTANCE g_libCEC = NULL;
-/*!
- * @deprecated Please use LibCecInit() instead
- */
-CEC::ICECAdapter *LoadLibCec(const char *strName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS, const char *strLib = NULL)
-{
- if (!g_libCEC)
-#if defined(_WIN64)
- g_libCEC = LoadLibrary(strLib ? strLib : "libcec.x64.dll");
-#else
- g_libCEC = LoadLibrary(strLib ? strLib : "libcec.dll");
-#endif
- if (!g_libCEC)
- return NULL;
-
- typedef void* (__cdecl*_CreateLibCec)(const char *, uint8_t, uint16_t);
- _CreateLibCec CreateLibCec;
- CreateLibCec = (_CreateLibCec) (GetProcAddress(g_libCEC, "CECCreate"));
- if (!CreateLibCec)
- return NULL;
- return static_cast< CEC::ICECAdapter* > (CreateLibCec(strName, (uint8_t) iLogicalAddress, iPhysicalAddress));
-}
-
/*!
* @brief Create a new libCEC instance.
* @param strDeviceName The name of the primary device to pass to other CEC devices.
using namespace std;
using namespace PLATFORM;
-CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
- m_bInitialised(false),
- m_iHDMIPort(CEC_DEFAULT_HDMI_PORT),
- m_iBaseDevice((cec_logical_address)CEC_DEFAULT_BASE_DEVICE),
- m_strDeviceName(strDeviceName),
- m_communication(NULL),
- m_controller(controller),
- m_bMonitor(false),
- m_iStandardLineTimeout(3),
- m_iRetryLineTimeout(3),
- m_iLastTransmission(0)
-{
- m_logicalAddresses.Clear();
- m_logicalAddresses.Set(iLogicalAddress);
- m_types.clear();
- for (int iPtr = 0; iPtr <= 16; iPtr++)
- m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0);
-}
-
CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, const cec_device_type_list &types) :
m_bInitialised(false),
m_iHDMIPort(CEC_DEFAULT_HDMI_PORT),
class CCECProcessor : public PLATFORM::CThread, public IAdapterCommunicationCallback
{
public:
- CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
CCECProcessor(CLibCEC *controller, const char *strDeviceName, const cec_device_type_list &types);
virtual ~CCECProcessor(void);
m_cec = new CCECProcessor(this, strDeviceName, types);
}
-CLibCEC::CLibCEC(const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */) :
- m_iStartTime(GetTimeMs()),
- m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN),
- m_buttontime(0),
- m_callbacks(NULL),
- m_cbParam(NULL)
-{
- m_cec = new CCECProcessor(this, strDeviceName, iLogicalAddress, iPhysicalAddress);
-}
-
CLibCEC::~CLibCEC(void)
{
Close();
g_libCEC_instance = instance;
}
-void * CECCreate(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress /*= CEC::CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */)
-{
- CLibCEC *lib = new CLibCEC(strDeviceName, iLogicalAddress, iPhysicalAddress);
- CLibCEC::SetInstance(lib);
- return static_cast< void* > (lib);
-}
-
void * CECInit(const char *strDeviceName, CEC::cec_device_type_list types)
{
CLibCEC *lib = new CLibCEC(strDeviceName, types);
*/
//@{
CLibCEC(const char *strDeviceName, cec_device_type_list types);
- CLibCEC(const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
virtual ~CLibCEC(void);
virtual bool Open(const char *strPort, uint32_t iTimeout = 10000);
//@{
ICECAdapter *cec_parser;
-int cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress)
-{
- cec_parser = (ICECAdapter *) CECCreate(strDeviceName, iLogicalAddress, iPhysicalAddress);
- return (cec_parser != NULL) ? 1 : 0;
-}
-
int cec_init_typed(const char *strDeviceName, cec_device_type_list devicesTypes)
{
cec_parser = (ICECAdapter *) CECInit(strDeviceName, devicesTypes);