View source for OpenmokoFramework/Status Update 1
From Openmoko
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Return to OpenmokoFramework/Status Update 1.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Return to OpenmokoFramework/Status Update 1.
Hi guys! This is the first of hopefully many Openmoko Framework Team Status updates...
For the general motivation, the goals, and the way we are doing our work, please see http://wiki.openmoko.org/wiki/OpenmokoFramework.
joined Openmoko and the framework team -- welcome on board, guys!
following APIs as being 0.9:
The others (.PDP, .CB, ...) are still in brainstorming mode.
have been checked into the specs repository.
Here's an example session that shows how to use the dbus API:
This is a python prompt where I have added dbus proxies for the first four OTAPI interfaces:
>>> device <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0x27de40> :1.39 /org/freesmartphone/GSM/Device at 0x28b9b0> implementing 'org.freesmartphone.GSM.Device' at 0x28bad0>
>>> sim <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0x27de40> :1.39 /org/freesmartphone/GSM/Device at 0x28b9b0> implementing 'org.freesmartphone.GSM.Sim' at 0x28bab0>
>>> network <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0x27de40> :1.39 /org/freesmartphone/GSM/Device at 0x28b9b0> implementing 'org.freesmartphone.GSM.Network' at 0x28bb30>
>>> call <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0x27de40> :1.39 /org/freesmartphone/GSM/Device at 0x28b9b0> implementing 'org.freesmartphone.GSM.Call' at 0x28bb10>
Now let's check whether we have a phone somewhere on the bus...
>>> device.GetInfo() dbus.Dictionary({dbus.String(u'imei'): dbus.String(u'354651019100314', variant_level=1), dbus.String(u'model'): dbus.String(u'Neo1973 Embedded GSM Modem', variant_level=1), dbus.String(u'revision'): dbus.String(u'HW: GTA, GSM: gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-Moko9-beta1', variant_level=1), dbus.String(u'manufacturer'): dbus.String(u'FIC/OpenMoko', variant_level=1)}, signature=dbus.Signature('sv'))
Excellent. That looks like a Modem in a Neo. Is it turned on?
>>> device.GetAntennaPower() dbus.Boolean(False)
Ooh, no :( Let's turn it on...
>>> device.SetAntennaPower(True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 140, in __call__ **keywords) File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 607, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freesmartphone.GSM.SIM.AuthFailed: SimAuthFailed: org.freesmartphone.GSM.SIM.AuthFailed: SIM PIN required
Yes, that's expected. We're getting an exception, since this SIM card needs a PIN. So, let's give it and try to turn on radio again...
>>> sim.SendAuthCode("7728") >>> device.SetAntennaPower(True) >>>
That seems to have worked. Let's get some more data from the SIM card:
>>> sim.RetrievePhonebook() dbus.Array([dbus.Struct((dbus.Int32(1), dbus.String(u'ADAC Operator'), dbus.String(u'+4917922411')), signature=None), dbus.Struct((dbus.Int32(2), dbus.String(u'Dt Bahn Auskunft'), dbus.String(u'+11861')), signature=None), dbus.Struct((dbus.Int32(3), dbus.String(u'ADAC Pannenhilfe'), dbus.String(u'+49179222222')), signature=None), dbus.Struct((dbus.Int32(4), dbus.String(u'ADAC Verkehr'), dbus.String(u'+4917922499')), signature=None), dbus.Struct((dbus.Int32(5), dbus.String(u'Dating Service'), dbus.String(u'+49179328464')), signature=None), dbus.Struct((dbus.Int32(6), dbus.String(u'Taxi Service'), dbus.String(u'+491798294')), signature=None), dbus.Struct((dbus.Int32(7), dbus.String(u'Weckruf Service'), dbus.String(u'+49179932536')), signature=None), dbus.Struct((dbus.Int32(8), dbus.String(u'Zeitansage'), dbus.String(u'+49179934836')), signature=None), dbus.Struct((dbus.Int32(9), dbus.String(u'Astro Service'), dbus.String(u'+4917927876')), signature=None), dbus.Struct((dbus.Int32(10), dbus.String(u'Lotto-Toto Info'), dbus.String(u'+4917956886')), signature=None), dbus.Struct((dbus.Int32(11), dbus.String(u'Sport Info'), dbus.String(u'+4917977678')), signature=None), dbus.Struct((dbus.Int32(12), dbus.String(u'Boerse'), dbus.String(u'+49179263773')), signature=None), dbus.Struct((dbus.Int32(13), dbus.String(u'Wetter'), dbus.String(u'+49179938837')), signature=None), dbus.Struct((dbus.Int32(14), dbus.String(u'Mailbox abh\xf6ren'), dbus.String(u'+491793000333')), signature=None), dbus.Struct((dbus.Int32(15), dbus.String(u'Alice Hotline'), dbus.String(u'+55656')), signature=None)], signature=dbus.Signature('(iss)')) >>>
That was quick! Whole phonebook in one call! Can we do the same for SMSes?
>>> sim.RetrieveMessagebook() dbus.Array([dbus.Struct((dbus.Int32(1), dbus.String(u'read'), dbus.String(u'+80215'), dbus.String(u'Lieber Kunde, Sie erhalten in Kuerze die richtigen Einstellungen auf Ihr Handy.')), signature=None), dbus.Struct((dbus.Int32(2), dbus.String(u'read'), dbus.String(u'+Alice-Team'), dbus.String(u'Lieber Kunde! Ab jetzt ist die Handynummer 0176/4900xxxx f\xfcr Sie aktiviert und wir w\xfcnschen Ihnen viel Spa\xdf mit Alice. Ihr Alice-Team')), signature=None), dbus.Struct((dbus.Int32(3), dbus.String(u'read'), dbus.String(u'+491793000333'), dbus.String(u'Von: Mailbox. Sie haben 1 neue Nachricht . Zum Abrufen w\xe4hlen Sie bitte "+491793000333')), signature=None), dbus.Struct((dbus.Int32(4), dbus.String(u'read'), dbus.String(u'+49696809xxxx'), dbus.String(u'Anruf-Info von Mailbox: \n0696809xxxx hat keine Nachricht hinterlassen (23.05. um 00:34 Uhr) \n* Diese SMS ist fuer Sie kostenlos')), signature=None)], signature=dbus.Signature('(isss)')) >>>
Yes, we can. Big deal. (By the way, the xxxx is to protect the last bits of my privacy ;) But what's a modem without any network... do we have any operators in reach?
>>> network.ListProviders() dbus.Array([dbus.Struct((dbus.Int32(26207), dbus.String(u'current'), dbus.String(u'Alice'), dbus.String(u)), signature=None), dbus.Struct((dbus.Int32(26203), dbus.String(u'available'), dbus.String(u'E-Plus'), dbus.String(u'E-Plus')), signature=None), dbus.Struct((dbus.Int32(26202), dbus.String(u'available'), dbus.String(u'Vodafone.de'), dbus.String(u'Vodafone')), signature=None)], signature=dbus.Signature('(isss)'))
Fine so far. Let's autoregister to the best one.
>>> network.Register() >>> ============================================================================== got a signal from '/org/freesmartphone/GSM/Device' (via :1.39): => SIGNAL: org.freesmartphone.GSM.Network.Status ( home, Alice, 81 ) ==============================================================================
Boom, here we got an asynchronous signal that we now are successfully registrated. Let's call someone!
>>> call.Initiate("+491764900xxxx","voice") dbus.Int32(0)
This call will be known to the system under ID 0 now. All further actions will happen asynchronously.
>>> ============================================================================== got a signal from '/org/freesmartphone/GSM/Device' (via :1.39): => SIGNAL: org.freesmartphone.GSM.Call.CallStatus ( 0, outgoing, dbus.Dictionary({dbus.String(u'direction'): dbus.String(u'outgoing', variant_level=1), dbus.String(u'created'): dbus.Double(1210036944.989151, variant_level=1), dbus.String(u'duration'): dbus.Int32(0, variant_level=1), dbus.String(u'reason'): dbus.String(u, variant_level=1), dbus.String(u'peer'): dbus.String(u, variant_level=1), dbus.String(u'ring'): dbus.Int32(0, variant_level=1), dbus.String(u'type'): dbus.String(u'voice', variant_level=1)}, signature=dbus.Signature('sv')) ) ==============================================================================
Ah, here we are... it's really an outgoing call... I hope someone will take it...
============================================================================== got a signal from '/org/freesmartphone/GSM/Device' (via :1.39): => SIGNAL: org.freesmartphone.GSM.Call.CallStatus ( 0, active, dbus.Dictionary({dbus.String(u'direction'): dbus.String(u'outgoing', variant_level=1), dbus.String(u'created'): dbus.Double(1210036944.989151, variant_level=1), dbus.String(u'duration'): dbus.Int32(0, variant_level=1), dbus.String(u'reason'): dbus.String(u, variant_level=1), dbus.String(u'peer'): dbus.String(u, variant_level=1), dbus.String(u'ring'): dbus.Int32(0, variant_level=1), dbus.String(u'type'): dbus.String(u'voice', variant_level=1)}, signature=dbus.Signature('sv')) ) ==============================================================================
Boom! What a pleasant surprise. Now we're talking!
Hmm...
She's talking too much... let's hang up.
>>> call.Release(0) >>> ============================================================================== got a signal from '/org/freesmartphone/GSM/Device' (via :1.39): => SIGNAL: org.freesmartphone.GSM.Call.CallStatus ( 0, release, dbus.Dictionary({dbus.String(u'direction'): dbus.String(u'outgoing', variant_level=1), dbus.String(u'created'): dbus.Double(1210036944.989151, variant_level=1), dbus.String(u'duration'): dbus.Int32(0, variant_level=1), dbus.String(u'reason'): dbus.String(u'local hangup', variant_level=1), dbus.String(u'peer'): dbus.String(u, variant_level=1), dbus.String(u'ring'): dbus.Int32(0, variant_level=1), dbus.String(u'type'): dbus.String(u'voice', variant_level=1)}, signature=dbus.Signature('sv')) ) ==============================================================================
As expected. Notice the reason attribute = 'local hangup'. Bingo!