Browse Source

Merge branch 'master' of git.13e7.de:fetap

pull/1/head
Fr3deric 9 years ago
parent
commit
7730762f87
  1. 7
      configreader.py
  2. 1
      fetap.ini.example
  3. 1
      phoneinterface.py
  4. 5
      tuitest.py

7
configreader.py

@ -15,6 +15,7 @@ class ConfigurationReader(object):
'pin_wecker_enable': '16', 'pin_wecker_enable': '16',
'pin_wecker_a': '18', 'pin_wecker_a': '18',
'pin_wecker_b': '19', 'pin_wecker_b': '19',
'invert_gs' : 'false',
'default_proxy': '' 'default_proxy': ''
} }
@ -35,6 +36,9 @@ class ConfigurationReader(object):
def __get_global_val_int(self, option): def __get_global_val_int(self, option):
return int(self.__cp.get('fetapd', option)) return int(self.__cp.get('fetapd', option))
def __get_global_val_bool(self, option):
return self.__cp.get('fetapd', option).lower() in ['true', 'yes', '1']
def __get_proxy_val(self, proxyname, option): def __get_proxy_val(self, proxyname, option):
return self.__cp.get('proxy_'+proxyname, option) return self.__cp.get('proxy_'+proxyname, option)
@ -67,7 +71,8 @@ class ConfigurationReader(object):
pin_schauzeichen = self.__get_global_val_int('pin_schauzeichen'), pin_schauzeichen = self.__get_global_val_int('pin_schauzeichen'),
pin_wecker_enable = self.__get_global_val_int('pin_wecker_enable'), pin_wecker_enable = self.__get_global_val_int('pin_wecker_enable'),
pin_wecker_a = self.__get_global_val_int('pin_wecker_a'), pin_wecker_a = self.__get_global_val_int('pin_wecker_a'),
pin_wecker_b = self.__get_global_val_int('pin_wecker_b') pin_wecker_b = self.__get_global_val_int('pin_wecker_b'),
invert_gs = self.__get_global_val_bool('invert_gs'),
) )
self.__dialconfig = fetapdtest.DialConfiguration( self.__dialconfig = fetapdtest.DialConfiguration(

1
fetap.ini.example

@ -10,6 +10,7 @@ pin_schauzeichen = 12
pin_wecker_enable = 16 pin_wecker_enable = 16
pin_wecker_a = 18 pin_wecker_a = 18
pin_wecker_b = 19 pin_wecker_b = 19
invert_gs = false
; Zeit bevor ein eingehender Anruf automatisch abgewiesen wird ; Zeit bevor ein eingehender Anruf automatisch abgewiesen wird
incoming_timeout = 60 incoming_timeout = 60

1
phoneinterface.py

@ -159,6 +159,7 @@ class PhoneInterface(object):
# Try to resolve prefix # Try to resolve prefix
for p in self.__config.proxies: for p in self.__config.proxies:
if number.startswith(p.prefix): if number.startswith(p.prefix):
number = number[len(p.prefix):]
number += '@' + p.realm number += '@' + p.realm
break break
self.__core.invite(number) self.__core.invite(number)

5
tuitest.py

@ -7,7 +7,7 @@ import threading
class FeApPinConfiguration(object): class FeApPinConfiguration(object):
def __init__(self, gpio_numbering, pin_nsa, pin_nsi, pin_gabelschalter, def __init__(self, gpio_numbering, pin_nsa, pin_nsi, pin_gabelschalter,
pin_schauzeichen, pin_wecker_enable, pin_wecker_a, pin_schauzeichen, pin_wecker_enable, pin_wecker_a,
pin_wecker_b): pin_wecker_b, invert_gs):
if gpio_numbering == 'BOARD': if gpio_numbering == 'BOARD':
gpio_numbering = gpio.BOARD gpio_numbering = gpio.BOARD
elif gpio_numbering == 'BCM': elif gpio_numbering == 'BCM':
@ -23,6 +23,7 @@ class FeApPinConfiguration(object):
self.pin_wecker_enable = pin_wecker_enable self.pin_wecker_enable = pin_wecker_enable
self.pin_wecker_a = pin_wecker_a self.pin_wecker_a = pin_wecker_a
self.pin_wecker_b = pin_wecker_b self.pin_wecker_b = pin_wecker_b
self.invert_gs = invert_gs
class FeApUserInterface(object): class FeApUserInterface(object):
def __init__(self, pinconfig): def __init__(self, pinconfig):
@ -69,6 +70,8 @@ class FeApUserInterface(object):
def __on_gabelschalter_change(self, pin): def __on_gabelschalter_change(self, pin):
gbstate = gpio.input(self.__pinconfig.pin_gabelschalter) gbstate = gpio.input(self.__pinconfig.pin_gabelschalter)
if self.__pinconfig.invert_gs:
gbstate = 1 - gbstate
print 'gabelschalter:', gbstate print 'gabelschalter:', gbstate
for cb in self.__gabelschalter_callbacks: for cb in self.__gabelschalter_callbacks:
cb(gbstate) cb(gbstate)

Loading…
Cancel
Save