X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftestclient%2Fmain.cpp;h=1b13848021c7bc2bf694efa0f6af90dedf9f91f3;hb=2f37cb68d7f3c71c38065e0e830c564a01b6caf3;hp=0a7a9be9874326691bbb2ea07142d78daee3963e;hpb=988de7b930e56f4acc1d03afd5e01cea9b67754f;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 0a7a9be..1b13848 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -40,6 +40,7 @@ #include #include "../lib/platform/threads.h" #include "../lib/util/StdString.h" +#include "../lib/implementations/CECCommandHandler.h" using namespace CEC; using namespace std; @@ -226,7 +227,7 @@ void ShowHelpConsole(void) "[on] {address} power on the device with the given logical address." << endl << "[standby] {address} put the device with the given address in standby mode." << endl << "[la] {logical address} change the logical address of the CEC adapter." << endl << - "[p] {port number} change the HDMI port number of the CEC adapter." << endl << + "[p] {device} {port} change the HDMI port number of the CEC adapter." << endl << "[pa] {physical address} change the physical address of the CEC adapter." << endl << "[osd] {addr} {string} set OSD message on the specified device." << endl << "[ver] {addr} get the CEC version of the specified device." << endl << @@ -241,6 +242,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 << + "[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 << @@ -443,7 +445,7 @@ int main (int argc, char *argv[]) if (iHDMIPort > 0) { - parser->SetHDMIPort((uint8_t)iHDMIPort); + parser->SetHDMIPort((cec_logical_address)CEC_DEFAULT_BASE_DEVICE, (uint8_t)iHDMIPort); FlushLog(parser); } @@ -558,10 +560,10 @@ int main (int argc, char *argv[]) } else if (command == "p") { - string strvalue; - if (GetWord(input, strvalue)) + string strPort, strDevice; + if (GetWord(input, strDevice) && GetWord(input, strPort)) { - parser->SetHDMIPort((uint8_t)atoi(strvalue.c_str())); + parser->SetHDMIPort((cec_logical_address)atoi(strDevice.c_str()), (uint8_t)atoi(strPort.c_str())); } } else if (command == "pa") @@ -740,7 +742,33 @@ int main (int argc, char *argv[]) cec_logical_addresses addresses = parser->GetActiveDevices(); for (uint8_t iPtr = 0; iPtr < 16; iPtr++) if (addresses[iPtr]) - cout << "logical address " << iPtr << endl; + 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") {