Upgrade ofono to 1.2
[profile/ivi/ofono.git] / src / modem.c
index 43d7e9e..3c7c80a 100644 (file)
@@ -128,6 +128,8 @@ static const char *modem_type_to_string(enum ofono_modem_type type)
                return "hfp";
        case OFONO_MODEM_TYPE_SAP:
                return "sap";
+       case OFONO_MODEM_TYPE_TEST:
+               return "test";
        }
 
        return "unknown";
@@ -692,6 +694,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
        case OFONO_SIM_STATE_NOT_PRESENT:
                modem_change_state(modem, MODEM_STATE_PRE_SIM);
        case OFONO_SIM_STATE_INSERTED:
+       case OFONO_SIM_STATE_RESETTING:
                break;
        case OFONO_SIM_STATE_LOCKED_OUT:
                modem_change_state(modem, MODEM_STATE_PRE_SIM);
@@ -1123,15 +1126,19 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
        return __ofono_error_invalid_args(msg);
 }
 
-static GDBusMethodTable modem_methods[] = {
-       { "GetProperties",      "",     "a{sv}",        modem_get_properties },
-       { "SetProperty",        "sv",   "",             modem_set_property,
-                                                       G_DBUS_METHOD_FLAG_ASYNC },
+static const GDBusMethodTable modem_methods[] = {
+       { GDBUS_METHOD("GetProperties",
+                       NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
+                       modem_get_properties) },
+       { GDBUS_ASYNC_METHOD("SetProperty",
+                       GDBUS_ARGS({ "property", "s" }, { "value", "v" }),
+                       NULL, modem_set_property) },
        { }
 };
 
-static GDBusSignalTable modem_signals[] = {
-       { "PropertyChanged",    "sv" },
+static const GDBusSignalTable modem_signals[] = {
+       { GDBUS_SIGNAL("PropertyChanged",
+                       GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
        { }
 };
 
@@ -1779,6 +1786,20 @@ void ofono_modem_set_name(struct ofono_modem *modem, const char *name)
        }
 }
 
+void ofono_modem_set_driver(struct ofono_modem *modem, const char *type)
+{
+       DBG("type: %s", type);
+
+       if (modem->driver)
+               return;
+
+       if (strlen(type) > 16)
+               return;
+
+       g_free(modem->driver_type);
+       modem->driver_type = g_strdup(type);
+}
+
 struct ofono_modem *ofono_modem_create(const char *name, const char *type)
 {
        struct ofono_modem *modem;