cec: added Toshiba's vendor id, and set the device ID of the primary device to Toshib...
[deb_libcec.git] / src / lib / devices / CECBusDevice.h
index ba686322ca3fe9dab6c87b3817b3afa1f1306477..30ac2dc788df51c50251eaae0c8a4488799ccc03 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
  *     http://www.pulse-eight.net/
  */
 
-#include <cectypes.h>
+#include "../../../include/cectypes.h"
 #include <set>
-#include "../platform/os.h"
+#include "../platform/threads/mutex.h"
+#include "../platform/util/StdString.h"
 
 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);
@@ -75,6 +74,8 @@ namespace CEC
     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 bool                  HandleReceiveFailed(void);
 
     virtual void SetInactiveSource(void);
     virtual void SetActiveSource(void);
@@ -93,6 +94,7 @@ namespace CEC
 
     virtual bool TransmitActiveSource(void);
     virtual bool TransmitCECVersion(cec_logical_address dest);
+    virtual bool TransmitImageViewOn(void);
     virtual bool TransmitInactiveSource(void);
     virtual bool TransmitMenuState(cec_logical_address dest);
     virtual bool TransmitOSDName(cec_logical_address dest);
@@ -104,8 +106,12 @@ namespace CEC
     virtual bool TransmitKeypress(cec_user_control_code key, bool bWait = true);
     virtual bool TransmitKeyRelease(bool bWait = true);
 
+    bool ReplaceHandler(bool bActivateSource = true);
+
   protected:
-    bool ReplaceHandler(bool bInitHandler = true);
+    void CheckVendorIdRequested(void);
+    void MarkBusy(void);
+    void MarkReady(void);
 
     bool RequestCecVersion(void);
     bool RequestMenuLanguage(void);
@@ -136,5 +142,9 @@ namespace CEC
     std::set<cec_opcode>  m_unsupportedFeatures;
     PLATFORM::CMutex      m_mutex;
     PLATFORM::CMutex      m_handlerMutex;
+    PLATFORM::CEvent      m_replacing;
+    unsigned              m_iHandlerUseCount;
+    bool                  m_bAwaitingReceiveFailed;
+    bool                  m_bVendorIdRequested;
   };
 };