Re: [RFC] Multi-recipient SMS implementation proposals

2012-08-24 Thread Marcel Holtmann
Hi Guillaume,



> 2-Modify existing SendMessage API in adding a new mms argument:
> GDBUS_ASYNC_METHOD("SendMessage",
>  GDBUS_ARGS({ "to", "s" }, { "text", "s" }, { "mms", "i" }),
>  GDBUS_ARGS({ "path", "o" }),
>  sms_send_message)

oFono 1.x has a stable API. Why are you proposing to break the API?

Regards

Marcel


___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] test: Add test script to list services properties

2012-08-24 Thread Denis Kenzior

Hi Ronald,

On 08/24/2012 07:58 AM, Ronald Tessier wrote:

---
  test/list-services |   27 +++
  1 file changed, 27 insertions(+)
  create mode 100755 test/list-services



Patch has been applied, thanks.

Regards,
-Denis

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 0/4] Immediate digit response

2012-08-24 Thread Denis Kenzior

Hi Philippe,

On 08/24/2012 09:28 AM, Philippe Nunes wrote:

For GET-INPUT proactive command, the command qualifier can require
to send the response immediately after the user has entered a digit.
In this mode, the entered digit shall not be displayed and the character
'+' is not allowed for user input.

Philippe Nunes (4):
   stk: check if immediate digit response is requested
   stkagent: Add argument to notify when immediate digit response is
 required
   doc: Update STK API regarding the new argument immediate_response
   test: Print the immediate_response argument for RequestDigit



This patch ordering makes no sense.  The doc changes should be first, 
followed by stkagent changes followed by stk changes and then the test 
scripts.  Remember you want to break git bisect as little as possible.


Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 3/4] doc: Update STK API regarding the new argument immediate_response

2012-08-24 Thread Denis Kenzior

Hi Philippe,

On 08/24/2012 09:28 AM, Philippe Nunes wrote:

---
  doc/stk-api.txt |   13 +
  1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index 471e5d6..0d96246 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -170,8 +170,9 @@ Methods byte RequestSelection(string title, 
byte icon_id,
string default, byte min, byte max,
boolean hide_typing)

