* @return The OSD name.
*/
virtual cec_osd_name GetOSDName(cec_logical_address iAddress) = 0;
+
+ virtual const char *ToString(const cec_menu_state state) = 0;
+ virtual const char *ToString(const cec_version version) = 0;
+ virtual const char *ToString(const cec_power_status status) = 0;
+ virtual const char *ToString(const cec_logical_address address) = 0;
+ virtual const char *ToString(const cec_deck_control_mode mode) = 0;
+ virtual const char *ToString(const cec_deck_info status) = 0;
+ virtual const char *ToString(const cec_opcode opcode) = 0;
+ virtual const char *ToString(const cec_system_audio_status mode) = 0;
+ virtual const char *ToString(const cec_audio_status status) = 0;
+ virtual const char *ToString(const cec_vendor_id vendor) = 0;
+
};
};
return m_busDevices[iDestination]->SendKeyRelease(bWait);
}
+const char *CCECProcessor::ToString(const cec_menu_state state)
+{
+ switch (state)
+ {
+ case CEC_MENU_STATE_ACTIVATED:
+ return "activated";
+ case CEC_MENU_STATE_DEACTIVATED:
+ return "deactivated";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_version version)
+{
+ switch (version)
+ {
+ case CEC_VERSION_1_2:
+ return "1.2";
+ case CEC_VERSION_1_2A:
+ return "1.2a";
+ case CEC_VERSION_1_3:
+ return "1.3";
+ case CEC_VERSION_1_3A:
+ return "1.3a";
+ case CEC_VERSION_1_4:
+ return "1.4";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_power_status status)
+{
+ switch (status)
+ {
+ case CEC_POWER_STATUS_ON:
+ return "on";
+ case CEC_POWER_STATUS_STANDBY:
+ return "standby";
+ case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
+ return "in transition from on to standby";
+ case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
+ return "in transition from standby to on";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_logical_address address)
+{
+ switch(address)
+ {
+ case CECDEVICE_AUDIOSYSTEM:
+ return "Audio";
+ case CECDEVICE_BROADCAST:
+ return "Broadcast";
+ case CECDEVICE_FREEUSE:
+ return "Free use";
+ case CECDEVICE_PLAYBACKDEVICE1:
+ return "Playback 1";
+ case CECDEVICE_PLAYBACKDEVICE2:
+ return "Playback 2";
+ case CECDEVICE_PLAYBACKDEVICE3:
+ return "Playback 3";
+ case CECDEVICE_RECORDINGDEVICE1:
+ return "Recorder 1";
+ case CECDEVICE_RECORDINGDEVICE2:
+ return "Recorder 2";
+ case CECDEVICE_RECORDINGDEVICE3:
+ return "Recorder 3";
+ case CECDEVICE_RESERVED1:
+ return "Reserved 1";
+ case CECDEVICE_RESERVED2:
+ return "Reserved 2";
+ case CECDEVICE_TUNER1:
+ return "Tuner 1";
+ case CECDEVICE_TUNER2:
+ return "Tuner 2";
+ case CECDEVICE_TUNER3:
+ return "Tuner 3";
+ case CECDEVICE_TUNER4:
+ return "Tuner 4";
+ case CECDEVICE_TV:
+ return "TV";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_deck_control_mode mode)
+{
+ switch (mode)
+ {
+ case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND:
+ return "skip forward wind";
+ case CEC_DECK_CONTROL_MODE_EJECT:
+ return "eject";
+ case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND:
+ return "reverse rewind";
+ case CEC_DECK_CONTROL_MODE_STOP:
+ return "stop";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_deck_info status)
+{
+ switch (status)
+ {
+ case CEC_DECK_INFO_PLAY:
+ return "play";
+ case CEC_DECK_INFO_RECORD:
+ return "record";
+ case CEC_DECK_INFO_PLAY_REVERSE:
+ return "play reverse";
+ case CEC_DECK_INFO_STILL:
+ return "still";
+ case CEC_DECK_INFO_SLOW:
+ return "slow";
+ case CEC_DECK_INFO_SLOW_REVERSE:
+ return "slow reverse";
+ case CEC_DECK_INFO_FAST_FORWARD:
+ return "fast forward";
+ case CEC_DECK_INFO_FAST_REVERSE:
+ return "fast reverse";
+ case CEC_DECK_INFO_NO_MEDIA:
+ return "no media";
+ case CEC_DECK_INFO_STOP:
+ return "stop";
+ case CEC_DECK_INFO_SKIP_FORWARD_WIND:
+ return "info skip forward wind";
+ case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
+ return "info skip reverse rewind";
+ case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
+ return "info index search forward";
+ case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
+ return "info index search reverse";
+ case CEC_DECK_INFO_OTHER_STATUS:
+ return "other";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_opcode opcode)
+{
+ switch (opcode)
+ {
+ case CEC_OPCODE_ACTIVE_SOURCE:
+ return "active source";
+ case CEC_OPCODE_IMAGE_VIEW_ON:
+ return "image view on";
+ case CEC_OPCODE_TEXT_VIEW_ON:
+ return "text view on";
+ case CEC_OPCODE_INACTIVE_SOURCE:
+ return "inactive source";
+ case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
+ return "request active source";
+ case CEC_OPCODE_ROUTING_CHANGE:
+ return "routing change";
+ case CEC_OPCODE_ROUTING_INFORMATION:
+ return "routing information";
+ case CEC_OPCODE_SET_STREAM_PATH:
+ return "set stream path";
+ case CEC_OPCODE_STANDBY:
+ return "standby";
+ case CEC_OPCODE_RECORD_OFF:
+ return "record off";
+ case CEC_OPCODE_RECORD_ON:
+ return "record on";
+ case CEC_OPCODE_RECORD_STATUS:
+ return "record status";
+ case CEC_OPCODE_RECORD_TV_SCREEN:
+ return "record tv screen";
+ case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
+ return "clear analogue timer";
+ case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
+ return "clear digital timer";
+ case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
+ return "clear external timer";
+ case CEC_OPCODE_SET_ANALOGUE_TIMER:
+ return "set analogue timer";
+ case CEC_OPCODE_SET_DIGITAL_TIMER:
+ return "set digital timer";
+ case CEC_OPCODE_SET_EXTERNAL_TIMER:
+ return "set external timer";
+ case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
+ return "set timer program title";
+ case CEC_OPCODE_TIMER_CLEARED_STATUS:
+ return "timer cleared status";
+ case CEC_OPCODE_TIMER_STATUS:
+ return "timer status";
+ case CEC_OPCODE_CEC_VERSION:
+ return "cec version";
+ case CEC_OPCODE_GET_CEC_VERSION:
+ return "get cec version";
+ case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
+ return "give physical address";
+ case CEC_OPCODE_GET_MENU_LANGUAGE:
+ return "get menu language";
+ case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
+ return "report physical address";
+ case CEC_OPCODE_SET_MENU_LANGUAGE:
+ return "set menu language";
+ case CEC_OPCODE_DECK_CONTROL:
+ return "deck control";
+ case CEC_OPCODE_DECK_STATUS:
+ return "deck status";
+ case CEC_OPCODE_GIVE_DECK_STATUS:
+ return "give deck status";
+ case CEC_OPCODE_PLAY:
+ return "play";
+ case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
+ return "give tuner status";
+ case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
+ return "select analogue service";
+ case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
+ return "set digital service";
+ case CEC_OPCODE_TUNER_DEVICE_STATUS:
+ return "tuner device status";
+ case CEC_OPCODE_TUNER_STEP_DECREMENT:
+ return "tuner step decrement";
+ case CEC_OPCODE_TUNER_STEP_INCREMENT:
+ return "tuner step increment";
+ case CEC_OPCODE_DEVICE_VENDOR_ID:
+ return "device vendor id";
+ case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
+ return "give device vendor id";
+ case CEC_OPCODE_VENDOR_COMMAND:
+ return "vendor command";
+ case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
+ return "vendor command with id";
+ case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
+ return "vendor remote button down";
+ case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
+ return "vendor remote button up";
+ case CEC_OPCODE_SET_OSD_STRING:
+ return "set osd string";
+ case CEC_OPCODE_GIVE_OSD_NAME:
+ return "give osd name";
+ case CEC_OPCODE_SET_OSD_NAME:
+ return "set osd name";
+ case CEC_OPCODE_MENU_REQUEST:
+ return "menu request";
+ case CEC_OPCODE_MENU_STATUS:
+ return "menu status";
+ case CEC_OPCODE_USER_CONTROL_PRESSED:
+ return "user control pressed";
+ case CEC_OPCODE_USER_CONTROL_RELEASE:
+ return "user control release";
+ case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
+ return "give device power status";
+ case CEC_OPCODE_REPORT_POWER_STATUS:
+ return "report power status";
+ case CEC_OPCODE_FEATURE_ABORT:
+ return "feature abort";
+ case CEC_OPCODE_ABORT:
+ return "abort";
+ case CEC_OPCODE_GIVE_AUDIO_STATUS:
+ return "give audio status";
+ case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
+ return "give audio mode status";
+ case CEC_OPCODE_REPORT_AUDIO_STATUS:
+ return "report audio status";
+ case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
+ return "set system audio mode";
+ case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
+ return "system audio mode request";
+ case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
+ return "system audio mode status";
+ case CEC_OPCODE_SET_AUDIO_RATE:
+ return "set audio rate";
+ default:
+ return "UNKNOWN";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_system_audio_status mode)
+{
+ switch(mode)
+ {
+ case CEC_SYSTEM_AUDIO_STATUS_ON:
+ return "on";
+ case CEC_SYSTEM_AUDIO_STATUS_OFF:
+ return "off";
+ default:
+ return "unknown";
+ }
+}
+
+const char *CCECProcessor::ToString(const cec_audio_status status)
+{
+ // TODO this is a mask
+ return "TODO";
+}
+
+const char *CCECProcessor::ToString(const cec_vendor_id vendor)
+{
+ switch (vendor)
+ {
+ case CEC_VENDOR_SAMSUNG:
+ return "Samsung";
+ case CEC_VENDOR_LG:
+ return "LG";
+ case CEC_VENDOR_PANASONIC:
+ return "Panasonic";
+ case CEC_VENDOR_PIONEER:
+ return "Pioneer";
+ case CEC_VENDOR_ONKYO:
+ return "Onkyo";
+ case CEC_VENDOR_YAMAHA:
+ return "Yamaha";
+ default:
+ return "Unknown";
+ }
+}
+
void *CCECBusScan::Process(void)
{
CCECBusDevice *device(NULL);
virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false);
virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false);
+ const char *ToString(const cec_menu_state state);
+ const char *ToString(const cec_version version);
+ const char *ToString(const cec_power_status status);
+ const char *ToString(const cec_logical_address address);
+ const char *ToString(const cec_deck_control_mode mode);
+ const char *ToString(const cec_deck_info status);
+ const char *ToString(const cec_opcode opcode);
+ const char *ToString(const cec_system_audio_status mode);
+ const char *ToString(const cec_audio_status status);
+ const char *ToString(const cec_vendor_id vendor);
+
virtual bool Transmit(const cec_command &data);
virtual bool Transmit(CCECAdapterMessage *output);
virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE);
if (lib)
delete lib;
}
+
+const char *CLibCEC::ToString(const cec_menu_state state)
+{
+ return m_cec->ToString(state);
+}
+
+const char *CLibCEC::ToString(const cec_version version)
+{
+ return m_cec->ToString(version);
+}
+
+const char *CLibCEC::ToString(const cec_power_status status)
+{
+ return m_cec->ToString(status);
+}
+
+const char *CLibCEC::ToString(const cec_logical_address address)
+{
+ return m_cec->ToString(address);
+}
+
+const char *CLibCEC::ToString(const cec_deck_control_mode mode)
+{
+ return m_cec->ToString(mode);
+}
+
+const char *CLibCEC::ToString(const cec_deck_info status)
+{
+ return m_cec->ToString(status);
+}
+
+const char *CLibCEC::ToString(const cec_opcode opcode)
+{
+ return m_cec->ToString(opcode);
+}
+
+const char *CLibCEC::ToString(const cec_system_audio_status mode)
+{
+ return m_cec->ToString(mode);
+}
+
+const char *CLibCEC::ToString(const cec_audio_status status)
+{
+ return m_cec->ToString(status);
+}
+
+const char *CLibCEC::ToString(const cec_vendor_id vendor)
+{
+ return m_cec->ToString(vendor);
+}
virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false);
virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false);
virtual cec_osd_name GetOSDName(cec_logical_address iAddress);
+
+ const char *ToString(const cec_menu_state state);
+ const char *ToString(const cec_version version);
+ const char *ToString(const cec_power_status status);
+ const char *ToString(const cec_logical_address address);
+ const char *ToString(const cec_deck_control_mode mode);
+ const char *ToString(const cec_deck_info status);
+ const char *ToString(const cec_opcode opcode);
+ const char *ToString(const cec_system_audio_status mode);
+ const char *ToString(const cec_audio_status status);
+ const char *ToString(const cec_vendor_id vendor);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
using namespace CEC;
+#define ToString(p) m_processor->ToString(p)
+
CCECAudioSystem::CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
CCECBusDevice(processor, address, iPhysicalAddress),
m_systemAudioStatus(CEC_SYSTEM_AUDIO_STATUS_ON),
if (m_systemAudioStatus != mode)
{
CStdString strLog;
- strLog.Format(">> %s (%X): system audio mode changed from %s to %s", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(m_systemAudioStatus), CCECCommandHandler::ToString(mode));
+ strLog.Format(">> %s (%X): system audio mode changed from %s to %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_systemAudioStatus), ToString(mode));
AddLog(CEC_LOG_DEBUG, strLog.c_str());
m_systemAudioStatus = mode;
{
CLockObject lock(&m_writeMutex);
CStdString strLog;
- strLog.Format("<< %x -> %x: system audio mode '%s'", m_iLogicalAddress, dest, CCECCommandHandler::ToString(m_systemAudioStatus));
+ strLog.Format("<< %x -> %x: system audio mode '%s'", m_iLogicalAddress, dest, ToString(m_systemAudioStatus));
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
using namespace CEC;
-#define ToString(p) CCECCommandHandler::ToString(p)
+#define ToString(p) m_processor->ToString(p)
CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) :
m_type(CEC_DEVICE_TYPE_RESERVED),
using namespace CEC;
+#define ToString(p) m_processor->ToString(p)
+
CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
CCECBusDevice(processor, address, iPhysicalAddress),
m_deckStatus(CEC_DECK_INFO_STOP),
if (m_deckStatus != deckStatus)
{
CStdString strLog;
- strLog.Format(">> %s (%X): deck status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(m_deckStatus), CCECCommandHandler::ToString(deckStatus));
+ strLog.Format(">> %s (%X): deck status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_deckStatus), ToString(deckStatus));
AddLog(CEC_LOG_DEBUG, strLog.c_str());
m_deckStatus = deckStatus;
if (m_deckControlMode != mode)
{
CStdString strLog;
- strLog.Format(">> %s (%X): deck control mode changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(m_deckControlMode), CCECCommandHandler::ToString(mode));
+ strLog.Format(">> %s (%X): deck control mode changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_deckControlMode), ToString(mode));
AddLog(CEC_LOG_DEBUG, strLog.c_str());
m_deckControlMode = mode;
{
CLockObject lock(&m_writeMutex);
CStdString strLog;
- strLog.Format("<< %s (%X) -> %s (%X): deck status '%s'", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(dest), dest, CCECCommandHandler::ToString(m_deckStatus));
+ strLog.Format("<< %s (%X) -> %s (%X): deck status '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_deckStatus));
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
bool bHandled(true);
CStdString strLog;
- strLog.Format(">> %s (%X) -> %s (%X): %s (%2X)", ToString(command.initiator), command.initiator, ToString(command.destination), command.destination, ToString(command.opcode), command.opcode);
+ strLog.Format(">> %s (%X) -> %s (%X): %s (%2X)", m_busDevice->GetProcessor()->ToString(command.initiator), command.initiator, m_busDevice->GetProcessor()->ToString(command.destination), command.destination, m_busDevice->GetProcessor()->ToString(command.opcode), command.opcode);
m_busDevice->AddLog(CEC_LOG_NOTICE, strLog);
switch(command.opcode)
}
}
}
-
-const char *CCECCommandHandler::ToString(const cec_menu_state state)
-{
- switch (state)
- {
- case CEC_MENU_STATE_ACTIVATED:
- return "activated";
- case CEC_MENU_STATE_DEACTIVATED:
- return "deactivated";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_version version)
-{
- switch (version)
- {
- case CEC_VERSION_1_2:
- return "1.2";
- case CEC_VERSION_1_2A:
- return "1.2a";
- case CEC_VERSION_1_3:
- return "1.3";
- case CEC_VERSION_1_3A:
- return "1.3a";
- case CEC_VERSION_1_4:
- return "1.4";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_power_status status)
-{
- switch (status)
- {
- case CEC_POWER_STATUS_ON:
- return "on";
- case CEC_POWER_STATUS_STANDBY:
- return "standby";
- case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
- return "in transition from on to standby";
- case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
- return "in transition from standby to on";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_logical_address address)
-{
- switch(address)
- {
- case CECDEVICE_AUDIOSYSTEM:
- return "Audio";
- case CECDEVICE_BROADCAST:
- return "Broadcast";
- case CECDEVICE_FREEUSE:
- return "Free use";
- case CECDEVICE_PLAYBACKDEVICE1:
- return "Playback 1";
- case CECDEVICE_PLAYBACKDEVICE2:
- return "Playback 2";
- case CECDEVICE_PLAYBACKDEVICE3:
- return "Playback 3";
- case CECDEVICE_RECORDINGDEVICE1:
- return "Recorder 1";
- case CECDEVICE_RECORDINGDEVICE2:
- return "Recorder 2";
- case CECDEVICE_RECORDINGDEVICE3:
- return "Recorder 3";
- case CECDEVICE_RESERVED1:
- return "Reserved 1";
- case CECDEVICE_RESERVED2:
- return "Reserved 2";
- case CECDEVICE_TUNER1:
- return "Tuner 1";
- case CECDEVICE_TUNER2:
- return "Tuner 2";
- case CECDEVICE_TUNER3:
- return "Tuner 3";
- case CECDEVICE_TUNER4:
- return "Tuner 4";
- case CECDEVICE_TV:
- return "TV";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_deck_control_mode mode)
-{
- switch (mode)
- {
- case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND:
- return "skip forward wind";
- case CEC_DECK_CONTROL_MODE_EJECT:
- return "eject";
- case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND:
- return "reverse rewind";
- case CEC_DECK_CONTROL_MODE_STOP:
- return "stop";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_deck_info status)
-{
- switch (status)
- {
- case CEC_DECK_INFO_PLAY:
- return "play";
- case CEC_DECK_INFO_RECORD:
- return "record";
- case CEC_DECK_INFO_PLAY_REVERSE:
- return "play reverse";
- case CEC_DECK_INFO_STILL:
- return "still";
- case CEC_DECK_INFO_SLOW:
- return "slow";
- case CEC_DECK_INFO_SLOW_REVERSE:
- return "slow reverse";
- case CEC_DECK_INFO_FAST_FORWARD:
- return "fast forward";
- case CEC_DECK_INFO_FAST_REVERSE:
- return "fast reverse";
- case CEC_DECK_INFO_NO_MEDIA:
- return "no media";
- case CEC_DECK_INFO_STOP:
- return "stop";
- case CEC_DECK_INFO_SKIP_FORWARD_WIND:
- return "info skip forward wind";
- case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
- return "info skip reverse rewind";
- case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
- return "info index search forward";
- case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
- return "info index search reverse";
- case CEC_DECK_INFO_OTHER_STATUS:
- return "other";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_opcode opcode)
-{
- switch (opcode)
- {
- case CEC_OPCODE_ACTIVE_SOURCE:
- return "active source";
- case CEC_OPCODE_IMAGE_VIEW_ON:
- return "image view on";
- case CEC_OPCODE_TEXT_VIEW_ON:
- return "text view on";
- case CEC_OPCODE_INACTIVE_SOURCE:
- return "inactive source";
- case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
- return "request active source";
- case CEC_OPCODE_ROUTING_CHANGE:
- return "routing change";
- case CEC_OPCODE_ROUTING_INFORMATION:
- return "routing information";
- case CEC_OPCODE_SET_STREAM_PATH:
- return "set stream path";
- case CEC_OPCODE_STANDBY:
- return "standby";
- case CEC_OPCODE_RECORD_OFF:
- return "record off";
- case CEC_OPCODE_RECORD_ON:
- return "record on";
- case CEC_OPCODE_RECORD_STATUS:
- return "record status";
- case CEC_OPCODE_RECORD_TV_SCREEN:
- return "record tv screen";
- case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
- return "clear analogue timer";
- case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
- return "clear digital timer";
- case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
- return "clear external timer";
- case CEC_OPCODE_SET_ANALOGUE_TIMER:
- return "set analogue timer";
- case CEC_OPCODE_SET_DIGITAL_TIMER:
- return "set digital timer";
- case CEC_OPCODE_SET_EXTERNAL_TIMER:
- return "set external timer";
- case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
- return "set timer program title";
- case CEC_OPCODE_TIMER_CLEARED_STATUS:
- return "timer cleared status";
- case CEC_OPCODE_TIMER_STATUS:
- return "timer status";
- case CEC_OPCODE_CEC_VERSION:
- return "cec version";
- case CEC_OPCODE_GET_CEC_VERSION:
- return "get cec version";
- case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
- return "give physical address";
- case CEC_OPCODE_GET_MENU_LANGUAGE:
- return "get menu language";
- case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
- return "report physical address";
- case CEC_OPCODE_SET_MENU_LANGUAGE:
- return "set menu language";
- case CEC_OPCODE_DECK_CONTROL:
- return "deck control";
- case CEC_OPCODE_DECK_STATUS:
- return "deck status";
- case CEC_OPCODE_GIVE_DECK_STATUS:
- return "give deck status";
- case CEC_OPCODE_PLAY:
- return "play";
- case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
- return "give tuner status";
- case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
- return "select analogue service";
- case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
- return "set digital service";
- case CEC_OPCODE_TUNER_DEVICE_STATUS:
- return "tuner device status";
- case CEC_OPCODE_TUNER_STEP_DECREMENT:
- return "tuner step decrement";
- case CEC_OPCODE_TUNER_STEP_INCREMENT:
- return "tuner step increment";
- case CEC_OPCODE_DEVICE_VENDOR_ID:
- return "device vendor id";
- case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
- return "give device vendor id";
- case CEC_OPCODE_VENDOR_COMMAND:
- return "vendor command";
- case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
- return "vendor command with id";
- case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
- return "vendor remote button down";
- case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
- return "vendor remote button up";
- case CEC_OPCODE_SET_OSD_STRING:
- return "set osd string";
- case CEC_OPCODE_GIVE_OSD_NAME:
- return "give osd name";
- case CEC_OPCODE_SET_OSD_NAME:
- return "set osd name";
- case CEC_OPCODE_MENU_REQUEST:
- return "menu request";
- case CEC_OPCODE_MENU_STATUS:
- return "menu status";
- case CEC_OPCODE_USER_CONTROL_PRESSED:
- return "user control pressed";
- case CEC_OPCODE_USER_CONTROL_RELEASE:
- return "user control release";
- case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
- return "give device power status";
- case CEC_OPCODE_REPORT_POWER_STATUS:
- return "report power status";
- case CEC_OPCODE_FEATURE_ABORT:
- return "feature abort";
- case CEC_OPCODE_ABORT:
- return "abort";
- case CEC_OPCODE_GIVE_AUDIO_STATUS:
- return "give audio status";
- case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
- return "give audio mode status";
- case CEC_OPCODE_REPORT_AUDIO_STATUS:
- return "report audio status";
- case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
- return "set system audio mode";
- case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
- return "system audio mode request";
- case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
- return "system audio mode status";
- case CEC_OPCODE_SET_AUDIO_RATE:
- return "set audio rate";
- default:
- return "UNKNOWN";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_system_audio_status mode)
-{
- switch(mode)
- {
- case CEC_SYSTEM_AUDIO_STATUS_ON:
- return "on";
- case CEC_SYSTEM_AUDIO_STATUS_OFF:
- return "off";
- default:
- return "unknown";
- }
-}
-
-const char *CCECCommandHandler::ToString(const cec_audio_status status)
-{
- // TODO this is a mask
- return "TODO";
-}
-
-const char *CCECCommandHandler::ToString(const cec_vendor_id vendor)
-{
- switch (vendor)
- {
- case CEC_VENDOR_SAMSUNG:
- return "Samsung";
- case CEC_VENDOR_LG:
- return "LG";
- case CEC_VENDOR_PANASONIC:
- return "Panasonic";
- case CEC_VENDOR_PIONEER:
- return "Pioneer";
- case CEC_VENDOR_ONKYO:
- return "Onkyo";
- case CEC_VENDOR_YAMAHA:
- return "Yamaha";
- default:
- return "Unknown";
- }
-}
virtual bool HandleCommand(const cec_command &command);
virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; };
- static const char *ToString(const cec_menu_state state);
- static const char *ToString(const cec_deck_control_mode mode);
- static const char *ToString(const cec_version version);
- static const char *ToString(const cec_power_status status);
- static const char *ToString(const cec_deck_info status);
- static const char* ToString(const cec_logical_address address);
- static const char* ToString(const cec_opcode opcode);
- static const char *ToString(const cec_system_audio_status mode);
- static const char *ToString(const cec_audio_status status);
- static const char *ToString(const cec_vendor_id vendor);
-
protected:
virtual bool HandleActiveSource(const cec_command &command);
virtual bool HandleDeckControl(const cec_command &command);
#include <sstream>
#include "../lib/platform/threads.h"
#include "../lib/util/StdString.h"
+#include "../lib/implementations/CECCommandHandler.h"
using namespace CEC;
using namespace std;
"[volup] send a volume up command to the amp if present" << endl <<
"[voldown] send a volume down command to the amp if present" << endl <<
"[mute] send a mute/unmute command to the amp if present" << endl <<
+ "[scan] scan the CEC bus and display device info" << endl <<
"[mon] {1|0} enable or disable CEC bus monitoring." << endl <<
"[log] {1 - 31} change the log level. see cectypes.h for values." << endl <<
"[ping] send a ping command to the CEC adapter." << endl <<
if (addresses[iPtr])
cout << "logical address " << (int)iPtr << endl;
}
+ else if (command == "scan")
+ {
+ cout << "CEC bus information" << endl;
+ cout << "===================" << endl;
+ cec_logical_addresses addresses = parser->GetActiveDevices();
+ for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ if (addresses[iPtr])
+ {
+ uint64_t iVendorId = parser->GetDeviceVendorId((cec_logical_address)iPtr);
+ cec_version iCecVersion = parser->GetDeviceCecVersion((cec_logical_address)iPtr);
+ cec_power_status power = parser->GetDevicePowerStatus((cec_logical_address)iPtr);
+ cec_osd_name osdName = parser->GetOSDName((cec_logical_address)iPtr);
+ cec_menu_language lang;
+ lang.device = CECDEVICE_UNKNOWN;
+ parser->GetDeviceMenuLanguage((cec_logical_address)iPtr, &lang);
+
+ cout << "device #" << (int)iPtr << ": " << parser->ToString((cec_logical_address)iPtr) << endl;
+ cout << "vendor: " << parser->ToString((cec_vendor_id)iVendorId) << endl;
+ cout << "osd string: " << osdName.name << endl;
+ cout << "CEC version: " << parser->ToString(iCecVersion) << endl;
+ cout << "power status: " << parser->ToString(power) << endl;
+ if ((uint8_t)lang.device == iPtr)
+ cout << "language: " << lang.language << endl;
+ cout << endl;
+ }
+ }
else if (command == "ad")
{
CStdString strDev;