Esempio n. 1
0
    def disconnect(self):
        """
        Stop the BACnet stack.  Free the IP socket.
        """
        self._log.debug('Stopping BACnet stack')
        # Freeing socket
        try:
            self.this_application.mux.directPort.handle_close()
        except:
            self.this_application.mux.broadcastPort.handle_close()

        stopBacnetIPApp()           # Stop Core
        self._stopped = True        # Stop stack thread
        self.t.join()
        self._started = False
        self._log.info('BACnet stopped')
Esempio n. 2
0
    def disconnect(self):
        """
        Stop the BACnet stack.  Free the IP socket.
        """
        self._log.debug("Stopping BACnet stack")
        # Freeing socket
        try:
            self.this_application.mux.directPort.handle_close()
        except:
            self.this_application.mux.broadcastPort.handle_close()

        stopBacnetIPApp()  # Stop Core
        self._stopped = True  # Stop stack thread
        self.t.join()
        self._started = False
        Base._used_ips.remove(self.localIPAddr)
        self._log.info("BACnet stopped")
Esempio n. 3
0
    def disconnect(self):
        """
        Stop the BACnet stack.  Free the IP socket.
        """
        self._log.debug("Stopping BACnet stack")
        # Freeing socket
        try:
            self.this_application.mux.directPort.handle_close()
        except:
            self.this_application.mux.broadcastPort.handle_close()

        stopBacnetIPApp()  # Stop Core
        self._stopped = True  # Stop stack thread
        self.t.join()
        self._started = False
        Base._used_ips.remove(self.localIPAddr)
        self._log.info("BACnet stopped")
Esempio n. 4
0
 def _startAppThread(self):
     """
     Starts the BACnet stack in its own thread so requests can be processed.
     As signal cannot be called in another thread than the main thread
     when calling startBacnetIPApp, we must pass None to both parameters
     """
     self._log.info("Starting app...")
     enable_sleeping(0.0005)
     self.t = Thread(
         target=startBacnetIPApp,
         kwargs={"sigterm": None, "sigusr1": None},
         daemon=True,
     )
     try:
         self.t.start()
         self._started = True
         self._log.info("BAC0 started")
     except OSError:
         stopBacnetIPApp()
         self.t.join()
         raise
Esempio n. 5
0
 def stopApp(self):
     """
     Used to stop the application
     Free the socket using ``handle_close()`` function
     Stop the thread
     """
     print('Stopping app')
     # Freeing socket
     try:
         self.this_application.mux.directPort.handle_close()
     except:
         self.this_application.mux.broadcastPort.handle_close()
     
     # Stopping Core        
     stopBacnetIPApp()
     self._stopped = True        
     # Stopping thread
     #print(Thread.is_alive)
     self.t.join()
     self._started = False
     print('App stopped')
Esempio n. 6
0
    def stopApp(self):
        """
        Used to stop the application
        Free the socket using ``handle_close()`` function
        Stop the thread
        """
        print('Stopping app')
        # Freeing socket
        try:
            self.this_application.mux.directPort.handle_close()
        except:
            self.this_application.mux.broadcastPort.handle_close()

        # Stopping Core
        stopBacnetIPApp()
        self._stopped = True
        # Stopping thread
        #print(Thread.is_alive)
        self.t.join()
        self._started = False
        print('App stopped')
Esempio n. 7
0
 def _startAppThread(self):
     """
     Starts the BACnet stack in its own thread so requests can be processed.
     As signal cannot be called in another thread than the main thread
     when calling startBacnetIPApp, we must pass None to both parameters
     """
     self._log.info("Starting app...")
     enable_sleeping(0.0005)
     self.t = Thread(
         target=startBacnetIPApp,
         kwargs={
             "sigterm": None,
             "sigusr1": None
         },
         daemon=True,
     )
     try:
         self.t.start()
         self._started = True
         self._log.info("BAC0 started")
     except OSError:
         stopBacnetIPApp()
         self.t.join()
         raise