-   Same as GetInput but only digit characters (0-9, *#+)
-   are expected.
+   Same as RequestInput but only digit characters
+   (0-9, *#+) are expected. In hidden entry mode, "+" is
+   not allowed for user input.

Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession


Why is this chunk in this patch? What you're changing here does not 
match the patch description at all.



@@ -185,10 +186,14 @@ Methods   byte RequestSelection(string title, 
byte icon_id,
Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession

-   string RequestDigit(string alpha, byte icon_id)
+   string RequestDigit(string alpha, byte icon_id,
+   boolean immediate_response)

Same as above, but only digits (0-9, *#+) are
-   expected.
+   expected. The parameter immediate_response indicates
+   that the entered digit shall not be displayed and the
+   response shall be sent immediately after the key press.
+   "+" is not allowed for user input in this mode.

Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession


Unfortunately we cannot do it this way, the oFono API is frozen, we can 
only add new Methods, not change their arguments.  Naming is tricky 
since the immediate_response crap in the STK spec is utterly stupid. 
Name it RequestQuickDigit for now and I will think on it some more.


Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] phonesim: Add GET_INPUT test case

2012-08-24 Thread Denis Kenzior

Hi Philippe,

On 08/24/2012 09:35 AM, Philippe Nunes wrote:

This test case is used to check the immediate digit response flag.
---
  src/conformancesimapplication.cpp |   25 -
  src/qsimcommand.cpp   |   32 
  src/qsimcommand.h |3 +++


Please break this up into two, one for conformancesimapplication.cpp and 
the rest.



  3 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/src/conformancesimapplication.cpp 
b/src/conformancesimapplication.cpp
index baf3538..a2bd3af 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -81,11 +81,12 @@ const QString ConformanceSimApplication::getName()
  #define GetInkeyMenu_Cyrillic_Display_2  4
  #define GetInkeyMenu_Cyrillic_Entry  5
  #define GetInkeyMenu_YesNo_Response  6
-#define GetInkeyMenu_Icon7
-#define GetInkeyMenu_Help8
-#define GetInkeyMenu_Variable_Timeout9
-#define GetInkeyMenu_Text_Attribute 10
-#define GetInkeyMenu_Main   11
+#define GetInkeyMenu_ImmediateResponse   7
+#define GetInkeyMenu_Icon8
+#define GetInkeyMenu_Help9
+#define GetInkeyMenu_Variable_Timeout   10
+#define GetInkeyMenu_Text_Attribute 11
+#define GetInkeyMenu_Main   12

  #define GetInputMenu_Normal  1
  #define GetInputMenu_No_Response 2
@@ -677,6 +678,10 @@ void ConformanceSimApplication::sendGetInkeyMenu()
  item.setLabel( "Yes/No response for the input" );
  items += item;

+item.setIdentifier( GetInkeyMenu_ImmediateResponse );
+item.setLabel( "Immediate response for the digit input" );
+items += item;
+
  item.setIdentifier( GetInkeyMenu_Icon );
  item.setLabel( "Display of icon" );
  items += item;
@@ -887,6 +892,16 @@ void ConformanceSimApplication::GetInkeyMenu( const 
QSimTerminalResponse&  resp )
  }
  break;

+case GetInkeyMenu_ImmediateResponse:
+{
+cmd.setType( QSimCommand::GetInkey );
+cmd.setDestinationDevice( QSimCommand::ME );
+cmd.setWantImmediateResponse( true );
+cmd.setText( "Enter 1" );
+command( cmd, this, SLOT(sendGetInkeyMenu()) );
+}
+break;
+
  case GetInkeyMenu_Icon:
  {
  sendGetInkeyIconMenu();
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index f5dbdf2..7ef9c2e 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -1312,6 +1312,38 @@ void QSimCommand::setWantYesNo( bool value )


  /*!
+Returns true if \c GetInkey wants that the response is immediately sent
+after key press.  The default value is false.
+
+Applies to: \c GetInkey
+
+\sa setWantImmediateResponse()
+*/
+bool QSimCommand::wantImmediateResponse() const
+{
+if ( d->type == QSimCommand::GetInkey )
+return d->qualifierBit( 0x08 );
+else
+return false;
+}
+
+


Why two empty lines?


+/*!
+Sets the flag that determines if \c GetInkey wants that
+the response is immediately sent after key press.
+
+Applies to: \c GetInkey
+
+\sa wantImmediateResponse()
+*/
+void QSimCommand::setWantImmediateResponse( bool value )
+{
+if ( d->type == QSimCommand::GetInkey )
+dwrite()->setQualifierBit( 0x08, value );
+}
+
+


And again?


+/*!
  Returns the minimum text length for input.  The default value is 0.

  Applies to: \c GetInput.
diff --git a/src/qsimcommand.h b/src/qsimcommand.h
index 3b34be9..2c1b423 100644
--- a/src/qsimcommand.h
+++ b/src/qsimcommand.h
@@ -292,6 +292,9 @@ public:
  bool echo() const;
  void setEcho( bool value );

+bool wantImmediateResponse() const;
+void setWantImmediateResponse( bool value );
+
  QSimCommand::Disposition disposition() const;
  void setDisposition( QSimCommand::Disposition value );



Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] phonesim: Add GET_INPUT test case

2012-08-24 Thread Philippe Nunes
This test case is used to check the immediate digit response flag.
---
 src/conformancesimapplication.cpp |   25 -
 src/qsimcommand.cpp   |   32 
 src/qsimcommand.h |3 +++
 3 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/src/conformancesimapplication.cpp 
b/src/conformancesimapplication.cpp
index baf3538..a2bd3af 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -81,11 +81,12 @@ const QString ConformanceSimApplication::getName()
 #define GetInkeyMenu_Cyrillic_Display_2  4
 #define GetInkeyMenu_Cyrillic_Entry  5
 #define GetInkeyMenu_YesNo_Response  6
-#define GetInkeyMenu_Icon7
-#define GetInkeyMenu_Help8
-#define GetInkeyMenu_Variable_Timeout9
-#define GetInkeyMenu_Text_Attribute 10
-#define GetInkeyMenu_Main   11
+#define GetInkeyMenu_ImmediateResponse   7
+#define GetInkeyMenu_Icon8
+#define GetInkeyMenu_Help9
+#define GetInkeyMenu_Variable_Timeout   10
+#define GetInkeyMenu_Text_Attribute 11
+#define GetInkeyMenu_Main   12
 
 #define GetInputMenu_Normal  1
 #define GetInputMenu_No_Response 2
@@ -677,6 +678,10 @@ void ConformanceSimApplication::sendGetInkeyMenu()
 item.setLabel( "Yes/No response for the input" );
 items += item;
 
+item.setIdentifier( GetInkeyMenu_ImmediateResponse );
+item.setLabel( "Immediate response for the digit input" );
+items += item;
+
 item.setIdentifier( GetInkeyMenu_Icon );
 item.setLabel( "Display of icon" );
 items += item;
@@ -887,6 +892,16 @@ void ConformanceSimApplication::GetInkeyMenu( const 
QSimTerminalResponse& resp )
 }
 break;
 
+case GetInkeyMenu_ImmediateResponse:
+{
+cmd.setType( QSimCommand::GetInkey );
+cmd.setDestinationDevice( QSimCommand::ME );
+cmd.setWantImmediateResponse( true );
+cmd.setText( "Enter 1" );
+command( cmd, this, SLOT(sendGetInkeyMenu()) );
+}
+break;
+
 case GetInkeyMenu_Icon:
 {
 sendGetInkeyIconMenu();
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index f5dbdf2..7ef9c2e 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -1312,6 +1312,38 @@ void QSimCommand::setWantYesNo( bool value )
 
 
 /*!
+Returns true if \c GetInkey wants that the response is immediately sent
+after key press.  The default value is false.
+
+Applies to: \c GetInkey
+
+\sa setWantImmediateResponse()
+*/
+bool QSimCommand::wantImmediateResponse() const
+{
+if ( d->type == QSimCommand::GetInkey )
+return d->qualifierBit( 0x08 );
+else
+return false;
+}
+
+
+/*!
+Sets the flag that determines if \c GetInkey wants that
+the response is immediately sent after key press.
+
+Applies to: \c GetInkey
+
+\sa wantImmediateResponse()
+*/
+void QSimCommand::setWantImmediateResponse( bool value )
+{
+if ( d->type == QSimCommand::GetInkey )
+dwrite()->setQualifierBit( 0x08, value );
+}
+
+
+/*!
 Returns the minimum text length for input.  The default value is 0.
 
 Applies to: \c GetInput.
diff --git a/src/qsimcommand.h b/src/qsimcommand.h
index 3b34be9..2c1b423 100644
--- a/src/qsimcommand.h
+++ b/src/qsimcommand.h
@@ -292,6 +292,9 @@ public:
 bool echo() const;
 void setEcho( bool value );
 
+bool wantImmediateResponse() const;
+void setWantImmediateResponse( bool value );
+
 QSimCommand::Disposition disposition() const;
 void setDisposition( QSimCommand::Disposition value );
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/4] test: Print the immediate_response argument for RequestDigit

2012-08-24 Thread Philippe Nunes
---
 test/test-stk-menu |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/test-stk-menu b/test/test-stk-menu
index a9f92e8..3bd4483 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -113,10 +113,11 @@ class StkAgent(dbus.service.Object):
return key
 
@dbus.service.method("org.ofono.SimToolkitAgent",
-   in_signature="sy", out_signature="s")
-   def RequestDigit(self, title, icon):
+   in_signature="sys", out_signature="s")
+   def RequestDigit(self, title, icon, immediate_response):
print "Title: (%s)" % (title)
print "Icon: (%d)" % (icon)
+   print "Immediate response: (%s)" % (immediate_response)
key = raw_input("Enter Digit (t, b):")
 
if key == 'b':
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/4] stk: check if immediate digit response is requested

2012-08-24 Thread Philippe Nunes
---
 src/stk.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/stk.c b/src/stk.c
index 7a7bd75..3883d11 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1519,6 +1519,7 @@ static gboolean handle_command_get_inkey(const struct 
stk_command *cmd,
gboolean alphabet = (qualifier & (1 << 0)) != 0;
gboolean ucs2 = (qualifier & (1 << 1)) != 0;
gboolean yesno = (qualifier & (1 << 2)) != 0;
+   gboolean immediate = (qualifier & (1 << 3)) != 0;
/*
 * Note: immediate response and help parameter values are not
 * provided by current api.
@@ -1547,8 +1548,9 @@ static gboolean handle_command_get_inkey(const struct 
stk_command *cmd,
timeout);
else
err = stk_agent_request_digit(stk->current_agent, text,
-   &gi->icon_id, request_key_cb,
-   stk, NULL, timeout);
+   &gi->icon_id, immediate,
+   request_key_cb, stk, NULL,
+   timeout);
 
g_free(text);
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/4] doc: Update STK API regarding the new argument immediate_response

2012-08-24 Thread Philippe Nunes
---
 doc/stk-api.txt |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index 471e5d6..0d96246 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -170,8 +170,9 @@ Methods byte RequestSelection(string title, 
byte icon_id,
string default, byte min, byte max,
boolean hide_typing)
 
-   Same as GetInput but only digit characters (0-9, *#+)
-   are expected.
+   Same as RequestInput but only digit characters
+   (0-9, *#+) are expected. In hidden entry mode, "+" is
+   not allowed for user input.
 
Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession
@@ -185,10 +186,14 @@ Methods   byte RequestSelection(string title, 
byte icon_id,
Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession
 
-   string RequestDigit(string alpha, byte icon_id)
+   string RequestDigit(string alpha, byte icon_id,
+   boolean immediate_response)
 
Same as above, but only digits (0-9, *#+) are
-   expected.
+   expected. The parameter immediate_response indicates
+   that the entered digit shall not be displayed and the
+   response shall be sent immediately after the key press.
+   "+" is not allowed for user input in this mode.
 
Possible Errors: [service].Error.SimToolkit.GoBack
 [service].Error.SimToolkit.EndSession
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/4] stkagent: Add argument to notify when immediate digit response is required

2012-08-24 Thread Philippe Nunes
---
 src/stkagent.c |6 --
 src/stkagent.h |5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/stkagent.c b/src/stkagent.c
index 7c3f697..ed5d28a 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -554,8 +554,9 @@ static void get_digit_cb(DBusPendingCall *call, void *data)
 
 int stk_agent_request_digit(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
-   stk_agent_string_cb cb, void *user_data,
-   ofono_destroy_func destroy, int timeout)
+   ofono_bool_t immediate, stk_agent_string_cb cb,
+   void *user_data, ofono_destroy_func destroy,
+   int timeout)
 {
DBusConnection *conn = ofono_dbus_get_connection();
 
@@ -568,6 +569,7 @@ int stk_agent_request_digit(struct stk_agent *agent, const 
char *text,
dbus_message_append_args(agent->msg,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_BYTE, &icon->id,
+   DBUS_TYPE_BOOLEAN, &immediate,
DBUS_TYPE_INVALID);
 
if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call,
diff --git a/src/stkagent.h b/src/stkagent.h
index 6e267fc..e797c1e 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -99,8 +99,9 @@ int stk_agent_request_confirmation(struct stk_agent *agent, 
const char *text,
 
 int stk_agent_request_digit(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
-   stk_agent_string_cb cb, void *user_data,
-   ofono_destroy_func destroy, int timeout);
+   ofono_bool_t immediate, stk_agent_string_cb cb,
+   void *user_data, ofono_destroy_func destroy,
+   int timeout);
 
 int stk_agent_request_key(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/4] Immediate digit response

2012-08-24 Thread Philippe Nunes
For GET-INPUT proactive command, the command qualifier can require
to send the response immediately after the user has entered a digit.
In this mode, the entered digit shall not be displayed and the character
'+' is not allowed for user input.

Philippe Nunes (4):
  stk: check if immediate digit response is requested
  stkagent: Add argument to notify when immediate digit response is
required
  doc: Update STK API regarding the new argument immediate_response
  test: Print the immediate_response argument for RequestDigit

 doc/stk-api.txt|   13 +
 src/stk.c  |6 --
 src/stkagent.c |6 --
 src/stkagent.h |5 +++--
 test/test-stk-menu |5 +++--
 5 files changed, 23 insertions(+), 12 deletions(-)

-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 12/12] doc: Add ReportChanged signal description

2012-08-24 Thread Ronald Tessier
---
 doc/message-api.txt |7 +++
 1 file changed, 7 insertions(+)

diff --git a/doc/message-api.txt b/doc/message-api.txt
index 2922e5d..274bb98 100644
--- a/doc/message-api.txt
+++ b/doc/message-api.txt
@@ -31,6 +31,13 @@ Signals  PropertyChanged(string name, variant 
value)
The only expected property change is for the
message status.
 
+   ReportChanged(string type, variant recipient, variant status)
+
+   Signal that is sent when a report has been received and
+   processed. It contains the type of the report
+   ("delivery_report" or other), the recipient concerned
+   and its new status.
+
 Properties string Status [readonly]
 
The status of the message.  Possible values are
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 10/12] service: Send a delivery changed signal

2012-08-24 Thread Ronald Tessier
---
 src/service.c |   48 +---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 44184cb..ba23b4a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -218,6 +218,40 @@ static void emit_msg_status_changed(const char *path, 
const char *new_status)
g_dbus_send_message(connection, signal);
 }
 
+static void emit_msg_delivery_changed(const char *path, const char *rec,
+   const char *status)
+{
+   DBusMessage *signal;
+   DBusMessageIter iter;
+   DBusMessageIter variant;
+   const char *type = "delivery_report";
+
+   signal = dbus_message_new_signal(path, MMS_MESSAGE_INTERFACE,
+   "ReportChanged");
+   if (signal == NULL)
+   return;
+
+   dbus_message_iter_init_append(signal, &iter);
+
+   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &type);
+
+   dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+   DBUS_TYPE_STRING_AS_STRING, &variant);
+
+   dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &rec);
+
+   dbus_message_iter_close_container(&iter, &variant);
+
+   dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+   DBUS_TYPE_STRING_AS_STRING, &variant);
+
+   dbus_message_iter_append_basic(&variant, DBUS_TYPE_STRING, &status);
+
+   dbus_message_iter_close_container(&iter, &variant);
+
+   g_dbus_send_message(connection, signal);
+}
+
 static DBusMessage *msg_mark_read(DBusConnection *conn,
DBusMessage *msg, void *user_data)
 {
@@ -269,6 +303,10 @@ static const GDBusMethodTable message_methods[] = {
 static const GDBusSignalTable message_signals[] = {
{ GDBUS_SIGNAL("PropertyChanged",
GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+   { GDBUS_SIGNAL("ReportChanged",
+   GDBUS_ARGS({ "name", "s" },
+   { "rec", "v" },
+   { "status", "v" })) },
{ }
 };
 
@@ -1369,6 +1407,7 @@ static void process_delivery_ind_notification(struct 
mms_service *service,
char uuid[MMS_META_UUID_LEN + 1];
char *path;
char *to;
+   const char *new_status;
 
if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
goto bail;
@@ -1381,15 +1420,18 @@ static void process_delivery_ind_notification(struct 
mms_service *service,
 
mms_address_to_string(to);
 
-   g_key_file_set_string(meta, "delivery_status", to,
-   delivery_status[di_msg->di.dr_status - 127]);
+   new_status = delivery_status[di_msg->di.dr_status - 127];
 
-   g_free(to);
+   g_key_file_set_string(meta, "delivery_status", to, new_status);
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
+   emit_msg_delivery_changed(path, to, new_status);
+
+   g_free(to);
+
g_free(path);
 
 bail:
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 08/12] store: Define MMS_META_UUID_XXX len and suffix

2012-08-24 Thread Ronald Tessier
---
 src/store.c |8 +++-
 src/store.h |5 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/store.c b/src/store.c
index b09c17b..f1c5714 100644
--- a/src/store.c
+++ b/src/store.c
@@ -42,8 +42,6 @@
 #define TFR
 #endif
 
-#define MMS_SHA1_UUID_LEN 20
-
 static const char *digest_to_str(const unsigned char *digest)
 {
static char buf[MMS_SHA1_UUID_LEN * 2 + 1];
@@ -293,7 +291,7 @@ void mms_store_remove(const char *service_id, const char 
*uuid)
 
unlink(pdu_path);
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
@@ -312,7 +310,7 @@ GKeyFile *mms_store_meta_open(const char *service_id, const 
char *uuid)
if (pdu_path == NULL)
return NULL;
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
@@ -337,7 +335,7 @@ static void meta_store_sync(const char *service_id, const 
char *uuid,
if (pdu_path == NULL)
return;
 
-   meta_path = g_strdup_printf("%s%s", pdu_path, ".status");
+   meta_path = g_strdup_printf("%s%s", pdu_path, MMS_META_UUID_SUFFIX);
 
g_free(pdu_path);
 
diff --git a/src/store.h b/src/store.h
index ba2c080..fb2ca9f 100644
--- a/src/store.h
+++ b/src/store.h
@@ -19,6 +19,11 @@
  *
  */
 
+#define MMS_SHA1_UUID_LEN 20
+#define MMS_META_UUID_SUFFIX ".status"
+#define MMS_META_UUID_SUFFIX_LEN 7
+#define MMS_META_UUID_LEN (MMS_SHA1_UUID_LEN * 2)
+
 const char *mms_store(const char *service_id, unsigned char *pdu,
unsigned int len);
 const char *mms_store_file(const char *service_id, const char *path);
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 11/12] test: Add ReportChanged to monitored signals

2012-08-24 Thread Ronald Tessier
---
 test/monitor-mms |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/test/monitor-mms b/test/monitor-mms
index 188d028..ef17a13 100755
--- a/test/monitor-mms
+++ b/test/monitor-mms
@@ -29,6 +29,10 @@ def property_changed(name, value, member, path, interface):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s" % (iface, name, member, value)
 
+def report_changed(type, rec, status, path, interface):
+   iface = interface[interface.rfind(".") + 1:]
+   print "{%s} [%s] <%s> %s : %s" % (iface, path, type, rec, status)
+
 if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
@@ -75,5 +79,11 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
 
+   bus.add_signal_receiver(report_changed,
+   bus_name="org.ofono.mms",
+   signal_name = "ReportChanged",
+   path_keyword="path",
+   interface_keyword="interface")
+
mainloop = gobject.MainLoop()
mainloop.run()
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 09/12] service: Process delivery_ind notification

2012-08-24 Thread Ronald Tessier
---
 src/service.c |  111 ++---
 1 file changed, 107 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index b3ecc1e..44184cb 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1300,6 +1300,104 @@ static void emit_service_removed(struct mms_service 
*service)
&service->path, DBUS_TYPE_INVALID);
 }
 
