Ejemplo n.º 1
0
def test_call_state_refuse_during_call():
    received_events = set()

    def listener(event, call_state):
        received_events.add(call_state.get_current_state())

    c = CallState()
    c.add_listener(listener)
    assert c.is_disconnected

    # disconnected -> ringing
    c.permit()
    assert c.is_ringing
    assert 'ringing' in received_events

    # ringing -> connected
    c.answer()
    assert c.is_connected
    assert 'connected' in received_events

    received_events = set()

    # connected -> refusing
    c.refuse()
    assert c.is_refusing
    assert 'refusing' in received_events

    assert c.is_refusing
    assert 'connected' not in received_events

    # refusing -> disconnected
    c.hangup()
    assert c.is_disconnected
    assert 'disconnected' in received_events
Ejemplo n.º 2
0
def test_call_state_refuse():
    received_events = set()

    def listener(event, call_state):
        received_events.add(call_state.get_current_state())

    c = CallState()
    c.add_listener(listener)
    assert c.is_disconnected

    # disconnected -> refusing
    c.refuse()
    assert c.is_refusing
    assert 'refusing' in received_events

    try:
        # refusing -> connected is not possible
        c.answer()
        raise AssertionError('can not trannsition from refusing to connected')
    except:
        pass
    assert c.is_refusing
    assert 'connected' not in received_events

    # refusing -> disconnected
    c.hangup()
    assert c.is_disconnected
    assert 'disconnected' in received_events
Ejemplo n.º 3
0
Archivo: ui.py Proyecto: synox/telewall
def start():
    """  start running the ui. GPIO must only be loaded when it is stared, as the library is not available on the
         build computer.
    """
    from RPi import GPIO
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)  # use pin numbers as written on the board

    main_led.start()
    button_led.start()
    display.start()
    button.start()

    CallState.add_listener(on_call_state_change)

    main_led.queue(Startup())
    button_led.queue(StartupButton())
    display.show(10, 'Telewall')