return 1;
}
+static int
+_on_cmd_manager_modems_get(char *cmd, char *args)
+{
+ char *path;
+ Eina_Array_Iterator iterator;
+ unsigned int i;
+ Eina_Array *modems = eina_array_new(1);
+
+ if(e_ofono_manager_modems_get(&modems))
+ {
+ printf("[");
+ EINA_ARRAY_ITER_NEXT(modems, i, path, iterator)
+ printf(" %s", path);
+ printf(" ]\n");
+ }
+
+ return 1;
+}
+
/* Modem Commands */
static int
{"get_properties", _on_cmd_get_properties},
{"set_property", _on_cmd_property_set},
{"manager_get", _on_cmd_manager_get},
+ {"manager_modems_get", _on_cmd_manager_modems_get},
{"modem_set_powered", _on_cmd_modem_set_powered},
{NULL, NULL}
};
/* Manager Methods */
EAPI E_Ofono_Element *e_ofono_manager_get(void) EINA_WARN_UNUSED_RESULT;
+ EAPI bool e_ofono_manager_modems_get(Eina_Array **array);
/* Modem Methods */
EAPI bool e_ofono_modem_powered_get(const E_Ofono_Element *element, Eina_Bool *powered) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
#define MAX_KEY_SIZE 4096
static Eina_Hash *elements = NULL;
-typedef struct _E_Ofono_Array E_Ofono_Array;
typedef struct _E_Ofono_Element_Pending E_Ofono_Element_Pending;
typedef struct _E_Ofono_Element_Call_Data E_Ofono_Element_Call_Data;
typedef struct _E_Ofono_Element_Property E_Ofono_Element_Property;
typedef struct _E_Ofono_Element_Listener E_Ofono_Element_Listener;
typedef struct _E_Ofono_Element_Dict_Entry E_Ofono_Element_Dict_Entry;
-struct _E_Ofono_Array
-{
- int type;
- Eina_Array *array;
-};
-
struct _E_Ofono_Element_Pending
{
EINA_INLIST;
{
return e_ofono_element_get(manager_path, e_ofono_iface_manager);
}
+
+/**
+ * Get array of modem object paths.
+ *
+ * If this property isn't found then 0 is returned.
+ * If zero is returned, then this call failed and parameter-returned
+ * values shall be considered invalid.
+ *
+ * @param array where to store the property value, must be a pointer
+ * to Eina_Array (Eina_Array **), it will not be allocated or
+ * copied and references will be valid until element changes,
+ * so copy it if you want to use it later.
+ *
+ * @return 1 on success, 0 otherwise.
+ */
+bool
+e_ofono_manager_modems_get(Eina_Array **array)
+{
+ E_Ofono_Element *element;
+ E_Ofono_Array *a;
+ bool r;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(array, 0);
+
+ element = e_ofono_element_get(manager_path, e_ofono_iface_manager);
+ r = e_ofono_element_property_get_stringshared
+ (element, e_ofono_prop_modems, NULL, &a);
+ *array = a->array;
+ return r;
+}
#define WRN(...) EINA_LOG_DOM_WARN(_e_dbus_ofono_log_dom , __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_e_dbus_ofono_log_dom , __VA_ARGS__)
+ typedef struct _E_Ofono_Array E_Ofono_Array;
+
+ struct _E_Ofono_Array
+ {
+ int type;
+ Eina_Array *array;
+ };
+
static inline bool
__dbus_callback_check_and_init(const char *file, int line, const char *function, DBusMessage *msg, DBusMessageIter *itr, DBusError *err)
{