+static gboolean get_meta_by_msgid(struct mms_service *service,
+   const char *msgid,
+   char *uuid)
+{
+   GDir *dir;
+   GKeyFile *meta;
+   const char *file;
+   const char *homedir;
+   const char *service_id;
+   char *service_path;
+
+   homedir = g_get_home_dir();
+   if (homedir == NULL)
+   return FALSE;
+
+   service_id = service->identity;
+
+   service_path = g_strdup_printf("%s/.mms/%s/", homedir, service_id);
+
+   dir = g_dir_open(service_path, 0, NULL);
+   g_free(service_path);
+   if (dir == NULL)
+   return FALSE;
+
+   while ((file = g_dir_read_name(dir)) != NULL) {
+   char *id;
+
+   if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
+   continue;
+
+   if (strlen(file) != MMS_META_UUID_LEN +
+   MMS_META_UUID_SUFFIX_LEN)
+   continue;
+
+   strncpy(uuid, file, MMS_META_UUID_LEN);
+   uuid[MMS_META_UUID_LEN] = 0;
+
+   meta = mms_store_meta_open(service_id, uuid);
+   if (meta == NULL)
+   goto bail;
+
+   id = g_key_file_get_string(meta, "info", "id", NULL);
+   if (id == NULL) {
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   continue;
+   }
+
+   if (g_strcmp0(msgid, id) == 0) {
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   g_dir_close(dir);
+   return TRUE;
+   }
+
+   mms_store_meta_close(service_id, uuid, meta, FALSE);
+   }
+
+bail:
+   g_dir_close(dir);
+
+   return FALSE;
+}
+
+static void process_delivery_ind_notification(struct mms_service *service,
+   struct mms_message *di_msg)
+{
+   GKeyFile *meta;
+   char uuid[MMS_META_UUID_LEN + 1];
+   char *path;
+   char *to;
+
+   if (get_meta_by_msgid(service, di_msg->di.msgid, uuid) == FALSE)
+   goto bail;
+
+   meta = mms_store_meta_open(service->identity, uuid);
+   if (meta == NULL)
+   return;
+
+   to = g_strdup(di_msg->di.to);
+
+   mms_address_to_string(to);
+
+   g_key_file_set_string(meta, "delivery_status", to,
+   delivery_status[di_msg->di.dr_status - 127]);
+
+   g_free(to);
+
+   mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
+
+   g_free(path);
+
+bail:
+   mms_store_remove(service->identity, di_msg->uuid);
+
+   mms_message_free(di_msg);
+}
+
 static gboolean load_message_from_store(const char *service_id,
const char *uuid, struct mms_message *msg)
 {
@@ -1485,6 +1583,7 @@ register_sr:
}
} else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
request = NULL;
+   process_delivery_ind_notification(service, msg);
} else
request = NULL;
 
