*/
virtual bool IsActiveSource(cec_logical_address iAddress) = 0;
+ /*!
+ * @brief Sets the stream path to the device on the given logical address.
+ * @param iAddress The address to activate.
+ * @return True when the command was sent, false otherwise.
+ */
+ virtual bool SetStreamPath(cec_logical_address iAddress) = 0;
+
+ /*!
+ * @brief Sets the stream path to the device on the given logical address.
+ * @param iPhysicalAddress The address to activate.
+ * @return True when the command was sent, false otherwise.
+ */
+ virtual bool SetStreamPath(uint16_t iPhysicalAddress) = 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;
extern DECLSPEC int cec_enable_physical_address_detection(void);
+#ifdef __cplusplus
+extern DECLSPEC int cec_set_stream_path_logical(CEC::cec_logical_address iAddress);
+#else
+extern DECLSPEC int cec_set_stream_path_logical(cec_logical_address iAddress);
+#endif
+
+extern DECLSPEC int cec_set_stream_path_physical(uint16_t iPhysicalAddress);
+
#ifdef __cplusplus
};
#endif
{
return !m_busDevices[initiator]->HandleReceiveFailed();
}
+
+bool CCECProcessor::SetStreamPath(uint16_t iPhysicalAddress)
+{
+ // stream path changes are sent by the TV
+ return m_busDevices[CECDEVICE_TV]->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
+}
virtual cec_logical_address GetActiveSource(void);
virtual bool IsActiveSource(cec_logical_address iAddress);
virtual bool IsInitialised(void);
+ virtual bool SetStreamPath(uint16_t iPhysicalAddress);
virtual bool SetActiveView(void);
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
}
}
+bool CLibCEC::SetStreamPath(cec_logical_address iAddress)
+{
+ uint16_t iPhysicalAddress = GetDevicePhysicalAddress(iAddress);
+ if (iPhysicalAddress != 0xFFFF)
+ return SetStreamPath(iPhysicalAddress);
+ return false;
+}
+
+bool CLibCEC::SetStreamPath(uint16_t iPhysicalAddress)
+{
+ return m_cec->SetStreamPath(iPhysicalAddress);
+}
+
static CLibCEC *g_libCEC_instance(NULL);
CLibCEC *CLibCEC::GetInstance(void)
{
virtual bool EnablePhysicalAddressDetection(void);
virtual cec_logical_address GetActiveSource(void);
virtual bool IsActiveSource(cec_logical_address iAddress);
+ virtual bool SetStreamPath(cec_logical_address iAddress);
+ virtual bool SetStreamPath(uint16_t iPhysicalAddress);
const char *ToString(const cec_menu_state state);
const char *ToString(const cec_version version);
return cec_parser ? (cec_parser->EnablePhysicalAddressDetection() ? 1 : 0) : -1;
}
+int cec_set_stream_path_logical(CEC::cec_logical_address iAddress)
+{
+ return cec_parser ? (cec_parser->SetStreamPath(iAddress) ? 1 : 0) : -1;
+}
+
+int cec_set_stream_path_physical(uint16_t iPhysicalAddress)
+{
+ return cec_parser ? (cec_parser->SetStreamPath(iPhysicalAddress) ? 1 : 0) : -1;
+}
+
//@}
return Transmit(command, false);
}
+bool CCECCommandHandler::TransmitSetStreamPath(uint16_t iStreamPath)
+{
+ cec_command command;
+ cec_command::Format(command, m_busDevice->GetLogicalAddress(), CECDEVICE_BROADCAST, CEC_OPCODE_SET_STREAM_PATH);
+ command.parameters.PushBack((uint8_t) ((iStreamPath >> 8) & 0xFF));
+ command.parameters.PushBack((uint8_t) (iStreamPath & 0xFF));
+
+ return Transmit(command, false);
+}
+
bool CCECCommandHandler::TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state)
{
cec_command command;
virtual bool TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state);
virtual bool TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
virtual bool TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait = true);
+ virtual bool TransmitSetStreamPath(uint16_t iStreamPath);
virtual void MarkBusy(void);
virtual bool MarkReady(void);
"[lad] lists active devices on the bus" << endl <<
"[ad] {addr} checks whether the specified device is active." << endl <<
"[at] {type} checks whether the specified device type is active." << endl <<
+ "[sp] {addr} makes the specified physical address active." << endl <<
+ "[spl] {addr} makes the specified logical address active." << endl <<
"[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 <<
"================================================================================" << endl;
}
+bool ProcessCommandSP(ICECAdapter *parser, const string &command, string &arguments)
+{
+ if (command == "sp")
+ {
+ string strAddress;
+ int iAddress;
+ if (GetWord(arguments, strAddress))
+ {
+ sscanf(strAddress.c_str(), "%x", &iAddress);
+ if (iAddress >= 0 && iAddress <= 0xFFFF)
+ parser->SetStreamPath((uint16_t)iAddress);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool ProcessCommandSPL(ICECAdapter *parser, const string &command, string &arguments)
+{
+ if (command == "spl")
+ {
+ string strAddress;
+ cec_logical_address iAddress;
+ if (GetWord(arguments, strAddress))
+ {
+ iAddress = (cec_logical_address)atoi(strAddress.c_str());
+ if (iAddress >= CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST)
+ parser->SetStreamPath(iAddress);
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool ProcessCommandTX(ICECAdapter *parser, const string &command, string &arguments)
{
if (command == "tx" || command == "txn")
ProcessCommandR(parser, command, input) ||
ProcessCommandH(parser, command, input) ||
ProcessCommandLOG(parser, command, input) ||
- ProcessCommandSCAN(parser, command, input);
+ ProcessCommandSCAN(parser, command, input) ||
+ ProcessCommandSP(parser, command, input) ||
+ ProcessCommandSPL(parser, command, input);
}
}
return true;