cec: added GetDeviceVendorId()/cec_get_device_vendor_id()
[deb_libcec.git] / src / testclient / main.cpp
index b8482d7fd422f83593ba17ce8fbddff7ee3e008e..38f6b5bd8eaaba8832890680da9e27d7325a827f 100644 (file)
@@ -221,6 +221,12 @@ 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 <<
+  "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 <<
   "[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 <<
@@ -388,6 +394,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();
@@ -492,6 +502,39 @@ int main (int argc, char *argv[])
         {
           parser->StartBootloader();
         }
+        else if (command == "lang")
+        {
+          CStdString strDev;
+          if (GetWord(input, strDev))
+          {
+            int iDev = atoi(strDev);
+            if (iDev >= 0 && iDev < 15)
+            {
+              CStdString strLog;
+              cec_menu_language language;
+              if (parser->GetDeviceMenuLanguage((cec_logical_address) iDev, &language))
+                strLog.Format("menu language '%s'", language.language);
+              else
+                strLog = "failed!";
+              cout << strLog.c_str() << endl;
+            }
+          }
+        }
+        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;