cec_device_type types[5]; /**< the list of device types */
#ifdef __cplusplus
- cec_device_type_list operator+ (const cec_device_type_list &other)
- {
- cec_device_type_list retVal;
- for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
- {
- if (other.types[iPtr] != CEC_DEVICE_TYPE_RESERVED)
- retVal.Add(other.types[iPtr]);
- if (types[iPtr] != CEC_DEVICE_TYPE_RESERVED)
- retVal.Add(types[iPtr]);
- }
- return retVal;
- }
-
/*!
* @deprecated Use Clear() instead.
* @brief Clear this list.
* @param type The type to check.
* @return True when set, false otherwise.
*/
- bool IsSet(const cec_device_type type) const
+ bool IsSet(cec_device_type type)
{
bool bReturn(false);
for (unsigned int iPtr = 0; !bReturn && iPtr < 5; iPtr++)
int addresses[16]; /**< the list of addresses */
#ifdef __cplusplus
- cec_logical_addresses(void) { Clear(); }
- virtual ~cec_logical_addresses(void) { Clear(); }
-
/*!
* @brief Clear this list.
*/
* @param address The address to check.
* @return True when set, false otherwise.
*/
- bool IsSet(const cec_logical_address address) const { return addresses[(int) address] == 1; }
+ bool IsSet(cec_logical_address address) const { return addresses[(int) address] == 1; }
/*!
* @brief Check whether an address is set in this list.
{
return !(*this == other);
}
-
- cec_logical_addresses operator+ (const cec_logical_addresses &other)
- {
- cec_logical_addresses retVal;
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
- {
- if (other.IsSet((cec_logical_address)iPtr) || IsSet((cec_logical_address)iPtr))
- retVal.Set((cec_logical_address)iPtr);
- }
- return retVal;
- }
-
- cec_logical_addresses &operator+= (const cec_logical_addresses &other)
- {
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
- {
- if (other.IsSet((cec_logical_address)iPtr))
- Set((cec_logical_address)iPtr);
- }
- return *this;
- }
#endif
} cec_logical_addresses;
{
libcec_parameter_type paramType; /**< the type of this parameter */
void* paramData; /**< the value of this parameter */
-
-#ifdef __cplusplus
- libcec_parameter(void)
- {
- paramType = CEC_PARAMETER_TYPE_UNKOWN;
- paramData = NULL;
- }
-
- libcec_parameter(const char *strMessage)
- {
- paramType = CEC_PARAMETER_TYPE_STRING;
- paramData = (void*)strMessage;
- }
-
- virtual ~libcec_parameter(void) {}
-#endif
};
struct libcec_configuration;
{
const char *strUpgradeMessage = "The firmware of this adapter can be upgraded. Please visit http://blog.pulse-eight.com/ for more information.";
m_libcec->AddLog(CEC_LOG_WARNING, strUpgradeMessage);
- client->Alert(CEC_ALERT_SERVICE_DEVICE, libcec_parameter(strUpgradeMessage));
+ libcec_parameter param;
+ param.paramData = (void*)strUpgradeMessage; param.paramType = CEC_PARAMETER_TYPE_STRING;
+ client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
}
else
{
cec_logical_addresses CCECProcessor::GetLogicalAddresses(void) const
{
cec_logical_addresses addresses;
+ addresses.Clear();
for (map<cec_logical_address, CCECClient *>::const_iterator client = m_clients.begin(); client != m_clients.end(); client++)
addresses.Set(client->first);
using namespace CEC;
using namespace PLATFORM;
-CLibCEC::CLibCEC(void) :
- m_client(NULL),
- m_iStartTime(GetTimeMs())
+CLibCEC::CLibCEC(const char *UNUSED(strDeviceName), cec_device_type_list UNUSED(types), uint16_t UNUSED(iPhysicalAddress) /* = 0 */) :
+ m_iStartTime(GetTimeMs()),
+ m_client(NULL)
+{
+ m_cec = new CCECProcessor(this);
+}
+
+CLibCEC::CLibCEC(libcec_configuration *UNUSED(configuration)) :
+ m_iStartTime(GetTimeMs()),
+ m_client(NULL)
{
m_cec = new CCECProcessor(this);
}
cec_logical_addresses CLibCEC::GetLogicalAddresses(void)
{
cec_logical_addresses addresses;
+ addresses.Clear();
if (m_cec)
addresses = m_cec->GetLogicalAddresses();
return addresses;
if (!configuration)
return NULL;
- CLibCEC *lib = new CLibCEC;
+ CLibCEC *lib = new CLibCEC(NULL);
CCECClient *client(NULL);
if (lib)
client = lib->RegisterClient(configuration);
return m_cec->GetDeviceInformation(strPort, config, iTimeoutMs);
}
+
+void CLibCEC::AddKey(const cec_keypress &UNUSED(key)) {}
+void CLibCEC::AddCommand(const cec_command &UNUSED(command)) {}
+void CLibCEC::ConfigurationChanged(const libcec_configuration &UNUSED(config)) {}
+void CLibCEC::SetCurrentButton(cec_user_control_code UNUSED(iButtonCode)) {}
+CLibCEC *CLibCEC::GetInstance(void) { return NULL; }
+void CLibCEC::SetInstance(CLibCEC *UNUSED(instance)) {}
class CLibCEC : public ICECAdapter
{
public:
- CLibCEC(void);
+ CLibCEC(const char *strDeviceName, cec_device_type_list types, uint16_t iPhysicalAddress = 0);
+ CLibCEC(libcec_configuration *configuration);
virtual ~CLibCEC(void);
/*!
bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
bool SwitchMonitoring(bool bEnable);
-
cec_version GetDeviceCecVersion(cec_logical_address iAddress);
bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
uint64_t GetDeviceVendorId(cec_logical_address iAddress);
uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
- cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
-
bool PollDevice(cec_logical_address iAddress);
cec_logical_addresses GetActiveDevices(void);
bool IsActiveDevice(cec_logical_address iAddress);
uint8_t MuteAudio(bool bSendRelease = true);
bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
bool SendKeyRelease(cec_logical_address iDestination, bool bWait = true);
+ cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
bool EnablePhysicalAddressDetection(void);
cec_logical_address GetActiveSource(void);
bool IsActiveSource(cec_logical_address iAddress);
const char *ToString(const cec_server_version version);
const char *ToString(const cec_device_type type);
- static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress);
-
static cec_device_type GetType(cec_logical_address address);
static uint16_t GetMaskForType(cec_logical_address address);
static uint16_t GetMaskForType(cec_device_type type);
bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT);
//@}
- void AddLog(const cec_log_level level, const char *strFormat, ...);
+ void AddLog(const cec_log_level level, const char *strFormat, ...);
+ static void AddKey(void) {} //UNUSED
+ static void AddKey(const cec_keypress &key); //UNUSED
+ static void AddCommand(const cec_command &command); //UNUSED
+ static void ConfigurationChanged(const libcec_configuration &config); //UNUSED
+ static void SetCurrentButton(cec_user_control_code iButtonCode); //UNUSED
void CheckKeypressTimeout(void);
void Alert(const libcec_alert type, const libcec_parameter ¶m);
+ static CLibCEC *GetInstance(void); //UNUSED
+ static void SetInstance(CLibCEC *instance); //UNUSED
+ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress);
CCECClient *RegisterClient(libcec_configuration *configuration);
void UnregisterClients(void);
- protected:
+
CCECProcessor * m_cec;
- CCECClient * m_client;
- int64_t m_iStartTime;
- PLATFORM::CMutex m_mutex;
+ protected:
+ int64_t m_iStartTime;
+ cec_user_control_code m_iCurrentButton; //UNUSED
+ int64_t m_buttontime; //UNUSED
+ PLATFORM::SyncedBuffer<cec_log_message> m_logBuffer; //UNUSED
+ PLATFORM::SyncedBuffer<cec_keypress> m_keyBuffer; //UNUSED
+ PLATFORM::SyncedBuffer<cec_command> m_commandBuffer; //UNUSED
+ ICECCallbacks * m_callbacks; //UNUSED
+ void * m_cbParam; //UNUSED
+ PLATFORM::CMutex m_mutex;
+ PLATFORM::CMutex m_logMutex; //UNUSED
+
+ CCECClient * m_client;
std::vector<CCECClient *> m_clients;
};
};
m_port->Close();
libcec_parameter param;
+ param.paramData = NULL; param.paramType = CEC_PARAMETER_TYPE_UNKOWN;
LIB_CEC->Alert(CEC_ALERT_CONNECTION_LOST, param);
}
void CCECDeviceMap::FilterTypes(const cec_device_type_list &types, CECDEVICEVEC &devices)
{
+ cec_device_type_list t(types);//silly, but needed to retain abi
CECDEVICEVEC newDevices;
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
{
- if (types.IsSet((*it)->GetType()))
+ if (t.IsSet((*it)->GetType()))
newDevices.push_back(*it);
}
devices = newDevices;
cec_logical_addresses CCECDeviceMap::ToLogicalAddresses(const CECDEVICEVEC &devices)
{
cec_logical_addresses addresses;
+ addresses.Clear();
for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
addresses.Set((*it)->GetLogicalAddress());
return addresses;