Beispiel #1
0
def test_Anruf_erlauben():
    u = inte_testutils.TestUtil()
    u.unblock_callerid(TelephoneNumber('0790000001'))

    call = u.make_call_to_incoming(callerid='0790000001')
    LOG.info('call: %s', call)
    sleep_until(lambda: 'Ringing' in call.get_call_states() or 'Up' in call.get_call_states(), 5)
    call.hangup()

    states = call.get_call_states()
    LOG.info('states: %s', states)
    assert_true('Ringing' in states,
                'Das analoge Telefon sollte angerufen worden sein, aber es gab keinen "Ringing" Status.')
    call.stop()
Beispiel #2
0
 def set_wait(self, value=0, sec=1, interruptible=None):
     """
     enable led for X seconds, then disable.
     :param value: value for led (0 is off, 100 is full)
     :param sec: how many seconds to enable
     :type sec: float
     :param interruptible: a function the returns True if the animation should be stopped
     """
     self.set(value)
     if interruptible:
         sleep_until(lambda: interruptible.is_interrupted(), sec)
     else:
         time.sleep(sec)
     self.set(0)
Beispiel #3
0
def test_Anruf_blockieren():
    u = inte_testutils.TestUtil()
    u.block_callerid(TelephoneNumber("0790000002"))

    call = u.make_call_to_incoming(callerid="0790000002")

    sleep_until(lambda: "Ringing" in call.get_call_states() or "Up" in call.get_call_states(), 5)
    call.hangup()

    states = call.get_call_states()
    assert_false(
        "Ringing" in states, 'Das analoge Telefon sollte NICHT angerufen werden, aber es gab einen "Ringing" Status.'
    )
    call.stop()
Beispiel #4
0
    def set_wait(self, red=0, green=0, blue=0, sec=1, interruptible=None):
        """
        enable led for X seconds, then disable. (used only by Animation implementations)
        :param red: value for red (0 is off, 100 is full)
        :param green:value for green (0 is off, 100 is full)
        :param blue:value for blue (0 is off, 100 is full)
        :param sec: how many seconds to wait
        :type sec: float
        :param interruptible: a function the returns True if the animation should be stopped
        """

        self.set(red, green, blue)
        if interruptible:
            sleep_until(lambda: interruptible.is_interrupted(), sec)
        else:
            time.sleep(sec)
        self.set(0, 0, 0)
Beispiel #5
0
 def _run(self):
     """ internal function that runs endless loop  """
     while True:
         # get message from the queue, wait if there is no message
         msg = self._queue.get(block=True)
         # set the cursor to row 0, column 0
         self.lcd.home()
         start_time = time.time()
         while self._queue.empty() and (time.time() - start_time) < msg.duration:
             # the display is always filled with spaces. This avoids the requirement to call clear() and this
             # avoids flickering.
             self.lcd.write_string(msg.get_line1())
             self.lcd.write_string(msg.get_line2())
             # scroll the text one step
             msg.scroll()
             # sleep to keep the scrolling text for a moment (but stop if there is another message waiting)
             sleep_until(lambda: not self._queue.empty(), Display.SCROLL_STEP_DURATION)
         # if the queue is empty and there is a standby function: run it.
         if self._queue.empty():
             if self.standby_function:
                 self.standby_function()