@@ -1514,15 +1613,17 @@ static void load_messages(struct mms_service *service)
return;
 
while ((file = g_dir_read_name(dir)) != NULL) {
-   const size_t suffix_len = 7;
char *uuid;
+   size_t uuid_len;
 
-   if (g_str_has_suffix(file, ".status") == FALSE)
+   if (g_str_has_suffix(file, MMS_META_UUID_SUFFIX) == FALSE)
continue;
-   if (strlen(file) - suffix_len == 0)
+
+   uuid_len = strlen(file) - MMS_META_UUID_SUFFIX_LEN;
+   if (uuid_len == 0)
continue;
 
-   uuid = g_strndup(file, strlen(file) - suffix_len);
+   uuid = g_strndup(file, uuid_len);
 
process_message_on_start(service, uuid);
 
@@ -2401,6 +2502,8 @@ void mms_service_push_notify(struct mms_service *service,
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
+   process_delivery_ind_notification(service, msg);
+
return;
}
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 04/12] service: Move mms_address_to_string() up

2012-08-24 Thread Ronald Tessier
---
 src/service.c |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/service.c b/src/service.c
index b073ca9..c3dc40a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -354,6 +354,19 @@ static gboolean mmap_file(const char *path, void 
**out_pdu, size_t *out_len)
return TRUE;
 }
 
+static const char *mms_address_to_string(char *mms_address)
+{
+   unsigned int prefix_len;
+
+   if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
+   prefix_len = strlen(mms_address) - 10;
+
+   mms_address[prefix_len] = '\0';
+   }
+
+   return (const char *) mms_address;
+}
+
 static gboolean send_message_get_recipients(DBusMessageIter *top_iter,
struct mms_message *msg)
 {
@@ -1702,19 +1715,6 @@ static void append_msg_attachments(DBusMessageIter 
*dict, const char *path,
}
 }
 
-static const char *mms_address_to_string(char *mms_address)
-{
-   unsigned int prefix_len;
-
-   if (g_str_has_suffix(mms_address, "/TYPE=PLMN") == TRUE) {
-   prefix_len = strlen(mms_address) - 10;
-
-   mms_address[prefix_len] = '\0';
-   }
-
-   return (const char *) mms_address;
-}
-
 static void append_msg_recipients(DBusMessageIter *dict,
struct mms_message *msg)
 {
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 07/12] service: Support delivery_ind notif on start

2012-08-24 Thread Ronald Tessier
---
 src/service.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/service.c b/src/service.c
index 8087477..b3ecc1e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1357,7 +1357,8 @@ static gboolean load_message_from_store(const char 
*service_id,
else if (strcmp(state, "draft") == 0
&& msg->type == MMS_MESSAGE_TYPE_SEND_REQ)
msg->sr.status = MMS_MESSAGE_STATUS_DRAFT;
-   else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
+   else if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND &&
+   msg->type != MMS_MESSAGE_TYPE_DELIVERY_IND)
goto out;
 
