added the type of adapter to libcec_configuration, and display the type in cec-client...
[deb_libcec.git] / src / lib / adapter / Pulse-Eight / USBCECAdapterMessage.cpp
index f213c1dda81238bac53ccac8a69aa051a70deee3..64efd062f5f58ab60a2666e4c6c82bab673cabb3 100644 (file)
@@ -126,9 +126,14 @@ std::string CCECAdapterMessage::ToString(void) const
         strMsg.AppendFormat(" %02x %s", At(2), IsEOM() ? "eom" : "");
       break;
     default:
-      for (uint8_t iPtr = 2; iPtr < Size(); iPtr++)
-        if (At(iPtr) != MSGEND)
-          strMsg.AppendFormat(" %02x", At(iPtr));
+      if (Size() >= 2 && (Message() == MSGCODE_COMMAND_ACCEPTED || Message() == MSGCODE_COMMAND_REJECTED))
+        strMsg.AppendFormat(": %s", ToString((cec_adapter_messagecode)At(2)));
+      else
+      {
+        for (uint8_t iPtr = 2; iPtr < Size(); iPtr++)
+          if (At(iPtr) != MSGEND)
+            strMsg.AppendFormat(" %02x", At(iPtr));
+      }
       break;
     }
   }
@@ -224,6 +229,8 @@ const char *CCECAdapterMessage::ToString(cec_adapter_messagecode msgCode)
     return "SET_OSD_NAME";
   case MSGCODE_WRITE_EEPROM:
     return "WRITE_EEPROM";
+  case MSGCODE_GET_ADAPTER_TYPE:
+    return "GET_ADAPTER_TYPE";
   default:
     break;
   }
@@ -329,6 +336,13 @@ cec_adapter_messagecode CCECAdapterMessage::Message(void) const
       MSGCODE_NOTHING;
 }
 
+cec_adapter_messagecode CCECAdapterMessage::ResponseTo(void) const
+{
+  return packet.size >= 3 ?
+      (cec_adapter_messagecode) (packet.At(2) & ~(MSGCODE_FRAME_EOM | MSGCODE_FRAME_ACK)) :
+      MSGCODE_NOTHING;
+}
+
 bool CCECAdapterMessage::IsTranmission(void) const
 {
   cec_adapter_messagecode msgCode = Message();