X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftestclient%2Fmain.cpp;h=b987ff9ac37d7e3b8994d5107dac0087b6ba2bd0;hb=80b72250dc1f336839ff2f13fd5247e7f273fb42;hp=c8e6819f091ba6741d06e9e685ee41fd5e7d406f;hpb=66e5bd7231e47eaef8a6472856443b4acffb48bd;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index c8e6819..b987ff9 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -278,6 +278,7 @@ void ShowHelpConsole(void) "[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 << @@ -291,6 +292,28 @@ 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") @@ -868,7 +891,8 @@ bool ProcessConsoleCommand(ICECAdapter *parser, string &input) ProcessCommandLOG(parser, command, input) || ProcessCommandSCAN(parser, command, input) || ProcessCommandSP(parser, command, input) || - ProcessCommandSPL(parser, command, input); + ProcessCommandSPL(parser, command, input) || + ProcessCommandSELF(parser, command, input); } } return true;