success = TRUE;
@@ -1482,6 +1483,8 @@ register_sr:
request = NULL;
mms_message_register(service, msg);
}
+   } else if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+   request = NULL;
} else
request = NULL;
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 06/12] service: Support M-Delivery.ind in mms_service_push_notify()

2012-08-24 Thread Ronald Tessier
---
 src/service.c |   31 +++
 1 file changed, 31 insertions(+)

diff --git a/src/service.c b/src/service.c
index ec1b1b9..8087477 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2325,6 +2325,21 @@ static void process_request_queue(struct mms_service 
*service)
bearer_idle_timeout, service);
 }
 
+static void dump_delivery_ind(struct mms_message *msg)
+{
+   char buf[128];
+
+   strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&msg->di.date));
+   buf[127] = '\0';
+
+   mms_info("MMS version: %u.%u\n", (msg->version & 0x70) >> 4,
+   msg->version & 0x0f);
+   mms_info("Msg ID: %s\n", msg->di.msgid);
+   mms_info("To: %s\n", msg->di.to);
+   mms_info("Date: %s\n", buf);
+   mms_info("Delivery Report status: %d\n", msg->di.dr_status);
+}
+
 static void dump_notification_ind(struct mms_message *msg)
 {
char buf[128];
@@ -2370,6 +2385,22 @@ void mms_service_push_notify(struct mms_service *service,
if (mms_message_decode(data + nread, len - nread, msg) == FALSE)
goto error;
 
+   if (msg->type == MMS_MESSAGE_TYPE_DELIVERY_IND) {
+   msg->uuid = g_strdup(uuid);
+
+   dump_delivery_ind(msg);
+
+   meta = mms_store_meta_open(service->identity, uuid);
+   if (meta == NULL)
+   goto error;
+
+   g_key_file_set_string(meta, "info", "state", "notification");
+
+   mms_store_meta_close(service->identity, uuid, meta, TRUE);
+
+   return;
+   }
+
if (msg->type != MMS_MESSAGE_TYPE_NOTIFICATION_IND)
goto error;
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 05/12] service: Add a group [delivery_status] in the msg status

2012-08-24 Thread Ronald Tessier
This group contains an entry for each message recipients. Each recipient
entry will be updated when the corresponding report will be received
and then remove the temporary stored delivery report.
---
 src/service.c |   33 +
 1 file changed, 33 insertions(+)

diff --git a/src/service.c b/src/service.c
index c3dc40a..ec1b1b9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -69,6 +69,17 @@ static const char *ctl_chars = 
"\x01\x02\x03\x04\x05\x06\x07\x08\x0A"
 
 static const char *sep_chars = "()<>@,;:\\\"/[]?={} \t";
 
+static const char *delivery_status[] = {
+   "none",
+   "expired",
+   "retrieved",
+   "rejected",
+   "deferred",
+   "indeterminate",
+   "forwarded",
+   "unreachable"
+};
+
 struct mms_request;
 
 typedef gboolean (*mms_request_result_cb_t) (struct mms_request *request);
@@ -1058,6 +1069,28 @@ static DBusMessage *send_message(DBusConnection *conn,
 
g_key_file_set_string(meta, "info", "state", "draft");
 
+   if (service->use_delivery_reports) {
+   char **tos;
+   int i;
+
+   tos = g_strsplit(msg->sr.to, ",", 0);
+
+   for (i = 0; tos[i] != NULL; i++) {
+   char *to = g_strdup(tos[i]);
+
+   mms_address_to_string(to);
+
+   DBG("%s=%s", to, delivery_status[0]);
+
+   g_key_file_set_string(meta, "delivery_status", to,
+   delivery_status[0]);
+
+   g_free(to);
+   }
+
+   g_strfreev(tos);
+   }
+
mms_store_meta_close(service->identity, msg->uuid, meta, TRUE);
 
if (mms_message_register(service, msg) < 0)
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/12] mmsutil: Decode delivery_ind msg

2012-08-24 Thread Ronald Tessier
---
 src/mmsutil.c |   22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index a9a12eb..7042276 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -964,6 +964,24 @@ static gboolean decode_send_req(struct wsp_header_iter 
*iter,
return TRUE;
 }
 
+static gboolean decode_delivery_ind(struct wsp_header_iter *iter,
+   struct mms_message *out)
+{
+   return mms_parse_headers(iter, MMS_HEADER_MMS_VERSION,
+   HEADER_FLAG_MANDATORY | HEADER_FLAG_PRESET_POS,
+   &out->version,
+   MMS_HEADER_MESSAGE_ID,
+   HEADER_FLAG_MANDATORY, &out->di.msgid,
+   MMS_HEADER_TO,
+   HEADER_FLAG_MANDATORY, &out->di.to,
+   MMS_HEADER_DATE,
+   HEADER_FLAG_MANDATORY, &out->di.date,
+   MMS_HEADER_STATUS,
+   HEADER_FLAG_MANDATORY, &out->di.dr_status,
+   MMS_HEADER_INVALID);
+}
+
+
 #define CHECK_WELL_KNOWN_HDR(hdr)  \
if (wsp_header_iter_next(&iter) == FALSE)   \
return FALSE;   \
@@ -1016,7 +1034,7 @@ gboolean mms_message_decode(const unsigned char *pdu,
case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
return FALSE;
case MMS_MESSAGE_TYPE_DELIVERY_IND:
-   return FALSE;
+   return decode_delivery_ind(&iter, out);
}
 
return FALSE;
@@ -1051,6 +1069,8 @@ void mms_message_free(struct mms_message *msg)
case MMS_MESSAGE_TYPE_ACKNOWLEDGE_IND:
break;
case MMS_MESSAGE_TYPE_DELIVERY_IND:
+   g_free(msg->di.msgid);
+   g_free(msg->di.to);
break;
}
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 03/12] service: Store msg_id provided by M-Send.conf PDU

2012-08-24 Thread Ronald Tessier
---
 src/service.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/service.c b/src/service.c
index db9c514..b073ca9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -629,7 +629,7 @@ static gboolean result_request_send_conf(struct mms_request 
*request)
 
uuid = request->msg->uuid;
 
-   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
+   path = g_strdup_printf("%s/%s/%s", MMS_PATH, service->identity, uuid);
 
if (request->status != 200)
goto error;
@@ -655,17 +655,21 @@ static gboolean result_request_send_conf(struct 
mms_request *request)
 
mms_debug("response status : %d", msg->sc.rsp_status);
 
-   mms_message_free(msg);
-
munmap(pdu, len);
 
unlink(request->data_path);
 
meta = mms_store_meta_open(service->identity, uuid);
-   if (meta == NULL)
+   if (meta == NULL) {
+   mms_message_free(msg);
+
goto error;
+   }
 
g_key_file_set_string(meta, "info", "state", "sent");
+   g_key_file_set_string(meta, "info", "id", msg->sc.msgid);
+
+   mms_message_free(msg);
 
