X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftestclient%2Fmain.cpp;h=b6c2cafb6e49247d121db9f1085d9a426be0db68;hb=34232c9249859abed3ae97c4d4289dd6ec87a2f6;hp=372706189f11e25b3fcd548ddc4142a1cf2e1821;hpb=d484304464eec5e35c35589e797e27cdd871b959;p=deb_libcec.git diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index 3727061..b6c2caf 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -1,7 +1,7 @@ /* * This file is part of the libCEC(R) library. * - * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. * libCEC(R) is an original work, containing original code. * * libCEC(R) is a trademark of Pulse-Eight Limited. @@ -197,45 +197,41 @@ int CecAlert(void *UNUSED(cbParam), const libcec_alert type, const libcec_parame void ListDevices(ICECAdapter *parser) { - cec_adapter *devices = new cec_adapter[10]; - int8_t iDevicesFound = parser->FindAdapters(devices, 10, NULL); + cec_adapter_descriptor devices[10]; + int8_t iDevicesFound = parser->DetectAdapters(devices, 10, NULL); if (iDevicesFound <= 0) { PrintToStdOut("Found devices: NONE"); } else { - CStdString strDeviceInfo; - strDeviceInfo.Format("Found devices: %d\n\n", iDevicesFound); + PrintToStdOut("Found devices: %d\n", iDevicesFound); for (int8_t iDevicePtr = 0; iDevicePtr < iDevicesFound; iDevicePtr++) { - strDeviceInfo.AppendFormat("device: %d\ncom port: %s\n", iDevicePtr + 1, devices[iDevicePtr].comm); - libcec_configuration config; - config.Clear(); + PrintToStdOut("device: %d", iDevicePtr + 1); + PrintToStdOut("com port: %s", devices[iDevicePtr].strComName); + PrintToStdOut("vendor id: %04x", devices[iDevicePtr].iVendorId); + PrintToStdOut("product id: %04x", devices[iDevicePtr].iProductId); + PrintToStdOut("firmware version: %d", devices[iDevicePtr].iFirmwareVersion); - if (!parser->GetDeviceInformation(devices[iDevicePtr].comm, &config)) - PrintToStdOut("WARNING: unable to open the device on port %s", devices[iDevicePtr].comm); - else + if (devices[iDevicePtr].iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN) { - strDeviceInfo.AppendFormat("firmware version: %d\n", config.iFirmwareVersion); - - if (config.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN) - { - time_t buildTime = (time_t)config.iFirmwareBuildDate; - strDeviceInfo.AppendFormat("firmware build date: %s", asctime(gmtime(&buildTime))); - strDeviceInfo = strDeviceInfo.Left(strDeviceInfo.length() > 1 ? (unsigned)(strDeviceInfo.length() - 1) : 0); // strip \n added by asctime - strDeviceInfo.append(" +0000\n"); - } + time_t buildTime = (time_t)devices[iDevicePtr].iFirmwareBuildDate; + CStdString strDeviceInfo; + strDeviceInfo.AppendFormat("firmware build date: %s", asctime(gmtime(&buildTime))); + strDeviceInfo = strDeviceInfo.Left(strDeviceInfo.length() > 1 ? (unsigned)(strDeviceInfo.length() - 1) : 0); // strip \n added by asctime + strDeviceInfo.append(" +0000"); + PrintToStdOut(strDeviceInfo.c_str()); + } - if (config.adapterType != ADAPTERTYPE_UNKNOWN) - { - strDeviceInfo.AppendFormat("type: %s\n", parser->ToString(config.adapterType)); - } + if (devices[iDevicePtr].adapterType != ADAPTERTYPE_UNKNOWN) + { + PrintToStdOut("type: %s", parser->ToString(devices[iDevicePtr].adapterType)); } - strDeviceInfo.append("\n"); + + PrintToStdOut(""); } - PrintToStdOut(strDeviceInfo.c_str()); } } @@ -285,6 +281,7 @@ void ShowHelpConsole(void) "[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 << "[as] make the CEC adapter the active source." << endl << + "[is] mark the CEC adapter as inactive source." << endl << "[osd] {addr} {string} set OSD message on the specified device." << endl << "[ver] {addr} get the CEC version of the specified device." << endl << "[ven] {addr} get the vendor ID of the specified device." << endl << @@ -559,6 +556,13 @@ bool ProcessCommandAS(ICECAdapter *parser, const string &command, string & UNUSE return false; } +bool ProcessCommandIS(ICECAdapter *parser, const string &command, string & UNUSED(arguments)) +{ + if (command == "is") + return parser->SetInactiveView(); + + return false; +} bool ProcessCommandPING(ICECAdapter *parser, const string &command, string & UNUSED(arguments)) { @@ -920,6 +924,7 @@ bool ProcessConsoleCommand(ICECAdapter *parser, string &input) ProcessCommandP(parser, command, input) || ProcessCommandPA(parser, command, input) || ProcessCommandAS(parser, command, input) || + ProcessCommandIS(parser, command, input) || ProcessCommandOSD(parser, command, input) || ProcessCommandPING(parser, command, input) || ProcessCommandVOLUP(parser, command, input) ||