[pkg-fso-commits] [SCM] framworkd debian packageing branch, master, updated. milestone2-110-g76700a0
Michael 'Mickey' Lauer
mickey at vanille-media.de
Tue Sep 2 10:34:58 UTC 2008
The following commit has been merged in the master branch:
commit 69efd426b2752689fab373715f2fa42d3cf9c64d
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Thu Aug 28 21:22:36 2008 +0200
ophoned: remove remaining LOG statements. We are now LOG-free
diff --git a/framework/subsystems/ophoned/ophoned.py b/framework/subsystems/ophoned/ophoned.py
index 75a1d9c..b15fea0 100644
--- a/framework/subsystems/ophoned/ophoned.py
+++ b/framework/subsystems/ophoned/ophoned.py
@@ -10,6 +10,9 @@ Package: ophoned
Implementation of the dbus objects.
"""
+MODULE_NAME = "ophoned"
+__version__ = "0.1.0"
+
from protocol import Protocol, ProtocolUnusable
from test import TestProtocol
from gsm import GSMProtocol
@@ -19,9 +22,7 @@ import dbus.service
from dbus import DBusException
import logging
-logger = logging.getLogger('ophoned')
-
-# from framework.config import LOG, LOG_ERR, LOG_WARNING, LOG_INFO, LOG_DEBUG
+logger = logging.getLogger( MODULE_NAME )
class Phone(dbus.service.Object):
"""The Phone object is used to create Call objects using different protocols"""
@@ -32,11 +33,11 @@ class Phone(dbus.service.Object):
self.interface = "org.freesmartphone.Phone"
super(Phone, self).__init__(bus, self.path)
self.protocols = None
-
+
@dbus.service.method('org.freesmartphone.Phone', in_signature='', out_signature='as')
def InitProtocols(self):
"""Initialize all the protocols
-
+
It is not compulsory to call this method, since it will be automatically called the first time
we attempt to create a call.
"""
@@ -52,10 +53,10 @@ class Phone(dbus.service.Object):
@dbus.service.method('org.freesmartphone.Phone', in_signature='ssb', out_signature='o')
def CreateCall(self, number, protocol = None, force = True):
""" Return a new Call targeting the given number, with an optional protocol.
-
+
If the protocol is not provided, the service will determine the best protocol to use.
if force is set to true, then we kill the channel if it is already opened
-
+
parameters:
number -- A string representing the number of the peer
protocol -- The name of the protocol as returned by InitProtocols, if None the best protocol will be used. Default to None
@@ -63,7 +64,7 @@ class Phone(dbus.service.Object):
"""
if self.protocols is None:
self.InitProtocols()
-
+
number = str(number)
# first we guess the best protocol to use
if protocol:
@@ -74,13 +75,13 @@ class Phone(dbus.service.Object):
# Then we just ask the protocol class
ret = protocol.CreateCall(number, force = force)
return ret
-
+
@dbus.service.signal('org.freesmartphone.Phone', signature='o')
def Incoming(self, call):
"""Emitted when a call is incoming"""
pass
-
-
+
+
def factory(prefix, controller):
"""This is the magic function that will be called bye the framework module manager"""
@@ -91,18 +92,18 @@ def factory(prefix, controller):
# XXX: remove that
logger.error("%s", e) # Just so that if an exception is raised, we can at least see the error message
raise
-
+
def generate_doc():
"""This function can be used to generate a wiki style documentation for the DBus API
-
+
It should be replaced by doxygen
"""
from protocol import Call
-
+
objects = [Phone, Call]
-
+
services = {}
-
+
for obj in objects:
for attr_name in dir(obj):
attr = getattr(obj, attr_name)
@@ -124,7 +125,7 @@ def generate_doc():
sig['doc'] = attr.__doc__
funcs, sigs = services.setdefault(attr._dbus_interface, [[],[]])
sigs.append(sig)
-
+
for name, funcs in services.items():
print '= %s =' % name
for func in funcs[0]:
@@ -132,7 +133,7 @@ def generate_doc():
== method %(name)s(%(args)s) ==
* in: %(in_sig)s
* out: %(out_sig)s
-* %(doc)s""" % func
+* %(doc)s""" % func
for sig in funcs[1]:
print """
== signal %(name)s(%(args)s) ==
@@ -144,7 +145,7 @@ if __name__ == '__main__':
import sys
generate_doc()
sys.exit(0)
-
+
import gobject
import dbus.mainloop.glib
@@ -152,7 +153,7 @@ if __name__ == '__main__':
mainloop = gobject.MainLoop()
bus = dbus.SystemBus()
name = dbus.service.BusName("org.freesmartphone.ophoned", bus)
-
+
phone = Phone(bus)
-
+
mainloop.run()
diff --git a/framework/subsystems/ophoned/test.py b/framework/subsystems/ophoned/test.py
index 74a7a17..b70e50c 100644
--- a/framework/subsystems/ophoned/test.py
+++ b/framework/subsystems/ophoned/test.py
@@ -3,17 +3,15 @@ import gobject
import protocol
-# from framework.config import LOG, LOG_ERR, LOG_WARNING, LOG_INFO, LOG_DEBUG
-
class TestProtocol(protocol.Protocol):
"""This special protocol is just used to emulate a real call
"""
def name(self):
return 'Test'
-
+
def __init__(self, bus):
super(TestProtocol, self).__init__(bus)
-
+
class Call(protocol.Call):
def __init__(self, proto, number):
@@ -27,7 +25,7 @@ class TestProtocol(protocol.Protocol):
self.Outgoing()
gobject.timeout_add(1000, on_timeout)
return super(TestProtocol.Call, self).Initiate()
-
+
def Outgoing(self):
"""Emited when the call is outgoing"""
super(TestProtocol.Call, self).Outgoing()
@@ -36,8 +34,8 @@ class TestProtocol(protocol.Protocol):
if self.status == 'Outgoing':
self.Activated()
gobject.timeout_add(1000, on_timeout)
-
-
+
+
def Release(self):
"""Release the call"""
# Since this is a test, after a while we release the call
--
framworkd debian packageing
More information about the pkg-fso-commits
mailing list