[maemo-developers] trouble to disconnect from WiFi AP
From: Jan Vachun vachun at spintec.comDate: Fri Apr 20 12:04:25 EEST 2007
- Previous message: Instructions cache flush on ARM (was: N800 & Video playback)
- Next message: trouble to disconnect from WiFi AP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
In my apllication I'm trying to ensure connection to specific Wifi
network Access Point AP. I'm using osso_iap_connect(....) call to
connect using previously configured profile and it works well when no
wifi connection is currently selected.
When N800 is already connected to another WiFi AP, calling
osso_iap_connect(....) blocks application until WiFi connection is
dropped using Connection manager UI.
calling osso_iap_disconnect(...) with OSSO_IAP_ANY or with realIAP
profile name as parameter returns no error but doesn't disconnect
current WiFi connection.
I have also tried to disconnect through D-BUS using
disconnect_iap_async() in following code, but it didn't work either.
Any hint will be really appreciated.
<--------------- begin of sample code -------------->
void send_message_no_reply(DBusMessage *msg);
int disconnect_iap_async(const char *iap);
DBusConnection *get_connection();
DBusConnection *get_connection()
{
static DBusConnection *connection = NULL;
if (connection == NULL) {
connection = dbus_connection_open(
DBUS_SYSTEM_BUS_DEFAULT_ADDRESS,
NULL);
if (!connection)
return NULL;
if (!dbus_bus_register(connection, NULL)) {
dbus_connection_disconnect(connection);
dbus_connection_unref(connection);
connection = NULL;
return NULL;
}
}
return connection;
}
void send_message_no_reply(DBusMessage *msg)
{
DBusConnection *conn;
conn = get_connection();
dbus_message_set_no_reply(msg, TRUE);
dbus_connection_send(conn, msg, NULL);
}
int disconnect_iap_async(const char *iap)
{
DBusMessage *msg;
msg = dbus_message_new_method_call(
ICD_DBUS_SERVICE,
ICD_DBUS_PATH,
ICD_DBUS_INTERFACE,
ICD_DISCONNECT_REQ);
if (msg == NULL)
return -1;
if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &iap,
DBUS_TYPE_INVALID))
{
dbus_message_unref(msg);
return -1;
}
send_message_no_reply(msg);
dbus_message_unref(msg);
return 0;
}
<--------------- end of sample code ---------------->
--
Jan Vachun
Spintec s.r.l.
C.so Torino 89/A
Ferriera di Buttigliera Alta (TO), 10090
tel: +39 011 9348228
fax: +39 011 9348861
- Previous message: Instructions cache flush on ARM (was: N800 & Video playback)
- Next message: trouble to disconnect from WiFi AP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
