Guest User

Untitled

a guest
Jan 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.57 KB | None | 0 0
  1. Index: Modules/InterPlatformComms/ZigbeeConnector.cpp
  2. ===================================================================
  3. --- Modules/InterPlatformComms/ZigbeeConnector.cpp  (revision 4433)
  4. +++ Modules/InterPlatformComms/ZigbeeConnector.cpp  (working copy)
  5. @@ -61,6 +61,7 @@
  6.  
  7.  ipc::ZigbeeConnector::ZigbeeConnector(VDK::IOID p_device, const ipc::NetworkAddress &p_address, VDK::ThreadID ipcThread)
  8.      : m_open(true),
  9. +      m_device(p_device),
  10.        m_uart( static_cast<VDK::DeviceDescriptor>(UINT_MAX) ),
  11.        m_bucket(128),
  12.        m_tftpport( htons(69) ),
  13. @@ -73,8 +74,7 @@
  14.  
  15.      // reset Zigbee
  16.      *pPORTHIO_CLEAR = PH6;
  17. -    char flags = O_FLOWDIS;
  18. -    m_uart = VDK::OpenDevice(p_device, &flags);
  19. +    Resume_Impl();
  20.      VDK::Sleep(ZIGBEE_RESET_TOUT);
  21.      *pPORTHIO_SET = PH6;
  22.  }
  23. @@ -338,6 +338,18 @@
  24.      return !m_output.empty();
  25.  }
  26.  
  27. +void ipc::ZigbeeConnector::Pause_Impl()
  28. +{
  29. +    VDK::CloseDevice(m_uart);
  30. +    m_uart = static_cast<VDK::DeviceDescriptor>(UINT_MAX);
  31. +}
  32. +
  33. +void ipc::ZigbeeConnector::Resume_Impl()
  34. +{
  35. +    char flags = O_FLOWDIS;
  36. +    m_uart = VDK::OpenDevice(m_device, &flags);
  37. +}
  38. +
  39.  void ipc::ZigbeeConnector::DoWrite_Impl()
  40.  {
  41.      utils::ScopedLock lock(m_mutex);
  42. Index: Modules/InterPlatformComms/ZigbeeConnector.hpp
  43. ===================================================================
  44. --- Modules/InterPlatformComms/ZigbeeConnector.hpp  (revision 4433)
  45. +++ Modules/InterPlatformComms/ZigbeeConnector.hpp  (working copy)
  46. @@ -103,6 +103,11 @@
  47.  
  48.      virtual void Close_Impl();
  49.  
  50. +    virtual void Pause_Impl();
  51. +
  52. +    virtual void Resume_Impl();
  53. +
  54. +    VDK::IOID            m_device;
  55.      ipc::Session::Socket m_uart;
  56.      bool                 m_open;
  57.      uint32_t             m_bucket;
  58. Index: Modules/InterPlatformComms/Reactor.hpp
  59. ===================================================================
  60. --- Modules/InterPlatformComms/Reactor.hpp  (revision 4433)
  61. +++ Modules/InterPlatformComms/Reactor.hpp  (working copy)
  62. @@ -111,6 +111,7 @@
  63.      void Pause()
  64.      {
  65.          m_paused = true;
  66. +        Pause_Impl();
  67.          assert(ShouldWrite() == false);
  68.          assert(ShouldRead()  == false);
  69.      }
  70. @@ -118,6 +119,7 @@
  71.      void Resume()
  72.      {
  73.          m_paused = false;
  74. +        Resume_Impl();
  75.      }
  76.  
  77.      virtual ~Session()
  78. @@ -154,6 +156,8 @@
  79.      virtual void DoWrite_Impl() = 0;
  80.      virtual bool IsOpen_Impl() const = 0;
  81.      virtual void Close_Impl() = 0;
  82. +    virtual void Pause_Impl()  { };
  83. +    virtual void Resume_Impl() { };
  84.  
  85.      ipc::Reactor *m_reactor;        ///< parent reactor
  86.  };
Add Comment
Please, Sign In to add comment