use phonesim to receive incoming call
by cy xie
Hi,
I have some questions about phonesim.
I want to create voice call in emulator, and receive the call in the
emulator also.
Can phonesim do that? if the phonesim can finish this, please help me or
give some details.
Thanks very much.
Chengyong Xie
BR
11 years, 7 months
[RFC v2] ifxmodem: Integration with n_gsm kernel mux and its line discipline
by Robertino Benis
RFC v2: Suggested way of integrating Infineon MAL with upcoming kernel mux (n_gsm)
---
drivers/ifxmodem/gprs-context.c | 70 +++++++++++++++++++++++++++++++++++++-
include/gsmmux.h | 40 ++++++++++++++++++++++
plugins/ifx.c | 70 +++++++++++++++++++++++++++++++-------
3 files changed, 165 insertions(+), 15 deletions(-)
create mode 100644 include/gsmmux.h
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2c68b44..3217492 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -27,8 +27,14 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <linux/types.h>
+#include <arpa/inet.h>
+#include <linux/if_ether.h>
#include <glib.h>
@@ -40,6 +46,7 @@
#include "gatresult.h"
#include "gatrawip.h"
+#include "gsmmux.h"
#include "ifxmodem.h"
#define TUN_SYSFS_DIR "/sys/devices/virtual/misc/tun"
@@ -63,6 +70,7 @@ struct gprs_context_data {
char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
GAtRawIP *rawip;
+ gboolean use_ofono_mux;
enum state state;
char address[32];
char dns1[32];
@@ -79,7 +87,43 @@ static void rawip_debug(const char *str, void *data)
ofono_info("%s: %s", (const char *) data, str);
}
-static const char *setup_rawip(struct ofono_gprs_context *gc)
+static const char *setup_rawip_kmux(struct ofono_gprs_context *gc)
+{
+ struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+ struct gsm_netconfig netconfig = { 0 };
+ int fd;
+ int n;
+ char *interface = NULL;
+ char ifname[IFNAMSIZ];
+
+ DBG("");
+ memset(&netconfig, 0, sizeof(struct gsm_netconfig));
+
+ fd = g_io_channel_unix_get_fd(g_at_chat_get_channel(gcd->chat));
+ ofono_info("Got file descriptor: %d", fd);
+
+ g_at_chat_suspend(gcd->chat);
+
+ netconfig.adaption = 3;
+ netconfig.protocol = htons(ETH_P_IP);
+ n = ioctl(fd, GSMIOC_ENABLE_NET, &netconfig);
+ if (n < 0) {
+ ofono_error("Cannot enable network on the mux: %d", n);
+ return NULL;
+ }
+ ofono_info("Net index: %d", n);
+
+ interface = if_indextoname(n, ifname);
+ if (interface == NULL) {
+ ofono_error("Interface index %d error %d error msg %s", n, errno, strerror(errno));
+ return NULL;
+ }
+ ofono_info("Interface name: %s", interface);
+
+ return interface;
+}
+
+static const char *setup_rawip_internal(struct ofono_gprs_context *gc)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
GAtIO *io;
@@ -153,7 +197,14 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
dns[1] = gcd->dns2;
dns[2] = 0;
- interface = setup_rawip(gc);
+ if (gcd->use_ofono_mux == FALSE) {
+ ofono_info("Calling setup_rawip_kmux()");
+ interface = setup_rawip_kmux(gc);
+ }
+ else {
+ ofono_info("Calling setup_rawip_internal()");
+ interface = setup_rawip_internal(gc);
+ }
if (interface == NULL)
interface = "invalid";
@@ -436,7 +487,9 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
unsigned int vendor, void *data)
{
GAtChat *chat = data;
+ const char *ldisc;
struct gprs_context_data *gcd;
+ struct ofono_modem *modem;
struct stat st;
DBG("");
@@ -455,6 +508,19 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
gcd->chat = g_at_chat_clone(chat);
+ modem = ofono_gprs_context_get_modem(gc);
+ ldisc = ofono_modem_get_string(modem, "LineDiscipline");
+
+ ofono_info("Got LineDiscipline variable from udev: %s", ldisc);
+ if (ldisc != NULL) {
+ ofono_info("setting up to use kernel mux for data");
+ gcd->use_ofono_mux = FALSE;
+ }
+ else {
+ ofono_info("setting up to use user space mux for data");
+ gcd->use_ofono_mux = TRUE;
+ }
+
ofono_gprs_context_set_data(gc, gcd);
chat = g_at_chat_get_slave(gcd->chat);
diff --git a/include/gsmmux.h b/include/gsmmux.h
new file mode 100644
index 0000000..d1880e7
--- /dev/null
+++ b/include/gsmmux.h
@@ -0,0 +1,40 @@
+#ifndef _LINUX_GSMMUX_H
+#define _LINUX_GSMMUX_H
+
+// #include <linux/if.h>
+#if !defined(IFNAMSIZ)
+#define IFNAMSIZ 16
+#endif
+
+struct gsm_config {
+ unsigned int adaption;
+ unsigned int encapsulation;
+ unsigned int initiator;
+ unsigned int t1;
+ unsigned int t2;
+ unsigned int t3;
+ unsigned int n2;
+ unsigned int mru;
+ unsigned int mtu;
+ unsigned int k;
+ unsigned int i;
+ unsigned int unused[8]; /* Padding for expansion without
+ breaking stuff */
+};
+
+#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
+#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
+
+struct gsm_netconfig {
+ unsigned int adaption; /* Adaption to use in network mode */
+ unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */
+ unsigned short unused2;
+ char if_name[IFNAMSIZ]; /* interface name format string */
+ __u8 unused[28]; /* For future use */
+};
+
+#define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig)
+#define GSMIOC_DISABLE_NET _IO('G', 3)
+
+
+#endif
diff --git a/plugins/ifx.c b/plugins/ifx.c
index 527a8c4..4d0be96 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -26,13 +26,16 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <linux/types.h>
#include <glib.h>
#include <gatchat.h>
#include <gatmux.h>
#include <gattty.h>
+#include "gsmmux.h"
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
@@ -75,9 +78,9 @@
static char *dlc_prefixes[NUM_DLC] = { "Voice: ", "Net: ", "GPRS1: ",
"GPRS2: ", "GPRS3: ", "Aux: " };
-static const char *dlc_nodes[NUM_DLC] = { "/dev/ttyGSM1", "/dev/ttyGSM2",
- "/dev/ttyGSM3", "/dev/ttyGSM4",
- "/dev/ttyGSM5", "/dev/ttyGSM6" };
+static const char *dlc_nodes[NUM_DLC] = { "/dev/gsmtty1", "/dev/gsmtty2",
+ "/dev/gsmtty3", "/dev/gsmtty4",
+ "/dev/gsmtty5", "/dev/gsmtty6" };
static const char *none_prefix[] = { NULL };
static const char *xdrv_prefix[] = { "+XDRV:", NULL };
@@ -471,6 +474,8 @@ static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct ifx_data *data = ofono_modem_get_data(modem);
+ int err;
+ struct gsm_config cfg;
int fd;
DBG("");
@@ -504,6 +509,34 @@ static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
goto error;
}
+ memset(&cfg, 0, sizeof(struct gsm_config));
+
+ if ((err = ioctl(fd, GSMIOC_GETCONF, &cfg)) < 0) {
+ ofono_error("Failed to get configuration on n_gsm multiplexer: %d", err);
+ goto error;
+ }
+
+ ofono_info("Got default configuration...");
+ ofono_info("adaption = %d", cfg.adaption);
+ ofono_info("encapsulation = %d", cfg.encapsulation);
+ ofono_info("initiator = %d", cfg.initiator);
+ ofono_info("t1 = %d", cfg.t1);
+ ofono_info("t2 = %d", cfg.t2);
+ ofono_info("t3 = %d", cfg.t3);
+ ofono_info("n2 = %d", cfg.n2);
+ ofono_info("mru = %d", cfg.mru);
+ ofono_info("mtu = %d", cfg.mtu);
+ ofono_info("k = %d", cfg.k);
+
+ cfg.encapsulation = 0; /* encoding - set to basic */
+ cfg.initiator = 1; /* we are starting side */
+ cfg.mru = 1500;
+ cfg.mtu = 1500;
+ if ((err = ioctl(fd, GSMIOC_SETCONF, &cfg)) < 0) {
+ ofono_error("Failed to configure n_gsm multiplexer: %d", err);
+ goto error;
+ }
+
data->dlc_poll_count = 0;
data->dlc_poll_source = g_timeout_add_seconds(1, dlc_ready_check,
modem);
@@ -511,6 +544,9 @@ static void mux_setup_cb(gboolean ok, GAtResult *result, gpointer user_data)
return;
error:
+ if (ioctl(fd, TIOCSETD, &data->saved_ldisc) < 0)
+ ofono_warn("Failed to restore line discipline");
+
data->saved_ldisc = -1;
g_io_channel_unref(data->device);
@@ -727,26 +763,34 @@ static void ifx_post_online(struct ofono_modem *modem)
if (mw)
ofono_message_waiting_register(mw);
+ ofono_warn("Creating GPRS");
gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX,
"atmodem", data->dlcs[NETREG_DLC]);
if (gprs == NULL)
return;
- if (data->mux_ldisc < 0) {
- gc = ofono_gprs_context_create(modem, 0,
+ ofono_warn("Creating GPRS context");
+ gc = ofono_gprs_context_create(modem, 0,
"ifxmodem", data->dlcs[GPRS1_DLC]);
- if (gc)
- ofono_gprs_add_context(gprs, gc);
+ if (gc) {
+ ofono_warn("Adding GPRS context");
+ ofono_gprs_add_context(gprs, gc);
+ }
- gc = ofono_gprs_context_create(modem, 0,
+ ofono_warn("Creaing 2nd GPRS context");
+ gc = ofono_gprs_context_create(modem, 0,
"ifxmodem", data->dlcs[GPRS2_DLC]);
- if (gc)
- ofono_gprs_add_context(gprs, gc);
+ if (gc) {
+ ofono_warn("Adding 2nd GPRS context");
+ ofono_gprs_add_context(gprs, gc);
+ }
- gc = ofono_gprs_context_create(modem, 0,
+ ofono_warn("Creaing 3nd GPRS context");
+ gc = ofono_gprs_context_create(modem, 0,
"ifxmodem", data->dlcs[GPRS3_DLC]);
- if (gc)
- ofono_gprs_add_context(gprs, gc);
+ if (gc) {
+ ofono_warn("Adding 3nd GPRS context");
+ ofono_gprs_add_context(gprs, gc);
}
}
--
1.7.1
11 years, 7 months
[PATCH] hfp: Don't reply to crashed bluetoothd
by Daniel Wagner
In case bluetoothd crashes randomly the data pointer can
be NULL. So we shouldn't derefernce it.
---
plugins/hfp.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 12d3457..acb297f 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -569,6 +569,9 @@ static void hfp_connect_reply(DBusPendingCall *call, gpointer user_data)
DBG("Connect reply: %s", derr.message);
+ if (data == NULL)
+ goto poweroff;
+
if (dbus_error_has_name(&derr, DBUS_ERROR_NO_REPLY)) {
msg = dbus_message_new_method_call(BLUEZ_SERVICE,
data->handsfree_path,
@@ -579,6 +582,7 @@ static void hfp_connect_reply(DBusPendingCall *call, gpointer user_data)
g_dbus_send_message(connection, msg);
}
+poweroff:
ofono_modem_set_powered(modem, FALSE);
dbus_error_free(&derr);
--
1.7.3.3
11 years, 7 months
[PATCH] ifx: Remove modem selftest
by Jeevaka Badrappan
Command used for self test is not working for all
versions of the modem firmware.
---
plugins/ifx.c | 65 +-------------------------------------------------------
1 files changed, 2 insertions(+), 63 deletions(-)
diff --git a/plugins/ifx.c b/plugins/ifx.c
index a41fc36..527a8c4 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -524,7 +524,7 @@ static gboolean mux_timeout_cb(gpointer user_data)
struct ofono_modem *modem = user_data;
struct ifx_data *data = ofono_modem_get_data(modem);
- ofono_error("Timeout with modem or multiplexer setup");
+ ofono_error("Timeout with multiplexer setup");
data->mux_init_timeout = 0;
@@ -539,56 +539,6 @@ static gboolean mux_timeout_cb(gpointer user_data)
return FALSE;
}
-static void dev_ver_selftest_cb(gboolean ok, GAtResult *result,
- gpointer user_data)
-{
- struct ofono_modem *modem = user_data;
- struct ifx_data *data = ofono_modem_get_data(modem);
-
- if (ok)
- return;
-
- ofono_error("at@vers:device_version_id()-FAILED");
-
- if (data->mux_init_timeout > 0) {
- g_source_remove(data->mux_init_timeout);
- data->mux_init_timeout = 0;
- }
-
- 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);
-}
-
-static void rtc_gti_selftest_cb(gboolean ok, GAtResult *result,
- gpointer user_data)
-{
- struct ofono_modem *modem = user_data;
- struct ifx_data *data = ofono_modem_get_data(modem);
-
- if (ok)
- return;
-
- ofono_error("at@rtc_drv:rtc_gti_test_verify_32khz()-FAILED");
-
- if (data->mux_init_timeout > 0) {
- g_source_remove(data->mux_init_timeout);
- data->mux_init_timeout = 0;
- }
-
- 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);
-}
-
static int ifx_enable(struct ofono_modem *modem)
{
struct ifx_data *data = ofono_modem_get_data(modem);
@@ -642,24 +592,13 @@ static int ifx_enable(struct ofono_modem *modem)
g_at_chat_send(chat, "ATE0 +CMEE=1", NULL,
NULL, NULL, NULL);
- /* Execute modem self tests */
- g_at_chat_send(chat, "at@rtc_drv:rtc_gti_test_verify_32khz()", NULL,
- rtc_gti_selftest_cb, modem, NULL);
-
- g_at_chat_send(chat, "at@vers:device_version_id()", NULL,
- dev_ver_selftest_cb, modem, NULL);
-
/* Enable multiplexer */
data->frame_size = 1509;
g_at_chat_send(chat, "AT+CMUX=0,0,,1509,10,3,30,,", NULL,
mux_setup_cb, modem, NULL);
- /*
- * Total self test execution time is around 2 seconds. Use
- * 10 seconds timeout to cover self tests and multiplexer setup.
- */
- data->mux_init_timeout = g_timeout_add_seconds(10, mux_timeout_cb,
+ data->mux_init_timeout = g_timeout_add_seconds(5, mux_timeout_cb,
modem);
data->dlcs[AUX_DLC] = chat;
--
1.7.0.4
11 years, 7 months
[PATCHv2] doc: Assisted Satellite Navigation API and Agent API
by Simon LETHBRIDGE
Hi Fred,
> + void ResetAssistanceData()
> +
> + A request has been received from the network that all
> + assistance data should be reset. This is used for 3gpp
> + performance tests.
>
> Sorry to come back so late of this. By assistance data reset, you meant a reset of all positioning stored information? Like used in 3GPP conformance testing (44.014 ? 8.15 for instance)?
> The knowledge of positioning information is somehow "Assistance" information, but this is not the wording I'm used to.
>
Yes. Since this is a 3GPP performance test most of the stored information will have been received from the network as assistance data.
The recs that I have in mind are 34.123 and 51.10 Section 70
Regards,
Simon
11 years, 7 months
[RFC PATCH 0/1] Gprs context provisioning plugin
by Jukka Saunamaki
Hello
Following patch introduces a gprs context provisioning plugin.
It tries to find settings from a operator settings database for internet and mms type of gprs contexts. ims and wap types may be added later.
Provisioning logic: first try to find exact match for type,MCC,MNC and SPN. If that fails (or if SPN read from SIM is missing/empty), select first match for type/MCC/MNC.
Settings database is an XML formatted file, containing one <access>-element per settings for a specific type of GPRS context (internet, mms, ims)
Example:
<?xml version="1.0"?>
<settings>
<access type="internet" mcc="246" mnc="81" spn="oFono" name="Phonesim Internet" apn="internet.apn"/>
<access type="mms" mcc="246" mnc="81" spn="oFono" name="Phonesim MMS" apn="mms.apn" protocol="ipv4" username="mmsuser" password="mmspass" proxy="10.11.12.13:8080" mmsc="http://mms.example.com:8000"/>
</settings>
Plugin reads xml-files from a settings file directory in alphabetical order, until matching settings are found. This enables easy way to enable local variants by just installing separate configuration package that provides variant specific xml-file with name alphabetically earlier than the default settings file.
Open issue:
* Location of settings files: current code uses $CONFIGDIR/operator-settings, but I guess something like /usr/share/operator-settings would be better? (autoconf magic help needed)
--Jukka
11 years, 7 months
[RFCv2] doc: Proposal for LTE/IMS API
by Sjur Brændeland
From: Sjur Brændeland <sjur.brandeland(a)stericsson.com>
Thanks for lots of useful feedback from last RFC,
here is my next revision on the LTE/IMS API.
Comments are still very much welcome!
Changes from RFC-V1:
- Renamed IMS to IpMultimediaSubsystem (some places)
- Changed registration of IMS application.
- Moved IMS Identities to a separate interface
- Dropped the entire TFT/QoS info.
Instead oFono checks the QoS SIP Preconditions.
IMS application is notified about changes in QoS,
and asks oFono if the QoS SIP preconditions are
satisfied.
---
doc/ims-api.txt | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 162 insertions(+), 0 deletions(-)
create mode 100644 doc/ims-api.txt
diff --git a/doc/ims-api.txt b/doc/ims-api.txt
new file mode 100644
index 0000000..5404e61
--- /dev/null
+++ b/doc/ims-api.txt
@@ -0,0 +1,162 @@
+Ip Multimedia Subsystem hierarchy [experimental]
+=================================
+
+Service org.ofono
+Interface org.ofono.IpMultimediaSubsystem
+Object path [variable prefix]
+
+Methods dict GetProperties()
+
+ Returns all IMS properties. See the
+ properties section for available properties.
+
+ void Register(string type)
+
+ Register a IMS Application. It must register
+ with one of the types:
+ "voice", "messaging", "voice_messaging".
+
+ This registration will inform modem's radio
+ stack that the IMS application has registered
+ for Voice and/or Messaging over IMS.
+ This registration may impact "UE Mode of operation"
+ and the ISR feature in the radio stack.
+
+ The registered application is tracked, if the
+ application exits the registration will be
+ automatically released.
+
+ Related AT command: AT+EISR.
+
+ Possible Errors: [service].Error.InvalidArguments
+
+ void UnRegister(object path)
+
+ Un-register a IpMultimediaSubsystemAgent.
+
+ Possible Errors: [service].Error.InvalidArguments
+
+ boolean PreConditionCheck(string Type, string PeerAddress,
+ uint16 PeerPort, uint16 LocalPort)
+
+ This method is used by the IMS application to check
+ if the QoS SIP precondition is fulfilled.
+
+ The IMS application should call this method when
+ receiving a PreConditionChanged() signal.
+ The IMS Application is not allowed to start alerting
+ before it has confirmed that it has a voice-ready
+ Dedicated Bearer and QoS set up in the network.
+
+ The legal parameter for Type currently is currently
+ "voice" only. In future "video" (Conversational Video,
+ Live Streaming) will be added.
+
+ PeerAddress can be IPv4 or IPv6 address. PeerPort and
+ LocalPort is the RTP port used for the media stream.
+
+ This method returns true if the Traffic Flow Template
+ read from the modem matches the address information
+ provided, and the QCI and Bit Rates fulfills the
+ requirements for the specified type.
+
+ Related AT commands: AT+CGEQOSRDP, AT+CGTFTRDP
+
+ NOTE: Should the "Type" parameter be removed?
+ Maybe IMS-video still is a bit futuristic.
+
+Signals PropertyChanged(string property, variant value)
+
+ This signal indicates a changed value of the given
+ property.
+
+ void PreConditionChanged()
+
+ This signal is sent when the network has changed
+ the QoS or Packet Filters for a Bearer.
+ The IMS application can then check the QoS SIP
+ preconditions by calling PreConditionCheck().
+
+ Only QoS information relevant for IMS will be
+ signaled, i.e. QCI=1 for voice and QCI=2 for video.
+
+ Related AT commands: AT+CGEREP,
+ +CGEV: NW ACT, +CGEV: NW MODIFY
+
+Properties
+ array{object} Identities [readonly]
+
+ Array of IP Multimedia Identities objects and
+ properties.
+ NOTE: It is assumed that Identities will not change.
+
+ boolean VoiceOverPs [readonly]
+
+ IMS voice is enabled by network
+ Related AT command: AT+CIREP.
+
+ string CsHandoverProgress [readonly, optional]
+
+ Indicates the handover progress status during a CS
+ fallback procedure. The possible values are:
+ "started" - CS Fallback procedure has started
+ "complete" - CS Fallback procedure has completed
+ "failure" - CS Fallback has failed
+ "idle" - No CS call or fallback is ongoing
+
+ Related AT URC: +CIREP
+
+ array{string} PcscfAddresses [readonly]
+
+ Domain Name or IP Address of the SIP Proxy.
+ The P-CSCF address returned in EPS signaling as
+ as part of the Default Bearer setup will be used.
+ The addresses may be of type IPv4 and/or IPv6.
+ If no P-CSCF data is available the information from
+ EFp-cscf will be used.
+
+ Related AT command: AT+CGCONTRDP
+
+ NOTE: If an operator can have more than one
+ IMS-APN with different set of pcscf servers,
+ this property must be moved to the
+ ConnectionContext object.
+
+IP Multimedia Identities hierarchy [experimental]
+==================================
+
+Service org.ofono
+Interface org.ofono.IpMultimediaIdentities
+Object path [variable prefix]
+
+
+Methods dict GetProperties()
+
+ Returns all IMS identitiy properties.
+
+ Possible Errors: [service].Error.InvalidArguments
+
+ NOTE: No PropertyChanged signal is supported.
+ Technically it is possible for provisioning
+ to update these identities, but 3gpp TS31.103
+ discourages this.
+
+Properties string PrivateIdentity [readonly]
+
+ The Private Identity is used to allow the UE access
+ to the IMS network (registration, authorization,
+ administration and billing).
+
+ array{string} PublicIdentity [readonly]
+
+ The Public Identity is used to identify a specific
+ IMS user (there may be more than one associated
+ with one Private Identity). This information is conveyed
+ to the IMS Network during registration so that the
+ network can know what IMS users that are registered and
+ available for service (e.g. a reception of a voice
+ session).
+
+ string HomeDomainName[readonly]
+
+ Identity used for IMS registration.
--
1.6.3.3
11 years, 7 months
[PATCH] modem:Add powered watches on modem.
by Guillaume Zajac
---
src/modem.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 7 +++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 8e243d8..4e026cf 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -77,6 +77,7 @@ struct ofono_modem {
guint timeout;
ofono_bool_t online;
struct ofono_watchlist *online_watches;
+ struct ofono_watchlist *powered_watches;
GHashTable *properties;
struct ofono_sim *sim;
unsigned int sim_watch;
@@ -383,6 +384,22 @@ static void notify_online_watches(struct ofono_modem *modem)
}
}
+static void notify_powered_watches(struct ofono_modem *modem)
+{
+ struct ofono_watchlist_item *item;
+ GSList *l;
+ ofono_modem_powered_notify_func notify;
+
+ if (modem->powered_watches == NULL)
+ return;
+
+ for (l = modem->powered_watches->items; l; l = l->next) {
+ item = l->data;
+ notify = item->notify;
+ notify(modem->powered, item->notify_data);
+ }
+}
+
static void modem_change_state(struct ofono_modem *modem,
enum modem_state new_state)
{
@@ -462,6 +479,30 @@ void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
__ofono_watchlist_remove_item(modem->online_watches, id);
}
+unsigned int __ofono_modem_add_powered_watch(struct ofono_modem *modem,
+ ofono_modem_powered_notify_func notify,
+ void *data, ofono_destroy_func destroy)
+{
+ struct ofono_watchlist_item *item;
+
+ if (modem == NULL || notify == NULL)
+ return 0;
+
+ item = g_new0(struct ofono_watchlist_item, 1);
+
+ item->notify = notify;
+ item->destroy = destroy;
+ item->notify_data = data;
+
+ return __ofono_watchlist_add_item(modem->powered_watches, item);
+}
+
+void __ofono_modem_remove_powered_watch(struct ofono_modem *modem,
+ unsigned int id)
+{
+ __ofono_watchlist_remove_item(modem->powered_watches, id);
+}
+
static void common_online_cb(const struct ofono_error *error, void *data)
{
struct ofono_modem *modem = data;
@@ -723,6 +764,8 @@ static int set_powered(struct ofono_modem *modem, ofono_bool_t powered)
else if (err != -EINPROGRESS)
modem->powered_pending = modem->powered;
+ notify_powered_watches(modem);
+
return err;
}
@@ -1699,6 +1742,7 @@ int ofono_modem_register(struct ofono_modem *modem)
modem->atom_watches = __ofono_watchlist_new(g_free);
modem->online_watches = __ofono_watchlist_new(g_free);
+ modem->powered_watches = __ofono_watchlist_new(g_free);
emit_modem_added(modem);
call_modemwatches(modem, TRUE);
@@ -1732,6 +1776,9 @@ static void modem_unregister(struct ofono_modem *modem)
__ofono_watchlist_free(modem->online_watches);
modem->online_watches = NULL;
+
+ __ofono_watchlist_free(modem->powered_watches);
+ modem->powered_watches = NULL;
modem->sim_watch = 0;
modem->sim_ready_watch = 0;
diff --git a/src/ofono.h b/src/ofono.h
index 6ba0187..82d857f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -188,6 +188,13 @@ unsigned int __ofono_modem_add_online_watch(struct ofono_modem *modem,
void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
unsigned int id);
+typedef void (*ofono_modem_powered_notify_func)(ofono_bool_t powered, void *data);
+unsigned int __ofono_modem_add_powered_watch(struct ofono_modem *modem,
+ ofono_modem_online_notify_func notify,
+ void *data, ofono_destroy_func destroy);
+void __ofono_modem_remove_powered_watch(struct ofono_modem *modem,
+ unsigned int id);
+
#include <ofono/call-barring.h>
gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
--
1.7.1
11 years, 7 months
RE: [PATCH 5/7] cdmamodem: Add Signal Strength Support
by Rajesh.Nagaiah@elektrobit.com
Hi Dara,
> -----Original Message-----
> From: Dara Spieker-Doyle [mailto:dara.spiekerdoyle@gmail.com]
>
> Hi Rajesh
>
> On 02/09/2011 02:58 PM, ext Rajesh.Nagaiah(a)elektrobit.com wrote:
>
> > Hi Dara,
> >
> >> -----Original Message-----
> >> From: ofono-bounces(a)ofono.org
> >> [mailto:ofono-bounces@ofono.org] On Behalf Of Dara Spieker-Doyle
> >> Sent: 08 February 2011 13:05
> >> To: ofono(a)ofono.org
> >> Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support
> >>
> >
> >> +static gboolean cdma_get_next_number(const char *line, gint
> >> *number) {
> >> + int pos;
> >> + int end;
> >> + int len;
> >> + int value = 0;
> >> +
> >> + len = strlen(line);
> >> +
> >> + pos = 0;
> >> + end = pos;
> >> +
> >> + while (line[end]>= '0'&& line[end]<= '9') {
> >> + value = value * 10 + (int)(line[end] - '0');
> >> + end += 1;
> >> + }
> >> +
> >> + if (pos == end)
> >> + return FALSE;
> >> +
> >> + pos = skip_to_next_field(line, end, len);
> >> +
> >> + if (number)
> >> + *number = value;
> >> +
> >> + return TRUE;
> >> +}
> >> +
> >
> > This is a duplicate of g_at_result_iter_next_number().
> > Why cant use this function instead of cdma_get_next_number() ?
>
> This is different from g_at_result_iter_next_number() in that
> it takes a raw response line to parse rather than the result
> iterator. The AT syntax format of the response from this CDMA
> device does not follow the GSM standard AT syntax format.
>
> >
> >> +static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer
> >> +user_data) {
> >> + struct cb_data *cbd = user_data;
> >> + ofono_cdma_netreg_strength_cb_t cb = cbd->cb;
> >> + const char *prefix = cbd->user;
> >> + struct ofono_error error;
> >> + const char *attr;
> >> + int strength = -1;
> >> +
> >> + decode_at_error(&error, g_at_result_final_response(result));
> >> +
> >> + if (!ok) {
> >> + cb(&error, -1, cbd->data);
> >> + return;
> >> + }
> >> +
> >> + if (at_util_parse_attr(result, prefix,&attr) == FALSE) {
> >> + CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> >> + return;
> >> + }
> >> +
> >> + cdma_get_next_number(attr,&strength);
> >> +
> >> + DBG("csq_cb: %d", strength);
> >> +
> >> + cb(&error, at_util_convert_signal_strength(strength),
> >> cbd->data); }
> >
> > Refer csq_cb() implementation in
> > /drivers/atmodem/network-registration.c
> >
>
> If you are referring to the AT result iterator use in the atmodem csq
> callback:- we cannot use that here due to the response format
> of this CDMA device not being the same as the GSM standard.
> The prefix in this case is actually not in the same line as
> the actual response line, so I just opted to use the same
> algorithm as attr_cb() in /drivers/cdmamodem/devinfo for now
> and re-use at_util_parse_attr(), taking the last line as the response.
> This could well need to be extended for alternative CDMA AT
> devices added in the future, as the CDMA AT syntax is not
> standardised.
Can you send whats the actual result of AT+CSQ from the modem ?
If the last line is going to be only one number value, then you
can use some utility function to convert that string to a numeric value,
rather than duplicating g_at_result_iter_next_number() logic.
BR,
Rajesh
11 years, 7 months
Re: [PATCH 5/7] cdmamodem: Add Signal Strength Support
by Dara Spieker-Doyle
Hi Rajesh
On 02/09/2011 02:58 PM, ext Rajesh.Nagaiah(a)elektrobit.com wrote:
> Hi Dara,
>
>> -----Original Message-----
>> From: ofono-bounces(a)ofono.org
>> [mailto:ofono-bounces@ofono.org] On Behalf Of Dara Spieker-Doyle
>> Sent: 08 February 2011 13:05
>> To: ofono(a)ofono.org
>> Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support
>>
>
>> +static gboolean cdma_get_next_number(const char *line, gint
>> *number) {
>> + int pos;
>> + int end;
>> + int len;
>> + int value = 0;
>> +
>> + len = strlen(line);
>> +
>> + pos = 0;
>> + end = pos;
>> +
>> + while (line[end]>= '0'&& line[end]<= '9') {
>> + value = value * 10 + (int)(line[end] - '0');
>> + end += 1;
>> + }
>> +
>> + if (pos == end)
>> + return FALSE;
>> +
>> + pos = skip_to_next_field(line, end, len);
>> +
>> + if (number)
>> + *number = value;
>> +
>> + return TRUE;
>> +}
>> +
>
> This is a duplicate of g_at_result_iter_next_number().
> Why cant use this function instead of cdma_get_next_number() ?
This is different from g_at_result_iter_next_number() in that it takes a
raw response line to parse rather than the result iterator. The AT
syntax format of the response from this CDMA device does not follow the
GSM standard AT syntax format.
>
>> +static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer
>> +user_data) {
>> + struct cb_data *cbd = user_data;
>> + ofono_cdma_netreg_strength_cb_t cb = cbd->cb;
>> + const char *prefix = cbd->user;
>> + struct ofono_error error;
>> + const char *attr;
>> + int strength = -1;
>> +
>> + decode_at_error(&error, g_at_result_final_response(result));
>> +
>> + if (!ok) {
>> + cb(&error, -1, cbd->data);
>> + return;
>> + }
>> +
>> + if (at_util_parse_attr(result, prefix,&attr) == FALSE) {
>> + CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
>> + return;
>> + }
>> +
>> + cdma_get_next_number(attr,&strength);
>> +
>> + DBG("csq_cb: %d", strength);
>> +
>> + cb(&error, at_util_convert_signal_strength(strength),
>> cbd->data); }
>
> Refer csq_cb() implementation in /drivers/atmodem/network-registration.c
>
If you are referring to the AT result iterator use in the atmodem csq
callback:- we cannot use that here due to the response format of this
CDMA device not being the same as the GSM standard.
The prefix in this case is not in the same line as the actual response
line, so I opted to use the same algorithm as attr_cb() in
/drivers/cdmamodem/devinfo for now and re-use at_util_parse_attr(),
taking the last line as the response.
This could well need to be extended for alternative CDMA AT devices
added in the future, as the CDMA AT syntax is not standardised.
Cheers
Dara
11 years, 7 months