X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Ftestclient%2Fmain.cpp;h=c67f0cc90ef020f0a0ef2d5b563c5c006c3c544c;hb=ddb76c470aa282f59064c8e2ffe20a0785463167;hp=4156d05ba9c59aed1a59d32a330a03fb5f6cd921;hpb=403398523c7fbae86cbc527473ea54d78bb3d763;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 4156d05..c67f0cc 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -42,7 +42,7 @@ using namespace CEC; using namespace std; -#define CEC_TEST_CLIENT_VERSION 5 +#define CEC_TEST_CLIENT_VERSION 6 inline bool HexStrToInt(const std::string& data, uint8_t& value) @@ -168,13 +168,22 @@ void show_console_help(void) "tx {bytes} transfer bytes over the CEC line." << endl << "[tx 40 00 FF 11 22 33] sends bytes 0x40 0x00 0xFF 0x11 0x22 0x33" << endl << endl << + "on {address} power on the device with the given logical address." << endl << + "[on 5] power on a connected audio system" << endl << + endl << + "standby {address} put the device with the given address in standby mode." << endl << + "[standby 0] powers off the TV" << endl << + endl << "la {logical_address} change the logical address of the CEC adapter." << endl << "[la 4] logical address 4" << endl << endl << "[ping] send a ping command to the CEC adapter." << endl << - "[bl] to let the adapter enter the bootloader, to upgrade the flash rom." << endl << + "[bl] to let the adapter enter the bootloader, to upgrade" << endl << + " the flash rom." << endl << + "[r] reconnect to the CEC adapter." << endl << "[h] or [help] show this help." << endl << - "[q] or [quit] to quit the CEC test client and switch off all connected CEC devices." << endl << + "[q] or [quit] to quit the CEC test client and switch off all" << endl << + " connected CEC devices." << endl << "================================================================================" << endl; } @@ -267,7 +276,7 @@ int main (int argc, char *argv[]) { string strvalue; uint8_t ivalue; - cec_frame bytes; + cec_command bytes; bytes.clear(); while (GetWord(input, strvalue) && HexStrToInt(strvalue, ivalue)) @@ -275,6 +284,32 @@ int main (int argc, char *argv[]) parser->Transmit(bytes); } + else if (command == "on") + { + string strValue; + uint8_t iValue = 0; + if (GetWord(input, strValue) && HexStrToInt(strValue, iValue) && iValue <= 0xF) + { + parser->PowerOnDevices((cec_logical_address) iValue); + } + else + { + cout << "invalid destination" << endl; + } + } + else if (command == "standby") + { + string strValue; + uint8_t iValue = 0; + if (GetWord(input, strValue) && HexStrToInt(strValue, iValue) && iValue <= 0xF) + { + parser->StandbyDevices((cec_logical_address) iValue); + } + else + { + cout << "invalid destination" << endl; + } + } else if (command == "la") { string strvalue;