r237 - in trunk/software/pyneod: . pygsm
smartphones-commits at lists.linuxtogo.org
smartphones-commits at lists.linuxtogo.org
Mon Apr 21 10:30:47 CEST 2008
Author: emdete
Date: 2008-04-21 10:30:43 +0200 (Mon, 21 Apr 2008)
New Revision: 237
Modified:
trunk/software/pyneod/Makefile
trunk/software/pyneod/base.py
trunk/software/pyneod/freesmartphone.py
trunk/software/pyneod/pygsm/attention.py
trunk/software/pyneod/pygsm/genericmodem.py
trunk/software/pyneod/pygsmd.py
trunk/software/pyneod/pypppd.py
Log:
fixes for gta01
incoming call signaling fixed
incoming sms signaling fixed
Modified: trunk/software/pyneod/Makefile
===================================================================
--- trunk/software/pyneod/Makefile 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/Makefile 2008-04-21 08:30:43 UTC (rev 237)
@@ -1,7 +1,7 @@
#!/usr/bin/env make -f
.PHONY: run
run:
- python2.5 -u ./supl/test.py
+ python2.5 -u ./test.py org.bluez /org/bluez
.PHONY: dbg
dbg:
Modified: trunk/software/pyneod/base.py
===================================================================
--- trunk/software/pyneod/base.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/base.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -9,7 +9,6 @@
from os.path import exists
from traceback import format_exc
-
class CfgPrsr(SafeConfigParser):
def __init__(self):
SafeConfigParser.__init__(self)
@@ -27,7 +26,8 @@
if level <= LOG_ERR and log_debug:
e = format_exc()
if e:
- syslog(level, ('%s %s'% (values[0], e, )).__repr__())
+ for l in e.split('\n'):
+ syslog(level, ('%s %s'% (values[0], l, )).__repr__())
if level <= LOG_ERR \
or level <= LOG_INFO and log_info \
or level <= LOG_DEBUG and log_debug:
@@ -51,7 +51,9 @@
def dedbusmap(map):
ret = {}
for n, v in map.items():
- if isinstance(v, float):
+ if v is False:
+ v = None
+ elif isinstance(v, float):
v = float(v)
elif isinstance(v, int):
v = int(v)
Modified: trunk/software/pyneod/freesmartphone.py
===================================================================
--- trunk/software/pyneod/freesmartphone.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/freesmartphone.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -8,7 +8,7 @@
DIN_MUXER = ''
DIN_PHONE = 'org.mobile.Phone'
DIN_STORAGE = 'org.mobile.Storage'
-DIN_EVENT = 'org.mobile.Event'
+DIN_ENTRY = 'org.mobile.Entry'
DIN_LOCATION = 'org.mobile.Location'
DIN_NETWORK = 'org.mobile.Network'
DIN_POWER = 'org.mobile.Power'
Modified: trunk/software/pyneod/pygsm/attention.py
===================================================================
--- trunk/software/pyneod/pygsm/attention.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/pygsm/attention.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -63,7 +63,7 @@
LOG(LOG_DEBUG, __name__, 'done', name)
if self._callback is not None:
LOG(LOG_DEBUG, __name__, 'callback')
- self._callback()
+ self._callback(name)
self._callback = None
self._error = None
@@ -131,10 +131,11 @@
def close(self, hard=False):
LOG(LOG_DEBUG, __name__, 'close')
for serial in (self.rr, self.um, ):
- if serial.iow:
- source_remove(serial.iow)
- if serial.isOpen():
- serial.close()
+ if serial:
+ if serial.iow:
+ source_remove(serial.iow)
+ if serial.isOpen():
+ serial.close()
self.rr, self.um, = None, None,
def __attention_write(self, source, command, ):
@@ -156,7 +157,7 @@
self.rr.request_parser = parser
self.__attention_write(self.rr, command)
- def activate(self, command):
+ def activate(self, command, timeout=200): # TODO timeout not implemented now
if self.um.request_tick:
self.um.request_stack.append(command)
else:
Modified: trunk/software/pyneod/pygsm/genericmodem.py
===================================================================
--- trunk/software/pyneod/pygsm/genericmodem.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/pygsm/genericmodem.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -180,11 +180,8 @@
)
#if _sim_auth_status != self._sim_auth_status:
self.SimAuthStatus(_sim_auth_status)
- def responseCPIN(self, _name, pin_state):
+ def responseCPIN(self, _name, pin_state='UNKOWN'):
LOG(LOG_DEBUG, __name__, 'pin state', pin_state)
- if pin_state == 'READY':
- self.request('+CIMI', self.responseCIMI) # ismsi
- self.request('+CNUM', self.responseCNUM) # subscriber number
_sim_auth_status = dict(self._sim_auth_status,
pin_state=pin_state,
)
@@ -248,7 +245,7 @@
)
#if _network_status != self._network_status:
self.NetworkStatus(_network_status)
- def responseCLIP(self, _name, number, type, subaddr=Empty, satype=Empty, alpha=Empty, cli_validity=Empty, ):
+ def unsolCLIP(self, _name, number, type, subaddr=Empty, satype=Empty, alpha=Empty, cli_validity=Empty, ):
LOG(LOG_DEBUG, __name__, 'calling line identification presentation', number, type, subaddr, satype, alpha, cli_validity)
_network_status = dict(self._network_status,
cli_number=number,
@@ -260,6 +257,15 @@
)
#if _network_status != self._network_status:
self.NetworkStatus(_network_status)
+ def unsolCRING(self, _name, *values):
+ LOG(LOG_DEBUG, __name__, 'ring', *values)
+ _network_status = dict(self._network_status,
+ phone_activity_status=3,
+ )
+ #if _network_status != self._network_status:
+ self.NetworkStatus(_network_status)
+ def unsolCPI(self, _name, *values):
+ LOG(LOG_DEBUG, __name__, 'calling progress indicator', *values)
def responseCOLP(self, _name, number, type, subaddr=Empty, satype=Empty, alpha=Empty, cli_validity=Empty, ):
LOG(LOG_DEBUG, __name__, 'connected line identification presentation', number, type, subaddr, satype, alpha, cli_validity)
_network_status = dict(self._network_status,
@@ -277,7 +283,7 @@
self.request('+CPAS', self.responseCPAS) # request phone activity status
def unsolCMTI(self, _name, storage, idx, ):
- self.MessageReceived(idx)
+ self.MessageReceived({str(idx): "NEW"})
@staticmethod
def gsm_signal(sig):
@@ -311,10 +317,13 @@
def sim_inquire(self):
self.request('+CPIN?', self.responseCPIN) # pin status
+ self.request('+CIMI', self.responseCIMI) # ismsi
+ self.request('+CNUM', self.responseCNUM) # subscriber number
def sim_send_pin(self, pin):
self.request('+CFUN=1;+CFUN?', self.responseCFUN, 10000) # phone function full
self.request('+CPIN="%s";+CPIN?'% pin, self.responseCPIN, 10000) # pin
+ self.sim_inquire()
self.network_inquire()
def network_inquire(self):
@@ -323,14 +332,14 @@
self.request('+CREG?', self.responseCREG) # network registration
self.request('+CPAS', self.responseCPAS) # request phone activity status
# TODO where to put this:
- self.activate('+CNMI=2,1,2,1,0') # new message indications to te
+ self.activate('+CNMI=2,1,2,1,0', timeout=10000) # new message indications to te
def network_register(self, no=0):
self.request('+CFUN=1;+CFUN?', self.responseCFUN, 10000) # phone function full
self.request('+COPS=%d;+COPS?'% no, self.responseCOPS, 20000) # operator selection
self.request('+CPAS', self.responseCPAS) # request phone activity status
self.request('+WS46?', self.responseWS46) # wireless network
- self.activate('+CNMI=2,1,2,1,0') # new message indications to te
+ self.activate('+CNMI=2,1,2,1,0', timeout=10000) # new message indications to te
def call_accept(self):
self.request('A', parser=StandardParser())
@@ -404,7 +413,6 @@
#'+CFUN=0', # limited phone functionality on
#'+CFUN?' # function
#'+CMOD=0', # call modes supported: single mode
-#'+CPIN?', # Pin state
#'+CSCS=8859-1', # character set
#'+CSNS=0', # single numbering scheme
#'+CSQ', # signal quality
Modified: trunk/software/pyneod/pygsmd.py
===================================================================
--- trunk/software/pyneod/pygsmd.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/pygsmd.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -17,7 +17,7 @@
$DB org.mobile.Phone.NetworkGetStatus
$DB org.mobile.Phone.CallInitiate string:$PN string: int32:0
$DB org.mobile.Phone.MessagesListAll
-$DB org.mobile.Phone.MessagesGet int32:6
+$DB org.mobile.Phone.MessagesGet int32:0
$DB org.mobile.Phone.MessagesDelete int32:6
$DB org.mobile.Phone.MessagesSend string:$PN string:neo_answers_bla_fasel
'''
@@ -56,6 +56,7 @@
# sim
def SimGetAuthStatus(self):
+ self.sim_inquire()
return self._sim_auth_status
@notify(DIN_PHONE, 'a{sv}')
def SimAuthStatus(self, _sim_auth_status):
Modified: trunk/software/pyneod/pypppd.py
===================================================================
--- trunk/software/pyneod/pypppd.py 2008-04-21 06:10:16 UTC (rev 236)
+++ trunk/software/pyneod/pypppd.py 2008-04-21 08:30:43 UTC (rev 237)
@@ -14,8 +14,10 @@
from gobject import timeout_add, child_watch_add, spawn_async
from freesmartphone import *
-# DB="dbus-send --system --print-reply --type=method_call --dest=org.mobile /org/mobile/GprsNetwork"
-# $DB org.mobile.Network.Activate boolean:true
+'''
+DB="dbus-send --system --print-reply --type=method_call --dest=org.mobile /org/mobile/GprsNetwork"
+$DB org.mobile.Network.Activate boolean:true
+'''
# see http://www.phonestar.com.my/s_at_10.html
#'OK' 'AT+CGDPADDR=1'\
@@ -85,6 +87,7 @@
'ktune',
'lcp-echo-failure', '8',
'lcp-echo-interval', '3',
+ 'ipcp-max-configure', '32',
'lock',
'noauth',
#'demand',
@@ -123,15 +126,12 @@
try:
if on:
if self.cpid >= 0: raise Exception('already active')
- if True:
- obj = self.bus.get_object('org.mobile.mux', '/org/mobile/mux/RemoteObject')
- #obj.connect_to_signal('deactivate', self.__deactivate, dbus_interface='org.mobile.mux.RemoteInterface')
- obj = Interface(obj, 'org.mobile.mux.RemoteInterface')
- self.port = str(obj.alloc_channel('ppp'))
- del obj
- if not self.port: raise Exception('no device')
- else: # go direct
- self.port = '/dev/ttySAC0'
+ muxer = self.bus.get_object('org.pyneo', '/org/pyneo/Muxer')
+ muxer = Interface(muxer, 'org.freesmartphone.GSM.MUX')
+ self.port = str(muxer.AllocChannel('ppp'))
+ del muxer
+ if not self.port: raise Exception('no device')
+ # go direct self.port = '/dev/ttySAC0'
LOG(LOG_INFO, __name__, 'Activate got port', self.port)
f = open(Gprs.__chap_secrets_filename, 'w')
f.write(Gprs.__chap_secrets_content)
More information about the Smartphones-commits
mailing list