cec: refactor USB adapter communication. less locks, shorter locks, added documentati...
[deb_libcec.git] / src / lib / devices / CECBusDevice.h
index a4350da4bc7f93162d78fc0e5c2c682f7ae8e8ae..2bd97302f1e047fbc9a2060c0284b768291acb24 100644 (file)
@@ -40,12 +40,10 @@ namespace CEC
 {
   class CCECProcessor;
   class CCECCommandHandler;
-  class CSLCommandHandler;
 
   class CCECBusDevice
   {
     friend class CCECProcessor;
-    friend class CSLCommandHandler;
 
   public:
     CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
@@ -65,18 +63,19 @@ namespace CEC
     virtual cec_logical_address   GetMyLogicalAddress(void) const;
     virtual uint16_t              GetMyPhysicalAddress(void) const;
     virtual CStdString            GetOSDName(bool bUpdate = false);
-    virtual uint16_t              GetPhysicalAddress(bool bUpdate = false);
+    virtual uint16_t              GetPhysicalAddress(bool bUpdate = false, bool bSuppressPoll = false);
     virtual cec_power_status      GetPowerStatus(bool bUpdate = false);
     virtual CCECProcessor *       GetProcessor(void) const { return m_processor; }
     virtual cec_device_type       GetType(void) const { return m_type; }
     virtual cec_vendor_id         GetVendorId(bool bUpdate = false);
     virtual const char *          GetVendorName(bool bUpdate = false);
     virtual bool                  MyLogicalAddressContains(cec_logical_address address) const;
-    virtual cec_bus_device_status GetStatus(bool bForcePoll = false);
+    virtual cec_bus_device_status GetStatus(bool bForcePoll = false, bool bSuppressPoll = false);
     virtual bool                  IsActiveSource(void) const { return m_bActiveSource; }
     virtual bool                  IsUnsupportedFeature(cec_opcode opcode) const;
     virtual void                  SetUnsupportedFeature(cec_opcode opcode);
-    virtual void                  HandlePoll(cec_logical_address initiator);
+    virtual void                  HandlePoll(cec_logical_address destination);
+    virtual void                  HandlePollFrom(cec_logical_address initiator);
     virtual bool                  HandleReceiveFailed(void);
 
     virtual void SetInactiveSource(void);
@@ -102,23 +101,26 @@ namespace CEC
     virtual bool TransmitOSDName(cec_logical_address dest);
     virtual bool TransmitOSDString(cec_logical_address dest, cec_display_control duration, const char *strMessage);
     virtual bool TransmitPhysicalAddress(void);
+    virtual bool TransmitSetMenuLanguage(cec_logical_address dest);
     virtual bool TransmitPowerState(cec_logical_address dest);
     virtual bool TransmitPoll(cec_logical_address dest);
     virtual bool TransmitVendorID(cec_logical_address dest, bool bSendAbort = true);
     virtual bool TransmitKeypress(cec_user_control_code key, bool bWait = true);
     virtual bool TransmitKeyRelease(bool bWait = true);
 
-  protected:
     bool ReplaceHandler(bool bActivateSource = true);
+
+  protected:
+    void CheckVendorIdRequested(void);
     void MarkBusy(void);
     void MarkReady(void);
 
-    bool RequestCecVersion(void);
-    bool RequestMenuLanguage(void);
-    bool RequestPowerStatus(void);
-    bool RequestVendorId(void);
-    bool RequestPhysicalAddress(void);
-    bool RequestOSDName(void);
+    bool RequestCecVersion(bool bWaitForResponse = true);
+    bool RequestMenuLanguage(bool bWaitForResponse = true);
+    bool RequestPowerStatus(bool bWaitForResponse = true);
+    bool RequestVendorId(bool bWaitForResponse = true);
+    bool RequestPhysicalAddress(bool bWaitForResponse = true);
+    bool RequestOSDName(bool bWaitForResponse = true);
 
     bool NeedsPoll(void);
 
@@ -145,5 +147,6 @@ namespace CEC
     PLATFORM::CEvent      m_replacing;
     unsigned              m_iHandlerUseCount;
     bool                  m_bAwaitingReceiveFailed;
+    bool                  m_bVendorIdRequested;
   };
 };