def deactivate(self):
        """
        Deactivate the sensor to stop sending and receiving packets.

        Classes that inherit this base class may extend this method.
        """

        super(RF_Sensor, self).deactivate()

        if self._activated:
            self._activated = False

        if self._connection is not None:
            # Close the connection and clean up so that the thread might get 
            # the signal faster and we can correctly reactivate later on.
            self._connection.close()
            self._connection = None