X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftestclient%2Fmain.cpp;h=b987ff9ac37d7e3b8994d5107dac0087b6ba2bd0;hb=bafc670148e70548664a2216d7f0476bde3fddd4;hp=cbdeddf7c8053714835f5427b40264353a9a8f12;hpb=6c1a84b8ace46872191383eff5c61be3ccf610d4;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index cbdeddf..b987ff9 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -273,9 +273,12 @@ void ShowHelpConsole(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 << + "[self] show the list of addresses controlled by libCEC" << 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 << @@ -289,6 +292,64 @@ void ShowHelpConsole(void) "================================================================================" << endl; } +bool ProcessCommandSELF(ICECAdapter *parser, const string &command, string & UNUSED(arguments)) +{ + if (command == "self") + { + cec_logical_addresses addr = parser->GetLogicalAddresses(); + CStdString strOut = "Addresses controlled by libCEC: "; + bool bFirst(true); + for (uint8_t iPtr = 0; iPtr <= 15; iPtr++) + { + if (addr[iPtr]) + { + strOut.AppendFormat((bFirst ? "%d%s" : ", %d%s"), iPtr, parser->IsActiveSource((cec_logical_address)iPtr) ? "*" : ""); + bFirst = false; + } + } + PrintToStdOut(strOut.c_str()); + return true; + } + + return false; +} + +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") @@ -828,7 +889,10 @@ bool ProcessConsoleCommand(ICECAdapter *parser, string &input) 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) || + ProcessCommandSELF(parser, command, input); } } return true;