[PATCH 1/9] coding-style: add rule about checking NULL pointer
by Lucas De Marchi
---
doc/coding-style.txt | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/doc/coding-style.txt b/doc/coding-style.txt
index eccdacc..9dfdc09 100644
--- a/doc/coding-style.txt
+++ b/doc/coding-style.txt
@@ -209,6 +209,27 @@ However if the enum comes from an external header file outside ofono
we cannot make any assumption of how the enum is defined and this
rule might not apply.
+M13: Check for pointer being NULL
+=================================
+
+When checking if a pointer or a return value is NULL, explicitly compare to
+NULL rather than use the shorter check with "!" operator.
+
+Example:
+1)
+array = g_try_new0(int, 20);
+if (!array) // Wrong
+ return;
+
+2)
+if (!g_at_chat_get_slave(chat)) // Wrong
+ return -EINVAL;
+
+3)
+array = g_try_new0(int, 20);
+if (array == NULL) // Correct
+ return;
+
O1: Shorten the name
====================
Better to use abbreviation, rather than full name, to name a variable,
--
1.7.3.2
10 years, 1 month
[PATCH 1/3] smsutil: Change the range of time zone
by Yang Gu
---
src/smsutil.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/smsutil.c b/src/smsutil.c
index b06e9bf..644e3e0 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -51,6 +51,13 @@
#define SMS_ADDR_FMT "%24[0-9A-F]"
#define SMS_MSGID_FMT "%40[0-9A-F]"
+/*
+ * Time zone accounts for daylight saving time, and the two extreme time
+ * zones on earth are UTC-12 and UTC+14.
+ */
+#define MAX_TIMEZONE 56
+#define MIN_TIMEZONE -48
+
static GSList *sms_assembly_add_fragment_backup(struct sms_assembly *assembly,
const struct sms *sms, time_t ts,
const struct sms_address *addr,
@@ -339,7 +346,7 @@ gboolean sms_encode_scts(const struct sms_scts *in, unsigned char *pdu,
if (in->second > 59)
return FALSE;
- if ((in->timezone > 12*4-1) || (in->timezone < -(12*4-1)))
+ if ((in->timezone > MAX_TIMEZONE) || (in->timezone < MIN_TIMEZONE))
return FALSE;
pdu = pdu + *offset;
@@ -426,7 +433,7 @@ gboolean sms_decode_scts(const unsigned char *pdu, int len,
if (oct & 0x08)
out->timezone = out->timezone * -1;
- if ((out->timezone > 12*4-1) || (out->timezone < -(12*4-1)))
+ if ((out->timezone > MAX_TIMEZONE) || (out->timezone < MIN_TIMEZONE))
return FALSE;
return TRUE;
--
1.7.2.3
10 years, 1 month
[PATCH 0/4] Emergency Calls (4th round)
by Andras Domokos
Here is a new proposal for emergency calls handling.
Steps in handling emergency calls:
- subscribe to modem online notifications (add modem online watcher)
- an emergency call detected (phone number is emergency number)
- increment emergency mode
- advertise "EmergencyMode" property change on D-Bus (first call)
- set modem online if it's in offline mode (minimal setup)
- adevertise "Online" property change on D-Bus
- if modem is not online postpone making the call, otherwise make
the emergency call
- when modem online notification comes and there is postponed call request
make the emergency call
- when an emergency call ends decrement emergency mode
- set modem offline if it was set online due to the emergency call (last call)
- advertise "Online" property change on D-Bus
- advertise "EmergencyMode" property change on D-Bus (last call)
Note: emergency calls with SIM card (network registered or unregistered) and
without SIM card are supported.
Andras Domokos (4):
modem: add modem online-offline watch
modem: add EmergencyMode property
modem: move dial_request_cb function
voicecall: add emergency call handling
src/modem.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 12 ++++
src/voicecall.c | 175 +++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 334 insertions(+), 33 deletions(-)
10 years, 1 month
Read/Write EFcfis/EFcphs-cff
by Jeevaka Badrappan
Hi,
This patch reads and writes the VoiceUnconditional call forwarding status
from and to the SIM files EFcfis/EFcphs-cff. New property ForwardingFlagOnSim
is added to inform the status of the VoiceUnconditional status read from SIM.
If EFcfis is present, EFcfis file is read and the status is updated via
properties VoiceUnconditional and ForwardingFlagOnSim. If VoiceUnconditional
call forwaring rule is enabled, VoiceUnconditional property holds the
"forwared to" number whereas ForwardingFlagOnSim holds the status of the call
forwarding rule.
If cfis is not present but EFcphs-cff is present, then EFcphs-cff is read
and the status is updated via the property ForwardingFlagOnSim.
offline-online state transitions results in caching the call forwaring status
every time. To avoid this, call forwarding atom is moved to the post sim and
its moved also due to the fact that call forwarding status doesn't change in
roaming.
Regards,
Jeevaka
10 years, 1 month
[PATCH] Simulate provide local info command in sim app
by Yang Gu
---
src/simapplication.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
src/simapplication.h | 2 +
2 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 05ae21f..bc96a8c 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -288,6 +288,7 @@ const QString DemoSimApplication::getName()
#define MainMenu_SendUSSD 13
#define MainMenu_SendSMS 14
#define MainMenu_Polling 15
+#define MainMenu_LocalInfo 16
#define SportsMenu_Chess 1
#define SportsMenu_Painting 2
@@ -346,6 +347,9 @@ const QString DemoSimApplication::getName()
#define SendUSSD_Error 4
#define SendUSSD_Main 5
+#define LocalInfoMenu_Time 1
+#define LocalInfoMenu_Lang 2
+
enum SendSMSMenuItems {
SendSMS_Unpacked = 1,
SendSMS_Packed,
@@ -426,6 +430,10 @@ void DemoSimApplication::mainMenu()
item.setLabel( "SIM Polling" );
items += item;
+ item.setIdentifier( MainMenu_LocalInfo );
+ item.setLabel( "Provide Local Information" );
+ items += item;
+
cmd.setMenuItems( items );
command( cmd, 0, 0 );
@@ -550,6 +558,12 @@ void DemoSimApplication::mainMenuSelection( int id )
}
break;
+ case MainMenu_LocalInfo:
+ {
+ sendLocalInfoMenu();
+ }
+ break;
+
default:
{
// Don't know what this item is, so just re-display the main menu.
@@ -2044,3 +2058,57 @@ void DemoSimApplication::pollingMenuResp( const QSimTerminalResponse& resp )
break;
}
}
+
+void DemoSimApplication::sendLocalInfoMenu()
+{
+ QSimCommand cmd;
+ QSimMenuItem item;
+ QList<QSimMenuItem> items;
+
+ cmd.setType( QSimCommand::SelectItem );
+ cmd.setTitle( "Provide Local Information" );
+
+ item.setIdentifier( LocalInfoMenu_Time );
+ item.setLabel( "Date, time and time zone" );
+ items += item;
+
+ item.setIdentifier( LocalInfoMenu_Lang );
+ item.setLabel( "Language setting" );
+ items += item;
+
+ cmd.setMenuItems( items );
+
+ command( cmd, this, SLOT(localInfoMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::localInfoMenu( const QSimTerminalResponse& resp )
+{
+ QSimCommand cmd;
+
+ if ( resp.result() == QSimTerminalResponse::Success ) {
+ switch ( resp.menuItem() ) {
+
+ case LocalInfoMenu_Time:
+ {
+ cmd.setType( QSimCommand::ProvideLocalInformation );
+ cmd.setQualifier( 0x03 );
+ command( cmd, this, SLOT(sendLocalInfoMenu()) );
+ }
+ break;
+
+ case LocalInfoMenu_Lang:
+ {
+ cmd.setType( QSimCommand::ProvideLocalInformation );
+ cmd.setQualifier( 0x04 );
+ command( cmd, this, SLOT(sendLocalInfoMenu()) );
+ }
+ break;
+
+ default:
+ endSession();
+ break;
+ }
+ } else {
+ endSession();
+ }
+}
\ No newline at end of file
diff --git a/src/simapplication.h b/src/simapplication.h
index 4a2430f..6f90a1f 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -119,6 +119,8 @@ protected slots:
void smsSetTextResp( const QSimTerminalResponse& resp );
void sendPollingMenu();
void pollingMenuResp( const QSimTerminalResponse& resp );
+ void sendLocalInfoMenu();
+ void localInfoMenu ( const QSimTerminalResponse& resp );
private:
int sticksLeft;
--
1.7.2.3
10 years, 1 month
Add Barred Dialing Support
by Jeevaka Badrappan
Hi,
This patch adds the barred dialing support. If Barred Dialing service is
enabled, then oFono will go into emergency mode. Patch has been tested with the phonesim.
Regards,
jeevaka
10 years, 1 month
[PATCHv4] voicecall: fix dial result handling
by Pekka.Pessi@nokia.com
From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
The existing call will be automatically put on hold if there is an
existing active call when dialing. On some modems the dial request
returns only after the dialed call is active and the existing call has
been put on hold.
However, on isimodem driver the dial request returns immediately before
the existing call has changed its status. With isimodem driver the
dial_handle_result() selected the existing call from the list when it
should have created a new one.
The dial result handling now guards againt returning a previously dialed
active call as result.
---
src/voicecall.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 52baec3..d03ac2e 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -68,6 +68,7 @@ struct voicecall {
char *message;
uint8_t icon_id;
gboolean untracked;
+ gboolean dial_result_handled;
};
struct dial_request {
@@ -1096,9 +1097,18 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
v = l->data;
if (v->call->status == CALL_STATUS_DIALING ||
- v->call->status == CALL_STATUS_ALERTING ||
- v->call->status == CALL_STATUS_ACTIVE)
- return v;
+ v->call->status == CALL_STATUS_ALERTING)
+ goto handled;
+
+ /*
+ * Dial request may return before existing active call
+ * is put on hold or after dialed call has got active
+ */
+ if (v->call->status == CALL_STATUS_ACTIVE &&
+ v->call->direction ==
+ CALL_DIRECTION_MOBILE_ORIGINATED &&
+ !v->dial_result_handled)
+ goto handled;
}
call = synthesize_outgoing_call(vc, number);
@@ -1119,6 +1129,9 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
*need_to_emit = TRUE;
+handled:
+ v->dial_result_handled = TRUE;
+
return v;
}
--
1.7.1
10 years, 1 month
[PATCH 1/5] Add ofono_modem_reset()
by Gustavo F. Padovan
Some modems can screw up everything and then we will need to do a silent
reset of the modem. This patch take the modem back to the OFFLINE state.
---
include/modem.h | 2 ++
src/modem.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/modem.h b/include/modem.h
index 7b13ee0..a92eb88 100644
--- a/include/modem.h
+++ b/include/modem.h
@@ -46,6 +46,8 @@ int ofono_modem_register(struct ofono_modem *modem);
ofono_bool_t ofono_modem_is_registered(struct ofono_modem *modem);
void ofono_modem_remove(struct ofono_modem *modem);
+void ofono_modem_reset(struct ofono_modem *modem);
+
void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered);
ofono_bool_t ofono_modem_get_powered(struct ofono_modem *modem);
diff --git a/src/modem.c b/src/modem.c
index f032d93..6233944 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1615,6 +1615,21 @@ void ofono_modem_remove(struct ofono_modem *modem)
g_free(modem);
}
+void ofono_modem_reset(struct ofono_modem *modem)
+{
+ int err;
+
+ DBG("%p", modem);
+
+ ofono_modem_set_powered(modem, FALSE);
+
+ err = set_powered(modem, TRUE);
+ if (err == -EINPROGRESS)
+ return;
+
+ modem_change_state(modem, MODEM_STATE_PRE_SIM);
+}
+
int ofono_modem_driver_register(const struct ofono_modem_driver *d)
{
DBG("driver: %p, name: %s", d, d->name);
--
1.7.3.2
10 years, 1 month
[PATCH] HACKING: Add ofono.conf file copy command required
by Rafael Ignacio Zurita
Add ofono.conf copy command required for oFono core daemon to work.
---
HACKING | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/HACKING b/HACKING
index e825185..e632279 100644
--- a/HACKING
+++ b/HACKING
@@ -76,6 +76,9 @@ use the plugins directly from within the repository. This removes the need
to use "make install" when testing "ofonod". The "bootstrap-configure"
automatically includes this option.
+ Copy configuration file which specifies the required security policies
+ # sudo cp ./src/ofono.conf /etc/dbus-1/system.d/
+
Run daemon in foreground with debugging
# sudo ./src/ofonod -n -d 'plugins/*'
10 years, 1 month
[PATCH] Add voice call boolean property for MO/MT distinction
by Rémi Denis-Courmont
---
doc/voicecall-api.txt | 5 +++++
src/voicecall.c | 6 +++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/doc/voicecall-api.txt b/doc/voicecall-api.txt
index f0ba316..f3cad7c 100644
--- a/doc/voicecall-api.txt
+++ b/doc/voicecall-api.txt
@@ -87,6 +87,11 @@ Properties string LineIdentification [readonly]
"override category" option was not provisioned for
the current subscriber.
+ boolean Originated [readonly]
+
+ Indicates whether the call was mobile-originated
+ (true) or mobile-terminated (false).
+
boolean Multiparty [readonly]
Contains the indication if the voice call is part
diff --git a/src/voicecall.c b/src/voicecall.c
index 52baec3..045b492 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -322,7 +322,7 @@ static void append_voicecall_properties(struct voicecall *v,
const char *status;
const char *callerid;
const char *timestr;
- ofono_bool_t mpty;
+ ofono_bool_t mpty, originated;
status = call_status_to_string(call->status);
callerid = phone_number_to_string(&call->phone_number);
@@ -342,6 +342,10 @@ static void append_voicecall_properties(struct voicecall *v,
×tr);
}
+ originated = call->direction == CALL_DIRECTION_MOBILE_ORIGINATED;
+ ofono_dbus_dict_append(dict, "Originated", DBUS_TYPE_BOOLEAN,
+ &originated);
+
if (g_slist_find_custom(v->vc->multiparty_list,
GINT_TO_POINTER(call->id),
call_compare_by_id))
--
1.7.1
10 years, 1 month