mms_store_meta_close(service->identity, uuid, meta, TRUE);
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 01/12] mmsutil: Define mms_delivery_ind struct

2012-08-24 Thread Ronald Tessier
---
 src/mmsutil.h |8 
 1 file changed, 8 insertions(+)

diff --git a/src/mmsutil.h b/src/mmsutil.h
index cc3ec67..e32c761 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -122,6 +122,13 @@ struct mms_notification_resp_ind {
enum mms_message_notify_status notify_status;
 };
 
+struct mms_delivery_ind {
+   enum mms_message_delivery_status dr_status;
+   char *msgid;
+   char *to;
+   time_t date;
+};
+
 struct mms_attachment {
unsigned char *data;
size_t offset;
@@ -143,6 +150,7 @@ struct mms_message {
struct mms_send_req sr;
struct mms_send_conf sc;
struct mms_notification_resp_ind nri;
+   struct mms_delivery_ind di;
};
 };
 
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 00/12] mmsd: (resending) Support Delivery Report notification

2012-08-24 Thread Ronald Tessier
These patches concern mmsd and add delivery report notification support.
Add MMS M-Delivery.ind PDU decoding support.
Update meta file of the sent message to store the received msg_id and to add a
group [delivery_status] if delivery_report is requested.
Upon MMS M-Delivery.ind PDU reception, update delivery_status recipient entry
with the received status (this is described in doc/storage.txt) and signal the
new delivery_report status for the recipient concerned.
Modify the monitor_mms test script to add report_changed monitoring.
Update message-api.txt doc to describe new ReportChanged signal.

Ronald Tessier (12):
  mmsutil: Define mms_delivery_ind struct
  mmsutil: Decode delivery_ind msg
  service: Store msg_id provided by M-Send.conf PDU
  service: Move mms_address_to_string() up
  service: Add a group [delivery_status] in the msg status
  service: Support M-Delivery.ind in mms_service_push_notify()
  service: Support delivery_ind notif on start
  store: Define MMS_META_UUID_XXX len and suffix
  service: Process delivery_ind notification
  service: Send a delivery changed signal
  test: Add ReportChanged to monitored signals
  doc: Add ReportChanged signal description

 doc/message-api.txt |7 ++
 src/mmsutil.c   |   22 -
 src/mmsutil.h   |8 ++
 src/service.c   |  260 ++-
 src/store.c |8 +-
 src/store.h |5 +
 test/monitor-mms|   10 ++
 7 files changed, 292 insertions(+), 28 deletions(-)

--
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] test: Add test script to list services properties

2012-08-24 Thread Ronald Tessier
---
 test/list-services |   27 +++
 1 file changed, 27 insertions(+)
 create mode 100755 test/list-services

diff --git a/test/list-services b/test/list-services
new file mode 100755
index 000..bd52d71
--- /dev/null
+++ b/test/list-services
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SessionBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono.mms', '/org/ofono/mms'),
+   'org.ofono.mms.Manager')
+
+services = manager.GetServices()
+
+for path, properties in services:
+   print "[ %s ]" % (path)
+
+   object = dbus.Interface(bus.get_object('org.ofono.mms', path),
+   'org.ofono.mms.Service')
+
+   try:
+   properties = object.GetProperties()
+   except:
+   continue
+
+   for key in properties.keys():
+   val = str(properties[key])
+   print "%s = %s" % (key, val)
+
+   print
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] mmsd: (resending) Add list-services script

2012-08-24 Thread Ronald Tessier
Add list-services script.
This script lists all services with their properties.

Ronald Tessier (1):
  test: Add test script to list services properties

 test/list-services |   27 +++
 1 file changed, 27 insertions(+)
 create mode 100755 test/list-services

--
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[RFC v1] gatchat: Print error message if opening tun failes

2012-08-24 Thread Daniel Wagner
From: Daniel Wagner 

This is a very common misstake. Let's help the users to
configure their system correctly.
---
Hi,

I was not able to find out why the check in at_grps_context_prope() does not
hit when the tun module is not loaded. Therefore, this on gets only
an RFC state...

cheers,
daniel

 gatchat/ppp_net.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 1609b99..813ed9b 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
if (fd < 0) {
/* open a tun interface */
fd = open("/dev/net/tun", O_RDWR);
-   if (fd < 0)
+   if (fd < 0) {
+   ppp_debug(ppp, "Couldn't open tun device. "
+   "Do you run oFono as root and do you "
+   "have the TUN module loaded?");
goto error;
+   }
 
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strcpy(ifr.ifr_name, "ppp%d");
-- 
1.7.12.rc1.16.g05a20c8

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] telit: sim status notification without polling

2012-08-24 Thread Christopher Vogl

Hi Denis,

On 23/08/12 19:37, Denis Kenzior wrote:

Hi Christopher,


Also, one other thing I'm concerned about is the CFUN=4 usage when we
try to set the modem offline. Your comments indicate that the Telit
modem resets the SIM when we issue CFUN=4. Going from Online True ->
False we don't actually want to reset the SIM. Does CFUN take an extra
parameter to turn SIM reset off by any chance?


Telit documentation says that +CFUN supports a second parameter which
should turn reset off.
AT+CFUN=? also returns +CFUN: (0,1,2,4,5),(0)
AT reference manual: "reset flag 0 - do not reset the ME before setting
it to  functionality level"

But the modem keeps returning +CME ERROR: 4 when I try it (no matter
which CFUN level).


That is funny.  Maybe the modem does not support a true 'offline' or 
'airplane' mode.  In which case the driver might need to be modified 
somewhat.


This is something we will need to solve in the future.  If not fixed, 
I'm guessing that going Online then Offline will reset the SIM and 
cause all kinds of funny behavior.




The modem behaves very strange sometimes. I kept getting timeouts when
setting AT+CFUN=4. I once tried it manually and it took 26 seconds until
I got an OK.
Currently it works fine again.



Is there a newer firmware available by any chance?



I'm currently using firmware version 08.01.107. Apparently there is a 
08.01.108 version. I contacted the Telit support and they said they are 
testing this version, so I don't know if it is available now. I hope we 
are getting an official Telit support with the possibility for updates 
soon - will know more on Tuesday.


Regards,
Christopher

--
Scanned by MailScanner.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] gdbus: Fix crash error when calling g_dbus_remove_all_watches

2012-08-24 Thread Tomasz Bursztyka
---
Hi,

While using gdbus on some other code, I found out that bug around 
g_dbus_remove_all_watches() usage.

Tomasz

 gdbus/watch.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gdbus/watch.c b/gdbus/watch.c
index d749176..968a38a 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -298,6 +298,9 @@ static void filter_data_call_and_free(struct filter_data 
*data)
g_free(cb);
}
 
+   g_slist_free(data->callbacks);
+   data->callbacks = NULL;
+
filter_data_free(data);
 }
 
-- 
1.7.8.6

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Reactivating context after SIM reinsertion fails sometimes (telit UC864G modem)

2012-08-24 Thread Christopher Vogl

Hi,

when I remove the SIM after a valid ppp connection and insert it again, 
the activation of the primary context often fails. The data port seems 
to be inactive at that time and AT+CGDCONT=1,"IP","gprswap" is not sent. 
The ppp connection seems to get shut down properly though.


