Convert multiple return values to structs.
Python DBus bindings are unable to implement methods that return multiple values.
This commit is contained in:
@@ -34,19 +34,9 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_info"/>
|
||||
<arg name="manufacturer" type="s" direction="out">
|
||||
<arg name="info" type="(sss)" direction="out">
|
||||
<tp:docstring>
|
||||
The manufacturer of the card.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="modem" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The model of the card.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="version" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The version (revision) of the card.
|
||||
Structure containing manufacturer, model, and version (revision) of the card.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
@@ -49,19 +49,9 @@
|
||||
The index of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="found_index" type="u" direction="out">
|
||||
<arg name="contact" type="(uss)" direction="out">
|
||||
<tp:docstring>
|
||||
The index of the contact (same as the passed index).
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="name" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The name of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="number" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The number of the contact.
|
||||
The contact structure containing index, name, and number.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
@@ -112,19 +112,12 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_reg_info"/>
|
||||
<arg name="status" type="u" direction="out" tp:type="MM_MODEM_GSM_NETWORK_REG_STATUS">
|
||||
<arg name="info" type="(uss)" direction="out">
|
||||
<tp:docstring>
|
||||
The network status.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="operator_code" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The current operator code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="operator_name" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The current operator name.
|
||||
The returned information contains:
|
||||
* Network status.
|
||||
* Current operator code.
|
||||
* Current operator name,
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
@@ -26,24 +26,9 @@
|
||||
The index of the SMS.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="found_index" type="u" direction="out">
|
||||
<arg name="sms" type="(ussd)" direction="out">
|
||||
<tp:docstring>
|
||||
The index of the SMS (same as the passed index).
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="number" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The number the SMS was received from.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="contents" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The contents of the SMS.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="time" type="d" direction="out">
|
||||
<tp:docstring>
|
||||
The timestamp.
|
||||
The SMS structure containing index, number, contents and time stamp.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
@@ -75,8 +75,32 @@ info_call_done (MMModemGsmCard *self,
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, manufacturer, model, version);
|
||||
else {
|
||||
GValueArray *array;
|
||||
GValue value = { 0, };
|
||||
|
||||
array = g_value_array_new (3);
|
||||
|
||||
/* Manufacturer */
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, manufacturer);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
/* Model */
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, model);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
/* Version */
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, version);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
dbus_g_method_return (context, array);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -116,9 +116,30 @@ reg_info_call_done (MMModemGsmNetwork *self,
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else {
|
||||
dbus_g_method_return (context, status,
|
||||
oper_code ? oper_code : "",
|
||||
oper_name ? oper_name : "");
|
||||
GValueArray *array;
|
||||
GValue value = { 0, };
|
||||
|
||||
array = g_value_array_new (3);
|
||||
|
||||
/* Status */
|
||||
g_value_init (&value, G_TYPE_UINT);
|
||||
g_value_set_uint (&value, (guint32) status);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
/* Operator code */
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, oper_code);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
/* Operator name */
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, oper_name);
|
||||
g_value_array_append (array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
dbus_g_method_return (context, array);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +351,9 @@ mm_modem_gsm_network_registration_info (MMModemGsmNetwork *self,
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
|
||||
g_signal_emit (self, signals[REGISTRATION_INFO], 0, status, oper_code, oper_name);
|
||||
g_signal_emit (self, signals[REGISTRATION_INFO], 0, status,
|
||||
oper_code ? oper_code : "",
|
||||
oper_name ? oper_name : "");
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user