[RFC] HFP support into oFono and BlueZ
by Gustavo F. Padovan
Hi,
These patches implement the new API for the Audio Gateway in BlueZ. It
follows the last version of the HandsfreeGateway and HandsfreeAgent
Intefaces API.
The first two patches is for BlueZ and the other for oFono. You can
test it with using enable-modem and test-voicecall scripts into the
test dir of oFono.
Feel free to test it and send me your comments. We have some bugs yet.
The audio part is not working yet. We are going to work on pulseaudio
this week to get this done soon.
Regards,
--
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
9 years, 8 months
CDMA SMS Handling
by Rajesh.Nagaiah@elektrobit.com
Hi,
There was a discussion about the CDMA SMS handling and CDMA PDUs in the
IRC channel couple of days before. I would like to highlight the
differences between CDMA and GSM PDU and how we should proceed with this
from my understanding. Let me know your opinion.
Even though oFono supports +CMT and +CMTI, if we feed the incoming CDMA
PDUs to the SMS core it wont get decoded correctly, as there is
substantial differences between the GSM and CDMA SMS PDUs as described
in 3GPP2 specification C.S0015-B Short Message Service (SMS) for
Wideband Spread Spectrum Systems
For eg, the incoming PDU example that was mentioned in the IRC
discussion
+CMT: , 40,
00000210020207028CE95DCC65800601FC08150003168D30010610241830608003061010
04044847
40 - Length of the PDU in bytes
00 - Message Type ( 00 - SMS Point-to-Point)
00 - TeleService Identifier Tag (SMS Parameter Indentifier)
02 - TeleService Identifier Length (SMS Parameter Length)
10 - TeleService Identifier Value - First 8 bits
02 - TeleService Identifier Value - Second 8 bits
TeleService Identifier - 0x1002 - CDMA Messaging Teleservice
(CMT-95)
02 - Originating Address Tag
07 - Originating Address Length
02 - Originating Address 1st 8 Bits
8C - Originating Address 2nd 8 Bits
E9 - Originating Address 3rd 8 Bits
5D - Originating Address 4th 8 Bits
CC - Originating Address 5th 8 Bits
65 - Originating Address 6th 8 Bits
80 - Originating Address 7th 8 Bits
Digit Mode - 1 Bit
Number Mode - 1 Bit
Number Type - 0 or 3 bits
Number Plan - 0 or 4 bits
Number Fields - 8 Bits
Number Field occurrence of CHARi
CHARi - 4 or 8 bits ( 4 - in case of DTMF encoding, 8 - incase
of ASCII encoding)
Reserved - 0-7 bits
Lets take the 1st and 2nd 8 bits
02 - 0000 0010 ( Digit Mode bit - 0, Number Mode bit - 0)
8C - 1000 1100
As Digit mode bit is set to 0, Number Plan and Number Type is void
(0 bits) in this case.
So the remaining 6 bits of 1st 8bits and the first 2 bits of 2nd
8bit is Number fields
Number fields - 00 0010 10 - 0000 1010 - 0x0A (10 digits)
As Digit mode bit is set to 0, each address digit here is
represented as 4bit DTMF digit
0x8C 0xE9 0x5D 0xCC 0x65 0X80
1000 1100 1110 1001 0101 1101 1100 1100 0110 0101 1000 0000
10 0011 0011 1010 0101 0111 0111 0011 0001 1001 0110 0000 00
3 3 0 5 7 7 3 1 9 6 Last 6 bits
are reserved bits
Originating Address - 3305773196
06 - Bearer Reply Option Tag
01 - Bearer Reply Option Length
FC - First 6 bits Reply Sequence number and last 2 bits reserved set to
0
1111 1100 - 111111 REPLY_SEQ
00 Reserved
08 - Bearer Data Tag
15 - Bearer Data Length
00 - Message Indentifier Tag ( Bearer Data Sub parameter )
03 - Message Indentifier Length
16 - Message Type 4 bits Message Id 4 Bits
8D - Message Id 8 Bits
30 - Message Id 4 Bits, UDH Header indicator 1 Bit, Reserved 3 Bits
How Message Identifier value 16 8D 30 was formed ?
Message type ( 4 bits ) - 1( 0001 - Deliver)
Message Identifier ( 16 bits ) - 26835( 0x68D3)
Header Indicator (1 bit) - 0 (UDH not present in User Data
Subparameter)
Reserved ( 3bits) - 0 (000)
01 - User Data Tag ( Bearer Data Sub parameter )
06 - User Data Length
10 - Message Encoding 5 bits ( 0001 0000 ( 00010 = 2 -> 7-bit ASCII )) &
Number Fields 3 bits ( 000)
24 - Number Fields 5 Bits + User char field 1's 3 bits ( 0010 0100 )
18 - User char field 1's remaining 5 bits + User char field 2's 3 bits
(0001 1000)
30 - User char field 2's remaining 5 bits + User char field 3's 3 bits
(0011 0000)
60 - User char field 3's remaining 5 bits + User char field 4's 3 bits
(0110 0000)
80 - User char field 4's remaining 5 bits + Reserved 3 Bits (1000 0000)
Number Fields: 000 00100 - 04 (4 Character fields)
User Char [1] - 100 00011 - 0x83
User Char [2] - 000 00110 - 0x06
User Char [3] - 000 01100 - 0x0C
User Char [4] - 000 10000 - 0x10
Hex 0x83 0x06 0x0C 0x10
Octets 1000 0011 0000 0110 0000 1100 0001 0000
Septets 1000 001 10000 01 100000 1 1000001
Character A(0x41) A(0x41) A(0x41) A(0x41)
Message content: AAAA
Message Encoding - 2 (00010 - 5 bits)
Number Fields - 4 (0000 0100 - 8 bits)
User characters - 0x83 0x06 0x0C 0x10 ( 8 bits each)
00010 0000 0100 1000 0011 0000 0110 0000 1100 0001 0000
0001 0000 - 0x10
0010 0100 - 0x24
0001 1000 - 0x18
0011 0000 - 0x30
0110 0000 - 0x60
1000 0000 - 0x80 (Last 3 bits set to 0's(reserved bit) to complete
the octets)
03 - Message Center Time Stamp Tag ( Bearer Data Sub parameter )
06 - Message Center Time Stamp Length
all date and time fields contain two 4-bit BCD numbers giving the
decimal value of the field.
10 - Year (2010)
10 - Month (10 - October)
04 - Day
04 - Hour
48 - Minutes
47 - Seconds
Time Stamp 04:48:47 04/10/2010
Decoded Information:
Message Type: Deliver (Incoming Message)
Teleservice: CMT-95
Message Identifier: 26835
Originating Address: 3305773196
Message content: AAAA
Message Center Time Stamp: 04:48:47 04/10/2010
As from the above decoding example we can see there is substantial
differences between the GSM and CDMA SMS specifications and so the SMS
atom needs many additions and needs to be heavily modified to support
also CDMA SMS handling. Currently the oFono sms file unit handles the
common and the GSM technology aspects of the SMS stack along with the
smsutils. The SMS atom has the GSM specific members, segmentation and
queuing logic. The smsutils mainly takes care of encoding/decoding of
the PDUs, which is GSM specific. As the segmentation and queuing logic
and the interface is common for both GSM and CDMA, we could reuse this
common code and add the CDMA handling into it and create a new
cdmasmsutils unit to support the CDMA SMS specifics, much like the
smsutils does already for GSM.
BR,
Rajesh
9 years, 11 months
Enabling/disabling the GPS part of a Huawei EM770W
by Florian Mayer (Mayer Electronics)
Hello folks,
is it possible to enable / disable the GPS part of a Huawei EM770W 3G
modem through a DBUS command? It is done with the command AT^WPDGP and
AT^WPEND on the modem (tested it on PCUI port). Or is it possible to
send generic AT commands through DBUS?
Regards
Florian Mayer
11 years, 1 month
[PATCH] TODO: Add vCard export to SM/ME stores
by Jaakko Kiviluoto
---
TODO | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/TODO b/TODO
index bf2305b..9dcb43f 100644
--- a/TODO
+++ b/TODO
@@ -496,3 +496,14 @@ Miscellaneous
Priority: Low
Complexity: C4
+
+- Enable exporting contact information from vCard data to SM and ME stores.
+ Need to implement a robust vCard parser that can extract at least the
+ fields supported by the existing phonebook module. Functionality should
+ be analoguous to existing import functionality.
+
+ Implements feature request http://bugs.meego.com/show_bug.cgi?id=4476
+
+ Priority: Low
+ Complexity: C1
+ Owner: Jaakko Kiviluoto <jaakko.j.kiviluoto(a)intel.com>
--
1.7.0.4
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 3 months
[PATCH 0/1] Patch Description
by Yang Gu
This patch is to cancel the pending sms via D-Bus. Till now, I'm still not sure what kind of sms should be cancelled. In theory, one message, or part of it, would be sent by oFono can be cancelled. For some examples: Any part of a message that has never been sent can be cancelled; one message was sent but failed, we can cancel before retry; One message is split into several pieces, we can cancel before all of them are sent.
In current patch, I only cancel the sms that has never been sent. I wonder if it's enough or I should handle all the situations above.
Another question here is about the existed code. There is a hashtable "messages" in struct ofono_sms. Can we store the state in the tx_queue_entry, and remove the hashtable thoroughly to make the code more simple?
Yang Gu (1):
sms: Cancel pending message
include/history.h | 1 +
src/sms.c | 132 ++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 106 insertions(+), 27 deletions(-)
11 years, 3 months
[PATCH 0/9] SMS history plugin.
by Oleg Zhurakivskyy
Hello,
Please find the SMS history plugin set of patches. The plugin makes it
possible for an application/multiple applications to register for
incoming/outgoing SMS messages and receive them over D-Bus.
The SMS history itself is maintained by a separate application,
which registers to ofonod using this interface.
Regards,
Oleg
Oleg Zhurakivskyy (9):
SMS history plugin.
SMS history plugin.
SMS history plugin documentation.
SMS history plugin test script.
oFono smsagent enhancements to permit more flexible parameter set to
be dispatched.
oFono smsagent enhancements to permit more flexible parameter set to
be dispatched.
Minor modifications due to sms_agent_dispatch_datagram()
enhancements.
Minor modifications due to sms_agent_dispatch_datagram()
enhancements.
D-Bus rules for SMS history plugin.
Makefile.am | 3 +
doc/messaging-agent-api.txt | 49 ++++++
plugins/messaging-agent.c | 403 +++++++++++++++++++++++++++++++++++++++++++
plugins/push-notification.c | 2 +-
plugins/smart-messaging.c | 4 +-
src/ofono.conf | 1 +
src/smsagent.c | 5 +
src/smsagent.h | 4 +
test/test-messaging-agent | 67 +++++++
9 files changed, 535 insertions(+), 3 deletions(-)
create mode 100644 doc/messaging-agent-api.txt
create mode 100644 plugins/messaging-agent.c
create mode 100644 test/test-messaging-agent
11 years, 3 months
unsolicited multiline result
by Petteri Tikander
This patch is for handling multiline unsolicited result-codes.
So state-machine used for handling result-bytes (gsmv1_feed) is set to the multiline-response
state. Otherwise next lines from the result-buffer are not handled correctly,
and response-handling will get stuck.
In the other hand, this correction keeps result-handling still unchanged.
So single line is notified to the upper level (atoms) at a time, not all lines of the result.
For instance: network-emergency numbers cannot be collect to the one single notification yet.
-- See us at Mobile World Congress, 14-17 February 2011, in Barcelona, Spain. Visit the Ixonos booth Hall 1, # 1E19.
11 years, 4 months
[PATCH v3] ifx: Adding modem selftest for Infineon modem
by Robertino Benis
Hi all,
This is another attempt to submit a patch that triggers Infineon
modem selftest during ofono boot. Patch addresses issues raised
by Marcel from the previous submissions.
Thank you,
-- r.
---
plugins/ifx.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 66 insertions(+), 10 deletions(-)
diff --git a/plugins/ifx.c b/plugins/ifx.c
index c0a69c2..e0eb982 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -71,6 +71,8 @@
#define GPRS3_DLC 4
#define AUX_DLC 5
+#define IFX_SELF_TESTS_TIMEOUT 10
+
static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "GPRS1: ",
"GPRS2: ", "GPRS3: ", "Aux: " };
@@ -81,6 +83,16 @@ static const char *dlc_nodes[NUM_DLC] = { "/dev/ttyGSM1", "/dev/ttyGSM2",
static const char *none_prefix[] = { NULL };
static const char *xdrv_prefix[] = { "+XDRV:", NULL };
+static struct {
+ char *test_desc;
+ char *at_cmd;
+} const mst[] = {
+ { "AT Command Test", "ATE0 +CMEE=1" }, /* set echo & error reporting */
+ { "RTC GTI Test", "at@rtc:rtc_gti_test_verify_32khz()" },
+ { "Device Version Test", "at@vers:device_version_id()" },
+ { NULL, NULL }
+};
+
struct ifx_data {
GIOChannel *device;
GAtMux *mux;
@@ -99,6 +111,7 @@ struct ifx_data {
int audio_loopback;
struct ofono_sim *sim;
gboolean have_sim;
+ int self_test_idx;
};
static void ifx_debug(const char *str, void *user_data)
@@ -545,6 +558,52 @@ static gboolean mux_timeout_cb(gpointer user_data)
return FALSE;
}
+static void ifx_self_test_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ifx_data *data = ofono_modem_get_data(modem);
+
+ if (data->mux_init_timeout > 0) {
+ g_source_remove(data->mux_init_timeout);
+ data->mux_init_timeout = 0;
+ }
+
+ if (!ok) {
+ ofono_error("Modem %s: FAIL",
+ mst[data->self_test_idx].test_desc);
+ g_at_chat_unref(data->dlcs[AUX_DLC]);
+ data->dlcs[AUX_DLC] = NULL;
+
+ g_io_channel_unref(data->device);
+ data->device = NULL;
+
+ ofono_modem_set_powered(modem, FALSE);
+
+ return;
+ }
+
+ data->self_test_idx++;
+
+ if (mst[data->self_test_idx].at_cmd != NULL) {
+ g_at_chat_send(data->dlcs[AUX_DLC],
+ mst[data->self_test_idx].at_cmd,
+ NULL, ifx_self_test_cb, modem, NULL);
+
+ data->mux_init_timeout = g_timeout_add_seconds(
+ IFX_SELF_TESTS_TIMEOUT, mux_timeout_cb, modem);
+
+ } else { /* Enable MUX Channels */
+ data->frame_size = 1509;
+ g_at_chat_send(data->dlcs[AUX_DLC],
+ "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
+ mux_setup_cb, modem, NULL);
+
+ data->mux_init_timeout = g_timeout_add_seconds(5,
+ mux_timeout_cb, modem);
+ }
+}
+
static int ifx_enable(struct ofono_modem *modem)
{
struct ifx_data *data = ofono_modem_get_data(modem);
@@ -595,18 +654,15 @@ static int ifx_enable(struct ofono_modem *modem)
if (getenv("OFONO_AT_DEBUG"))
g_at_chat_set_debug(chat, ifx_debug, "Master: ");
- g_at_chat_send(chat, "ATE0 +CMEE=1", NULL,
- NULL, NULL, NULL);
-
- data->frame_size = 1509;
-
- g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
- mux_setup_cb, modem, NULL);
+ /* Execute Modem Self tests */
+ data->dlcs[AUX_DLC] = chat;
+ data->self_test_idx = 0;
- data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb,
- modem);
+ g_at_chat_send(data->dlcs[AUX_DLC], mst[data->self_test_idx].at_cmd,
+ NULL, ifx_self_test_cb, modem, NULL);
- data->dlcs[AUX_DLC] = chat;
+ data->mux_init_timeout = g_timeout_add_seconds(
+ IFX_SELF_TESTS_TIMEOUT, mux_timeout_cb, modem);
return -EINPROGRESS;
}
--
1.7.0.4
11 years, 4 months
[PATCHv2] plugin: Add ste modem initd integration
by Sjur Brændeland
From: Sjur Brændeland <sjur.brandeland(a)stericsson.com>
This patch introduces auto discovery of ST-Ericsson modems.
ST-Ericsson modems (M5XX, M57XX, M7XX, M74XX) are managed by a
Modem Init Daemon responsible for start, power cycles,
flashing etc. This STE plugin monitors the modem state exposed
from the Modem Init Damon's Dbus API. When the modem is in state
"on" the STE modem is created and registered. Multiple modem
instances, and reset handling is supported.
---
Changes:
- Support for multiple STE modems.
- Better naming of STE modem instances, using received dbus path.
- CAIF Link layer to use for AT channels specified pr modem instance.
- Added support for reset.
Makefile.am | 5 +
configure.ac | 6 +
plugins/stemid.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 321 insertions(+), 0 deletions(-)
create mode 100644 plugins/stemid.c
diff --git a/Makefile.am b/Makefile.am
index 12b3c33..98096ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,6 +82,11 @@ gatchat_sources = gatchat/gatchat.h gatchat/gatchat.c \
udev_files = plugins/ofono.rules
+if STE_MODEM_INITD
+builtin_modules += stemid
+builtin_sources += plugins/stemid.c
+endif
+
if UDEV
builtin_modules += udev
builtin_sources += plugins/udev.c
diff --git a/configure.ac b/configure.ac
index 5c18f68..f733fc4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,12 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
+AC_ARG_ENABLE(ste_modem_initd, AC_HELP_STRING([--disable-ste-modem-initd],
+ [disable auto discovery of STE modem using modem init daemon]),
+ [enable_ste_modem_initd=${enableval}])
+
+AM_CONDITIONAL(STE_MODEM_INITD, test "${enable_ste_modem_initd}" != "no")
+
if (test "${prefix}" = "NONE"); then
dnl no prefix and no localstatedir, so default to /var
if (test "$localstatedir" = '${prefix}/var'); then
diff --git a/plugins/stemid.c b/plugins/stemid.c
new file mode 100644
index 0000000..9f5da22
--- /dev/null
+++ b/plugins/stemid.c
@@ -0,0 +1,310 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2010 ST-Ericsson AB.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <net/if.h>
+
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/plugin.h>
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/dbus.h>
+
+/*
+ * ST-Ericsson's Modem Init Daemon is used for controling the modem power
+ * cycles and provides a dbus API for modem state and properties.
+ */
+#define MID_SERVICE "com.stericsson.modeminit"
+#define MID_INTERFACE MID_SERVICE ".Modem"
+
+/* The signal StateChange sends the modem state.*/
+#define STATUS_CHANGED "StateChange"
+
+#define MID_ACTION_ON "on" /* Modem is on */
+#define MID_ACTION_RESET "dumping" /* Modem is resetting */
+#define MID_ACTION_UNKNOWN "unknown" /* Don't care */
+
+/* ResetState requests resending of StateChange. */
+#define MID_RESEND_STATE "ResendState"
+
+/* GetCaifIfName requests the CAIF Interface Name. */
+#define MID_GET_CAIFIF "GetCaifIfName"
+
+#define TIMEOUT 5000
+#define STE_DRIVER_NAME "ste"
+#define STE_INTERFACE_PROPERTY "Interface"
+
+enum ste_state {
+ STE_PENDING, /* Waiting for caifif and "on" notification */
+ STE_PENDING_IF, /* Waiting for caifif, already got "on" */
+ STE_REGISTERED, /* Modem is registered */
+ STE_RESETTING /* Modem is resetting */
+};
+
+struct ste_modem {
+ char *path;
+ struct ofono_modem *modem;
+ enum ste_state state;
+ gboolean got_caifif;
+ gboolean pending_call;
+};
+
+static GHashTable *modem_list;
+static guint mid_api_watch;
+static guint mid_state_watch;
+static DBusConnection *connection;
+
+static void get_caifif_reply(DBusPendingCall *call, void *user_data)
+{
+ DBusMessage *reply;
+ char *ifname;
+ struct ste_modem *stemodem = user_data;
+
+ stemodem->pending_call = FALSE;
+ stemodem->got_caifif = TRUE;
+ reply = dbus_pending_call_steal_reply(call);
+
+ if (dbus_message_is_error(reply, DBUS_ERROR_SERVICE_UNKNOWN)) {
+ ofono_error("STE Modem Init Daemon: unavailable");
+ goto error;
+ }
+
+ if (dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &ifname,
+ DBUS_TYPE_INVALID) == FALSE) {
+ ofono_error("STE Modem Init Daemon: bad signature for %s",
+ MID_GET_CAIFIF);
+ goto error;
+ }
+
+ if (strlen(ifname) > IF_NAMESIZE) {
+ ofono_error("STE Modem Init Daemon: %s bad response %s\n",
+ MID_GET_CAIFIF, ifname);
+ goto error;
+ }
+
+ if (ifname != NULL) {
+ DBG("STE Modem '%s' uses CAIF interface '%s'\n", stemodem->path,
+ ifname);
+ ofono_modem_set_string(stemodem->modem, STE_INTERFACE_PROPERTY,
+ ifname);
+ }
+
+error:
+ if (stemodem->state == STE_PENDING_IF) {
+ DBG("Register STE modem %s", stemodem->path);
+ ofono_modem_register(stemodem->modem);
+ stemodem->state = STE_REGISTERED;
+ }
+
+ dbus_message_unref(reply);
+}
+
+static void get_caif_interface(const char *path, struct ste_modem *stemodem)
+{
+ DBusMessage *message;
+ DBusPendingCall *call;
+
+ stemodem->pending_call = TRUE;
+ message = dbus_message_new_method_call(MID_SERVICE, path,
+ MID_INTERFACE, MID_GET_CAIFIF);
+
+ if (!message) {
+ ofono_error("Unable to allocate new D-Bus message");
+ goto error;
+ }
+
+ dbus_message_set_auto_start(message, FALSE);
+
+ if (dbus_connection_send_with_reply(connection, message,
+ &call, TIMEOUT) == FALSE) {
+ ofono_error("Sending D-Bus message failed");
+ stemodem->got_caifif = TRUE;
+ goto error;
+ }
+
+ if (call == NULL) {
+ DBG("D-Bus connection not available");
+ stemodem->got_caifif = TRUE;
+ goto error;
+ }
+
+ dbus_pending_call_set_notify(call, get_caifif_reply, stemodem, NULL);
+ dbus_pending_call_unref(call);
+
+error:
+ dbus_message_unref(message);
+}
+
+static void handle_stemodem(const char *action, const char *path)
+{
+ struct ste_modem *stemodem = g_hash_table_lookup(modem_list, path);
+
+ if (stemodem == NULL) {
+ DBG("created STE modem %s", path);
+ stemodem = g_try_new0(struct ste_modem, 1);
+ if (stemodem == NULL)
+ return;
+
+ /* remove '/' from path to create a leagal modem name */
+ stemodem->modem = ofono_modem_create(path+1, STE_DRIVER_NAME);
+ if (stemodem->modem == NULL) {
+ ofono_error("STE Modem Init: Bad path: '%s'\n", path);
+ g_free(stemodem);
+ return;
+ }
+
+ stemodem->path = g_strdup(path);
+ stemodem->state = STE_PENDING;
+ g_hash_table_insert(modem_list, stemodem->path, stemodem);
+ }
+
+ if (!stemodem->got_caifif) {
+ DBG("request caif interface %s", path);
+ get_caif_interface(path, stemodem);
+ stemodem->state = STE_PENDING;
+ }
+
+ switch (stemodem->state) {
+ case STE_PENDING:
+ if (g_strcmp0(action, MID_ACTION_ON) != 0)
+ break;
+ if (stemodem->got_caifif) {
+ DBG("register STE modem %s", path);
+ ofono_modem_register(stemodem->modem);
+ stemodem->state = STE_REGISTERED;
+ } else
+ stemodem->state = STE_PENDING_IF;
+ break;
+ case STE_PENDING_IF:
+ break;
+ case STE_REGISTERED:
+ if (g_strcmp0(action, MID_ACTION_RESET) == 0) {
+ DBG("reset ongoing %s", path);
+ /* NOTE: Should we set powered = FALSE here? */
+ stemodem->state = STE_RESETTING;
+ } else if (g_strcmp0(action, MID_ACTION_ON) != 0) {
+ DBG("STE modem unregistering %s %s", path, action);
+ g_hash_table_remove(modem_list, path);
+ }
+
+ break;
+ case STE_RESETTING:
+ if (g_strcmp0(action, MID_ACTION_ON) == 0) {
+ DBG("STE modem reset complete %s", path);
+ if (ofono_modem_get_powered(stemodem->modem))
+ ofono_modem_reset(stemodem->modem);
+ } else if (g_strcmp0(action, MID_ACTION_RESET) != 0) {
+ DBG("STE modem unregistering %s %s", path, action);
+ g_hash_table_remove(modem_list, path);
+ }
+
+ break;
+ }
+}
+
+static gboolean mid_signal_status_change(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ const char *state;
+ const char *path = dbus_message_get_path(message);
+
+ if (dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &state,
+ DBUS_TYPE_INVALID) == FALSE) {
+ ofono_error("STE Modem Init Daemon: invalid signal signature");
+ return FALSE;
+ }
+
+ if (g_strcmp0(path, "/") == 0)
+ return TRUE;
+
+ handle_stemodem(state, path);
+ return TRUE;
+}
+
+static void mid_connect(DBusConnection *connection, void *user_data)
+{
+ DBusMessage *message;
+
+ mid_state_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
+ MID_INTERFACE,
+ STATUS_CHANGED,
+ mid_signal_status_change,
+ NULL, NULL);
+
+ message = dbus_message_new_method_call(MID_SERVICE, "/",
+ MID_INTERFACE, MID_RESEND_STATE);
+ if (!message) {
+ ofono_error("Unable to allocate new D-Bus message");
+ goto error;
+ }
+
+ if (dbus_connection_send(connection, message, NULL) == FALSE)
+ ofono_error("Sending D-Bus message failed");
+
+error:
+ dbus_message_unref(message);
+}
+
+static void mid_disconnect(DBusConnection *connection, void *user_data)
+{
+ g_hash_table_remove_all(modem_list);
+ g_dbus_remove_watch(connection, mid_state_watch);
+}
+
+static void destroy_stemodem(gpointer data)
+{
+ struct ste_modem *stemodem = data;
+
+ ofono_modem_remove(stemodem->modem);
+ g_free(stemodem->path);
+ g_free(stemodem);
+}
+
+static int stemid_init()
+{
+ connection = ofono_dbus_get_connection();
+ if (connection == NULL)
+ return -EIO;
+
+ modem_list = g_hash_table_new_full(g_str_hash, g_str_equal,
+ NULL, destroy_stemodem);
+ mid_api_watch = g_dbus_add_service_watch(connection, MID_SERVICE,
+ mid_connect, mid_disconnect, NULL, NULL);
+ return 0;
+}
+
+static void stemid_exit()
+{
+ DBusConnection *connection = ofono_dbus_get_connection();
+
+ g_hash_table_destroy(modem_list);
+ g_dbus_remove_watch(connection, mid_api_watch);
+}
+
+OFONO_PLUGIN_DEFINE(stemid, "STE Modem Init Daemon dbus api", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT, stemid_init, stemid_exit)
--
1.7.0.4
11 years, 4 months
Discussion on CTM enhancement
by Predon, Frederic
Hi,
As we are currently implementing the CTM modem driver for ifxmodem, I would like to bring a couple of things in the discussion.
Today, patches for our modem driver are ready by before submitting them on the mailing list, I have 2 items to discuss:
1) First, it might a good proposal to merge the TextTelephony and the AudioSettings atoms. Enabling and disabling CTM on a platform require to configure the audio settings on the modem side (audio routing parameters changes). Today, in my patches, I have nearly the same code as the AudioSetting modem driver for configuring the audio. Another proposal would be that the TextTelephony atom indicates to the AudioSetting atom that CTM is enable or disable but that would be good also to merge the 2.
Any idea?
2) Secondly, I think that 2 properties can be added in the TextTelephony atom and/or the AudioSetting atom (or the "merged" atom described in 1). The first property is when the device receives an incoming CTM call. Even if the type is still a voice call, upper layers should be notified that the incoming is a TTY call to display some UI stuff or to turn on the TTY mode in case the device is not already TTY enabled (this is totally UI dependant but at least we leave the flexibility to the UI to decide).
The second property is for MO calls. Remote user can accept the call as a TTY enable device or not. This is supported by the standard. In our case, we are receiving unsolicited AT commands "CTM CALL" when the remote party has accepted the call as a TTY enabled device and "NO CTM CALL" when the remote has accepted the call but his device is not TTY enabled.
Let me know your thinking
Regards
Fred
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
11 years, 4 months