I compared the output after removing the SIM with the output when it 
worked and I can't see any difference. Could this be a "timing problem"? 
How can I tell if the modem is ready for +CGDCONT again, i.e. which URC 
would tell me that? In that case I could defer the sending of+CGDCONT.  
I'm lacking knowledge and experience to solve this.




Valid ppp connection

...
...
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: < \r\n+CRSM: 
106,130\r\n\r\nOK\r\n

Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: > AT+CRSM=192,28618\r
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: < \r\n+CRSM: 
144,0,62218205022100050183026FCAA5038001318A01058B036F060B800200058800F10100\r\n\r\nOK\r\n
Aug 22 09:13:13 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/sim.c:at_crsm_info_cb() crsm_info_cb: 90, 00, 35
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: > 
AT+CRSM=178,28618,1,4,5\r
Aug 22 09:13:13 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/gprs-context.c:at_gprs_activate_primary() cid 1
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Modem: > 
AT+CGDCONT=1,"IP","gprswap"\r
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: < \r\n+CRSM: 
144,0,00\r\n\r\nOK\r\n
Aug 22 09:13:13 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/sim.c:at_crsm_read_cb() crsm_read_cb: 90, 00, 5

Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Aux: > AT+CRSM=192,28617\r
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Modem: < \r\nOK\r\n
Aug 22 09:13:13 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/gprs-context.c:at_cgdcont_cb() ok 1
Aug 22 09:13:13 mx31tt01 daemon.info ofonod[969]: Modem: > 
AT+CGDATA="PPP",1\r
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: Aux: < \r\n+CRSM: 
144,0,62218205022100040183026FC9A5038001318A01058B036F060B800200048800F10100\r\n\r\nOK\r\n
Aug 22 09:13:14 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/sim.c:at_crsm_info_cb() crsm_info_cb: 90, 00, 35
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: Aux: > 
AT+CRSM=178,28617,1,4,4\r

Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: Modem: < \r\nCONNECT\r\n
Aug 22 09:13:14 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/gprs-context.c:at_cgdata_cb() ok 1
Aug 22 09:13:14 mx31tt01 daemon.debug ofonod[969]: 
drivers/atmodem/gprs-context.c:setup_ppp()
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_generate_event: current state 0:INITIAL
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 0 (Up), 
action: 2, new_state: 2 (CLOSED)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_generate_event: current state 2:CLOSED
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 2 (Open), 
action: 1026, new_state: 6 (REQSENT)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_initialize_restart_count: current state 2:CLOSED
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_send_configure_request: current state 2:CLOSED
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: 
gatchat/gatppp.c:ppp_enter_phase() 1
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_process_configure_request: current state 6:REQSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_generate_event: current state 6:REQSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 6 (RCR+), 
action: 2008, new_state: 8 (ACKSENT)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_send_configure_ack: current state 6:REQSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_process_configure_ack: current state 8:ACKSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_generate_event: current state 8:ACKSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 8 (RCA), 
action: 129, new_state: 9 (OPENED)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: lcp: 
pppcp_initialize_restart_count: current state 8:ACKSENT
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: 
gatchat/gatppp.c:ppp_enter_phase() 2
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: 
gatchat/gatppp.c:ppp_enter_phase() 3
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: ipcp: 
pppcp_generate_event: current state 0:INITIAL
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 2 (Open), 
action: 401, new_state: 1 (STARTING)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: ipcp: 
pppcp_generate_event: current state 1:STARTING
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: event: 0 (Up), 
action: 1026, new_state: 6 (REQSENT)
Aug 22 09:13:14 mx31tt01 daemon.info ofonod[969]: PPP: ipcp: 
pppcp_initialize_restart_count: current state 1:STARTING
Aug 22 09:13:14 mx31tt01 daemon.info 

[RFC] Multi-recipient SMS implementation proposals

2012-08-24 Thread Guillaume Zajac

Hi all,

Mutli-recipient SMS implementation is needed to pass GCF test cases 
34.2.9.1 and 34.2.9.2 for GSM; 16.1.9.1 and 16.1.9.2 for WCDMA.
A new task should be added to oFono TODO and as requested by Denis we 
have to discuss first the proposals.

I have in mind 2 solutions:

1- Add a new API in message manager methods using an array of string 
containing all the recipients and returning an array of message paths:

GDBUS_ASYNC_METHOD("SendMultipleMessage",
GDBUS_ARGS({ "to", "a{s}" }, { "text", "s" }),
GDBUS_ARGS({ "paths", "a{o}" }),
sms_send_multiple_message)
It requires also to implement a new function in core based on 
__ofono_sms_txq_submit() to fill in the TX queue with all recipients 
before submitting the message.


2-Modify existing SendMessage API in adding a new mms argument:
GDBUS_ASYNC_METHOD("SendMessage",
GDBUS_ARGS({ "to", "s" }, { "text", "s" }, { "mms", "i" }),
GDBUS_ARGS({ "path", "o" }),
sms_send_message)
It requires to add a new field in struct ofono_sms like 'int send_mms'.
tx_next() function should be modified to check 'int mms' option before 
analysing the TX queue size.
We should determine if send_mms = 2 options could be used. Even if we 
don't use it, send_mms should be set to 0 once all the multi-recipient 
SMS have been transmitted.


Kind regards,
Guillaume
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH v2] ussd: Recover idle state in case of response sending failure

2012-08-24 Thread Philippe Nunes

On 08/23/2012 08:03 PM, Denis Kenzior wrote:

Hi Philippe,

On 08/23/2012 11:27 AM, Philippe Nunes wrote:

GCF test case 31.8.1.2.3 is rejecting the user response.
Any subsequent USSD notification are not handled because USSD is
always in
state user-action.
---
src/ussd.c | 12 
1 file changed, 12 insertions(+)

diff --git a/src/ussd.c b/src/ussd.c
index 74888b2..21e0164 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -414,6 +414,18 @@ void ofono_ussd_notify(struct ofono_ussd *ussd,
int status, int dcs,
return;
}

+ if (status == OFONO_USSD_STATUS_TERMINATED&&
+ (ussd->state == USSD_STATE_IDLE ||
+ ussd->state == USSD_STATE_USER_ACTION)) {


This check makes no sense, why bother checking for ussd->state ==
USSD_STATE_IDLE?


The issue has been unveiled after a network initiated USSD request:

\r\n+CUSD: 1,"Type *70*635*562# and send",15\r\n
src/ussd.c:ofono_ussd_notify() status: 1 ACTION_REQUIRED, state: 0 IDLE

then we try to  give an answer:

AT+CUSD=1,"*70*635*562#",15\r
\r\n+CUSD: 2\r\n
\r\n+CME ERROR: 100\r\n


I presume that the same error could occur after a user USSD request. In 
this case, the state is still 'idle' and the "Terminated" notification 
results in a "NotificationReceived" signal with a NULL string. To avoid 
this, I need to check also for ussd->state == USSD_STATE_IDLE. That's 
why the first version was for me more appropriate.






+ ussd_change_state(ussd, USSD_STATE_IDLE);
+
+ if (ussd->pending == NULL)
+ return;
+
+ reply = __ofono_error_not_supported(ussd->pending);
+ goto out;
+ }
+


