Editing Documentation/Maemo 5 Developer Guide/Using Connectivity Components/Maemo Connectivity

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.

Warning: This page is 82 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
The Maemo connectivity subsystem is implemented by using known Linux conventions. It resides in the user space of Linux, and relies on the Linux kernel through standard C libraries. GPRS or WLAN is the main channel to the Internet. The Bluetooth software of Maemo is based on BlueZ, which is known as the de-facto implementation of Bluetooth for Linux. D-Bus is used for internal application level message exchange.
+
The Maemo connectivity subsystem is implemented by using known Linux conventions. It resides in the user space of Linux, and relies on the Linux kernel through standard C libraries. GPRS or WLAN is the main channel to the Internet. The Bluetooth software of maemo is based on BlueZ, which is known as the de-facto implementation of Bluetooth for Linux. D-Bus is used for internal application level message exchange.
Even though the connectivity device drivers are closely related to this subsystem, they are considered to be outside of the scope of this manual.
Even though the connectivity device drivers are closely related to this subsystem, they are considered to be outside of the scope of this manual.
-
===Components of the Maemo connectivity architecture===
+
===Components of the maemo connectivity architecture===
* '''Maemo connectivity UI''' - User Interface parts of the connectivity. This includes Control Panel applets and several different dialogs.
* '''Maemo connectivity UI''' - User Interface parts of the connectivity. This includes Control Panel applets and several different dialogs.
Line 22: Line 22:
This section describes the system decomposition of the Connectivity subsystem. Maemo applications can open Internet connections by using the LibConIC API. The Internet Access subsystem take care of the connection to the phone, if necessary, by using the services of the Phone Access subsystem. If an application needs to gain access to the phone's files, the File selector consults the Phone Access subsystem.
This section describes the system decomposition of the Connectivity subsystem. Maemo applications can open Internet connections by using the LibConIC API. The Internet Access subsystem take care of the connection to the phone, if necessary, by using the services of the Phone Access subsystem. If an application needs to gain access to the phone's files, the File selector consults the Phone Access subsystem.
-
In offline mode, none of the radios must be active. The [[Documentation/Maemo 5 Developer Guide/Architecture/System Software#Device State Management Entity (DSME)|Device System Management Entity (DSME)]] of Maemo provides information about the transitions to and from the offline mode.
+
In offline mode, none of the radios must be active. The Device System Management Entity (DSME) of maemo provides information about the transitions to and from the offline mode.
-
;Name
+
{| class="wikitable"
-
: Connectivity UI
+
! Name
-
;Purpose
+
! Connectivity UI
-
: Provides the UI for managing phone and Internet connections. Available as a Control Panel applet, and from the Status Bar.
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Displaying active connections with statistics</li><li>Updating status indicators</li><li>Providing dialogs for changing and disconnecting connections</li></ul>
+
| Provides the UI for managing phone and Internet connections. Available as a Control Panel applet, and from the Status Bar.
-
;Concurrent usage
+
|-
-
: (N/A)
+
| Responsibilities and additional requirements
 +
|
 +
* Displaying active connections with statistics
 +
* Updating status indicators
 +
* Providing dialogs for changing and disconnecting connections
 +
|-
 +
| Concurrent usage
 +
| (N/A)
 +
|}
-
;Name
+
{| class="wikitable"
-
: Phone Access
+
! Name
-
;Purpose
+
! Phone Access
-
: Provides connections to phones with different Bluetooth profiles
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Searching for phones and inquiring their services</li><li>Keeping phone register</li><li>Providing status of the phone connections for Connectivity UI</li><li>Binding RFCOMM devices to Bluetooth services on the phone</li><li>Providing easy access to OpenOBEX</li></ul>
+
| Provides connections to phones with different Bluetooth profiles
-
;Concurrent usage
+
|-
-
: Number of clients not limited by Maemo. However, some phones may not support more than one Bluetooth profile at a time.
+
| Responsibilities and additional requirements
 +
|
 +
* Searching for phones and inquiring their services
 +
* Keeping phone register
 +
* Providing status of the phone connections for Connectivity UI
 +
* Binding RFCOMM devices to Bluetooth services on the phone
 +
* Providing easy access to OpenOBEX
 +
|-
 +
| Concurrent usage
 +
| Number of clients not limited by Maemo. However, some phones may not support more than one Bluetooth profile at a time.
 +
|}
-
;Name
+
{| class="wikitable"
-
: Internet Access
+
! Name
-
;Purpose
+
! Internet Access
-
: Provides Internet connections over different bearers.
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Providing means for configuration and management of IAP settings</li><li>Providing API for Internet connections over different bearers (e.g. WLAN, GPRS)</li><li>Providing status of Internet connections for Connectivity UI</li></ul>
+
| Provides Internet connections over different bearers.
-
;Concurrent usage
+
|-
-
: Number of clients not limited, but only one connection to the Internet can exist at any given time
+
| Responsibilities and additional requirements
 +
|
 +
* Providing means for configuration and management of IAP settings
 +
* Providing API for Internet connections over different bearers (e.g. WLAN, GPRS)
 +
* Providing status of Internet connections for Connectivity UI
 +
|-
 +
| Concurrent usage
 +
| Number of clients not limited, but only one connection to the Internet can exist at any given time
 +
|}
Phone and Internet connections are quite different by nature and behavior. These are introduced in more detail in the following sections.
Phone and Internet connections are quite different by nature and behavior. These are introduced in more detail in the following sections.
Line 57: Line 83:
Phone Access is the subsystem handling connections to a cellular phone. It offers a search utility for finding potential phones and inquiring the services they can offer. This is based on the standard Bluetooth service discovery mechanism. Phone Access also keeps a record of phones that have connected to the device in GConf, and provides a list of them for the user to choose from. Phone Access relies on the Linux Bluetooth implementation called BlueZ. BlueZ offers the Berkeley socket interface to the HCI and to the L2CAP protocol for the user space applications.
Phone Access is the subsystem handling connections to a cellular phone. It offers a search utility for finding potential phones and inquiring the services they can offer. This is based on the standard Bluetooth service discovery mechanism. Phone Access also keeps a record of phones that have connected to the device in GConf, and provides a list of them for the user to choose from. Phone Access relies on the Linux Bluetooth implementation called BlueZ. BlueZ offers the Berkeley socket interface to the HCI and to the L2CAP protocol for the user space applications.
-
In principle, any cellular phone supporting Bluetooth Service Discovery Protocol (SDP) and File Transfer Profile (FTP) can connect to Maemo. However, different mobile phones implement varying levels of file transfer services and OBEX. Some products limit access to the Inbox (Object Push), whereas more sophisticated ones make the Gallery and the memory card available. The recent products support the OBEX Capability request for retrieving more specific information about the file system on the phone.
+
In principle, any cellular phone supporting Bluetooth Service Discovery Protocol (SDP) and File Transfer Profile (FTP) can connect to maemo. However, different mobile phones implement varying levels of file transfer services and OBEX. Some products limit access to the Inbox (Object Push), whereas more sophisticated ones make the Gallery and the memory card available. The recent products support the OBEX Capability request for retrieving more specific information about the file system on the phone.
Maemo connects to a phone on an on-demand basis, such as when an application requires a connection. For example, when the Internet browser is about to open a URL, it requests Phone Access to establish a connection to the phone. This causes Phone Access to bind an RFCOMM device to the requested service on the phone. In a similar fashion, the File Selector can set up a file transfer connection to the phone using another RFCOMM device. After binding to a service, the application in question can open the local RFCOMM device. Normal file selector access is performed with GnomeVFS layer to get transparent access to phone in the same way as internal flash and MMC are accessed.
Maemo connects to a phone on an on-demand basis, such as when an application requires a connection. For example, when the Internet browser is about to open a URL, it requests Phone Access to establish a connection to the phone. This causes Phone Access to bind an RFCOMM device to the requested service on the phone. In a similar fashion, the File Selector can set up a file transfer connection to the phone using another RFCOMM device. After binding to a service, the application in question can open the local RFCOMM device. Normal file selector access is performed with GnomeVFS layer to get transparent access to phone in the same way as internal flash and MMC are accessed.
-
;Name
 
-
: General Bluetooth UI
 
-
;Purpose
 
-
: User interface for managing all paired BT devices
 
-
;Responsibilities and additional requirements
 
-
: <ul><li>Keeping a list of all paired devices (not only phones)</li></ul>
 
-
;Concurrent usage
 
-
: N/A
 
-
;Name
+
{| class="wikitable"
-
: BT search
+
! Name
-
;Purpose
+
! General Bluetooth UI
-
: Searches for available Bluetooth devices
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Bluetooth inquiry</li><li>Checking on offline mode state</li></ul>
+
| User interface for managing all paired BT devices
-
;Concurrent usage
+
|-
-
: N/A
+
| Responsibilities and additional requirements
 +
|
 +
* Keeping a list of all paired devices (not only phones)
 +
|-
 +
| Concurrent usage
 +
| N/A
 +
|}
-
;Name
+
{| class="wikitable"
-
: BT service discovery
+
! Name
-
;Purpose
+
| BT search
-
: Checks if a found Bluetooth device is sufficient
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: Bluetooth service discovery (SDP)
+
| Searches for available Bluetooth devices
-
;Concurrent usage
+
|-
-
: Not limited (but used by Phone selection UI and Phone connection daemon only)
+
| Responsibilities and additional requirements
 +
|
 +
* Bluetooth inquiry
 +
* Checking on offline mode state
 +
|-
 +
| Concurrent usage
 +
| N/A
 +
|}
-
;Name
+
{| class="wikitable"
-
: GW OBEX library
+
! Name
-
;Purpose
+
! BT service discovery
-
: Provides access to OpenOBEX library for the File selector (Gnome VFS) on a higher abstraction level than OpenOBEX itself supports
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Handling OBEX requests</li></ul>
+
| Checks if a found Bluetooth device is sufficient
-
;Concurrent usage
+
|-
-
: Not limited
+
| Responsibilities and additional requirements
 +
|
 +
* Bluetooth service discovery (SDP)
 +
|-
 +
| Concurrent usage
 +
| Not limited (but used by Phone selection UI and Phone connection daemon only)
 +
|}
 +
 
 +
{| class="wikitable"
 +
| Name
 +
| GW OBEX library
 +
|-
 +
| Purpose
 +
| Provides access to OpenOBEX library for the File selector (Gnome VFS) on a higher abstraction level than OpenOBEX itself supports
 +
|-
 +
| Responsibilities and additional requirements
 +
|
 +
* Handling OBEX requests
 +
|-
 +
| width="100" align="LEFT" valign="TOP" | Concurrent usage
 +
| width="350" align="LEFT" valign="TOP" | Not limited
 +
|}
Maemo Bluetooth also supports HID (keyboard) and OPP (object push file transfer) profiles.
Maemo Bluetooth also supports HID (keyboard) and OPP (object push file transfer) profiles.
Line 108: Line 160:
For Bluetooth connections, AT commands are applied to establish a PPP link to the cellular modem and the connection to the Internet.
For Bluetooth connections, AT commands are applied to establish a PPP link to the cellular modem and the connection to the Internet.
-
;Name
+
{| class="wikitable"
-
: IC daemon
+
! Name
-
;Purpose
+
! IC daemon
-
: IC daemon establishes Internet connections over different bearers.
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Controlling that only one Internet connection (one active IAP) can exist at any given time</li><li>Using WLAN or GPRS connection daemon for getting a network device and getting the connection authenticated</li><li>Starting IP level services like PPP and DHCP</li><li>Providing statistics about the usage of IAPs to any application</li></ul>
+
| IC daemon establishes Internet connections over different bearers.
-
;Concurrent usage
+
|-
-
: Has multiple clients and limits the connections to one at a time
+
| Responsibilities and additional requirements
 +
|
 +
* Controlling that only one Internet connection (one active IAP) can exist at any given time
 +
* Using WLAN or GPRS connection daemon for getting a network device and getting the connection authenticated
 +
* Starting IP level services like PPP and DHCP
 +
* Providing statistics about the usage of IAPs to any application
 +
|-
 +
| Concurrent usage
 +
| Has multiple clients and limits the connections to one at a time
 +
|}
-
;Name
+
{| class="wikitable"
-
: Internet Connectivity GUI
+
! Name
-
;Purpose
+
! Internet Connectivity GUI
-
: Has GUI applications for configuring Internet Access Points and WLAN settings.
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Providing the UI for configuring an IAP</li><li>Providing the UI for WLAN settings</li><li>Scanning for available WLAN networks (on request)</li><li>Saving IAP and WLAN settings (excluding EAP settings) to GConf</li><li>Opening up dialogs and displaying notifications</li></ul>
+
| Has GUI applications for configuring Internet Access Points and WLAN settings.
-
;Concurrent usage
+
|-
-
: N/A
+
| Responsibilities and additional requirements
 +
|
 +
* Providing the UI for configuring an IAP
 +
* Providing the UI for WLAN settings
 +
* Scanning for available WLAN networks (on request)
 +
* Saving IAP and WLAN settings (excluding EAP settings) to GConf
 +
* Opening up dialogs and displaying notifications
 +
|-
 +
| Concurrent usage
 +
| N/A
 +
|}
-
;Name
+
{| class="wikitable"
-
: WLAN connection daemon
+
! Name
-
;Purpose
+
! WLAN connection daemon
-
: Manages WLAN network connections
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Starting WLAN driver with the settings provided; stopping WLAN</li><li>Requesting authentication when necessary</li><li>Relaying WLAN IAP settings from IC daemon to WLAN drivers and authentication requests to EAP</li><li>Relaying WLAN events from WLAN drivers</li><li>Providing WLAN status information</li></ul>
+
| Manages WLAN network connections
-
;Concurrent usage
+
|-
-
: Not limited
+
| Responsibilities and additional requirements
 +
|
 +
* Starting WLAN driver with the settings provided; stopping WLAN
 +
* Requesting authentication when necessary
 +
* Relaying WLAN IAP settings from IC daemon to WLAN drivers and authentication requests to EAP
 +
* Relaying WLAN events from WLAN drivers
 +
* Providing WLAN status information
 +
|-
 +
| Concurrent usage
 +
| Not limited
 +
|}
-
;Name
+
{| class="wikitable"
-
: EAP UI
+
! Name
-
;Purpose
+
! EAP UI
-
: User interface for EAP authentication
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Invoking a dialog for an authentication password</li><li>Showing authentication status</li></ul>
+
| User interface for EAP authentication
-
;Concurrent usage
+
|-
-
: N/A
+
| Responsibilities and additional requirements
 +
|
 +
* Invoking a dialog for an authentication password
 +
* Showing authentication status
 +
|-
 +
| Concurrent usage
 +
| N/A
 +
|}
-
;Name
+
{| class="wikitable"
-
: EAP
+
! Name
-
;Purpose
+
! EAP
-
: Provides WLAN security excluding basic WEP settings, which are in Wireless Extensions
+
|-
-
;Responsibilities and additional requirements
+
| Purpose
-
: <ul><li>Taking care of the authentication process for the active IAP</li><li>Delivering progress events to IC daemon</li><li>As a special case, controlling the EAP-SIM authentication using the SIM Access Profile</li><li>Providing authentication status</li></ul>
+
| Provides WLAN security excluding basic WEP settings, which are in Wireless Extensions
-
;Concurrent usage
+
|-
-
: N/A
+
| Responsibilities and additional requirements
 +
|
 +
* Taking care of the authentication process for the active IAP
 +
* Delivering progress events to IC daemon
 +
* As a special case, controlling the EAP-SIM authentication using the SIM Access Profile
 +
* Providing authentication status
 +
|-
 +
| Concurrent usage
 +
| N/A
 +
|}
==Internet Connectivity Daemon ==
==Internet Connectivity Daemon ==
Line 175: Line 272:
* Ensure that the user is aware of updates and can see the time when the data was last updated.
* Ensure that the user is aware of updates and can see the time when the data was last updated.
* Ensure that the application registers via LibConIC and listens to signals emitted by the ICd (Connection Created, Lost and Changed), and react as follows:
* Ensure that the application registers via LibConIC and listens to signals emitted by the ICd (Connection Created, Lost and Changed), and react as follows:
-
** '''Connection Created''': Use the connection and update all data.
+
** '''Connection Created'''<nowiki>: Use the connection and update all data. </nowiki>
-
** '''Connection Lost''': Go to an idle state silently and wait until a new connection is created.
+
** '''Connection Lost'''<nowiki>: Go to an idle state silently and wait until a new connection is created. </nowiki>
-
** '''Connection Changed''': Use the new connection.
+
** '''Connection Changed'''<nowiki>: Use the new connection. </nowiki>
* Ensure that automatic data updates run in background and silently:
* Ensure that automatic data updates run in background and silently:
** Avoid alarming the user with unnecessary banners or dialogs.
** Avoid alarming the user with unnecessary banners or dialogs.
Line 215: Line 312:
# employ no threading support in the Libconic API
# employ no threading support in the Libconic API
-
If the application is a standard Hildon application, almost all of these requirements are already fulfilled. LibOSSO context initialization connects the application to both session and system D-Bus buses, <code>g_type_init()</code> is called as a part of <code>gtk_init()</code>, and probably no extra threads are used.  
+
If the application is a standard Hildon application, almost all of these requirements are already fulfilled. LibOSSO context initialization connects the application to both session and system D-BUS buses, <code>g_type_init()</code> is called as a part of <code>gtk_init()</code>, and probably no extra threads are used.  
=== Non-Blocking Sockets ===
=== Non-Blocking Sockets ===
Line 235: Line 332:
=== No Multiple Threads ===
=== No Multiple Threads ===
-
Libconic API is not thread-safe. If the applications has threads, use Libconic API only from the same context where <code>GMainloop</code> is running.
+
Libconic API is not thread-safe. If the applications have threads, use Libconic API only from the same context where <code>GMainloop</code> is running.
===Libconic Usage ===
===Libconic Usage ===
Line 241: Line 338:
==== Requesting for Connection ====
==== Requesting for Connection ====
-
[http://maemo.org/api_refs/5.0/5.0-final/libconic/ LibConIc] is an asynchronous connection API, which heavily relies on <code>GObject</code> signals. Basically this means that <code>GMainloop</code> must be iterated in order to successfully execute connection requests. After the application is set up, use a <code>ConIcConnection</code> object to request a connection:
+
Libconic is an asynchronous connection API, which heavily relies on <code>GObject</code> signals. Basically this means that <code>GMainloop</code> must be iterated in order to successfully execute connection requests. After the application is set up, use a <code>ConIcConnection</code> object to request a connection:
<source lang="c">
<source lang="c">
Line 255: Line 352:
</source>
</source>
-
At this point, the application does not yet have an Internet connection. A successful return from <code>con_ic_connection_connect()</code> means only that the request was successfully dispatched to the Internet Connectivity daemon. When the daemon has a connection ready, the application receives an [http://maemo.org/api_refs/5.0/5.0-final/libconic/conicconnectionevent_8h.html event] (as an <code>GObject</code> signal) indicating that the device is connected. If the connection attempt fails, the application receives a disconnected event with an error describing the reason for the failure.
+
At this point, the application does not yet have an Internet connection. A successful return from <code>con_ic_connection_connect()</code> means only that the request was successfully dispatched to the Internet Connectivity daemon. When the daemon has a connection ready, the application receives an event (as an <code>GObject</code> signal) indicating that the device is connected. If the connection attempt fails, the application receives a disconnected event with an error describing the reason for the failure.
The connection handler (<code>my_connection_handler()</code> function registered in the previous snippet) could look like this:
The connection handler (<code>my_connection_handler()</code> function registered in the previous snippet) could look like this:
Line 377: Line 474:
** <code>con_ic_connection_get_proxy_port()</code> to get the proxy port
** <code>con_ic_connection_get_proxy_port()</code> to get the proxy port
** <code>con_ic_connection_get_proxy_ignore_hosts()</code> to get a list of hosts for which the proxy should not be used.
** <code>con_ic_connection_get_proxy_ignore_hosts()</code> to get a list of hosts for which the proxy should not be used.
-
* If proxy mode is <code>CON_IC_PROXY_MODE_AUTO</code>, use <code>con_ic_connection_get_proxy_autoconfig_url()</code> to get a proxy auto configuration URL.
+
* If proxy mode is CON_IC_PROXY_MODE_AUTO, use <code>con_ic_connection_get_proxy_autoconfig_url()</code> to get a proxy auto configuration URL.
** Use of auto configuration URL is explained in [[:wikipedia:Proxy_auto-config|Wikipedia]]
** Use of auto configuration URL is explained in [[:wikipedia:Proxy_auto-config|Wikipedia]]
Line 507: Line 604:
This section explains how Maemo Bluetooth libraries work internally. The following subsections explain the behavior and the decomposition of the Bluetooth library components in detail.
This section explains how Maemo Bluetooth libraries work internally. The following subsections explain the behavior and the decomposition of the Bluetooth library components in detail.
-
 
-
=== Discovering devices ===
 
-
 
-
Maemo provides a D-Bus interface for displaying a Bluetooth device search dialog (You can find a list of available Bluetooth D-Bus calls [[#D-Bus Connectivity UI Interface|below]]).
 
-
 
-
Devices can be searched with following steps:
 
-
# Set up a D-Bus connection
 
-
# call <code>bt_ui.search_req</code> to show the dialog - you can filter the results
 
-
# catch <code>bt_ui.search_result</code> signal
 
-
# process the results
 
-
 
-
Here is a working example in C:
 
-
 
-
<source lang="c">
 
-
// Bluetooth discovery example - bluetooth libraries will not work in the SDK!
 
-
#include <hildon/hildon-program.h>
 
-
#include <dbus/dbus.h>
 
-
#include <dbus/dbus-glib.h>
 
-
#include <contbtdialogs-dbus.h>
 
-
 
-
/* structure to hold some info */
 
-
typedef struct _AppData AppData;
 
-
struct _AppData {
 
-
    HildonProgram *program;
 
-
    HildonStackableWindow *window;
 
-
    DBusGConnection *dbus_conn;
 
-
};
 
-
 
-
static DBusGConnection *dbus_conn = NULL;
 
-
static AppData *app = NULL;
 
-
 
-
gboolean initialize()
 
-
{
 
-
    GError *error = NULL;
 
-
 
-
    //connects to system bus - this is where bt_ui resides
 
-
    dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
 
-
    if (dbus_conn == NULL)
 
-
    {
 
-
        g_print("Initialization failed: %s\n", error->message);
 
-
        g_clear_error(&error);
 
-
        return FALSE;
 
-
    }
 
-
 
-
    return TRUE;
 
-
}
 
-
 
-
DBusHandlerResult search_done(DBusConnection *con, DBusMessage *msg, void *data)
 
-
{
 
-
    gchar *device_address;
 
-
    gchar *device_name;
 
-
    gchar *device_name_logical;
 
-
    gchar *device_class_minor;
 
-
    gchar *device_class_major;
 
-
    gboolean device_trusted = FALSE;
 
-
    gchar **device_services;
 
-
    gint device_services_len;
 
-
    DBusError *err = NULL;
 
-
 
-
    if (dbus_message_is_signal(msg, CONBTDIALOGS_DBUS_INTERFACE, CONBTDIALOGS_SEARCH_SIG))
 
-
    {
 
-
        /* this is our message, so get response args */
 
-
        if (dbus_message_get_args(msg, err, DBUS_TYPE_STRING, &device_address,
 
-
                          DBUS_TYPE_STRING, &device_name,
 
-
                          DBUS_TYPE_STRING, &device_name_logical,
 
-
                          DBUS_TYPE_STRING, &device_class_major,
 
-
                          DBUS_TYPE_STRING, &device_class_minor,
 
-
                          DBUS_TYPE_BOOLEAN, &device_trusted,
 
-
                          DBUS_TYPE_ARRAY, &device_services,
 
-
                          DBUS_TYPE_INT32, &device_services_len,
 
-
                          DBUS_TYPE_INVALID))
 
-
        {
 
-
            g_print(_("Error getting device info: %s\n"), err->message);
 
-
            dbus_error_free(err);
 
-
 
-
            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-
        }
 
-
 
-
        g_print("OK");
 
-
        /* you can now use args */
 
-
        return DBUS_HANDLER_RESULT_HANDLED;
 
-
    }
 
-
 
-
    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-
}
 
-
 
-
gboolean searchBtDevices(AppData *app)
 
-
{
 
-
    GError *error = NULL;
 
-
    DBusGProxy *proxy;
 
-
    DBusConnection *second_conn;
 
-
    gchar *filter_string = NULL;
 
-
    gchar **filter = NULL;
 
-
 
-
    filter = g_new0(gchar*, 1);
 
-
    filter[0] = NULL;
 
-
 
-
    /* Create proxy to bluetooth UI service */
 
-
    proxy = dbus_g_proxy_new_for_name( app->dbus_conn,
 
-
                                  CONBTDIALOGS_DBUS_SERVICE,
 
-
                                  CONBTDIALOGS_DBUS_PATH,
 
-
                                  CONBTDIALOGS_DBUS_INTERFACE );
 
-
 
-
    hildon_banner_show_information( GTK_WIDGET(app->window), NULL, _("Searching BT devices..."));
 
-
 
-
    /* run the call to show dialog */
 
-
    if (!dbus_g_proxy_call( proxy,
 
-
                            CONBTDIALOGS_SEARCH_REQ,
 
-
                            &error,
 
-
                            G_TYPE_STRING, "",
 
-
                            G_TYPE_STRING, "",
 
-
                            G_TYPE_STRV, &filter,
 
-
                            G_TYPE_STRING, "require",
 
-
                            G_TYPE_INVALID, G_TYPE_INVALID ))
 
-
    {
 
-
        g_print(_("Bluetooth discovery failed: %s\n", error->message);
 
-
        g_clear_error(&error);
 
-
        g_strfreev(filter);
 
-
        g_object_unref( G_OBJECT(proxy) );
 
-
 
-
        return FALSE;
 
-
    }
 
-
 
-
    g_object_unref( G_OBJECT(proxy) );
 
-
    g_strfreev(filter);
 
-
 
-
    /* create second connection to catch our signal */
 
-
    second_conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
 
-
    /* set search_done as message handler */
 
-
    g_assert(dbus_connection_add_filter(second_conn, search_done, NULL, NULL));
 
-
    /* we are looking for signal, so accept only signals */
 
-
    filter_string = g_strdup_printf("type='signal'");
 
-
    dbus_bus_add_match(second_conn, filter_string, NULL);
 
-
    dbus_connection_unref(second_conn);
 
-
 
-
    return TRUE;
 
-
}
 
-
 
-
void search_btn_pressed(HildonButton *btn, gpointer data)
 
-
{
 
-
    /* data = our AppData struct */
 
-
    if (!searchBtDevices(data))
 
-
        return FALSE;
 
-
    else
 
-
        return TRUE;
 
-
}
 
-
 
-
HildonStackableWindow *createMainWindow(AppData *app)
 
-
{
 
-
    /** Creates window with button that searches bt devices when clicked **/
 
-
 
-
    HildonStackableWindow *window = HILDON_STACKABLE_WINDOW(hildon_stackable_window_new());
 
-
    GtkWidget *search_btn;
 
-
   
 
-
    search_btn = hildon_button_new( HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
 
-
HILDON_BUTTON_ARRANGEMENT_VERTICAL );
 
-
    hildon_button_set_text (HILDON_BUTTON (search_btn), "Bluetooth example", "BT example");
 
-
 
-
    /* Add signals */
 
-
    g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK(gtk_main_quit), NULL;
 
-
    g_signal_connect( G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
-
    g_signal_connect( G_OBJECT(search_btn), "clicked", G_CALLBACK(search_btn_pressed), app);
 
-
 
-
    gtk_widget_show_all( GTK_WIDGET(search_btn) );
 
-
 
-
    return window;   
 
-
}
 
-
 
-
int main(int argc, char* argv[])
 
-
{
 
-
    /* Create empty appdata */
 
-
    app = g_new0(AppData, 1);
 
-
 
-
    /* Init localization support */
 
-
    locale_init();
 
-
 
-
    /* Init gtk */
 
-
    gtk_init(&argc, &argv);
 
-
 
-
    if (!initialize())
 
-
        return -1;
 
-
 
-
    /* Create program object */
 
-
    app->program = HILDON_PROGRAM(hildon_program_get_instance());
 
-
    g_set_application_name("Bluetooth discovery example");
 
-
 
-
    app->window = createMainWindow();
 
-
    if (!window)
 
-
        return -1;
 
-
   
 
-
    app->dbus_conn = dbus_conn;
 
-
 
-
    gtk_widget_show_all( GTK_WIDGET(window) );
 
-
    gtk_main();
 
-
 
-
    /* just in case */
 
-
    if (dbus_conn != NULL)
 
-
        dbus_g_connection_unref(dbus_conn);
 
-
 
-
    return 0;
 
-
}
 
-
 
-
</source>
 
=== Libgwobex ===
=== Libgwobex ===
Line 792: Line 686:
</source>
</source>
-
This reads an entry from the directory <code>dir (char *)</code> and returns it in <code>buf (char **)</code>.
+
This reads an entry from the directory dir (char *) and returns it in buf (char **).
To change the current directory, use the following function: gw-obex.h
To change the current directory, use the following function: gw-obex.h
Line 813: Line 707:
</source>
</source>
-
To retrieve files over the OBEX connection, use the <code>gw_obex_get_file</code> function: gw-obex.h
+
To retrieve files over the OBEX connection, use the gw_obex_get_file function: gw-obex.h
<source lang="c">
<source lang="c">
Line 853: Line 747:
===UI Components ===
===UI Components ===
-
 
Connectivity UI contains various dialogs and other components used to control the connectivity. The different UI parts are:
Connectivity UI contains various dialogs and other components used to control the connectivity. The different UI parts are:
Line 862: Line 755:
* Bluetooth UIs
* Bluetooth UIs
-
The connectivity dialogs are invoked by D-Bus method calls, so for example the ICd is using these D-Bus method calls for showing dialogs when they are needed. The next section specifies the D-Bus API of Maemo connectivity UI.
+
The connectivity dialogs are invoked by D-Bus method calls, so for example the ICd is using these D-Bus method calls for showing dialogs when they are needed. The next section specifies the D-Bus API of maemo connectivity UI.
-
=== D-Bus Connectivity UI Interface ===
 
 +
===D-Bus Connectivity UI Interface ===
If the user must provide information about the IAP that the system is about to connect to, you can use the following method:
If the user must provide information about the IAP that the system is about to connect to, you can use the following method:
-
;Service
+
<div class="graybox">
-
: <code>com.nokia.icd_ui</code>
+
-
;Interfaces
+
-
: <code>com.nokia.icd_ui</code>
+
-
;Object paths
+
-
: <code>/com/nokia/icd_ui</code>
+
-
The Internet Connectivity UIs implement the following D-Bus API used by the ICd and EAP.
+
 +
Service:          com.nokia.icd_ui
 +
Interfaces:        com.nokia.icd_ui
 +
Object paths:      /com/nokia/icd_ui
-
==== D-Bus methods ====
+
</div>
-
===== show_conn_dlg =====
 
-
;Parameters
+
The Internet Connectivity UIs implement the following D-Bus API used by the ICd and EAP.
-
: <ol><li>boolean: When <code>TRUE</code> the dialog is requested because there were no saved connections (i.e. autoconnect was tried before invoking the dialog)</li></ol>
+
-
;Return parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows the Connect Dialog where the user can choose an IAP.
+
-
===== show_disconnect_dlg =====
 
-
;Parameters
+
<div class="graybox">
-
: none
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows the disconnect dialog.
+
-
===== show_retry_dlg =====
+
 +
Method:            show_conn_dlg
 +
Parameters:        1. boolean When TRUE the dialog is requested because
 +
                              there were no saved connections (i.e. auto 
 +
                              connect was tried before invoking the dialog)
 +
Return parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
Description:      Shows the Connect Dialog where the user can choose an IAP.
-
;Parameters
+
</div>
-
: <ol><li>string  Bluetooth address of the device used with SAP</li><li>string  Name of the connection attempt error which selects the retry dialog type.</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows the retry dialog.
+
-
===== show_change_dlg =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>string  Name of the currently active IAP</li><li>string  Name of the IAP to be activated</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows the Change IAP Dialog
+
-
===== show_passwd_dlg =====
+
 +
Method:            show_disconnect_dlg
 +
Parameters:        none
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows the disconnect dialog.
-
;Parameters
+
</div>
-
: <ol><li>string  Username supplied by ICd</li><li>string  Password supplied by ICd</li><li>string  Name of the IAP</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
; Description
+
-
: Shows the username/password dialog.
+
-
===== show_gtc_dlg =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>string  GTC challenge string</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows EAP GTC challenge dialog.
+
-
===== show_mschap_change_dlg =====
+
 +
Method:            show_retry_dlg
 +
Parameters:        1. string  Bluetooth address of the device used with SAP
 +
                    2. string  Name of the connection attempt error which
 +
                                selects the retry dialog type.
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows the retry dialog.
-
;Parameters
+
</div>
-
: <ol><li>string  Supplied username</li><li>string  Old password that is to be changed</li><li>string  Name of the IAP</li>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows EAP MSCHAPv2 change password dialog.
+
-
===== show_private_key_passwd_dlg =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>byte array  Certificate ID</ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows EAP private key password dialog
+
-
===== show_server_cert_dlg =====
+
 +
Method:            show_change_dlg
 +
Parameters:        1. string  Name of the currently active IAP
 +
                    2. string  Name of the IAP to be activated
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows the Change IAP Dialog
-
;Parameters
+
</div>
-
: <ol><li>string  Certificate name</li><li>string  Certificate serial</li><li>boolean <code>TRUE</code> if certificate is expired, <code>FALSE</code> otherwise</li><li>boolean <code>TRUE</code> if root CA is unknown or self-signed certificate, <code>FALSE</code> otherwise</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows server certificate error and expiration dialogs. If both boolean arguments are false, the error dialog is shown. If either or both boolean arguments are TRUE, the expiration dialog is shown instead.
+
-
===== strong_bt_req =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>string  Bluetooth address of the device to pair with</li><li>boolean  <code>TRUE</code> if strong authentication enabled, <code>FALSE</code> if strong authentication is disabled</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Requests strong (16 digit) BT PIN dialog for a BT device
+
-
===== show_sim_pin_dlg =====
+
 +
Method:            show_passwd_dlg
 +
Parameters:        1. string  Username supplied by ICd
 +
                    2. string  Password supplied by ICd
 +
                    3. string  Name of the IAP
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows the username/password dialog.
-
;Parameters
+
</div>
-
: <ol><li>string  Bluetooth address of the device used with SAP</li><li>boolean  <code>TRUE</code> if PIN was incorrect and retry dialog should be displayed before asking PIN. <code>FALSE</code> if this is the first PIN request.</li></ol>
+
-
;Return Parameters
+
-
: none
+
-
;Errors
+
-
: <code>com.nokia.icd_ui.error.flight_mode</code>: Flight mode enabled, dialog not shown
+
-
;Description
+
-
: Shows SIM PIN dialog
+
-
The code example for the application to show the connect dialog using <code>show_conn_dlg</code> is following. Note the use of the macro.
 
-
<source lang="c">
+
<div class="graybox">
-
#include <osso-ic-ui-dbus.h>
+
-
/* ... */
+
-
/* in our code somewhere, where we need the Connect Dialog*/
+
-
DBusMessage *uimsg;
+
-
/* construct the message for Connect Dialog request*/
+
-
uimsg =
+
-
  dbus_message_new_method_call(ICD_UI_DBUS_SERVICE,
+
-
                            ICD_UI_DBUS_PATH,
+
-
                          ICD_UI_DBUS_INTERFACE,
+
-
                        /*macro for show_conn_dlg */
+
-
                              ICD_UI_SHOW_CONNDLG_REQ);
+
-
/* send the message */
+
-
reply =
+
-
  dbus_connection_send_with_reply_and_block(connection,
+
-
                                    uimsg,
+
-
                                  reply_timeout,
+
-
                                  &error);
+
-
if (reply == NULL) {
+
-
    DLOG_ERR("Failed to show connect dialog: %s", uierror.message);
+
-
    dbus_error_free(&uierror);
+
-
}
+
-
dbus_message_unref(uimsg);
+
-
dbus_message_unref(reply);
+
-
/* ... */
+
-
</source>
+
-
==== D-Bus signals ====
+
 +
Method:            show_gtc_dlg
 +
Parameters:        1. string  GTC challenge string
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows EAP GTC challenge dialog.
-
The signals emitted from <code>com.nokia.icd_ui</code> interface are listed below.
+
</div>
-
===== disconnect =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>boolean  <code>TRUE</code> if "disconnect" pressed, <code>FALSE</code> if "cancel"</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when disconnect dialog has been closed.
+
 +
 +
Method:            show_mschap_change_dlg
 +
Parameters:        1. string  Supplied username
 +
                    2. string  Old password that is to be changed
 +
                    3. string  Name of the IAP
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows EAP MSCHAPv2 change password dialog.
-
===== retry =====
+
</div>
-
;Parameters
 
-
: <ol><li>string  The IAP that is to be retried</li><li>boolean  <code>TRUE</code> if "retry" pressed, <code>FALSE</code> if "cancel"</li></ol>
 
-
;Description
 
-
: Signal emitted from UI when the retry dialog has been closed.
 
-
===== change =====
+
<div class="graybox">
-
;Parameters
+
-
: <ol><li>string Old IAP to change from</li><li>string New IAP to change to</li><li>boolean Change to the new IAP If <code>TRUE</code>, keep old if <code>FALSE</code></li></ol>
+
Method:           show_private_key_passwd_dlg
-
;Description
+
  Parameters:        1. byte array Certificate ID
-
: Signal emitted from UI when change connection dialog has been closed.
+
   
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:       Shows EAP private key password dialog
-
===== passwd =====
+
</div>
-
;Parameters
 
-
: <ol><li>string  Username supplied or modified by the user</li><li>string  Password supplied or modified by the user</li><li>string  IAP name</li><li>boolean  <code>TRUE</code> if "ok" pressed, <code>FALSE</code> if "cancel"</li></ol>
 
-
;Description
 
-
: Signal emitted from UI when the username/password dialog has been closed
 
 +
<div class="graybox">
-
===== gtc_response =====
+
 +
Method:            show_server_cert_dlg
 +
Parameters:        1. string  Certificate name
 +
                    2. string  Certificate serial
 +
                    3. boolean  TRUE if certificate is expired, FALSE otherwise
 +
                    4. boolean  TRUE if root CA is unknown or self-signed
 +
                                certificate, FALSE otherwise
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows server certificate error and expiration dialogs.
 +
                    If both boolean arguments are false, the error dialog is
 +
                    shown. If either or both boolean arguments are TRUE, the
 +
                    expiration dialog is shown instead.
-
;Parameters
+
</div>
-
: <ol><li>string  Response to the given challenge or empty string if cancelled</li><li>boolean  <code>TRUE</code> if "ok" pressed, <code>FALSE</code> if "cancel"</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when the EAP GTC challenge dialog has been closed.
+
-
===== mschap_change =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>string  Supplied username</li><li>string  The new password or empty string if cancelled</li><li>string  IAP name</li><li>boolean  <code>TRUE</code> if "ok" pressed, <code>FALSE</code> if "cancel"</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when the MSCHAPv2 password has been changed
+
-
===== private_key_passwd =====
+
 +
Method:            strong_bt_req
 +
Parameters:        1. string  Bluetooth address of the device to pair with
 +
                    2. boolean  TRUE if strong authentication enabled, FALSE
 +
                                if strong authentication is disabled
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Requests strong (16 digit) BT PIN dialog for a BT device
-
;Parameters
+
</div>
-
: <ol><li>byte array  Certificate ID</li><li>string  Password for the private key or empty string if none</li><li>boolean  <code>TRUE</code> if "ok" pressed, <code>FALSE</code> if "cancel"</li>
+
-
;Description
+
-
: Signal emitted from UI when the private key password dialog has been closed
+
-
===== server_cert =====
 
-
;Parameters
+
<div class="graybox">
-
: <ol><li>boolean  <code>TRUE</code> if strong PIN entered, <code>FALSE</code> if strong PIN dialog was canceled</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when the server certificate error dialog has been closed
+
-
===== strong_bt =====
+
 +
Method:            show_sim_pin_dlg
 +
Parameters:        1. string  Bluetooth address of the device used with SAP
 +
                    2. boolean  TRUE if PIN was incorrect and retry dialog
 +
                                should be displayed before asking PIN. FALSE
 +
                                if this is the first PIN request.
 +
 +
Return Parameters: none
 +
Errors:            com.nokia.icd_ui.error.flight_mode:
 +
                    Flight mode enabled, dialog not shown
 +
 +
Description:      Shows SIM PIN dialog
-
;Parameters
+
</div>
-
: <ol><li>boolean  <code>TRUE</code> if strong PIN entered, <code>FALSE</code> if strong PIN dialog was cancelled</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when the strong (16 digit) BT PIN has been entered
+
-
===== sim_pin =====
 
-
;Parameters
+
The code example for the application to show the connect dialog using show_conn_dlg is following. Note the use of the macro.
-
: <ol><li>string  SIM PIN code or empty string if  cancelled</li><li>boolean  <code>TRUE</code> if "ok" pressed, <code>FALSE</code> if "cancel"</li></ol>
+
-
;Description
+
-
: Signal emitted from UI when the SIM PIN has been entered.
+
-
===Bluetooth D-Bus UI dialogs ===
+
<tt><span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;osso-ic-ui-dbus.h&gt;</font></span>
 +
<span>''<span><font color="#9A1900">/* ... */</font></span>''</span>
 +
<span>''<span><font color="#9A1900">/* in our code somewhere, where we need the Connect Dialog*/</font></span>''</span>
 +
DBusMessage <span><font color="#990000"><nowiki>*</nowiki></font></span>uimsg<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
<span>''<span><font color="#9A1900">/* construct the message for Connect Dialog request*/</font></span>''</span>
 +
uimsg <span><font color="#990000"><nowiki>=</nowiki></font></span>
 +
  <span>'''<span><font color="#000000">dbus_message_new_method_call</font></span>'''</span><span><font color="#990000">(</font></span>ICD_UI_DBUS_SERVICE<span><font color="#990000">,</font></span>
 +
                              ICD_UI_DBUS_PATH<span><font color="#990000">,</font></span>
 +
                            ICD_UI_DBUS_INTERFACE<span><font color="#990000">,</font></span>
 +
                          <span>''<span><font color="#9A1900">/*macro for show_conn_dlg */</font></span>''</span>
 +
                                ICD_UI_SHOW_CONNDLG_REQ<span><font color="#990000">);</font></span>
 +
<span>''<span><font color="#9A1900">/* send the message */</font></span>''</span>
 +
reply <span><font color="#990000"><nowiki>=</nowiki></font></span>
 +
  <span>'''<span><font color="#000000">dbus_connection_send_with_reply_and_block</font></span>'''</span><span><font color="#990000">(</font></span>connection<span><font color="#990000">,</font></span>
 +
                                    uimsg<span><font color="#990000">,</font></span>
 +
                                    reply_timeout<span><font color="#990000">,</font></span>
 +
                                    <span><font color="#990000">&amp;</font></span>error<span><font color="#990000">);</font></span>
 +
<span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>reply <span><font color="#990000"><nowiki>==</nowiki></font></span> NULL<span><font color="#990000">)</font></span> <span><font color="#FF0000">{</font></span>
 +
    <span>'''<span><font color="#000000">DLOG_ERR</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#FF0000">"Failed to show connect dialog: %s"</font></span><span><font color="#990000">,</font></span> uierror<span><font color="#990000">.</font></span>message<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#000000">dbus_error_free</font></span>'''</span><span><font color="#990000">(&amp;</font></span>uierror<span><font color="#990000">);</font></span>
 +
<span><font color="#FF0000">}</font></span>
 +
<span>'''<span><font color="#000000">dbus_message_unref</font></span>'''</span><span><font color="#990000">(</font></span>uimsg<span><font color="#990000">);</font></span>
 +
<span>'''<span><font color="#000000">dbus_message_unref</font></span>'''</span><span><font color="#990000">(</font></span>reply<span><font color="#990000">);</font></span>
 +
<span>''<span><font color="#9A1900">/* ... */</font></span>''</span></tt>
-
conbtdialogs-dbus.h
+
The signals emitted from com.nokia.icd_ui interface are listed below.
-
<source lang="c">
 
-
/**
 
-
  Example of use (command line):
 
-
 
 
-
  dbus-send --system --print-reply \
 
-
    --dest='com.nokia.icd_ui' /com/nokia/bt_ui \
 
-
    com.nokia.bt_ui.show_send_file_dlg \
 
-
    array:string:file:///home/user/MyDocs/.documents/testing.txt
 
-
   
 
-
  dbus-send --system --print-reply \
 
-
    --dest=com.nokia.bt_ui  /com/nokia/bt_ui
 
-
    com.nokia.bt_ui.show_search_dlg \
 
-
    string: string: array:string: string:
 
-
*/
 
-
#ifndef CONBTDIALOGS_DBUS_H
+
<div class="graybox">
-
#define CONBTDIALOGS_DBUS_H
+
-
#ifdef __cplusplus
+
-
extern "C" {
+
Signal:        disconnect
-
#endif
+
Parameters:    1. boolean  TRUE if "disconnect" pressed, FALSE if "cancel"
 +
 +
Description:  Signal emitted from UI when disconnect dialog has been closed.
-
/** Conbtdialogs service, resides in system dbus */
+
</div>
-
#define CONBTDIALOGS_DBUS_SERVICE                "com.nokia.bt_ui"
+
-
/** Conbtdialogs interface */
+
-
#define CONBTDIALOGS_DBUS_INTERFACE                "com.nokia.bt_ui"
+
-
/** Conbtdialogs path */
+
-
#define CONBTDIALOGS_DBUS_PATH                        "/com/nokia/bt_ui"
+
-
/**
 
-
  Show send file dialog
 
-
 
-
  Arguments:
 
-
 
 
-
  uris: DBUS_TYPE_ARRAY                Array of strings representing the URIs of the
 
-
                                files to send.
 
-
 
 
-
  Returns:
 
-
 
 
-
  DBUS_TYPE_BOOLEAN            TRUE, if dialog was shown successfully.
 
-
*/
 
-
#define CONBTDIALOGS_SEND_FILE_REQ                "show_send_file_dlg"
 
-
/**
+
<div class="graybox">
-
  File sending result signal
+
-
+
-
  Arguments:
+
-
 
+
-
  success: DBUS_TYPE_BOOLEAN        TRUE, if all files were sent successfully or
+
-
                                FALSE, if error occurred or sending was
+
-
                                canceled.
+
-
*/
+
-
#define CONBTDIALOGS_SEND_FILE_SIG                "send_file"
+
-
/**
 
-
  Show BT device search dialog
 
   
   
-
  Arguments:
+
Signal:       retry
-
 
+
Parameters:   1. string  The IAP that is to be retried
-
  major_class: DBUS_TYPE_STRING To set filtering based on major_class or
+
                2. boolean  TRUE if "retry" pressed, FALSE if "cancel"
-
                                "". Possible major class values are:
+
-
                               
+
Description:   Signal emitted from UI when the retry dialog has been closed.
-
                                "miscellaneous", "computer", "phone",
+
-
                                "access point", "audio/video",
+
-
                                "peripheral", "imaging", "wearable",
+
-
                                "toy" and "uncategorized".
+
-
    
+
-
  minor_class: DBUS_TYPE_STRING To set filtering based on minor_class or "".
+
-
                                Possible minor class values are:
+
-
                       
+
-
                                - Minor classes for "computer":
+
-
                                  "uncategorized", "desktop", "server",
+
-
                                  "laptop", "handheld", "palm", "wearable"
+
-
                                - Minor classes for "phone": "uncategorized",
+
</div>
-
                                  "cellular", "cordless", "smart phone",
+
 
-
                                  "modem", "isdn"
+
<br /><br />
-
 
+
 
-
  service_classes: DBUS_TYPE_ARRAY To set filtering based on service classes.
+
<div class="graybox">
-
                                  Supported classes include "positioning",
+
-
                                  "networking", "rendering", "capturing",
+
-
                                  "object transfer", "audio", "telephony",
+
-
                                  "information". Can be empty list, when no
+
-
                                  service class filtering is performed.
+
-
 
+
-
  bonding: DBUS_TYPE_STRING    Bonding mode for found and selected device:
+
-
                               
+
-
                                "require" for requiring a bonding from a
+
-
                                selected device (i.e. bond device if it has not
+
-
                                been bonded before).
+
-
                               
+
-
                                "force" to always bond (i.e. device will be
+
-
                                bonded even if bonded before).
+
-
                               
+
-
                                Any other string will allow to search and
+
-
                                select device without bonding it.
+
-
                               
+
-
  Returns:
+
-
 
+
-
  DBUS_TYPE_BOOLEAN            TRUE, if dialog was shown successfully.
+
-
*/
+
-
#define CONBTDIALOGS_SEARCH_REQ                "show_search_dlg"
+
-
/**
 
-
  Bluetooth search result signal
 
   
   
-
  Arguments:
+
Signal:       change
-
 
+
Parameters:   1. string  Old IAP to change from
-
  address: DBUS_TYPE_STRING    Bluetooth address of the selected device, or ""
+
                2. string  New IAP to change to
-
                                if search dialog was cancelled.
+
                3. boolean  Change to the new IAP If TRUE, keep old if FALSE
-
 
+
-
  name: DBUS_TYPE_STRING        Name of the device.
+
DescriptionSignal emitted from UI when change connection dialog has
-
 
+
                been closed.
-
  icon: DBUS_TYPE_STRING        Logical name for the icon describing the
+
-
                                device.
+
-
 
+
-
  major_class: DBUS_TYPE_STRING Major class of the device.
+
-
 
+
-
  minor_class: DBUS_TYPE_STRING Minor class of the device.
+
-
    
+
-
  trusted: DBUS_TYPE_BOOLEAN    Defines whether the device is marked as a trusted device.
+
-
 
+
-
  services: DBUS_TYPE_ARRAY    List of strings describing the service classes
+
-
                                and SDP-based services provided by the device.
+
-
*/
+
-
#define CONBTDIALOGS_SEARCH_SIG                "search_result"
+
-
</source>
+
-
<source lang="c">
+
</div>
-
/**
+
-
  Bluetooth UI Library for maemo
+
-
  Copyright (C) 2006 Nokia. All rights reserved.
 
-
 
 
-
  This sample demonstrates the use of conbtdialogs API and especially
 
-
  send_file function. Compile the program with conbtdialogs and dbus:
 
-
 
 
-
  gcc -Wall `pkg-config -libs -cflags dbus-glib-1 conbtdialogs` \
 
-
-o send_file conbtdialogs_send_file.c
 
-
 
 
-
  Run with list of URLS:
 
-
 
 
-
  ./send_file file:///home/user/MyDocs/.sounds/Everyday.mp3
 
-
*/
 
-
#define DBUS_API_SUBJECT_TO_CHANGE
+
<div class="graybox">
-
#include <glib.h>
+
-
#include <conbtdialogs-dbus.h>
+
Signal:        passwd
-
#include <dbus/dbus.h>
+
Parameters:    1. string  Username supplied or modified by the user
-
#include <dbus/dbus-glib.h>
+
                2. string  Password supplied or modified by the user
 +
                3. string  IAP name
 +
                4. boolean  TRUE if "ok" pressed, FALSE if "cancel"
 +
 +
Description:  Signal emitted from UI when the username/password dialog has
 +
                been closed
-
DBusGConnection *connection = NULL;
+
</div>
-
GMainLoop *mainloop = NULL;
+
-
static gboolean initialize(void)
 
-
{
 
-
    GError *error = NULL;
 
-
    g_type_init ();
+
<div class="graybox">
-
    /* Create main loop */
+
-
    mainloop = g_main_loop_new(NULL, TRUE);
+
Signal:        gtc_response
-
    if ( mainloop == NULL ) return FALSE;
+
Parameters:    1. string  Response to the given challenge or empty string
 +
                            if cancelled
 +
                2. boolean  TRUE if "ok" pressed, FALSE if "cancel"
 +
 +
Description:  Signal emitted from UI when the EAP GTC challenge dialog has
 +
                been closed.
-
    /* Create DBUS connection */
+
</div>
-
    connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+
-
    if (connection == NULL )
 
-
    {
 
-
        g_print ("Error: %s\n", error->message);
 
-
        g_clear_error (&error);
 
-
        return FALSE;
 
-
    }
 
-
    return TRUE;
+
<div class="graybox">
-
}
+
-
static gboolean uninitialize(void)
+
-
{
+
Signal:        mschap_change
-
    /* Quit main loop and unref it */
+
Parameters:    1. string  Supplied username
-
    if (mainloop != NULL)
+
                2. string  The new password or empty string if cancelled
-
    {
+
                3. string  IAP name
-
        g_main_loop_quit(mainloop);
+
                4. boolean  TRUE if "ok" pressed, FALSE if "cancel"
-
        g_main_loop_unref(mainloop);
+
-
    }
+
Description:  Signal emitted from UI when the MSCHAPv2 password has been
 +
                changed
-
    return TRUE;
+
</div>
-
}
+
-
static DBusHandlerResult file_sent_signal ( DBusConnection *connection,
 
-
                                            DBusMessage *message,
 
-
                                            void *data )
 
-
{
 
-
    gboolean success = FALSE;
 
-
    /* check signal */
+
<div class="graybox">
-
    if (!dbus_message_is_signal(message,
+
-
                                CONBTDIALOGS_DBUS_INTERFACE,
+
-
                                CONBTDIALOGS_SEND_FILE_SIG))
+
-
        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
-
    /* get args */
+
-
    if ( !dbus_message_get_args ( message, NULL,
+
Signal:        private_key_passwd
-
                                  DBUS_TYPE_BOOLEAN, &success,
+
Parameters:    1. byte array  Certificate ID
-
                                  DBUS_TYPE_INVALID ) )
+
                2. string  Password for the private key or empty string if none
-
      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
                3. boolean  TRUE if "ok" pressed, FALSE if "cancel"
 +
 +
Description:  Signal emitted from UI when the private key password dialog
 +
                has been closed
-
    /* print if file sending was success or failure */
+
</div>
-
    g_print ( "File sending was a " );
+
-
    if (success) g_print("success\n"); else g_print("failure\n");
 
-
    dbus_connection_close(connection);
 
-
    uninitialize();
 
-
    return DBUS_HANDLER_RESULT_HANDLED;
+
<div class="graybox">
-
}
+
-
gint main(gint argc, gchar **argv)
+
-
{
+
Signal:        server_cert
-
    GError *error = NULL;
+
Parameters:    1. boolean  TRUE if strong PIN entered, FALSE if strong
-
    gchar **files = NULL;
+
                            PIN dialog was canceled
-
    gint idx = 0;
+
-
    DBusGProxy *proxy;
+
Description:  Signal emitted from UI when the server certificate error
-
    DBusConnection *sys_conn;
+
                dialog has been closed
-
    gchar *filter_string = NULL;
+
-
    if (argc < 2) return 1;
+
</div>
-
    if (initialize() == FALSE) {
+
<br /><br />
-
        uninitialize();
+
-
        return 1;
+
-
    }
+
-
    /* Copy urls to GLib compatible char array */
+
<div class="graybox">
-
    files = g_new0(gchar*, argc);
+
-
    for (idx = 1; idx < argc; idx++)
+
-
        files[idx-1] = g_strdup(argv[idx]);
+
Signal:        strong_bt
 +
Parameters:    1. boolean  TRUE if strong PIN entered, FALSE if strong
 +
                            PIN dialog was cancelled
 +
 +
Description:  Signal emitted from UI when the strong (16 digit) BT PIN
 +
                has been entered
-
    files[argc-1] = NULL;
+
</div>
-
    /* Open connection for btdialogs service */
 
-
    proxy = dbus_g_proxy_new_for_name(connection,
 
-
                                      CONBTDIALOGS_DBUS_SERVICE,
 
-
                                      CONBTDIALOGS_DBUS_PATH,
 
-
                                      CONBTDIALOGS_DBUS_INTERFACE);
 
-
    /* Send send file request to btdialogs service */
+
<div class="graybox">
-
    if (!dbus_g_proxy_call(proxy, CONBTDIALOGS_SEND_FILE_REQ,
+
-
                          &error,
+
-
                          G_TYPE_STRV, files, G_TYPE_INVALID,
+
-
                          G_TYPE_INVALID))
+
-
    {
+
-
        g_print("Error: %s\n", error->message);
+
-
        g_clear_error(&error);
+
-
        g_strfreev (files);
+
-
        g_object_unref(G_OBJECT(proxy));
+
-
        uninitialize();
+
-
        return 1;
+
-
    }
+
-
    g_strfreev (files);
+
-
    files = NULL;
+
-
    g_object_unref(G_OBJECT(proxy));
+
 +
Signal:        sim_pin
 +
Parameters:    1. string  SIM PIN code or empty string if  cancelled
 +
                2. boolean  TRUE if "ok" pressed, FALSE if "cancel"
 +
 +
Description:  Signal emitted from UI when the SIM PIN has been entered.
-
    /* Now wait for file sent signal, use low level bindings as glib
+
</div>
-
      bindings require signal marshaller registered */
+
-
    sys_conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+
-
    g_assert(dbus_connection_add_filter(sys_conn,
+
-
                                        file_sent_signal,
+
-
                                        NULL,
+
-
                                        NULL ));
+
-
    filter_string =
+
-
      g_strdup_printf ("type='signal',interface='%s'", CONBTDIALOGS_DBUS_INTERFACE);
+
-
    dbus_bus_add_match(sys_conn, filter_string, NULL);
+
===Bluetooth DBUS UI dialogs ===
-
    dbus_connection_unref(sys_conn);
+
-
    /* Run mainloop */
+
conbtdialogs-dbus.h
-
    g_main_loop_run(mainloop);
+
-
     return 0;
+
<tt><span>''<span><font color="#9A1900">/** </font></span>''</span>
-
}
+
<span>''<span><font color="#9A1900">  Example of use (command line):</font></span>''</span>
-
</source>
+
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  dbus-send --system --print-reply \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">    --dest='com.nokia.icd_ui' /com/nokia/bt_ui \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">    com.nokia.bt_ui.show_send_file_dlg \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">    array:string:</font></span>''</span><span><u><span><font color="#0000FF">file:///home/user/MyDocs/.documents/testing.txt</font></span></u></span>
 +
<span>''<span><font color="#9A1900">    </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  dbus-send --system --print-reply \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">    --dest=com.nokia.bt_ui  /com/nokia/bt_ui </font></span>''</span>
 +
<span>''<span><font color="#9A1900">    com.nokia.bt_ui.show_search_dlg \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">    string: string: array:string: string:</font></span>''</span>
 +
<span>''<span><font color="#9A1900"><nowiki>*/</nowiki></font></span>''</span>
 +
 +
<span>'''<span><font color="#000080"><nowiki>#ifndef</nowiki></font></span>'''</span> CONBTDIALOGS_DBUS_H
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_DBUS_H
 +
 +
<span>'''<span><font color="#000080"><nowiki>#ifdef</nowiki></font></span>'''</span> __cplusplus
 +
<span>'''<span><font color="#0000FF">extern</font></span>'''</span> <span><font color="#FF0000">"C"</font></span> <span><font color="#FF0000">{</font></span>
 +
<span>'''<span><font color="#000080"><nowiki>#endif</nowiki></font></span>'''</span>
 +
 +
<span>''<span><font color="#9A1900">/** Conbtdialogs service, resides in system dbus */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_DBUS_SERVICE                <span><font color="#FF0000">"com.nokia.bt_ui"</font></span>
 +
<span>''<span><font color="#9A1900">/** Conbtdialogs interface */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_DBUS_INTERFACE                <span><font color="#FF0000">"com.nokia.bt_ui"</font></span>
 +
<span>''<span><font color="#9A1900">/** Conbtdialogs path */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_DBUS_PATH                        <span><font color="#FF0000">"/com/nokia/bt_ui"</font></span>
 +
 +
<span>''<span><font color="#9A1900">/** </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Show send file dialog</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Arguments:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  uris: DBUS_TYPE_ARRAY                Array of strings representing the URIs of the</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                files to send.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Returns:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  DBUS_TYPE_BOOLEAN            TRUE, if dialog was shown successfully.</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_SEND_FILE_REQ                <span><font color="#FF0000">"show_send_file_dlg"</font></span>
 +
 +
<span>''<span><font color="#9A1900">/** </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  File sending result signal</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Arguments:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  success: DBUS_TYPE_BOOLEAN        TRUE, if all files were sent successfully or</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                FALSE, if error occurred or sending was </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                canceled.</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_SEND_FILE_SIG                <span><font color="#FF0000">"send_file"</font></span>
 +
 +
<span>''<span><font color="#9A1900">/** </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Show BT device search dialog</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Arguments:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  major_class: DBUS_TYPE_STRING To set filtering based on major_class or</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "". Possible major class values are:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "miscellaneous", "computer", "phone", </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "access point", "audio/video", </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "peripheral", "imaging", "wearable",</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "toy" and "uncategorized".</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  minor_class: DBUS_TYPE_STRING To set filtering based on minor_class or "".</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                Possible minor class values are:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                        </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                - Minor classes for "computer": </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "uncategorized", "desktop", "server",</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "laptop", "handheld", "palm", "wearable"</font></span>''</span>
 +
 +
<span>''<span><font color="#9A1900">                                - Minor classes for "phone": "uncategorized",</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "cellular", "cordless", "smart phone",</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "modem", "isdn"</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  service_classes: DBUS_TYPE_ARRAY To set filtering based on service classes.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  Supported classes include "positioning", </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "networking", "rendering", "capturing",</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "object transfer", "audio", "telephony", </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  "information". Can be empty list, when no</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                  service class filtering is performed.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  bonding: DBUS_TYPE_STRING     Bonding mode for found and selected device:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "require" for requiring a bonding from a</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                selected device (i.e. bond device if it has not</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                been bonded before). </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                "force" to always bond (i.e. device will be</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                bonded even if bonded before).</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                Any other string will allow to search and</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                select device without bonding it.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Returns:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  DBUS_TYPE_BOOLEAN            TRUE, if dialog was shown successfully.</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_SEARCH_REQ                <span><font color="#FF0000">"show_search_dlg"</font></span>
 +
 +
<span>''<span><font color="#9A1900">/** </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Bluetooth search result signal</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Arguments:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  address: DBUS_TYPE_STRING    Bluetooth address of the selected device, or ""</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                if search dialog was cancelled.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  name: DBUS_TYPE_STRING        Name of the device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  icon: DBUS_TYPE_STRING        Logical name for the icon describing the </font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  major_class: DBUS_TYPE_STRING Major class of the device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  minor_class: DBUS_TYPE_STRING Minor class of the device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  trusted: DBUS_TYPE_BOOLEAN    Defines whether the device is marked as a trusted device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  services: DBUS_TYPE_ARRAY    List of strings describing the service classes</font></span>''</span>
 +
<span>''<span><font color="#9A1900">                                and SDP-based services provided by the device.</font></span>''</span>
 +
<span>''<span><font color="#9A1900"> */</font></span>''</span>
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> CONBTDIALOGS_SEARCH_SIG                <span><font color="#FF0000">"search_result"</font></span>
 +
</tt>
 +
 
 +
<br>
 +
 
 +
<tt><span>''<span><font color="#9A1900">/**</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Bluetooth UI Library for maemo</font></span>''</span>
 +
 +
<span>''<span><font color="#9A1900">  Copyright (C) 2006 Nokia. All rights reserved.</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  This sample demonstrates the use of conbtdialogs API and especially </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  send_file function. Compile the program with conbtdialogs and dbus:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  gcc -Wall `pkg-config -libs -cflags dbus-glib-1 conbtdialogs` \</font></span>''</span>
 +
<span>''<span><font color="#9A1900">-o send_file conbtdialogs_send_file.c</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  Run with list of URLS:</font></span>''</span>
 +
<span>''<span><font color="#9A1900">  </font></span>''</span>
 +
<span>''<span><font color="#9A1900">  ./send_file </font></span>''</span><span><u><span><font color="#0000FF">file:///home/user/MyDocs/.sounds/Everyday.mp3</font></span></u></span>
 +
<span>''<span><font color="#9A1900"><nowiki>*/</nowiki></font></span>''</span>
 +
 +
<span>'''<span><font color="#000080"><nowiki>#define</nowiki></font></span>'''</span> DBUS_API_SUBJECT_TO_CHANGE
 +
 +
<span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;glib.h&gt;</font></span>
 +
<span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;conbtdialogs-dbus.h&gt;</font></span>
 +
<span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;dbus/dbus.h&gt;</font></span>
 +
<span>'''<span><font color="#000080"><nowiki>#include</nowiki></font></span>'''</span> <span><font color="#FF0000">&lt;dbus/dbus-glib.h&gt;</font></span>
 +
 +
DBusGConnection <span><font color="#990000"><nowiki>*</nowiki></font></span>connection <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
GMainLoop <span><font color="#990000"><nowiki>*</nowiki></font></span>mainloop <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> gboolean <span>'''<span><font color="#000000">initialize</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
    GError <span><font color="#990000"><nowiki>*</nowiki></font></span>error <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>'''<span><font color="#000000">g_type_init</font></span>'''</span> <span><font color="#990000">();</font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Create main loop */</font></span>''</span>
 +
    mainloop <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">g_main_loop_new</font></span>'''</span><span><font color="#990000">(</font></span>NULL<span><font color="#990000">,</font></span> TRUE<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span> mainloop <span><font color="#990000"><nowiki>==</nowiki></font></span> NULL <span><font color="#990000">)</font></span> <span>'''<span><font color="#0000FF">return</font></span>'''</span> FALSE<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Create DBUS connection */</font></span>''</span>
 +
    connection <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">dbus_g_bus_get</font></span>'''</span><span><font color="#990000">(</font></span>DBUS_BUS_SYSTEM<span><font color="#990000">,</font></span> <span><font color="#990000">&amp;</font></span>error<span><font color="#990000">);</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>connection <span><font color="#990000"><nowiki>==</nowiki></font></span> NULL <span><font color="#990000">)</font></span>
 +
    <span><font color="#FF0000">{</font></span>
 +
        <span>'''<span><font color="#000000">g_print</font></span>'''</span> <span><font color="#990000">(</font></span><span><font color="#FF0000">"Error: %s</font></span><span><font color="#CC33CC">\n</font></span><span><font color="#FF0000">"</font></span><span><font color="#990000">,</font></span> error<span><font color="#990000">-&gt;</font></span>message<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#000000">g_clear_error</font></span>'''</span> <span><font color="#990000">(&amp;</font></span>error<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#0000FF">return</font></span>'''</span> FALSE<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">return</font></span>'''</span> TRUE<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
<span><font color="#FF0000">}</font></span>
 +
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> gboolean <span>'''<span><font color="#000000">uninitialize</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#009900">void</font></span><span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
    <span>''<span><font color="#9A1900">/* Quit main loop and unref it */</font></span>''</span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>mainloop <span><font color="#990000"><nowiki>!=</nowiki></font></span> NULL<span><font color="#990000">)</font></span>
 +
    <span><font color="#FF0000">{</font></span>
 +
        <span>'''<span><font color="#000000">g_main_loop_quit</font></span>'''</span><span><font color="#990000">(</font></span>mainloop<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#000000">g_main_loop_unref</font></span>'''</span><span><font color="#990000">(</font></span>mainloop<span><font color="#990000">);</font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">return</font></span>'''</span> TRUE<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
<span><font color="#FF0000">}</font></span>
 +
 +
<span>'''<span><font color="#0000FF">static</font></span>'''</span> DBusHandlerResult <span>'''<span><font color="#000000">file_sent_signal</font></span>'''</span> <span><font color="#990000">(</font></span> DBusConnection <span><font color="#990000"><nowiki>*</nowiki></font></span>connection<span><font color="#990000">,</font></span>
 +
                                            DBusMessage <span><font color="#990000"><nowiki>*</nowiki></font></span>message<span><font color="#990000">,</font></span>
 +
                                            <span><font color="#009900">void</font></span> <span><font color="#990000"><nowiki>*</nowiki></font></span>data <span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
    gboolean success <span><font color="#990000"><nowiki>=</nowiki></font></span> FALSE<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* check signal */</font></span>''</span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(!</font></span><span>'''<span><font color="#000000">dbus_message_is_signal</font></span>'''</span><span><font color="#990000">(</font></span>message<span><font color="#990000">,</font></span>
 +
                                CONBTDIALOGS_DBUS_INTERFACE<span><font color="#990000">,</font></span>
 +
                                CONBTDIALOGS_SEND_FILE_SIG<span><font color="#990000">))</font></span>
 +
        <span>'''<span><font color="#0000FF">return</font></span>'''</span> DBUS_HANDLER_RESULT_NOT_YET_HANDLED<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* get args */</font></span>''</span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span> <span><font color="#990000"><nowiki>!</nowiki></font></span><span>'''<span><font color="#000000">dbus_message_get_args</font></span>'''</span> <span><font color="#990000">(</font></span> message<span><font color="#990000">,</font></span> NULL<span><font color="#990000">,</font></span>
 +
                                  DBUS_TYPE_BOOLEAN<span><font color="#990000">,</font></span> <span><font color="#990000">&amp;</font></span>success<span><font color="#990000">,</font></span>
 +
                                  DBUS_TYPE_INVALID <span><font color="#990000">)</font></span> <span><font color="#990000">)</font></span>
 +
      <span>'''<span><font color="#0000FF">return</font></span>'''</span> DBUS_HANDLER_RESULT_NOT_YET_HANDLED<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* print if file sending was success or failure */</font></span>''</span>
 +
    <span>'''<span><font color="#000000">g_print</font></span>'''</span> <span><font color="#990000">(</font></span> <span><font color="#FF0000">"File sending was a "</font></span> <span><font color="#990000">);</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>success<span><font color="#990000">)</font></span> <span>'''<span><font color="#000000">g_print</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#FF0000">"success</font></span><span><font color="#CC33CC">\n</font></span><span><font color="#FF0000">"</font></span><span><font color="#990000">);</font></span> <span>'''<span><font color="#0000FF">else</font></span>'''</span> <span>'''<span><font color="#000000">g_print</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#FF0000">"failure</font></span><span><font color="#CC33CC">\n</font></span><span><font color="#FF0000">"</font></span><span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#000000">dbus_connection_close</font></span>'''</span><span><font color="#990000">(</font></span>connection<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#000000">uninitialize</font></span>'''</span><span><font color="#990000">();</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">return</font></span>'''</span> DBUS_HANDLER_RESULT_HANDLED<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
<span><font color="#FF0000">}</font></span>
 +
 +
gint <span>'''<span><font color="#000000">main</font></span>'''</span><span><font color="#990000">(</font></span>gint argc<span><font color="#990000">,</font></span> gchar <span><font color="#990000"><nowiki>**</nowiki></font></span>argv<span><font color="#990000">)</font></span>
 +
<span><font color="#FF0000">{</font></span>
 +
    GError <span><font color="#990000"><nowiki>*</nowiki></font></span>error <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    gchar <span><font color="#990000"><nowiki>**</nowiki></font></span>files <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    gint idx <span><font color="#990000"><nowiki>=</nowiki></font></span> <span><font color="#993399">0</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    DBusGProxy <span><font color="#990000"><nowiki>*</nowiki></font></span>proxy<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    DBusConnection <span><font color="#990000"><nowiki>*</nowiki></font></span>sys_conn<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    gchar <span><font color="#990000"><nowiki>*</nowiki></font></span>filter_string <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span>argc <span><font color="#990000">&lt;</font></span> <span><font color="#993399">2</font></span><span><font color="#990000">)</font></span> <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span><font color="#993399">1</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(</font></span><span>'''<span><font color="#000000">initialize</font></span>'''</span><span><font color="#990000">()</font></span> <span><font color="#990000"><nowiki>==</nowiki></font></span> FALSE<span><font color="#990000">)</font></span> <span><font color="#FF0000">{</font></span>
 +
        <span>'''<span><font color="#000000">uninitialize</font></span>'''</span><span><font color="#990000">();</font></span>
 +
        <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span><font color="#993399">1</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Copy urls to GLib compatible char array */</font></span>''</span>
 +
    files <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">g_new0</font></span>'''</span><span><font color="#990000">(</font></span>gchar<span><font color="#990000"><nowiki>*,</nowiki></font></span> argc<span><font color="#990000">);</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">for</font></span>'''</span> <span><font color="#990000">(</font></span>idx <span><font color="#990000"><nowiki>=</nowiki></font></span> <span><font color="#993399">1</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span> idx <span><font color="#990000">&lt;</font></span> argc<span><font color="#990000"><nowiki>;</nowiki></font></span> idx<span><font color="#990000">++)</font></span>
 +
        files<span><font color="#990000">[</font></span>idx<span><font color="#990000">-</font></span><span><font color="#993399">1</font></span><span><font color="#990000">]</font></span> <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">g_strdup</font></span>'''</span><span><font color="#990000">(</font></span>argv<span><font color="#990000">[</font></span>idx<span><font color="#990000">]);</font></span>
 +
 +
    files<span><font color="#990000">[</font></span>argc<span><font color="#990000">-</font></span><span><font color="#993399">1</font></span><span><font color="#990000">]</font></span> <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Open connection for btdialogs service */</font></span>''</span>
 +
    proxy <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">dbus_g_proxy_new_for_name</font></span>'''</span><span><font color="#990000">(</font></span>connection<span><font color="#990000">,</font></span>
 +
                                      CONBTDIALOGS_DBUS_SERVICE<span><font color="#990000">,</font></span>
 +
                                      CONBTDIALOGS_DBUS_PATH<span><font color="#990000">,</font></span>
 +
                                      CONBTDIALOGS_DBUS_INTERFACE<span><font color="#990000">);</font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Send send file request to btdialogs service */</font></span>''</span>
 +
    <span>'''<span><font color="#0000FF">if</font></span>'''</span> <span><font color="#990000">(!</font></span><span>'''<span><font color="#000000">dbus_g_proxy_call</font></span>'''</span><span><font color="#990000">(</font></span>proxy<span><font color="#990000">,</font></span> CONBTDIALOGS_SEND_FILE_REQ<span><font color="#990000">,</font></span>
 +
                            <span><font color="#990000">&amp;</font></span>error<span><font color="#990000">,</font></span>
 +
                            G_TYPE_STRV<span><font color="#990000">,</font></span> files<span><font color="#990000">,</font></span> G_TYPE_INVALID<span><font color="#990000">,</font></span>
 +
                            G_TYPE_INVALID<span><font color="#990000">))</font></span>
 +
    <span><font color="#FF0000">{</font></span>
 +
        <span>'''<span><font color="#000000">g_print</font></span>'''</span><span><font color="#990000">(</font></span><span><font color="#FF0000">"Error: %s</font></span><span><font color="#CC33CC">\n</font></span><span><font color="#FF0000">"</font></span><span><font color="#990000">,</font></span> error<span><font color="#990000">-&gt;</font></span>message<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#000000">g_clear_error</font></span>'''</span><span><font color="#990000">(&amp;</font></span>error<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#000000">g_strfreev</font></span>'''</span> <span><font color="#990000">(</font></span>files<span><font color="#990000">);</font></span>
 +
        <span>'''<span><font color="#000000">g_object_unref</font></span>'''</span><span><font color="#990000">(</font></span><span>'''<span><font color="#000000">G_OBJECT</font></span>'''</span><span><font color="#990000">(</font></span>proxy<span><font color="#990000">));</font></span>
 +
        <span>'''<span><font color="#000000">uninitialize</font></span>'''</span><span><font color="#990000">();</font></span>
 +
        <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span><font color="#993399">1</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
    <span><font color="#FF0000">}</font></span>
 +
    <span>'''<span><font color="#000000">g_strfreev</font></span>'''</span> <span><font color="#990000">(</font></span>files<span><font color="#990000">);</font></span>
 +
    files <span><font color="#990000"><nowiki>=</nowiki></font></span> NULL<span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
 +
    <span>'''<span><font color="#000000">g_object_unref</font></span>'''</span><span><font color="#990000">(</font></span><span>'''<span><font color="#000000">G_OBJECT</font></span>'''</span><span><font color="#990000">(</font></span>proxy<span><font color="#990000">));</font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Now wait for file sent signal, use low level bindings as glib </font></span>''</span>
 +
<span>''<span><font color="#9A1900">      bindings require signal marshaller registered */</font></span>''</span>
 +
    sys_conn <span><font color="#990000"><nowiki>=</nowiki></font></span> <span>'''<span><font color="#000000">dbus_bus_get</font></span>'''</span><span><font color="#990000">(</font></span>DBUS_BUS_SYSTEM<span><font color="#990000">,</font></span> NULL<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#000000">g_assert</font></span>'''</span><span><font color="#990000">(</font></span><span>'''<span><font color="#000000">dbus_connection_add_filter</font></span>'''</span><span><font color="#990000">(</font></span>sys_conn<span><font color="#990000">,</font></span>
 +
                                        file_sent_signal<span><font color="#990000">,</font></span>
 +
                                        NULL<span><font color="#990000">,</font></span>
 +
                                        NULL <span><font color="#990000">));</font></span>
 +
    filter_string <span><font color="#990000"><nowiki>=</nowiki></font></span>
 +
        <span>'''<span><font color="#000000">g_strdup_printf</font></span>'''</span> <span><font color="#990000">(</font></span><span><font color="#FF0000">"type='signal',interface='%s'"</font></span><span><font color="#990000">,</font></span> CONBTDIALOGS_DBUS_INTERFACE<span><font color="#990000">);</font></span>
 +
 +
    <span>'''<span><font color="#000000">dbus_bus_add_match</font></span>'''</span><span><font color="#990000">(</font></span>sys_conn<span><font color="#990000">,</font></span> filter_string<span><font color="#990000">,</font></span> NULL<span><font color="#990000">);</font></span>
 +
    <span>'''<span><font color="#000000">dbus_connection_unref</font></span>'''</span><span><font color="#990000">(</font></span>sys_conn<span><font color="#990000">);</font></span>
 +
 +
    <span>''<span><font color="#9A1900">/* Run mainloop */</font></span>''</span>
 +
    <span>'''<span><font color="#000000">g_main_loop_run</font></span>'''</span><span><font color="#990000">(</font></span>mainloop<span><font color="#990000">);</font></span>
 +
 +
    <span>'''<span><font color="#0000FF">return</font></span>'''</span> <span><font color="#993399">0</font></span><span><font color="#990000"><nowiki>;</nowiki></font></span>
 +
<span><font color="#FF0000">}</font></span></tt>
[[Category:Development]]
[[Category:Development]]
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Fremantle]]
[[Category:Fremantle]]

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)