forked from LUG-Saar/fetapi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
3.3 KiB
86 lines
3.3 KiB
import time |
|
from phoneinterface import PhoneInterface, PhoneEvent |
|
from apparatinterface import FeApPinConfiguration, FeApUserInterface |
|
import configreader |
|
import statemachine |
|
|
|
|
|
FeTAp = """ |
|
,ooFeTApFeTApFeTA%=+-,. |
|
,+FeTAp+' `o,, |
|
,oFeTAp+ `, |
|
,ooo' ,oFeTApFeTAp o |
|
oo +FeTAp+' `oo, H |
|
o o' X o l |
|
,@=@+ o ,,-+*==+-., R o .; |
|
,@=@+ o o' ,/ 22 11 ``, E`ooooo' |
|
@@* @@ oo o' / 33 , ` ` , ; T |
|
@:n T:@ oo o ; 44 , . \ L |
|
uM:m A:K oFeTAp' ;55 , : ; A |
|
E:Rn N:t F, | ` : ; | H |
|
SC:h K:o e, ` 66 ` , dHHH C |
|
A:Ll L:s r, ` 77 `. , . 0 `q/ S |
|
ER:a P:U n, \ 88 99 00 ,' L |
|
R:Be i:M s `<,,______,-` sZ, E |
|
i:T E:r p, `sZ B |
|
S:K l:T r, A |
|
o:N H:a e, G |
|
t:a s:c c, ,x+x+' |
|
k:T:@:U:M:R:n; h, ,p+e+r+a+t/ |
|
`@:n:M:E:' `T=i=s=c=h=A=p/ |
|
""" |
|
|
|
controller = None |
|
|
|
def gabelschalter_cb(state): |
|
if state == 1: |
|
controller.queue_event('gabelschalter_up') |
|
else: |
|
controller.queue_event('gabelschalter_down') |
|
|
|
def nummernschalter_active_cb(): |
|
controller.queue_event('nummernschalter_active') |
|
|
|
def nummernschalter_done_cb(digit): |
|
controller.queue_event('nummernschalter_input', digit) |
|
|
|
def phone_cb(event): |
|
if event == PhoneEvent.RegInProgress: |
|
controller.queue_event('registration_in_progress') |
|
elif event == PhoneEvent.RegSuccessfull: |
|
controller.queue_event('registration_successful') |
|
elif event == PhoneEvent.RegLost: |
|
controller.queue_event('registration_lost') |
|
elif event == PhoneEvent.CallIncoming: |
|
controller.queue_event('incoming_call') |
|
elif event == PhoneEvent.CallAccepted: |
|
controller.queue_event('call_accepted') |
|
elif event == PhoneEvent.CallEnded: |
|
controller.queue_event('call_ended') |
|
elif event == PhoneEvent.CallRinging: |
|
controller.queue_event('call_ringing') |
|
elif event == PhoneEvent.CallBusy: |
|
controller.queue_event('call_ended') |
|
elif event == PhoneEvent.CallInvalidNumber: |
|
controller.queue_event('invalid_number') |
|
|
|
if __name__ == '__main__': |
|
print FeTAp |
|
|
|
cfg = configreader.ConfigurationReader() |
|
cfg.read('fetap.ini') |
|
|
|
phone = PhoneInterface(cfg.phoneconfig) |
|
feap = FeApUserInterface(cfg.pinconfig) |
|
controller = statemachine.StateMachineController(phone, feap, cfg.dialconfig) |
|
|
|
phone.start() |
|
try: |
|
while True: |
|
time.sleep(1) |
|
|
|
except KeyboardInterrupt: |
|
phone.stop() |
|
feap.set_wecker(False) |
|
c.stop() |
|
|
|
|