I would handle it just like the 'Not Supported' case but with a new
__ofono_error_network_terminated error reply. Or perhaps re-use
__ofono_error_canceled.


In practice, I don't ever expect to send a reply since the 
ussd_response_callback/ ussd_callback is invoked before the TERMINATED 
notification. The error returned in the callback is __ofono_error_failed.
So, what about changing the state to 'idle' if not already set and 
simply return?


Regards,

Philippe.

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/3] control: Link functionnality to STK command editor

2012-08-24 Thread Nicolas Bertrand
---
 src/control.cpp |   12 
 src/control.h   |2 ++
 2 files changed, 14 insertions(+)

diff --git a/src/control.cpp b/src/control.cpp
index 3f1dd45..f518201 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -91,6 +91,8 @@ ControlWidget::ControlWidget(const QString &ruleFile, Control 
*parent)
 connect(ui->pbAlerting, SIGNAL(clicked()), this, SLOT(setStateAlerting()));
 connect(ui->pbActive, SIGNAL(clicked()), this, SLOT(setStateConnected()));
 connect(ui->pbHangup, SIGNAL(clicked()), this, SLOT(setStateHangup()));
+connect(ui->pbSTKCmdSend, SIGNAL(clicked()), this, SLOT(STKCmdSend()));
+connect(ui->pbSTKClear, SIGNAL(clicked()), this, SLOT(STKClear()));
 
 QStringList headers;
 headers << "Sender" << "Priority" << "Notification Status";
@@ -625,6 +627,16 @@ void Control::handleNewApp()
 widget->handleNewApp();
 }
 
+void ControlWidget::STKCmdSend()
+{
+emit unsolicitedCommand( "+CUSATP: " + ui->teSTKCmdEditor->toPlainText() );
+}
+
+void ControlWidget::STKClear()
+{
+ui->teSTKCmdEditor->clear();
+}
+
 void ControlWidget::simAppStart()
 {
 if ( ui->cbSimApps->currentIndex() >= 0 )
diff --git a/src/control.h b/src/control.h
index fd1a4e6..c4d5244 100644
--- a/src/control.h
+++ b/src/control.h
@@ -107,6 +107,8 @@ private slots:
 void setStateAlerting();
 void setStateConnected();
 void setStateHangup();
+void STKCmdSend();
+void STKClear();
 
 signals:
 void unsolicitedCommand(const QString &);
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/3] controlbase_ui: Add manual stk command editor

2012-08-24 Thread Nicolas Bertrand
---
 src/controlbase.ui |   46 ++
 1 file changed, 46 insertions(+)

diff --git a/src/controlbase.ui b/src/controlbase.ui
index 4eb1355..e230d7c 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -1161,6 +1161,52 @@
 


+
+ 
+  STK Command
+ 
+ 
+  false
+ 
+ 
+  
+   
+80
+150
+141
+31
+   
+  
+  
+   Send
+  
+ 
+ 
+  
+   
+235
+20
+401
+161
+   
+  
+ 
+ 
+  
+   
+80
+100
+141
+31
+   
+  
+  
+   Clear
+  
+ 
+
+   
+   
 
  
   Application
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/3] phonesim: accept STK command without application

2012-08-24 Thread Nicolas Bertrand
If the STK command is rightly formated, send OK even if
the sim application does not handle it. it's needed to
be able to manualy send STK command.
---
 src/phonesim.cpp |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 276ae47..aa4f8a2 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -985,8 +985,10 @@ bool SimRules::simCommand( const QString& cmd )
 QByteArray response = QAtUtils::fromHex( cmd.mid(start) );
 QSimTerminalResponse resp = QSimTerminalResponse::fromPdu( response );
 
-if ( !toolkitApp || !toolkitApp->response( resp ) )
+if ( ( resp.command().type() == QSimCommand::NoCommand ) || 
!toolkitApp )
 respond( "ERROR" );
+else if ( !toolkitApp->response( resp ) )
+respond( "OK" );
 
 return true;
 }
@@ -997,8 +999,10 @@ bool SimRules::simCommand( const QString& cmd )
 QByteArray envelope = QAtUtils::fromHex( cmd.mid(start) );
 QSimEnvelope env = QSimEnvelope::fromPdu( envelope );
 
-if (!toolkitApp || !toolkitApp->envelope( env ) )
+if ( ( env.type() == QSimEnvelope::NoEnvelope ) || !toolkitApp )
 respond( "ERROR" );
+else if ( !toolkitApp->envelope( env ) )
+respond( "OK" );
 
 return true;
 }
-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/3] Add STK APDU editor

2012-08-24 Thread Nicolas Bertrand
Add to phonesim the capability to symply send STK APDU

Nicolas Bertrand (3):
  phonesim: accept STK command without application
  controlbase_ui: Add manual stk command editor
  control: Link functionnality to STK command editor

 src/control.cpp|   12 
 src/control.h  |2 ++
 src/controlbase.ui |   46 ++
 src/phonesim.cpp   |8 ++--
 4 files changed, 66 insertions(+), 2 deletions(-)

-- 
1.7.9.5

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] sms: Add delay before submitting multiple SMS to modem

2012-08-24 Thread Guillaume Zajac

Hi Denis,

On 23/08/2012 19:33, Denis Kenzior wrote:

Hi Guillaume,

On 08/23/2012 09:26 AM, Guillaume Zajac wrote:

Hi Denis,

On 23/08/2012 15:48, Denis Kenzior wrote:

Hi Guillaume,




Unfortunately I come to the conclusion that if I want to send one same
SMS to 3/4/5/... recipients with an application using oFono 
middleware,

I will not be able to send them through the same RRC channel, unless I
queue them offline.



If such a feature is important, then you do have a point. However,
implementing _anything_ by introducing an arbitrary delay is simply
wrong. I believe they teach the reasons for that in Operating Systems
101. You are introducing a race condition that will break things at
the most inopportune time.


I agree that it is not the most elegant/cleanest solution.



Then please refrain from sending patches which contain 'not the most 
elegant/cleanest' solution in the future.  oFono has a very high 
standard of quality, and the standard is even higher in the core than 
the driver code.


You are better off starting a discussion on IRC or describing the 
problem in detail on the mailing list asking for possible solutions.




If we really require multi-recipient SMS to go on the same RRC
channel, then the best way to do so would be to introduce a new API
specifically for this use case.


Having a new API for multi-recipient SMS would be indeed the best 
solution.

With current implementation the test is passing with multi-segment SMS
using script but GCF test description is mentioning 3 different SMS.
During device certification (with applications), the tester will try to
send an SMS to 3 recipients but it will fail.
Another solution would be to remove multi-SMS support from the PICS.


Our current goal is just the baseline.  That means if we're missing a 
feature, then we need to note that down and continue on.


This is where the TODO file comes in.  If you see features that are 
missing, then send a patch to the TODO file describing the feature and 
the preferred approach (after the relevant discussions on IRC/mailing 
list).  The feature priority assignment / implementation can then 
proceed with the well-established workflow.




Ok I will send a RFC about this new feature, this will be the new thread 
to discuss on it.


Kind regards,
Guillaume
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono