| 932 | } |
| 933 | |
| 934 | bool ProcessCommandSCAN(ICECAdapter *parser, const std::string &command, std::string & UNUSED(arguments)) |
| 935 | { |
| 936 | if (command == "scan") |
| 937 | { |
| 938 | std::string strLog; |
| 939 | PrintToStdOut("requesting CEC bus information ..."); |
| 940 | |
| 941 | strLog.append("CEC bus information\n===================\n"); |
| 942 | cec_logical_addresses addresses = parser->GetActiveDevices(); |
| 943 | cec_logical_address activeSource = parser->GetActiveSource(); |
| 944 | for (uint8_t iPtr = 0; iPtr < 16; iPtr++) |
| 945 | { |
| 946 | if (addresses[iPtr]) |
| 947 | { |
| 948 | uint64_t iVendorId = parser->GetDeviceVendorId((cec_logical_address)iPtr); |
| 949 | uint16_t iPhysicalAddress = parser->GetDevicePhysicalAddress((cec_logical_address)iPtr); |
| 950 | bool bActive = parser->IsActiveSource((cec_logical_address)iPtr); |
| 951 | cec_version iCecVersion = parser->GetDeviceCecVersion((cec_logical_address)iPtr); |
| 952 | cec_power_status power = parser->GetDevicePowerStatus((cec_logical_address)iPtr); |
| 953 | std::string osdName = parser->GetDeviceOSDName((cec_logical_address)iPtr); |
| 954 | std::string strAddr; |
| 955 | strAddr = StringUtils::Format("%x.%x.%x.%x", (iPhysicalAddress >> 12) & 0xF, (iPhysicalAddress >> 8) & 0xF, (iPhysicalAddress >> 4) & 0xF, iPhysicalAddress & 0xF); |
| 956 | std::string lang = parser->GetDeviceMenuLanguage((cec_logical_address)iPtr); |
| 957 | |
| 958 | strLog += StringUtils::Format("device #%X: %s\n", (int)iPtr, parser->ToString((cec_logical_address)iPtr)); |
| 959 | strLog += StringUtils::Format("address: %s\n", strAddr.c_str()); |
| 960 | strLog += StringUtils::Format("active source: %s\n", (bActive ? "yes" : "no")); |
| 961 | strLog += StringUtils::Format("vendor: %s\n", parser->ToString((cec_vendor_id)iVendorId)); |
| 962 | strLog += StringUtils::Format("osd string: %s\n", osdName.c_str()); |
| 963 | strLog += StringUtils::Format("CEC version: %s\n", parser->ToString(iCecVersion)); |
| 964 | strLog += StringUtils::Format("power status: %s\n", parser->ToString(power)); |
| 965 | strLog += StringUtils::Format("language: %s\n", lang.c_str()); |
| 966 | strLog.append("\n\n"); |
| 967 | } |
| 968 | } |
| 969 | |
| 970 | activeSource = parser->GetActiveSource(); |
| 971 | strLog += StringUtils::Format("currently active source: %s (%d)", parser->ToString(activeSource), (int)activeSource); |
| 972 | |
| 973 | PrintToStdOut(strLog.c_str()); |
| 974 | return true; |
| 975 | } |
| 976 | |
| 977 | return false; |
| 978 | } |
| 979 | |
| 980 | #if CEC_LIB_VERSION_MAJOR >= 5 |
| 981 | bool ProcessCommandSTATS(ICECAdapter *parser, const std::string &command, std::string & UNUSED(arguments)) |
no test coverage detected