X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftestclient%2Fmain.cpp;h=33cbd88e2cec3ebec16cf97394061723a40ea14a;hb=5eb9e3af7e3ef69a7acb98d32b6275156a6ff8b0;hp=3117ee689d5564e20e30d71f06c361a948db5742;hpb=a3269a0a9e8973e29cfe073dd8e558aad173f984;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 3117ee6..33cbd88 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -221,9 +221,15 @@ void show_console_help(void) "ver {addr} get the CEC version of the specified device." << endl << "[ver 0] get the CEC version of the TV" << endl << endl << - "lang {addr get the menu language of the specified device." << endl << + "ven {addr} get the vendor ID of the specified device." << endl << + "[ven 0] get the vendor ID of the TV" << endl << + endl << + "lang {addr} get the menu language of the specified device." << endl << "[lang 0] get the menu language of the TV" << endl << endl << + "pow {addr} get the power status of the specified device." << endl << + "[pow 0] get the power status of the TV" << endl << + 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 << @@ -391,6 +397,10 @@ int main (int argc, char *argv[]) { flush_log(parser); + /* just ignore the command buffer and clear it */ + cec_command dummy; + while (parser && parser->GetNextCommand(&dummy)) {} + string input; getline(cin, input); cin.clear(); @@ -513,6 +523,21 @@ int main (int argc, char *argv[]) } } } + else if (command == "ven") + { + CStdString strDev; + if (GetWord(input, strDev)) + { + int iDev = atoi(strDev); + if (iDev >= 0 && iDev < 15) + { + uint64_t iVendor = parser->GetDeviceVendorId((cec_logical_address) iDev); + CStdString strLog; + strLog.Format("vendor id: %06x", iVendor); + cout << strLog.c_str() << endl; + } + } + } else if (command == "ver") { CStdString strDev; @@ -543,6 +568,36 @@ int main (int argc, char *argv[]) } } } + else if (command == "pow") + { + CStdString strDev; + if (GetWord(input, strDev)) + { + int iDev = atoi(strDev); + if (iDev >= 0 && iDev < 15) + { + cec_power_status iPower = parser->GetDevicePowerStatus((cec_logical_address) iDev); + switch (iPower) + { + case CEC_POWER_STATUS_ON: + cout << "powered on" << endl; + break; + case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY: + cout << "on -> standby" << endl; + break; + case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON: + cout << "standby -> on" << endl; + break; + case CEC_POWER_STATUS_STANDBY: + cout << "standby" << endl; + break; + default: + cout << "unknown power status" << endl; + break; + } + } + } + } else if (command == "r") { cout << "closing the connection" << endl;