Implement the more granular GSM interfaces as agreed on NM mailing list.
Convert all exisiting code over to new DBus interfaces.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
EXTRA_DIST = \
|
||||
mm-manager.xml \
|
||||
mm-modem.xml \
|
||||
mm-gsm-modem.xml \
|
||||
mm-gsm-modem-hso.xml \
|
||||
mm-cdma-modem.xml
|
||||
mm-modem-cdma.xml \
|
||||
mm-modem-gsm-card.xml \
|
||||
mm-modem-gsm-contacts.xml \
|
||||
mm-modem-gsm-network.xml \
|
||||
mm-modem-gsm-sms.xml
|
||||
|
||||
|
@@ -24,7 +24,9 @@
|
||||
|
||||
<xi:include href="mm-manager.xml"/>
|
||||
<xi:include href="mm-modem.xml"/>
|
||||
<xi:include href="mm-cdma-modem.xml"/>
|
||||
<xi:include href="mm-gsm-modem.xml"/>
|
||||
<xi:include href="mm-gsm-modem-hso.xml"/>
|
||||
<xi:include href="mm-modem-cdma.xml"/>
|
||||
<xi:include href="mm-modem-gsm-card.xml"/>
|
||||
<xi:include href="mm-modem-gsm-contacts.xml"/>
|
||||
<xi:include href="mm-modem-gsm-network.xml"/>
|
||||
<xi:include href="mm-modem-gsm-sms.xml"/>
|
||||
</tp:spec>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
Get the current signal quality.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_cdma_modem_get_signal_quality"/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_modem_cdma_get_signal_quality"/>
|
||||
<arg name="quality" type="u" direction="out">
|
||||
<tp:docstring>
|
||||
Signal quality (percent).
|
104
introspection/mm-modem-gsm-card.xml
Normal file
104
introspection/mm-modem-gsm-card.xml
Normal file
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.freedesktop.ModemManager.Modem.Gsm.Card">
|
||||
<method name="GetImei">
|
||||
<tp:docstring>
|
||||
Get the IMEI of the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_imei"/>
|
||||
<arg name="imei" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The IMEI.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="GetImsi">
|
||||
<tp:docstring>
|
||||
Get the IMSI of the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_imsi"/>
|
||||
<arg name="imsi" type="s" direction="out">
|
||||
<tp:docstring>
|
||||
The IMSI.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="GetInfo">
|
||||
<tp:docstring>
|
||||
Get the card information (manufacturer, modem, version).
|
||||
</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">
|
||||
<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.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="SendPin">
|
||||
<tp:docstring>
|
||||
Send the PIN (or PUK) to unlock the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_send_pin"/>
|
||||
<arg name="pin" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The PIN code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="EnablePin">
|
||||
<tp:docstring>
|
||||
Enable or disable the PIN checking.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_enable_pin"/>
|
||||
<arg name="pin" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The PIN code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="enabled" type="b" direction="in">
|
||||
<tp:docstring>
|
||||
True to enable PIN checking.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="ChangePin">
|
||||
<tp:docstring>
|
||||
Change the PIN code.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_change_pin"/>
|
||||
<arg name="old_pin" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The current PIN code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="new_pin" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The new PIN code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
</interface>
|
||||
</node>
|
114
introspection/mm-modem-gsm-contacts.xml
Normal file
114
introspection/mm-modem-gsm-contacts.xml
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.freedesktop.ModemManager.Modem.Gsm.Contacts">
|
||||
<method name="Add">
|
||||
<tp:docstring>
|
||||
Add a new contact to the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_add"/>
|
||||
<arg name="name" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The name of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="number" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The phone number of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="index" type="u" direction="out">
|
||||
<tp:docstring>
|
||||
The index of the new contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="Delete">
|
||||
<tp:docstring>
|
||||
Delete a contact from the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_delete"/>
|
||||
<arg name="index" type="u" direction="in">
|
||||
<tp:docstring>
|
||||
The index of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="Get">
|
||||
<tp:docstring>
|
||||
Retrieve a contact from the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_get"/>
|
||||
<arg name="index" type="u" direction="in">
|
||||
<tp:docstring>
|
||||
The index of the contact.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="found_index" type="u" 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.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="List">
|
||||
<tp:docstring>
|
||||
List all contacts on the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_list"/>
|
||||
<arg name="results" type="a(uss)" direction="out">
|
||||
<tp:docstring>
|
||||
The list of contacts where each contact has an index, name, and number.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="Find">
|
||||
<tp:docstring>
|
||||
Find a contact from the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_find"/>
|
||||
<arg name="pattern" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The pattern to search for.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="results" type="a(uss)" direction="out">
|
||||
<tp:docstring>
|
||||
The list of matching contacts where a contact has an index, name, and number.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="GetCount">
|
||||
<tp:docstring>
|
||||
Get the number of contacts stored on the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_contacts_count"/>
|
||||
<arg name="count" type="u" direction="out">
|
||||
<tp:docstring>
|
||||
The number of contacts.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
</interface>
|
||||
</node>
|
@@ -1,19 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
|
||||
<interface name="org.freedesktop.ModemManager.Modem.Gsm">
|
||||
<method name="SetPin">
|
||||
<tp:docstring>
|
||||
Set the PIN (or PUK) to unlock the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_set_pin"/>
|
||||
<arg name="pin" type="s" direction="in">
|
||||
The PIN code.
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<interface name="org.freedesktop.ModemManager.Modem.Gsm.Network">
|
||||
<method name="Register">
|
||||
<tp:docstring>
|
||||
Register the device to network.
|
||||
@@ -47,7 +35,9 @@
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_set_apn"/>
|
||||
<arg name="apn" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The APN.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
@@ -70,7 +60,7 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_set_band"/>
|
||||
<arg name="band" type="u" direction="in" tp:type="MM_GSM_MODEM_BAND">
|
||||
<arg name="band" type="u" direction="in" tp:type="MM_MODEM_GSM_NETWORK_BAND">
|
||||
<tp:docstring>
|
||||
The band.
|
||||
</tp:docstring>
|
||||
@@ -83,7 +73,7 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_band"/>
|
||||
<arg name="band" type="u" direction="out" tp:type="MM_GSM_MODEM_BAND">
|
||||
<arg name="band" type="u" direction="out" tp:type="MM_MODEM_GSM_NETWORK_BAND">
|
||||
<tp:docstring>
|
||||
The current band.
|
||||
</tp:docstring>
|
||||
@@ -96,7 +86,7 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_set_network_mode"/>
|
||||
<arg name="mode" type="u" direction="in" tp:type="MM_GSM_MODEM_NETWORK_MODE">
|
||||
<arg name="mode" type="u" direction="in" tp:type="MM_MODEM_GSM_NETWORK_MODE">
|
||||
<tp:docstring>
|
||||
The GSM network mode.
|
||||
</tp:docstring>
|
||||
@@ -109,7 +99,7 @@
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_get_network_mode"/>
|
||||
<arg name="mode" type="u" direction="out" tp:type="MM_GSM_MODEM_NETWORK_MODE">
|
||||
<arg name="mode" type="u" direction="out" tp:type="MM_MODEM_GSM_NETWORK_MODE">
|
||||
<tp:docstring>
|
||||
The current network mode.
|
||||
</tp:docstring>
|
||||
@@ -122,9 +112,9 @@
|
||||
</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_GSM_MODEM_REG_STATUS">
|
||||
<arg name="status" type="u" direction="out" tp:type="MM_MODEM_GSM_NETWORK_REG_STATUS">
|
||||
<tp:docstring>
|
||||
The current network mode.
|
||||
The network status.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="operator_code" type="s" direction="out">
|
||||
@@ -150,18 +140,39 @@
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="RegistrationInfo">
|
||||
<tp:docstring>
|
||||
The registration status changed.
|
||||
</tp:docstring>
|
||||
<arg name="status" type="u" tp:type="MM_MODEM_GSM_NETWORK_REG_STATUS">
|
||||
<tp:docstring>
|
||||
The network status.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="operator_code" type="s">
|
||||
<tp:docstring>
|
||||
The current operator code.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="operator_name" type="s">
|
||||
<tp:docstring>
|
||||
The current operator name.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="NetworkMode">
|
||||
<tp:docstring>
|
||||
The network mode changed.
|
||||
</tp:docstring>
|
||||
<arg name="mode" type="u" tp:type="MM_GSM_MODEM_NETWORK_MODE">
|
||||
<arg name="mode" type="u" tp:type="MM_MODEM_GSM_NETWORK_MODE">
|
||||
<tp:docstring>
|
||||
The new network mode.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<tp:enum name="MM_GSM_MODEM_NETWORK_MODE" type="u">
|
||||
<tp:enum name="MM_MODEM_GSM_NETWORK_MODE" type="u">
|
||||
<tp:enumvalue suffix="ANY" value="0">
|
||||
<tp:docstring>
|
||||
Any network mode can be used.
|
||||
@@ -199,7 +210,7 @@
|
||||
</tp:enumvalue>
|
||||
</tp:enum>
|
||||
|
||||
<tp:enum name="MM_GSM_MODEM_BAND" type="u">
|
||||
<tp:enum name="MM_MODEM_GSM_NETWORK_BAND" type="u">
|
||||
<tp:enumvalue suffix="ANY" value="0">
|
||||
<tp:docstring>
|
||||
Any band can be used.
|
||||
@@ -215,54 +226,54 @@
|
||||
DCS (1800 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="PCS" value="3">
|
||||
<tp:enumvalue suffix="PCS" value="4">
|
||||
<tp:docstring>
|
||||
PCS (1900 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="G850" value="4">
|
||||
<tp:enumvalue suffix="G850" value="8">
|
||||
<tp:docstring>
|
||||
G850 (850 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U2100" value="5">
|
||||
<tp:enumvalue suffix="U2100" value="16">
|
||||
<tp:docstring>
|
||||
U2100 (WCDMA 2100 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U1700" value="6">
|
||||
<tp:enumvalue suffix="U1700" value="32">
|
||||
<tp:docstring>
|
||||
U1700 (WCDMA 3GPP UMTS1800 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="17IV" value="7">
|
||||
<tp:enumvalue suffix="17IV" value="64">
|
||||
<tp:docstring>
|
||||
17IV (WCDMA 3GPP AWS 1700/2100 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U800" value="8">
|
||||
<tp:enumvalue suffix="U800" value="128">
|
||||
<tp:docstring>
|
||||
U800 (WCDMA 3GPP UMTS800 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U850" value="9">
|
||||
<tp:enumvalue suffix="U850" value="256">
|
||||
<tp:docstring>
|
||||
U850 (WCDMA 3GPP UMTS850 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U900" value="10">
|
||||
<tp:enumvalue suffix="U900" value="512">
|
||||
<tp:docstring>
|
||||
U900 (WCDMA 3GPP UMTS900 MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="U17IX" value="11">
|
||||
<tp:enumvalue suffix="U17IX" value="1024">
|
||||
<tp:docstring>
|
||||
U17IX (WCDMA 3GPP UMTS MHz).
|
||||
</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
</tp:enum>
|
||||
|
||||
<tp:enum name="MM_GSM_MODEM_REG_STATUS" type="u">
|
||||
<tp:enum name="MM_MODEM_GSM_NETWORK_REG_STATUS" type="u">
|
||||
<tp:enumvalue suffix="IDLE" value="0">
|
||||
<tp:docstring>
|
||||
Not registered, not searching for new operator to register.
|
98
introspection/mm-modem-gsm-sms.xml
Normal file
98
introspection/mm-modem-gsm-sms.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.freedesktop.ModemManager.Modem.Gsm.SMS">
|
||||
<method name="Delete">
|
||||
<tp:docstring>
|
||||
Delete an SMS message.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_sms_delete"/>
|
||||
<arg name="index" type="u" direction="in">
|
||||
<tp:docstring>
|
||||
The index of the SMS.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="Get">
|
||||
<tp:docstring>
|
||||
Retrieve an SMS from the SIM card.
|
||||
</tp:docstring>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_gsm_modem_sms_get"/>
|
||||
<arg name="index" type="u" direction="in">
|
||||
<tp:docstring>
|
||||
The index of the SMS.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
<arg name="found_index" type="u" 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.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="GetFormat">
|
||||
<arg name="result" type="u" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="SetFormat">
|
||||
<arg name="format" type="u" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="GetSmsc">
|
||||
<arg name="result" type="s" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="SetSmsc">
|
||||
<arg name="smsc" type="s" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="List">
|
||||
<arg name="result" type="a(ussd)" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="Save">
|
||||
<arg name="number" type="s" direction="in"/>
|
||||
<arg name="contents" type="s" direction="in"/>
|
||||
<arg name="index" type="u" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="Send">
|
||||
<arg name="result" type="u" direction="out"/>
|
||||
</method>
|
||||
|
||||
<method name="SendFromStorage">
|
||||
<arg name="index" type="u" direction="in"/>
|
||||
</method>
|
||||
|
||||
<method name="SetIndication">
|
||||
<arg name="mode" type="u" direction="in"/>
|
||||
<arg name="mt" type="u" direction="in"/>
|
||||
<arg name="bm" type="u" direction="in"/>
|
||||
<arg name="ds" type="u" direction="in"/>
|
||||
<arg name="bfr" type="u" direction="in"/>
|
||||
</method>
|
||||
|
||||
<signal name="SmsReceived">
|
||||
<arg name="index" type="u"/>
|
||||
</signal>
|
||||
|
||||
</interface>
|
||||
</node>
|
@@ -9,7 +9,6 @@
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include "mm-modem-hso.h"
|
||||
#include "mm-serial.h"
|
||||
#include "mm-gsm-modem.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
@@ -357,23 +356,17 @@ impl_hso_authenticate (MMModemHso *self,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_modem_hso_init (MMModemHso *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
modem_init (MMModem *modem_class)
|
||||
{
|
||||
modem_class->connect = do_connect;
|
||||
}
|
||||
|
||||
static void
|
||||
gsm_modem_init (MMGsmModem *gsm_modem_class)
|
||||
{
|
||||
gsm_modem_class->need_authentication = need_auth;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_modem_hso_init (MMModemHso *self)
|
||||
{
|
||||
}
|
||||
|
||||
static GObject*
|
||||
constructor (GType type,
|
||||
guint n_construct_params,
|
||||
@@ -486,14 +479,9 @@ mm_modem_hso_get_type (void)
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo gsm_modem_iface_info = {
|
||||
(GInterfaceInitFunc) gsm_modem_init
|
||||
};
|
||||
|
||||
modem_hso_type = g_type_register_static (MM_TYPE_GENERIC_GSM, "MMModemHso", &modem_hso_type_info, 0);
|
||||
|
||||
g_type_add_interface_static (modem_hso_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
g_type_add_interface_static (modem_hso_type, MM_TYPE_GSM_MODEM, &gsm_modem_iface_info);
|
||||
}
|
||||
|
||||
return modem_hso_type;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "mm-modem-huawei.h"
|
||||
#include "mm-gsm-modem.h"
|
||||
#include "mm-modem-gsm-network.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
@@ -44,7 +44,7 @@ mm_modem_huawei_new (const char *data_device,
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
parse_monitor_line (MMGsmModem *gsm_modem, char *buf)
|
||||
parse_monitor_line (MMModemGsmNetwork *modem, char *buf)
|
||||
{
|
||||
char **lines;
|
||||
char **iter;
|
||||
@@ -71,25 +71,25 @@ parse_monitor_line (MMGsmModem *gsm_modem, char *buf)
|
||||
quality = quality * 100 / 31;
|
||||
|
||||
g_debug ("Signal quality: %d", quality);
|
||||
mm_gsm_modem_signal_quality (gsm_modem, (guint32) quality);
|
||||
mm_modem_gsm_network_signal_quality (modem, (guint32) quality);
|
||||
} else if (!strncmp (line, "MODE:", 5)) {
|
||||
MMGsmModemNetworkMode mode = 0;
|
||||
MMModemGsmNetworkMode mode = 0;
|
||||
int a;
|
||||
int b;
|
||||
|
||||
if (sscanf (line + 5, "%d,%d", &a, &b)) {
|
||||
if (a == 3 && b == 2)
|
||||
mode = MM_GSM_MODEM_NETWORK_MODE_GPRS;
|
||||
mode = MM_MODEM_GSM_NETWORK_MODE_GPRS;
|
||||
else if (a == 3 && b == 3)
|
||||
mode = MM_GSM_MODEM_NETWORK_MODE_EDGE;
|
||||
mode = MM_MODEM_GSM_NETWORK_MODE_EDGE;
|
||||
else if (a == 5 && b == 4)
|
||||
mode = MM_GSM_MODEM_NETWORK_MODE_3G;
|
||||
mode = MM_MODEM_GSM_NETWORK_MODE_3G;
|
||||
else if (a ==5 && b == 5)
|
||||
mode = MM_GSM_MODEM_NETWORK_MODE_HSDPA;
|
||||
mode = MM_MODEM_GSM_NETWORK_MODE_HSDPA;
|
||||
|
||||
if (mode) {
|
||||
g_debug ("Mode: %d", mode);
|
||||
mm_gsm_modem_network_mode (gsm_modem, mode);
|
||||
mm_modem_gsm_network_mode (modem, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ monitor_device_got_data (GIOChannel *source,
|
||||
|
||||
if (bytes_read) {
|
||||
buf[bytes_read] = '\0';
|
||||
parse_monitor_line (MM_GSM_MODEM (data), buf);
|
||||
parse_monitor_line (MM_MODEM_GSM_NETWORK (data), buf);
|
||||
}
|
||||
} while (bytes_read == 4096 || status == G_IO_STATUS_AGAIN);
|
||||
}
|
||||
@@ -220,8 +220,8 @@ set_network_mode_get_done (MMSerial *serial, const char *reply, gpointer user_da
|
||||
}
|
||||
|
||||
static void
|
||||
set_network_mode (MMGsmModem *modem,
|
||||
MMGsmModemNetworkMode mode,
|
||||
set_network_mode (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -232,26 +232,26 @@ set_network_mode (MMGsmModem *modem,
|
||||
info = mm_callback_info_new (MM_MODEM (modem), callback, user_data);
|
||||
|
||||
switch (mode) {
|
||||
case MM_GSM_MODEM_NETWORK_MODE_ANY:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_ANY:
|
||||
/* Do nothing */
|
||||
mm_callback_info_schedule (info);
|
||||
return;
|
||||
break;
|
||||
case MM_GSM_MODEM_NETWORK_MODE_GPRS:
|
||||
case MM_GSM_MODEM_NETWORK_MODE_EDGE:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_GPRS:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_EDGE:
|
||||
mm_callback_info_set_data (info, "mode-a", GINT_TO_POINTER (13), NULL);
|
||||
mm_callback_info_set_data (info, "mode-b", GINT_TO_POINTER (1), NULL);
|
||||
break;
|
||||
case MM_GSM_MODEM_NETWORK_MODE_3G:
|
||||
case MM_GSM_MODEM_NETWORK_MODE_HSDPA:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_3G:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_HSDPA:
|
||||
mm_callback_info_set_data (info, "mode-a", GINT_TO_POINTER (14), NULL);
|
||||
mm_callback_info_set_data (info, "mode-b", GINT_TO_POINTER (2), NULL);
|
||||
break;
|
||||
case MM_GSM_MODEM_NETWORK_MODE_PREFER_2G:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_PREFER_2G:
|
||||
mm_callback_info_set_data (info, "mode-a", GINT_TO_POINTER (2), NULL);
|
||||
mm_callback_info_set_data (info, "mode-b", GINT_TO_POINTER (1), NULL);
|
||||
break;
|
||||
case MM_GSM_MODEM_NETWORK_MODE_PREFER_3G:
|
||||
case MM_MODEM_GSM_NETWORK_MODE_PREFER_3G:
|
||||
mm_callback_info_set_data (info, "mode-a", GINT_TO_POINTER (2), NULL);
|
||||
mm_callback_info_set_data (info, "mode-b", GINT_TO_POINTER (2), NULL);
|
||||
break;
|
||||
@@ -280,13 +280,13 @@ get_network_mode_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
|
||||
if (parse_syscfg (reply, &a, &b, &band, &u1, &u2)) {
|
||||
if (a == 2 && b == 1)
|
||||
info->uint_result = MM_GSM_MODEM_NETWORK_MODE_PREFER_2G;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_MODE_PREFER_2G;
|
||||
else if (a == 2 && b == 2)
|
||||
info->uint_result = MM_GSM_MODEM_NETWORK_MODE_PREFER_3G;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_MODE_PREFER_3G;
|
||||
else if (a == 13 && b == 1)
|
||||
info->uint_result = MM_GSM_MODEM_NETWORK_MODE_GPRS;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_MODE_GPRS;
|
||||
else if (a == 14 && b == 2)
|
||||
info->uint_result = MM_GSM_MODEM_NETWORK_MODE_3G;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_MODE_3G;
|
||||
}
|
||||
|
||||
if (info->uint_result == 0)
|
||||
@@ -297,7 +297,7 @@ get_network_mode_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
get_network_mode (MMGsmModem *modem,
|
||||
get_network_mode (MMModemGsmNetwork *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -364,8 +364,8 @@ set_band_get_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
set_band (MMGsmModem *modem,
|
||||
MMGsmModemBand band,
|
||||
set_band (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -376,15 +376,15 @@ set_band (MMGsmModem *modem,
|
||||
info = mm_callback_info_new (MM_MODEM (modem), callback, user_data);
|
||||
|
||||
switch (band) {
|
||||
case MM_GSM_MODEM_BAND_ANY:
|
||||
case MM_MODEM_GSM_NETWORK_BAND_ANY:
|
||||
mm_callback_info_set_data (info, "band", GUINT_TO_POINTER (0x3FFFFFFF), NULL);
|
||||
break;
|
||||
case MM_GSM_MODEM_BAND_EGSM:
|
||||
case MM_GSM_MODEM_BAND_DCS:
|
||||
case MM_GSM_MODEM_BAND_U2100:
|
||||
case MM_MODEM_GSM_NETWORK_BAND_EGSM:
|
||||
case MM_MODEM_GSM_NETWORK_BAND_DCS:
|
||||
case MM_MODEM_GSM_NETWORK_BAND_U2100:
|
||||
mm_callback_info_set_data (info, "band", GUINT_TO_POINTER (0x400380), NULL);
|
||||
break;
|
||||
case MM_GSM_MODEM_BAND_PCS:
|
||||
case MM_MODEM_GSM_NETWORK_BAND_PCS:
|
||||
mm_callback_info_set_data (info, "band", GUINT_TO_POINTER (0x200000), NULL);
|
||||
break;
|
||||
default:
|
||||
@@ -414,11 +414,11 @@ get_band_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
|
||||
if (parse_syscfg (reply, &a, &b, &band, &u1, &u2)) {
|
||||
if (band == 0x3FFFFFFF)
|
||||
info->uint_result = MM_GSM_MODEM_BAND_ANY;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_BAND_ANY;
|
||||
else if (band == 0x400380)
|
||||
info->uint_result = MM_GSM_MODEM_BAND_DCS;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_BAND_DCS;
|
||||
else if (band == 0x200000)
|
||||
info->uint_result = MM_GSM_MODEM_BAND_PCS;
|
||||
info->uint_result = MM_MODEM_GSM_NETWORK_BAND_PCS;
|
||||
}
|
||||
|
||||
if (info->uint_result == 0xdeadbeaf) {
|
||||
@@ -431,7 +431,7 @@ get_band_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
get_band (MMGsmModem *modem,
|
||||
get_band (MMModemGsmNetwork *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -459,12 +459,12 @@ modem_init (MMModem *modem_class)
|
||||
}
|
||||
|
||||
static void
|
||||
gsm_modem_init (MMGsmModem *gsm_modem_class)
|
||||
modem_gsm_network_init (MMModemGsmNetwork *class)
|
||||
{
|
||||
gsm_modem_class->set_network_mode = set_network_mode;
|
||||
gsm_modem_class->get_network_mode = get_network_mode;
|
||||
gsm_modem_class->set_band = set_band;
|
||||
gsm_modem_class->get_band = get_band;
|
||||
class->set_network_mode = set_network_mode;
|
||||
class->get_network_mode = get_network_mode;
|
||||
class->set_band = set_band;
|
||||
class->get_band = get_band;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -593,14 +593,14 @@ mm_modem_huawei_get_type (void)
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo gsm_modem_iface_info = {
|
||||
(GInterfaceInitFunc) gsm_modem_init
|
||||
static const GInterfaceInfo modem_gsm_network_info = {
|
||||
(GInterfaceInitFunc) modem_gsm_network_init
|
||||
};
|
||||
|
||||
modem_huawei_type = g_type_register_static (MM_TYPE_GENERIC_GSM, "MMModemHuawei", &modem_huawei_type_info, 0);
|
||||
|
||||
g_type_add_interface_static (modem_huawei_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
g_type_add_interface_static (modem_huawei_type, MM_TYPE_GSM_MODEM, &gsm_modem_iface_info);
|
||||
g_type_add_interface_static (modem_huawei_type, MM_TYPE_MODEM_GSM_NETWORK, &modem_gsm_network_info);
|
||||
}
|
||||
|
||||
return modem_huawei_type;
|
||||
|
@@ -11,20 +11,22 @@ modem_manager_SOURCES = \
|
||||
main.c \
|
||||
mm-callback-info.c \
|
||||
mm-callback-info.h \
|
||||
mm-cdma-modem.c \
|
||||
mm-cdma-modem.h \
|
||||
mm-generic-cdma.c \
|
||||
mm-generic-cdma.h \
|
||||
mm-generic-gsm.c \
|
||||
mm-generic-gsm.h \
|
||||
mm-gsm-modem.c \
|
||||
mm-gsm-modem.h \
|
||||
mm-manager.c \
|
||||
mm-manager.h \
|
||||
mm-modem.c \
|
||||
mm-modem.h \
|
||||
mm-modem-cdma.c \
|
||||
mm-modem-cdma.h \
|
||||
mm-modem-error.c \
|
||||
mm-modem-error.h \
|
||||
mm-modem-gsm-card.c \
|
||||
mm-modem-gsm-card.h \
|
||||
mm-modem-gsm-network.c \
|
||||
mm-modem-gsm-network.h \
|
||||
mm-plugin.c \
|
||||
mm-plugin.h \
|
||||
mm-serial.c \
|
||||
@@ -36,16 +38,21 @@ mm-manager-glue.h: $(top_srcdir)/introspection/mm-manager.xml
|
||||
mm-modem-glue.h: $(top_srcdir)/introspection/mm-modem.xml
|
||||
dbus-binding-tool --prefix=mm_modem --mode=glib-server --output=$@ $<
|
||||
|
||||
mm-gsm-modem-glue.h: $(top_srcdir)/introspection/mm-gsm-modem.xml
|
||||
dbus-binding-tool --prefix=mm_gsm_modem --mode=glib-server --output=$@ $<
|
||||
mm-modem-cdma-glue.h: $(top_srcdir)/introspection/mm-modem-cdma.xml
|
||||
dbus-binding-tool --prefix=mm_modem_cdma --mode=glib-server --output=$@ $<
|
||||
|
||||
mm-modem-gsm-card-glue.h: $(top_srcdir)/introspection/mm-modem-gsm-card.xml
|
||||
dbus-binding-tool --prefix=mm_modem_gsm_card --mode=glib-server --output=$@ $<
|
||||
|
||||
mm-modem-gsm-network-glue.h: $(top_srcdir)/introspection/mm-modem-gsm-network.xml
|
||||
dbus-binding-tool --prefix=mm_modem_gsm_network --mode=glib-server --output=$@ $<
|
||||
|
||||
mm-cdma-modem-glue.h: $(top_srcdir)/introspection/mm-cdma-modem.xml
|
||||
dbus-binding-tool --prefix=mm_cdma_modem --mode=glib-server --output=$@ $<
|
||||
|
||||
BUILT_SOURCES = \
|
||||
mm-cdma-modem-glue.h \
|
||||
mm-gsm-modem-glue.h \
|
||||
mm-manager-glue.h \
|
||||
mm-modem-glue.h
|
||||
mm-modem-glue.h \
|
||||
mm-modem-cdma-glue.h \
|
||||
mm-modem-gsm-card-glue.h \
|
||||
mm-modem-gsm-network-glue.h
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_CDMA_MODEM_H
|
||||
#define MM_CDMA_MODEM_H
|
||||
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_TYPE_CDMA_MODEM (mm_cdma_modem_get_type ())
|
||||
#define MM_CDMA_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CDMA_MODEM, MMCdmaModem))
|
||||
#define MM_IS_CDMA_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CDMA_MODEM))
|
||||
#define MM_CDMA_MODEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_CDMA_MODEM, MMCdmaModem))
|
||||
|
||||
typedef struct _MMCdmaModem MMCdmaModem;
|
||||
|
||||
struct _MMCdmaModem {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
void (*get_signal_quality) (MMCdmaModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Signals */
|
||||
void (*signal_quality) (MMCdmaModem *self,
|
||||
guint32 quality);
|
||||
};
|
||||
|
||||
GType mm_cdma_modem_get_type (void);
|
||||
|
||||
void mm_cdma_modem_get_signal_quality (MMCdmaModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Protected */
|
||||
|
||||
void mm_cdma_modem_signal_quality (MMCdmaModem *self,
|
||||
guint32 quality);
|
||||
|
||||
#endif /* MM_CDMA_MODEM_H */
|
@@ -4,7 +4,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mm-generic-cdma.h"
|
||||
#include "mm-cdma-modem.h"
|
||||
#include "mm-modem-cdma.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
@@ -196,7 +196,7 @@ get_signal_quality_done (MMSerial *serial, const char *reply, gpointer user_data
|
||||
}
|
||||
|
||||
static void
|
||||
get_signal_quality (MMCdmaModem *modem,
|
||||
get_signal_quality (MMModemCdma *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ modem_init (MMModem *modem_class)
|
||||
}
|
||||
|
||||
static void
|
||||
cdma_modem_init (MMCdmaModem *cdma_modem_class)
|
||||
modem_cdma_init (MMModemCdma *cdma_modem_class)
|
||||
{
|
||||
cdma_modem_class->get_signal_quality = get_signal_quality;
|
||||
}
|
||||
@@ -333,14 +333,14 @@ mm_generic_cdma_get_type (void)
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo cdma_modem_iface_info = {
|
||||
(GInterfaceInitFunc) cdma_modem_init
|
||||
static const GInterfaceInfo modem_cdma_iface_info = {
|
||||
(GInterfaceInitFunc) modem_cdma_init
|
||||
};
|
||||
|
||||
generic_cdma_type = g_type_register_static (MM_TYPE_SERIAL, "MMGenericCdma", &generic_cdma_type_info, 0);
|
||||
|
||||
g_type_add_interface_static (generic_cdma_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
g_type_add_interface_static (generic_cdma_type, MM_TYPE_CDMA_MODEM, &cdma_modem_iface_info);
|
||||
g_type_add_interface_static (generic_cdma_type, MM_TYPE_MODEM_CDMA, &modem_cdma_iface_info);
|
||||
}
|
||||
|
||||
return generic_cdma_type;
|
||||
|
@@ -4,7 +4,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "mm-generic-gsm.h"
|
||||
#include "mm-gsm-modem.h"
|
||||
#include "mm-modem-gsm-card.h"
|
||||
#include "mm-modem-gsm-network.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
@@ -16,12 +17,12 @@ typedef struct {
|
||||
char *driver;
|
||||
char *oper_code;
|
||||
char *oper_name;
|
||||
MMGsmModemRegStatus reg_status;
|
||||
MMModemGsmNetworkRegStatus reg_status;
|
||||
guint32 cid;
|
||||
guint32 pending_id;
|
||||
} MMGenericGsmPrivate;
|
||||
|
||||
static void register_auto (MMGsmModem *modem, MMCallbackInfo *info);
|
||||
static void register_auto (MMModemGsmNetwork *modem, MMCallbackInfo *info);
|
||||
|
||||
MMModem *
|
||||
mm_generic_gsm_new (const char *serial_device, const char *driver)
|
||||
@@ -45,7 +46,7 @@ mm_generic_gsm_get_cid (MMGenericGsm *modem)
|
||||
|
||||
void
|
||||
mm_generic_gsm_set_reg_status (MMGenericGsm *modem,
|
||||
MMGsmModemRegStatus status)
|
||||
MMModemGsmNetworkRegStatus status)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GENERIC_GSM (modem));
|
||||
|
||||
@@ -73,7 +74,7 @@ mm_generic_gsm_set_operator (MMGenericGsm *modem,
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
need_auth_done (MMSerial *serial,
|
||||
check_pin_done (MMSerial *serial,
|
||||
int reply_index,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -101,21 +102,18 @@ need_auth_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
static void
|
||||
need_auth (MMGsmModem *modem,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
check_pin (MMSerial *serial, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
char *responses[] = { "READY", "SIM PIN", "SIM PUK", "ERROR", "ERR", NULL };
|
||||
char *terminators[] = { "OK", "ERROR", "ERR", NULL };
|
||||
guint id = 0;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (modem), callback, user_data);
|
||||
|
||||
if (mm_serial_send_command_string (MM_SERIAL (modem), "AT+CPIN?"))
|
||||
id = mm_serial_wait_for_reply (MM_SERIAL (modem), 3, responses, terminators, need_auth_done, info);
|
||||
if (mm_serial_send_command_string (serial, "AT+CPIN?"))
|
||||
id = mm_serial_wait_for_reply (serial, 3, responses, terminators, check_pin_done, user_data);
|
||||
|
||||
if (!id) {
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "PIN checking failed.");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
@@ -131,7 +129,7 @@ init_done (MMSerial *serial,
|
||||
switch (reply_index) {
|
||||
case 0:
|
||||
/* success */
|
||||
mm_gsm_modem_need_authentication (MM_GSM_MODEM (serial), info->callback, info->user_data);
|
||||
check_pin (serial, user_data);
|
||||
break;
|
||||
case -1:
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "Modem initialization timed out.");
|
||||
@@ -215,7 +213,7 @@ set_pin_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
static void
|
||||
set_pin (MMGsmModem *modem,
|
||||
send_pin (MMModemGsmCard *modem,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
@@ -331,27 +329,27 @@ get_reg_status_done (MMSerial *serial,
|
||||
|
||||
switch (reply_index) {
|
||||
case 0:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_IDLE;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_IDLE;
|
||||
break;
|
||||
case 1:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_HOME;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_HOME;
|
||||
break;
|
||||
case 2:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_SEARCHING;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_SEARCHING;
|
||||
break;
|
||||
case 3:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_DENIED;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_DENIED;
|
||||
break;
|
||||
case 4:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_ROAMING;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING;
|
||||
break;
|
||||
case -1:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_UNKNOWN;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN;
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s",
|
||||
"Reading registration status timed out");
|
||||
break;
|
||||
default:
|
||||
info->uint_result = (guint32) MM_GSM_MODEM_REG_STATUS_UNKNOWN;
|
||||
info->uint_result = (guint32) MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN;
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s",
|
||||
"Reading registration status failed");
|
||||
break;
|
||||
@@ -363,7 +361,7 @@ get_reg_status_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
static void
|
||||
get_registration_status (MMGsmModem *modem, MMModemUIntFn callback, gpointer user_data)
|
||||
get_registration_status (MMModemGsmNetwork *modem, MMModemUIntFn callback, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
char *responses[] = { "+CREG: 0,0", "+CREG: 0,1", "+CREG: 0,2", "+CREG: 0,3", "+CREG: 0,5", NULL };
|
||||
@@ -390,7 +388,7 @@ register_manual_get_status_done (MMModem *modem,
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
|
||||
if (result == MM_GSM_MODEM_REG_STATUS_HOME || result == MM_GSM_MODEM_REG_STATUS_ROAMING)
|
||||
if (result == MM_MODEM_GSM_NETWORK_REG_STATUS_HOME || result == MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING)
|
||||
read_operator (MM_GENERIC_GSM (modem), info);
|
||||
else
|
||||
mm_callback_info_schedule (info);
|
||||
@@ -406,7 +404,7 @@ register_manual_done (MMSerial *serial,
|
||||
switch (reply_index) {
|
||||
case 0:
|
||||
/* success */
|
||||
get_registration_status (MM_GSM_MODEM (serial), register_manual_get_status_done, info);
|
||||
get_registration_status (MM_MODEM_GSM_NETWORK (serial), register_manual_get_status_done, info);
|
||||
break;
|
||||
case -1:
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "Manual registration timed out");
|
||||
@@ -421,7 +419,7 @@ register_manual_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
static void
|
||||
register_manual (MMGsmModem *modem, const char *network_id, MMCallbackInfo *info)
|
||||
register_manual (MMModemGsmNetwork *modem, const char *network_id, MMCallbackInfo *info)
|
||||
{
|
||||
char *command;
|
||||
char *responses[] = { "OK", "ERROR", "ERR", NULL };
|
||||
@@ -445,7 +443,7 @@ automatic_registration_again (gpointer data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) data;
|
||||
|
||||
register_auto (MM_GSM_MODEM (info->modem), info);
|
||||
register_auto (MM_MODEM_GSM_NETWORK (info->modem), info);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -464,22 +462,22 @@ register_auto_done (MMModem *modem,
|
||||
}
|
||||
|
||||
switch (result) {
|
||||
case MM_GSM_MODEM_REG_STATUS_IDLE:
|
||||
case MM_MODEM_GSM_NETWORK_REG_STATUS_IDLE:
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||
"%s", "Automatic registration failed: not registered and not searching.");
|
||||
break;
|
||||
case MM_GSM_MODEM_REG_STATUS_HOME:
|
||||
case MM_MODEM_GSM_NETWORK_REG_STATUS_HOME:
|
||||
g_message ("Registered on Home network");
|
||||
break;
|
||||
case MM_GSM_MODEM_REG_STATUS_SEARCHING:
|
||||
case MM_MODEM_GSM_NETWORK_REG_STATUS_SEARCHING:
|
||||
MM_GENERIC_GSM_GET_PRIVATE (modem)->pending_id = g_timeout_add (1000, automatic_registration_again, info);
|
||||
return;
|
||||
break;
|
||||
case MM_GSM_MODEM_REG_STATUS_DENIED:
|
||||
case MM_MODEM_GSM_NETWORK_REG_STATUS_DENIED:
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s",
|
||||
"Automatic registration failed: registration denied");
|
||||
break;
|
||||
case MM_GSM_MODEM_REG_STATUS_ROAMING:
|
||||
case MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING:
|
||||
g_message ("Registered on Roaming network");
|
||||
break;
|
||||
case -1:
|
||||
@@ -499,13 +497,13 @@ register_auto_done (MMModem *modem,
|
||||
}
|
||||
|
||||
static void
|
||||
register_auto (MMGsmModem *modem, MMCallbackInfo *info)
|
||||
register_auto (MMModemGsmNetwork *modem, MMCallbackInfo *info)
|
||||
{
|
||||
get_registration_status (modem, register_auto_done, info);
|
||||
}
|
||||
|
||||
static void
|
||||
do_register (MMGsmModem *modem,
|
||||
do_register (MMModemGsmNetwork *modem,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
@@ -526,10 +524,10 @@ get_registration_info_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMGsmModemRegInfoFn reg_info_fn;
|
||||
MMModemGsmNetworkRegInfoFn reg_info_fn;
|
||||
|
||||
reg_info_fn = (MMGsmModemRegInfoFn) mm_callback_info_get_data (info, "reg-info-callback");
|
||||
reg_info_fn (MM_GSM_MODEM (modem),
|
||||
reg_info_fn = (MMModemGsmNetworkRegInfoFn) mm_callback_info_get_data (info, "reg-info-callback");
|
||||
reg_info_fn (MM_MODEM_GSM_NETWORK (modem),
|
||||
priv->reg_status,
|
||||
priv->oper_code,
|
||||
priv->oper_name,
|
||||
@@ -538,8 +536,8 @@ get_registration_info_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
get_registration_info (MMGsmModem *self,
|
||||
MMGsmModemRegInfoFn callback,
|
||||
get_registration_info (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
@@ -640,15 +638,15 @@ scan_callback_wrapper (MMModem *modem,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMGsmModemScanFn scan_fn;
|
||||
MMModemGsmNetworkScanFn scan_fn;
|
||||
GPtrArray *results;
|
||||
gpointer data;
|
||||
|
||||
scan_fn = (MMGsmModemScanFn) mm_callback_info_get_data (info, "scan-callback");
|
||||
scan_fn = (MMModemGsmNetworkScanFn) mm_callback_info_get_data (info, "scan-callback");
|
||||
results = (GPtrArray *) mm_callback_info_get_data (info, "scan-results");
|
||||
data = mm_callback_info_get_data (info, "scan-data");
|
||||
|
||||
scan_fn (MM_GSM_MODEM (modem), results, error, data);
|
||||
scan_fn (MM_MODEM_GSM_NETWORK (modem), results, error, data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -711,8 +709,8 @@ scan_done (MMSerial *serial, const char *reply, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
scan (MMGsmModem *modem,
|
||||
MMGsmModemScanFn callback,
|
||||
scan (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkScanFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
@@ -754,7 +752,7 @@ set_apn_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
static void
|
||||
set_apn (MMGsmModem *modem,
|
||||
set_apn (MMModemGsmNetwork *modem,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
@@ -810,7 +808,7 @@ get_signal_quality_done (MMSerial *serial, const char *reply, gpointer user_data
|
||||
}
|
||||
|
||||
static void
|
||||
get_signal_quality (MMGsmModem *modem,
|
||||
get_signal_quality (MMModemGsmNetwork *modem,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -840,15 +838,19 @@ modem_init (MMModem *modem_class)
|
||||
}
|
||||
|
||||
static void
|
||||
gsm_modem_init (MMGsmModem *gsm_modem_class)
|
||||
modem_gsm_card_init (MMModemGsmCard *class)
|
||||
{
|
||||
gsm_modem_class->need_authentication = need_auth;
|
||||
gsm_modem_class->set_pin = set_pin;
|
||||
gsm_modem_class->do_register = do_register;
|
||||
gsm_modem_class->get_registration_info = get_registration_info;
|
||||
gsm_modem_class->set_apn = set_apn;
|
||||
gsm_modem_class->scan = scan;
|
||||
gsm_modem_class->get_signal_quality = get_signal_quality;
|
||||
class->send_pin = send_pin;
|
||||
}
|
||||
|
||||
static void
|
||||
modem_gsm_network_init (MMModemGsmNetwork *class)
|
||||
{
|
||||
class->do_register = do_register;
|
||||
class->get_registration_info = get_registration_info;
|
||||
class->set_apn = set_apn;
|
||||
class->scan = scan;
|
||||
class->get_signal_quality = get_signal_quality;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -960,14 +962,19 @@ mm_generic_gsm_get_type (void)
|
||||
(GInterfaceInitFunc) modem_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo gsm_modem_iface_info = {
|
||||
(GInterfaceInitFunc) gsm_modem_init
|
||||
static const GInterfaceInfo modem_gsm_card_info = {
|
||||
(GInterfaceInitFunc) modem_gsm_card_init
|
||||
};
|
||||
|
||||
static const GInterfaceInfo modem_gsm_network_info = {
|
||||
(GInterfaceInitFunc) modem_gsm_network_init
|
||||
};
|
||||
|
||||
generic_gsm_type = g_type_register_static (MM_TYPE_SERIAL, "MMGenericGsm", &generic_gsm_type_info, 0);
|
||||
|
||||
g_type_add_interface_static (generic_gsm_type, MM_TYPE_MODEM, &modem_iface_info);
|
||||
g_type_add_interface_static (generic_gsm_type, MM_TYPE_GSM_MODEM, &gsm_modem_iface_info);
|
||||
g_type_add_interface_static (generic_gsm_type, MM_TYPE_MODEM_GSM_CARD, &modem_gsm_card_info);
|
||||
g_type_add_interface_static (generic_gsm_type, MM_TYPE_MODEM_GSM_NETWORK, &modem_gsm_network_info);
|
||||
}
|
||||
|
||||
return generic_gsm_type;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#ifndef MM_GENERIC_GSM_H
|
||||
#define MM_GENERIC_GSM_H
|
||||
|
||||
#include "mm-gsm-modem.h"
|
||||
#include "mm-modem-gsm-network.h"
|
||||
#include "mm-serial.h"
|
||||
|
||||
#define MM_TYPE_GENERIC_GSM (mm_generic_gsm_get_type ())
|
||||
@@ -28,7 +28,7 @@ MMModem *mm_generic_gsm_new (const char *serial_device,
|
||||
|
||||
guint32 mm_generic_gsm_get_cid (MMGenericGsm *modem);
|
||||
void mm_generic_gsm_set_reg_status (MMGenericGsm *modem,
|
||||
MMGsmModemRegStatus status);
|
||||
MMModemGsmNetworkRegStatus status);
|
||||
|
||||
void mm_generic_gsm_set_operator (MMGenericGsm *modem,
|
||||
const char *code,
|
||||
|
@@ -1,470 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#include <string.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include "mm-gsm-modem.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static void impl_gsm_modem_set_pin (MMGsmModem *modem, const char *pin, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_register (MMGsmModem *modem, const char *network_id, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_get_reg_info (MMGsmModem *modem, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_scan (MMGsmModem *modem, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_set_apn (MMGsmModem *modem, const char *apn, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_get_signal_quality (MMGsmModem *modem, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_set_band (MMGsmModem *modem, guint32 band, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_get_band (MMGsmModem *modem, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_set_network_mode (MMGsmModem *modem, guint32 mode, DBusGMethodInvocation *context);
|
||||
static void impl_gsm_modem_get_network_mode (MMGsmModem *modem, DBusGMethodInvocation *context);
|
||||
|
||||
#include "mm-gsm-modem-glue.h"
|
||||
|
||||
enum {
|
||||
SIGNAL_QUALITY,
|
||||
NETWORK_MODE,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void
|
||||
async_op_not_supported (MMModem *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (self, callback, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
async_call_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context);
|
||||
}
|
||||
|
||||
static void
|
||||
uint_op_not_supported (MMModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_uint_new (self, callback, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
uint_call_done (MMModem *modem, guint32 result, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, result);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_need_authentication (MMGsmModem *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->need_authentication)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->need_authentication (self, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_set_pin (MMGsmModem *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
g_return_if_fail (pin != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->set_pin)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->set_pin (self, pin, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_pin (MMGsmModem *modem,
|
||||
const char *pin,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_set_pin (modem, pin, async_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_register (MMGsmModem *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->do_register)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->do_register (self, network_id, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_register (MMGsmModem *modem,
|
||||
const char *network_id,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* DBus does not support NULL strings, so the caller should pass an empty string
|
||||
for manual registration. */
|
||||
if (strlen (network_id) < 1)
|
||||
id = NULL;
|
||||
else
|
||||
id = network_id;
|
||||
|
||||
mm_gsm_modem_register (modem, id, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
reg_not_supported (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMGsmModemRegInfoFn callback = (MMGsmModemRegInfoFn) mm_callback_info_get_data (info, "reg-info-callback");
|
||||
|
||||
callback (MM_GSM_MODEM (modem), 0, NULL, NULL, error, mm_callback_info_get_data (info, "reg-info-data"));
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_get_reg_info (MMGsmModem *self,
|
||||
MMGsmModemRegInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->get_registration_info)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->get_registration_info (self, callback, user_data);
|
||||
else {
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), reg_not_supported, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
|
||||
info->user_data = info;
|
||||
mm_callback_info_set_data (info, "reg-info-callback", callback, NULL);
|
||||
mm_callback_info_set_data (info, "reg-info-data", user_data, NULL);
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_reg_info_done (MMGsmModem *modem,
|
||||
MMGsmModemRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else {
|
||||
dbus_g_method_return (context, status,
|
||||
oper_code ? oper_code : "",
|
||||
oper_name ? oper_name : "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_reg_info (MMGsmModem *modem, DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_get_reg_info (modem, get_reg_info_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_scan (MMGsmModem *self,
|
||||
MMGsmModemScanFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->scan)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->scan (self, callback, user_data);
|
||||
else
|
||||
/* FIXME */ ;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_scan_done (MMGsmModem *modem, GPtrArray *results, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, results);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_scan (MMGsmModem *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_scan (modem, impl_scan_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_set_apn (MMGsmModem *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (apn != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->set_apn)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->set_apn (self, apn, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_apn (MMGsmModem *modem,
|
||||
const char *apn,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_set_apn (modem, apn, async_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_get_signal_quality (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->get_signal_quality)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->get_signal_quality (self, callback, user_data);
|
||||
else
|
||||
uint_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_signal_quality (MMGsmModem *modem, DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_get_signal_quality (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_set_band (MMGsmModem *self,
|
||||
MMGsmModemBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->set_band)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->set_band (self, band, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_band (MMGsmModem *modem,
|
||||
guint32 band,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
if (band >= MM_GSM_MODEM_BAND_ANY && band <= MM_GSM_MODEM_BAND_LAST)
|
||||
mm_gsm_modem_set_band (modem, (MMGsmModemBand) band, async_call_done, context);
|
||||
else {
|
||||
GError *error;
|
||||
|
||||
error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||
"%s", "Invalid band");
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_get_band (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->get_band)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->get_band (self, callback, user_data);
|
||||
else
|
||||
uint_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_band (MMGsmModem *modem, DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_get_band (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_set_network_mode (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->set_network_mode)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->set_network_mode (self, mode, callback, user_data);
|
||||
else
|
||||
async_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_network_mode (MMGsmModem *modem,
|
||||
guint32 mode,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
if (mode >= MM_GSM_MODEM_NETWORK_MODE_ANY && mode <= MM_GSM_MODEM_NETWORK_MODE_LAST)
|
||||
mm_gsm_modem_set_network_mode (modem, (MMGsmModemNetworkMode) mode, async_call_done, context);
|
||||
else {
|
||||
GError *error;
|
||||
|
||||
error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||
"%s", "Invalid network mode");
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_get_network_mode (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_GSM_MODEM_GET_INTERFACE (self)->get_network_mode)
|
||||
MM_GSM_MODEM_GET_INTERFACE (self)->get_network_mode (self, callback, user_data);
|
||||
else
|
||||
uint_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_network_mode (MMGsmModem *modem, DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_gsm_modem_get_network_mode (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_signal_quality (MMGsmModem *self,
|
||||
guint32 quality)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
|
||||
g_signal_emit (self, signals[SIGNAL_QUALITY], 0, quality);
|
||||
}
|
||||
|
||||
void
|
||||
mm_gsm_modem_network_mode (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode)
|
||||
{
|
||||
g_return_if_fail (MM_IS_GSM_MODEM (self));
|
||||
|
||||
g_signal_emit (self, signals[NETWORK_MODE], 0, mode);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_gsm_modem_init (gpointer g_iface)
|
||||
{
|
||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
/* Signals */
|
||||
signals[SIGNAL_QUALITY] =
|
||||
g_signal_new ("signal-quality",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMGsmModem, signal_quality),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_UINT);
|
||||
|
||||
signals[NETWORK_MODE] =
|
||||
g_signal_new ("network-mode",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMGsmModem, network_mode),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_UINT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
GType
|
||||
mm_gsm_modem_get_type (void)
|
||||
{
|
||||
static GType modem_type = 0;
|
||||
|
||||
if (!G_UNLIKELY (modem_type)) {
|
||||
const GTypeInfo modem_info = {
|
||||
sizeof (MMGsmModem), /* class_size */
|
||||
mm_gsm_modem_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
|
||||
modem_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"MMGsmModem",
|
||||
&modem_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (modem_type, MM_TYPE_MODEM);
|
||||
|
||||
dbus_g_object_type_install_info (modem_type, &dbus_glib_mm_gsm_modem_object_info);
|
||||
}
|
||||
|
||||
return modem_type;
|
||||
}
|
@@ -1,186 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_GSM_MODEM_H
|
||||
#define MM_GSM_MODEM_H
|
||||
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_TYPE_GSM_MODEM (mm_gsm_modem_get_type ())
|
||||
#define MM_GSM_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_GSM_MODEM, MMGsmModem))
|
||||
#define MM_IS_GSM_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_GSM_MODEM))
|
||||
#define MM_GSM_MODEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_GSM_MODEM, MMGsmModem))
|
||||
|
||||
typedef enum {
|
||||
MM_GSM_MODEM_NETWORK_MODE_ANY = 0,
|
||||
MM_GSM_MODEM_NETWORK_MODE_GPRS = 1,
|
||||
MM_GSM_MODEM_NETWORK_MODE_EDGE = 2,
|
||||
MM_GSM_MODEM_NETWORK_MODE_3G = 3,
|
||||
MM_GSM_MODEM_NETWORK_MODE_HSDPA = 4,
|
||||
MM_GSM_MODEM_NETWORK_MODE_PREFER_2G = 5,
|
||||
MM_GSM_MODEM_NETWORK_MODE_PREFER_3G = 6,
|
||||
|
||||
MM_GSM_MODEM_NETWORK_MODE_LAST = MM_GSM_MODEM_NETWORK_MODE_PREFER_3G
|
||||
} MMGsmModemNetworkMode;
|
||||
|
||||
typedef enum {
|
||||
MM_GSM_MODEM_BAND_ANY = 0,
|
||||
MM_GSM_MODEM_BAND_EGSM = 1, /* 900 MHz */
|
||||
MM_GSM_MODEM_BAND_DCS = 2, /* 1800 MHz */
|
||||
MM_GSM_MODEM_BAND_PCS = 3, /* 1900 MHz */
|
||||
MM_GSM_MODEM_BAND_G850 = 4, /* 850 MHz */
|
||||
MM_GSM_MODEM_BAND_U2100 = 5, /* WCDMA 2100 MHz (Class I) */
|
||||
MM_GSM_MODEM_BAND_U1700 = 6, /* WCDMA 3GPP UMTS1800 MHz (Class III) */
|
||||
MM_GSM_MODEM_BAND_17IV = 7, /* WCDMA 3GPP AWS 1700/2100 MHz (Class IV) */
|
||||
MM_GSM_MODEM_BAND_U800 = 8, /* WCDMA 3GPP UMTS800 MHz (Class VI) */
|
||||
MM_GSM_MODEM_BAND_U850 = 9, /* WCDMA 3GPP UMTS850 MHz (Class V) */
|
||||
MM_GSM_MODEM_BAND_U900 = 10, /* WCDMA 3GPP UMTS900 MHz (Class VIII) */
|
||||
MM_GSM_MODEM_BAND_U17IX = 11, /* WCDMA 3GPP UMTS MHz (Class IX) */
|
||||
|
||||
MM_GSM_MODEM_BAND_LAST = MM_GSM_MODEM_BAND_U17IX
|
||||
} MMGsmModemBand;
|
||||
|
||||
typedef enum {
|
||||
MM_GSM_MODEM_REG_STATUS_IDLE = 0,
|
||||
MM_GSM_MODEM_REG_STATUS_HOME = 1,
|
||||
MM_GSM_MODEM_REG_STATUS_SEARCHING = 2,
|
||||
MM_GSM_MODEM_REG_STATUS_DENIED = 3,
|
||||
MM_GSM_MODEM_REG_STATUS_UNKNOWN = 4,
|
||||
MM_GSM_MODEM_REG_STATUS_ROAMING = 5
|
||||
} MMGsmModemRegStatus;
|
||||
|
||||
typedef struct _MMGsmModem MMGsmModem;
|
||||
|
||||
typedef void (*MMGsmModemScanFn) (MMGsmModem *modem,
|
||||
GPtrArray *results,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*MMGsmModemRegInfoFn) (MMGsmModem *modem,
|
||||
MMGsmModemRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMGsmModem {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
void (*need_authentication) (MMGsmModem *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_pin) (MMGsmModem *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* 'register' is a reserved word */
|
||||
void (*do_register) (MMGsmModem *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_registration_info) (MMGsmModem *self,
|
||||
MMGsmModemRegInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*scan) (MMGsmModem *self,
|
||||
MMGsmModemScanFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_signal_quality) (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_apn) (MMGsmModem *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_band) (MMGsmModem *self,
|
||||
MMGsmModemBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_band) (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_network_mode) (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_network_mode) (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Signals */
|
||||
void (*signal_quality) (MMGsmModem *self,
|
||||
guint32 quality);
|
||||
|
||||
void (*network_mode) (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode);
|
||||
};
|
||||
|
||||
GType mm_gsm_modem_get_type (void);
|
||||
|
||||
void mm_gsm_modem_need_authentication (MMGsmModem *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_set_pin (MMGsmModem *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_register (MMGsmModem *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_get_reg_info (MMGsmModem *self,
|
||||
MMGsmModemRegInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_scan (MMGsmModem *self,
|
||||
MMGsmModemScanFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_set_apn (MMGsmModem *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_get_signal_quality (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_set_band (MMGsmModem *self,
|
||||
MMGsmModemBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_get_band (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_set_network_mode (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_gsm_modem_get_network_mode (MMGsmModem *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Protected */
|
||||
|
||||
void mm_gsm_modem_signal_quality (MMGsmModem *self,
|
||||
guint32 quality);
|
||||
|
||||
void mm_gsm_modem_network_mode (MMGsmModem *self,
|
||||
MMGsmModemNetworkMode mode);
|
||||
|
||||
#endif /* MM_GSM_MODEM_H */
|
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include "mm-cdma-modem.h"
|
||||
#include "mm-modem-cdma.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static void impl_cdma_modem_get_signal_quality (MMCdmaModem *modem, DBusGMethodInvocation *context);
|
||||
static void impl_modem_cdma_get_signal_quality (MMModemCdma *modem, DBusGMethodInvocation *context);
|
||||
|
||||
#include "mm-cdma-modem-glue.h"
|
||||
#include "mm-modem-cdma-glue.h"
|
||||
|
||||
enum {
|
||||
SIGNAL_QUALITY,
|
||||
@@ -43,30 +43,30 @@ uint_call_done (MMModem *modem, guint32 result, GError *error, gpointer user_dat
|
||||
}
|
||||
|
||||
void
|
||||
mm_cdma_modem_get_signal_quality (MMCdmaModem *self,
|
||||
mm_modem_cdma_get_signal_quality (MMModemCdma *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_CDMA_MODEM (self));
|
||||
g_return_if_fail (MM_IS_MODEM_CDMA (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_CDMA_MODEM_GET_INTERFACE (self)->get_signal_quality)
|
||||
MM_CDMA_MODEM_GET_INTERFACE (self)->get_signal_quality (self, callback, user_data);
|
||||
if (MM_MODEM_CDMA_GET_INTERFACE (self)->get_signal_quality)
|
||||
MM_MODEM_CDMA_GET_INTERFACE (self)->get_signal_quality (self, callback, user_data);
|
||||
else
|
||||
uint_op_not_supported (MM_MODEM (self), callback, user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_cdma_modem_get_signal_quality (MMCdmaModem *modem, DBusGMethodInvocation *context)
|
||||
impl_modem_cdma_get_signal_quality (MMModemCdma *modem, DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_cdma_modem_get_signal_quality (modem, uint_call_done, context);
|
||||
mm_modem_cdma_get_signal_quality (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
void
|
||||
mm_cdma_modem_signal_quality (MMCdmaModem *self,
|
||||
mm_modem_cdma_signal_quality (MMModemCdma *self,
|
||||
guint32 quality)
|
||||
{
|
||||
g_return_if_fail (MM_IS_CDMA_MODEM (self));
|
||||
g_return_if_fail (MM_IS_MODEM_CDMA (self));
|
||||
|
||||
g_signal_emit (self, signals[SIGNAL_QUALITY], 0, quality);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ mm_cdma_modem_signal_quality (MMCdmaModem *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_cdma_modem_init (gpointer g_iface)
|
||||
mm_modem_cdma_init (gpointer g_iface)
|
||||
{
|
||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
||||
static gboolean initialized = FALSE;
|
||||
@@ -88,7 +88,7 @@ mm_cdma_modem_init (gpointer g_iface)
|
||||
g_signal_new ("signal-quality",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMCdmaModem, signal_quality),
|
||||
G_STRUCT_OFFSET (MMModemCdma, signal_quality),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1,
|
||||
@@ -98,14 +98,14 @@ mm_cdma_modem_init (gpointer g_iface)
|
||||
}
|
||||
|
||||
GType
|
||||
mm_cdma_modem_get_type (void)
|
||||
mm_modem_cdma_get_type (void)
|
||||
{
|
||||
static GType modem_type = 0;
|
||||
|
||||
if (!G_UNLIKELY (modem_type)) {
|
||||
const GTypeInfo modem_info = {
|
||||
sizeof (MMCdmaModem), /* class_size */
|
||||
mm_cdma_modem_init, /* base_init */
|
||||
sizeof (MMModemCdma), /* class_size */
|
||||
mm_modem_cdma_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
@@ -116,12 +116,12 @@ mm_cdma_modem_get_type (void)
|
||||
};
|
||||
|
||||
modem_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"MMCdmaModem",
|
||||
"MMModemCdma",
|
||||
&modem_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (modem_type, MM_TYPE_MODEM);
|
||||
|
||||
dbus_g_object_type_install_info (modem_type, &dbus_glib_mm_cdma_modem_object_info);
|
||||
dbus_g_object_type_install_info (modem_type, &dbus_glib_mm_modem_cdma_object_info);
|
||||
}
|
||||
|
||||
return modem_type;
|
39
src/mm-modem-cdma.h
Normal file
39
src/mm-modem-cdma.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_CDMA_H
|
||||
#define MM_MODEM_CDMA_H
|
||||
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_TYPE_MODEM_CDMA (mm_modem_cdma_get_type ())
|
||||
#define MM_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_CDMA, MMModemCdma))
|
||||
#define MM_IS_MODEM_CDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_CDMA))
|
||||
#define MM_MODEM_CDMA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_MODEM_CDMA, MMModemCdma))
|
||||
|
||||
typedef struct _MMModemCdma MMModemCdma;
|
||||
|
||||
struct _MMModemCdma {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
void (*get_signal_quality) (MMModemCdma *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Signals */
|
||||
void (*signal_quality) (MMModemCdma *self,
|
||||
guint32 quality);
|
||||
};
|
||||
|
||||
GType mm_modem_cdma_get_type (void);
|
||||
|
||||
void mm_modem_cdma_get_signal_quality (MMModemCdma *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Protected */
|
||||
|
||||
void mm_modem_cdma_signal_quality (MMModemCdma *self,
|
||||
guint32 quality);
|
||||
|
||||
#endif /* MM_MODEM_CDMA_H */
|
319
src/mm-modem-gsm-card.c
Normal file
319
src/mm-modem-gsm-card.c
Normal file
@@ -0,0 +1,319 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include "mm-modem-gsm-card.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static void impl_gsm_modem_get_imei (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_imsi (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_info (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_send_pin (MMModemGsmCard *modem,
|
||||
const char *pin,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_enable_pin (MMModemGsmCard *modem,
|
||||
const char *pin,
|
||||
gboolean enabled,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_change_pin (MMModemGsmCard *modem,
|
||||
const char *old_pin,
|
||||
const char *new_pin,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
#include "mm-modem-gsm-card-glue.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
str_call_done (MMModem *modem, const char *result, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, result);
|
||||
}
|
||||
|
||||
static void
|
||||
str_not_supported_wrapper (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMModemStringFn callback;
|
||||
|
||||
callback = (MMModemStringFn) mm_callback_info_get_data (info, "str-callback");
|
||||
callback (MM_MODEM (modem), NULL, error, mm_callback_info_get_data (info, "str-data"));
|
||||
}
|
||||
|
||||
static void
|
||||
str_call_not_supported (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), str_not_supported_wrapper, NULL);
|
||||
info->user_data = info;
|
||||
mm_callback_info_set_data (info, "str-callback", callback, NULL);
|
||||
mm_callback_info_set_data (info, "str-data", user_data, NULL);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
info_call_done (MMModemGsmCard *self,
|
||||
const char *manufacturer,
|
||||
const char *model,
|
||||
const char *version,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, manufacturer, model, version);
|
||||
}
|
||||
|
||||
static void
|
||||
info_not_supported_wrapper (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMModemGsmCardInfoFn callback;
|
||||
|
||||
callback = (MMModemGsmCardInfoFn) mm_callback_info_get_data (info, "info-callback");
|
||||
callback (MM_MODEM_GSM_CARD (modem), NULL, NULL, NULL, error, mm_callback_info_get_data (info, "info-data"));
|
||||
}
|
||||
|
||||
static void
|
||||
info_call_not_supported (MMModemGsmCard *self,
|
||||
MMModemGsmCardInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), info_not_supported_wrapper, NULL);
|
||||
info->user_data = info;
|
||||
mm_callback_info_set_data (info, "info-callback", callback, NULL);
|
||||
mm_callback_info_set_data (info, "info-data", user_data, NULL);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
async_call_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context);
|
||||
}
|
||||
|
||||
static void
|
||||
async_call_not_supported (MMModemGsmCard *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), callback, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_get_imei (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_imei)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_imei (self, callback, user_data);
|
||||
else
|
||||
str_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_get_imsi (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_imsi)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_imsi (self, callback, user_data);
|
||||
else
|
||||
str_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_get_info (MMModemGsmCard *self,
|
||||
MMModemGsmCardInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_info)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->get_info (self, callback, user_data);
|
||||
else
|
||||
info_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_send_pin (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (pin != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->send_pin)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->send_pin (self, pin, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_enable_pin (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
gboolean enabled,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (pin != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->enable_pin)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->enable_pin (self, pin, enabled, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_card_change_pin (MMModemGsmCard *self,
|
||||
const char *old_pin,
|
||||
const char *new_pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_CARD (self));
|
||||
g_return_if_fail (old_pin != NULL);
|
||||
g_return_if_fail (new_pin != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_CARD_GET_INTERFACE (self)->change_pin)
|
||||
MM_MODEM_GSM_CARD_GET_INTERFACE (self)->change_pin (self, old_pin, new_pin, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_imei (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_get_imei (modem, str_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_imsi (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_get_imsi (modem, str_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_info (MMModemGsmCard *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_get_info (modem, info_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_send_pin (MMModemGsmCard *modem,
|
||||
const char *pin,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_send_pin (modem, pin, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_enable_pin (MMModemGsmCard *modem,
|
||||
const char *pin,
|
||||
gboolean enabled,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_enable_pin (modem, pin, enabled, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_change_pin (MMModemGsmCard *modem,
|
||||
const char *old_pin,
|
||||
const char *new_pin,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_card_change_pin (modem, old_pin, new_pin, async_call_done, context);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_modem_gsm_card_init (gpointer g_iface)
|
||||
{
|
||||
}
|
||||
|
||||
GType
|
||||
mm_modem_gsm_card_get_type (void)
|
||||
{
|
||||
static GType card_type = 0;
|
||||
|
||||
if (!G_UNLIKELY (card_type)) {
|
||||
const GTypeInfo card_info = {
|
||||
sizeof (MMModemGsmCard), /* class_size */
|
||||
mm_modem_gsm_card_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
|
||||
card_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"MMModemGsmCard",
|
||||
&card_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (card_type, G_TYPE_OBJECT);
|
||||
dbus_g_object_type_install_info (card_type, &dbus_glib_mm_modem_gsm_card_object_info);
|
||||
}
|
||||
|
||||
return card_type;
|
||||
}
|
87
src/mm-modem-gsm-card.h
Normal file
87
src/mm-modem-gsm-card.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_GSM_CARD_H
|
||||
#define MM_MODEM_GSM_CARD_H
|
||||
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_TYPE_MODEM_GSM_CARD (mm_modem_gsm_card_get_type ())
|
||||
#define MM_MODEM_GSM_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_GSM_CARD, MMModemGsmCard))
|
||||
#define MM_IS_MODEM_GSM_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_GSM_CARD))
|
||||
#define MM_MODEM_GSM_CARD_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_MODEM_GSM_CARD, MMModemGsmCard))
|
||||
|
||||
typedef struct _MMModemGsmCard MMModemGsmCard;
|
||||
|
||||
typedef void (*MMModemGsmCardInfoFn) (MMModemGsmCard *self,
|
||||
const char *manufacturer,
|
||||
const char *model,
|
||||
const char *version,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMModemGsmCard {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
void (*get_imei) (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_imsi) (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_info) (MMModemGsmCard *self,
|
||||
MMModemGsmCardInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*send_pin) (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*enable_pin) (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
gboolean enabled,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*change_pin) (MMModemGsmCard *self,
|
||||
const char *old_pin,
|
||||
const char *new_pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
};
|
||||
|
||||
GType mm_modem_gsm_card_get_type (void);
|
||||
|
||||
void mm_modem_gsm_card_get_imei (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_card_get_imsi (MMModemGsmCard *self,
|
||||
MMModemStringFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_card_get_info (MMModemGsmCard *self,
|
||||
MMModemGsmCardInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_card_send_pin (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_card_enable_pin (MMModemGsmCard *self,
|
||||
const char *pin,
|
||||
gboolean enabled,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_card_change_pin (MMModemGsmCard *self,
|
||||
const char *old_pin,
|
||||
const char *new_pin,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* MM_MODEM_GSM_CARD_H */
|
507
src/mm-modem-gsm-network.c
Normal file
507
src/mm-modem-gsm-network.c
Normal file
@@ -0,0 +1,507 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#include <string.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include "mm-modem-gsm-network.h"
|
||||
#include "mm-modem-error.h"
|
||||
#include "mm-callback-info.h"
|
||||
|
||||
static void impl_gsm_modem_register (MMModemGsmNetwork *modem,
|
||||
const char *network_id,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_scan (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_set_apn (MMModemGsmNetwork *modem,
|
||||
const char *apn,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_signal_quality (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_set_band (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkBand band,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_band (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_set_network_mode (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkMode mode,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_network_mode (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_gsm_modem_get_reg_info (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
#include "mm-modem-gsm-network-glue.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
enum {
|
||||
SIGNAL_QUALITY,
|
||||
REGISTRATION_INFO,
|
||||
NETWORK_MODE,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
async_call_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context);
|
||||
}
|
||||
|
||||
static void
|
||||
async_call_not_supported (MMModemGsmNetwork *self,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), callback, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
uint_call_done (MMModem *modem, guint32 result, GError *error, gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, result);
|
||||
}
|
||||
|
||||
static void
|
||||
uint_call_not_supported (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_uint_new (MM_MODEM (self), callback, user_data);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
reg_info_call_done (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else {
|
||||
dbus_g_method_return (context, status,
|
||||
oper_code ? oper_code : "",
|
||||
oper_name ? oper_name : "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reg_info_not_supported_wrapper (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMModemGsmNetworkRegInfoFn callback;
|
||||
|
||||
callback = (MMModemGsmNetworkRegInfoFn) mm_callback_info_get_data (info, "reg-info-callback");
|
||||
callback (MM_MODEM_GSM_NETWORK (modem), 0, NULL, NULL, error, mm_callback_info_get_data (info, "reg-info-data"));
|
||||
}
|
||||
|
||||
static void
|
||||
reg_info_call_not_supported (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), reg_info_not_supported_wrapper, NULL);
|
||||
info->user_data = info;
|
||||
mm_callback_info_set_data (info, "reg-info-callback", callback, NULL);
|
||||
mm_callback_info_set_data (info, "reg-info-data", user_data, NULL);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static void
|
||||
scan_call_done (MMModemGsmNetwork *self,
|
||||
GPtrArray *results,
|
||||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
|
||||
|
||||
if (error)
|
||||
dbus_g_method_return_error (context, error);
|
||||
else
|
||||
dbus_g_method_return (context, results);
|
||||
}
|
||||
|
||||
static void
|
||||
scan_not_supported_wrapper (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||
MMModemGsmNetworkScanFn callback;
|
||||
|
||||
callback = (MMModemGsmNetworkScanFn) mm_callback_info_get_data (info, "scan-callback");
|
||||
callback (MM_MODEM_GSM_NETWORK (modem), NULL, error, mm_callback_info_get_data (info, "scan-data"));
|
||||
}
|
||||
|
||||
static void
|
||||
scan_call_not_supported (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkScanFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MMCallbackInfo *info;
|
||||
|
||||
info = mm_callback_info_new (MM_MODEM (self), scan_not_supported_wrapper, NULL);
|
||||
info->user_data = info;
|
||||
mm_callback_info_set_data (info, "scan-callback", callback, NULL);
|
||||
mm_callback_info_set_data (info, "scan-data", user_data, NULL);
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
"%s", "Operation not supported");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_register (MMModemGsmNetwork *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->do_register)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->do_register (self, network_id, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_scan (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkScanFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->scan)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->scan (self, callback, user_data);
|
||||
else
|
||||
scan_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_set_apn (MMModemGsmNetwork *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (apn != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_apn)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_apn (self, apn, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_get_signal_quality (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_signal_quality)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_signal_quality (self, callback, user_data);
|
||||
else
|
||||
uint_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_set_band (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_band)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_band (self, band, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_get_band (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_band)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_band (self, callback, user_data);
|
||||
else
|
||||
uint_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_set_mode (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_network_mode)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->set_network_mode (self, mode, callback, user_data);
|
||||
else
|
||||
async_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_get_mode (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_network_mode)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_network_mode (self, callback, user_data);
|
||||
else
|
||||
uint_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_get_registration_info (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegInfoFn callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_registration_info)
|
||||
MM_MODEM_GSM_NETWORK_GET_INTERFACE (self)->get_registration_info (self, callback, user_data);
|
||||
else
|
||||
reg_info_call_not_supported (self, callback, user_data);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_signal_quality (MMModemGsmNetwork *self,
|
||||
guint32 quality)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
|
||||
g_signal_emit (self, signals[SIGNAL_QUALITY], 0, quality);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_registration_info (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
|
||||
g_signal_emit (self, signals[REGISTRATION_INFO], 0, status, oper_code, oper_name);
|
||||
}
|
||||
|
||||
void
|
||||
mm_modem_gsm_network_mode (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode)
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM_GSM_NETWORK (self));
|
||||
|
||||
g_signal_emit (self, signals[NETWORK_MODE], 0, mode);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
impl_gsm_modem_register (MMModemGsmNetwork *modem,
|
||||
const char *network_id,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
const char *id;
|
||||
|
||||
/* DBus does not support NULL strings, so the caller should pass an empty string
|
||||
for manual registration. */
|
||||
if (strlen (network_id) < 1)
|
||||
id = NULL;
|
||||
else
|
||||
id = network_id;
|
||||
|
||||
mm_modem_gsm_network_register (modem, id, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_scan (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_scan (modem, scan_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_apn (MMModemGsmNetwork *modem,
|
||||
const char *apn,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_set_apn (modem, apn, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_signal_quality (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_get_signal_quality (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_band (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkBand band,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_set_band (modem, band, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_band (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_get_band (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_set_network_mode (MMModemGsmNetwork *modem,
|
||||
MMModemGsmNetworkMode mode,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_set_mode (modem, mode, async_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_network_mode (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_get_mode (modem, uint_call_done, context);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_gsm_modem_get_reg_info (MMModemGsmNetwork *modem,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
mm_modem_gsm_network_get_registration_info (modem, reg_info_call_done, context);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_modem_gsm_network_init (gpointer g_iface)
|
||||
{
|
||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
/* Signals */
|
||||
signals[SIGNAL_QUALITY] =
|
||||
g_signal_new ("signal-quality",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMModemGsmNetwork, signal_quality),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_UINT);
|
||||
|
||||
/* FIXME */
|
||||
#if 0
|
||||
signals[REGISTRATION_INFO] =
|
||||
g_signal_new ("registration-info",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMModemGsmNetwork, registration_info),
|
||||
NULL, NULL,
|
||||
mm_marshal_VOID__UINT_STRING_STRING,
|
||||
G_TYPE_NONE, 3,
|
||||
G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
|
||||
#endif
|
||||
|
||||
signals[NETWORK_MODE] =
|
||||
g_signal_new ("network-mode",
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (MMModemGsmNetwork, network_mode),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_UINT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
GType
|
||||
mm_modem_gsm_network_get_type (void)
|
||||
{
|
||||
static GType network_type = 0;
|
||||
|
||||
if (!G_UNLIKELY (network_type)) {
|
||||
const GTypeInfo network_info = {
|
||||
sizeof (MMModemGsmNetwork), /* class_size */
|
||||
mm_modem_gsm_network_init, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
0,
|
||||
0, /* n_preallocs */
|
||||
NULL
|
||||
};
|
||||
|
||||
network_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"MMModemGsmNetwork",
|
||||
&network_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (network_type, G_TYPE_OBJECT);
|
||||
dbus_g_object_type_install_info (network_type, &dbus_glib_mm_modem_gsm_network_object_info);
|
||||
}
|
||||
|
||||
return network_type;
|
||||
}
|
178
src/mm-modem-gsm-network.h
Normal file
178
src/mm-modem-gsm-network.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
#ifndef MM_MODEM_GSM_NETWORK_H
|
||||
#define MM_MODEM_GSM_NETWORK_H
|
||||
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_TYPE_MODEM_GSM_NETWORK (mm_modem_gsm_network_get_type ())
|
||||
#define MM_MODEM_GSM_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM_GSM_NETWORK, MMModemGsmNetwork))
|
||||
#define MM_IS_MODEM_GSM_NETWORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM_GSM_NETWORK))
|
||||
#define MM_MODEM_GSM_NETWORK_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_MODEM_GSM_NETWORK, MMModemGsmNetwork))
|
||||
|
||||
typedef enum {
|
||||
MM_MODEM_GSM_NETWORK_MODE_ANY = 0,
|
||||
MM_MODEM_GSM_NETWORK_MODE_GPRS = 1,
|
||||
MM_MODEM_GSM_NETWORK_MODE_EDGE = 2,
|
||||
MM_MODEM_GSM_NETWORK_MODE_3G = 3,
|
||||
MM_MODEM_GSM_NETWORK_MODE_HSDPA = 4,
|
||||
MM_MODEM_GSM_NETWORK_MODE_PREFER_2G = 5,
|
||||
MM_MODEM_GSM_NETWORK_MODE_PREFER_3G = 6,
|
||||
|
||||
MM_MODEM_GSM_NETWORK_MODE_LAST = MM_MODEM_GSM_NETWORK_MODE_PREFER_3G
|
||||
} MMModemGsmNetworkMode;
|
||||
|
||||
typedef enum {
|
||||
MM_MODEM_GSM_NETWORK_BAND_ANY = 0,
|
||||
MM_MODEM_GSM_NETWORK_BAND_EGSM = 1, /* 900 MHz */
|
||||
MM_MODEM_GSM_NETWORK_BAND_DCS = 2, /* 1800 MHz */
|
||||
MM_MODEM_GSM_NETWORK_BAND_PCS = 3, /* 1900 MHz */
|
||||
MM_MODEM_GSM_NETWORK_BAND_G850 = 4, /* 850 MHz */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U2100 = 5, /* WCDMA 2100 MHz (Class I) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U1700 = 6, /* WCDMA 3GPP UMTS1800 MHz (Class III) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_17IV = 7, /* WCDMA 3GPP AWS 1700/2100 MHz (Class IV) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U800 = 8, /* WCDMA 3GPP UMTS800 MHz (Class VI) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U850 = 9, /* WCDMA 3GPP UMTS850 MHz (Class V) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U900 = 10, /* WCDMA 3GPP UMTS900 MHz (Class VIII) */
|
||||
MM_MODEM_GSM_NETWORK_BAND_U17IX = 11, /* WCDMA 3GPP UMTS MHz (Class IX) */
|
||||
|
||||
MM_MODEM_GSM_NETWORK_BAND_LAST = MM_MODEM_GSM_NETWORK_BAND_U17IX
|
||||
} MMModemGsmNetworkBand;
|
||||
|
||||
typedef enum {
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_IDLE = 0,
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_HOME = 1,
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_SEARCHING = 2,
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_DENIED = 3,
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_UNKNOWN = 4,
|
||||
MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING = 5
|
||||
} MMModemGsmNetworkRegStatus;
|
||||
|
||||
typedef struct _MMModemGsmNetwork MMModemGsmNetwork;
|
||||
|
||||
typedef void (*MMModemGsmNetworkScanFn) (MMModemGsmNetwork *self,
|
||||
GPtrArray *results,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*MMModemGsmNetworkRegInfoFn) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMModemGsmNetwork {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
/* 'register' is a reserved word */
|
||||
void (*do_register) (MMModemGsmNetwork *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*scan) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkScanFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_apn) (MMModemGsmNetwork *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_signal_quality) (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_band) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_band) (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*set_network_mode) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_network_mode) (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void (*get_registration_info) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Signals */
|
||||
void (*signal_quality) (MMModemGsmNetwork *self,
|
||||
guint32 quality);
|
||||
|
||||
void (*registration_info) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegStatus status,
|
||||
const char *open_code,
|
||||
const char *oper_name);
|
||||
|
||||
void (*network_mode) (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode);
|
||||
};
|
||||
|
||||
GType mm_modem_gsm_network_get_type (void);
|
||||
|
||||
void mm_modem_gsm_network_register (MMModemGsmNetwork *self,
|
||||
const char *network_id,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_scan (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkScanFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_set_apn (MMModemGsmNetwork *self,
|
||||
const char *apn,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_get_signal_quality (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_set_band (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkBand band,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_get_band (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_set_mode (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode,
|
||||
MMModemFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_get_mode (MMModemGsmNetwork *self,
|
||||
MMModemUIntFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
void mm_modem_gsm_network_get_registration_info (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegInfoFn callback,
|
||||
gpointer user_data);
|
||||
|
||||
/* Protected */
|
||||
|
||||
void mm_modem_gsm_network_signal_quality (MMModemGsmNetwork *self,
|
||||
guint32 quality);
|
||||
|
||||
void mm_modem_gsm_network_registration_info (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkRegStatus status,
|
||||
const char *oper_code,
|
||||
const char *oper_name);
|
||||
|
||||
void mm_modem_gsm_network_mode (MMModemGsmNetwork *self,
|
||||
MMModemGsmNetworkMode mode);
|
||||
|
||||
#endif /* MM_MODEM_GSM_NETWORK_H */
|
@@ -36,6 +36,11 @@ typedef void (*MMModemUIntFn) (MMModem *modem,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*MMModemStringFn) (MMModem *modem,
|
||||
const char *result,
|
||||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
struct _MMModem {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
|
Reference in New Issue
Block a user