Re: trouble to disconnect from WiFi AP

2007-04-22 Thread Patrik Flykt

Hi,

On Fri, 2007-04-20 at 11:04 +0200, ext Jan Vachun wrote:
> When N800 is already connected to another WiFi AP, calling
> osso_iap_connect() blocks application until WiFi connection is
> dropped using Connection manager UI.

The blocking thing seems more like a bug to me, but eventually
osso_iap_connect should return latest after ~3 minutes due to the D-Bus
timeout used.

Connectivity works with the following policy in N800:
1) if the requested connection is on, the connect request succeeds
2) if there is no connection on, the requested one is created
3) if there is another connection on, the requested connection is not
  connected

In the majority of cases where applications just ask for any connection,
everything works all the time, it's the specific connections that cannot
be connected at will.

Then there is also the OSSO_IAP_TIMED_CONNECT flag. It must be set if
the application triggers a network connection request by itself without
user intervention. When this flag is set, case 2) above does not apply,
i.e. no application can by itself turn on an (expensive GPRS or CS)
network connection.

> 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.

Yes. Connectivity policy again. In 770 there was a reference count that
disconnected the network connection after the last user exited. As N800
tries to be online as much as possible, the reference count is omitted
and the connection does not get disconnected.

> I have also tried to disconnect through D-BUS using
> disconnect_iap_async() in following code, but it didn't work either.

The library is already using that D-Bus interface, so it will work
identically.

What is the exact use case where policy 3) above jams your application?

HTH,

Patrik


___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers


trouble to disconnect from WiFi AP

2007-04-20 Thread Jan Vachun
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
___
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers