2004-12-11 01:13:37

by wim delvaux

[permalink] [raw]
Subject: [Bluez-users] what API to use to disconnect an rfcomm connection

Hi all,

if you started

rfcomm x XXXXXXXXXX y &
and the connection to XXXXXXXXXXX is running,

How can other application terminate that connection (much like pand -k addr)

What API (ioctl ?) should be used ? Code samples ?>

W


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2004-12-13 08:11:30

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] what API to use to disconnect an rfcomm connection

Hi Wim,

> if I run the command rfcomm 0 xxxxx 1 under a linux shell,
> the rfcomm program starts up and (if run in background) runs
> as a connection daemon between a device file /dev/xxx and a RFCOMM
> connection to - say - a telephone.
>
> On top of that rfcomm device file (/dev/xxx) you can run a pppd and
> hence create a GPRS connection over that phone.
>
> now suppose I want to disconnect from that GPRS connection. First I need
> to terminate the ppp connection. This is easy : just kill pppd.
>
> Next I need to disconnect from the phone. I.e. terminate the serial
> connection that the rfcomm daemon is managing.

you should use "rfcomm bind 0 ..." and simply open /dev/rfcomm0. If the
last user of /dev/rfcomm0 is gone and nobody else is using the ACL link
between these devices it will disconnect. These means kill the pppd
terminates the RFCOMM connection and in the end the ACL link.

> I could kill the 'appropriate' rfcomm daemon. However since the PAND
> daemon serves a very similar purpose and you can call PAND with -k
> to terminate a certain NAP/PANU - BNEP connection without having
> to kill that PAND I was wondering if there is a similar call for RFCOMM.
>
> The source for PAND shows that calling
>
> ioctl(ctl, bnepconndel, .... )
>
> terminates a certain BNEP connection.
>
> Does RFCOMM have a similar API e.g.
> iotcl( ctl, rfcommconndel, ... ) ?

the BNEP and RFCOMM have actually nothing in common. Their design it
quite different. If you wan't something similar then you must play with
dund.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-12-12 22:38:11

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] what API to use to disconnect an rfcomm connection

> this makes it even more unclear to me. You talked about PAN and RFCOMM.
> What profiles do you wanna serve? What is your current setup?

OK let's start again.

if I run the command rfcomm 0 xxxxx 1 under a linux shell,
the rfcomm program starts up and (if run in background) runs
as a connection daemon between a device file /dev/xxx and a RFCOMM
connection to - say - a telephone.

On top of that rfcomm device file (/dev/xxx) you can run a pppd and
hence create a GPRS connection over that phone.

now suppose I want to disconnect from that GPRS connection. First I need
to terminate the ppp connection. This is easy : just kill pppd.

Next I need to disconnect from the phone. I.e. terminate the serial
connection that the rfcomm daemon is managing.

I could kill the 'appropriate' rfcomm daemon. However since the PAND
daemon serves a very similar purpose and you can call PAND with -k
to terminate a certain NAP/PANU - BNEP connection without having
to kill that PAND I was wondering if there is a similar call for RFCOMM.

The source for PAND shows that calling

ioctl(ctl, bnepconndel, .... )

terminates a certain BNEP connection.

Does RFCOMM have a similar API e.g.
iotcl( ctl, rfcommconndel, ... ) ?

W


>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-12-11 12:34:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] what API to use to disconnect an rfcomm connection

Hi Wim,

> > > if you started
> > >
> > > rfcomm x XXXXXXXXXX y &
> > > and the connection to XXXXXXXXXXX is running,
> > >
> > > How can other application terminate that connection (much like pand -k
> > > addr)
> > >
> > > What API (ioctl ?) should be used ? Code samples ?>
> >
> > the use of ACL connections is tracked with reference counting and as
> > long as there is a upper layer connection using the ACL link it is not
> > closed. If the last one is gone, the disconnect timer is started and
> > after the timeout the ACL link is terminated.
>
>
> I want to create a 'hangup' button that should disconnect from
> a phone connection immediately. This means that is
> should terminate say the ppp connection ontop of the serial
> connection and also the serial connection to the phone.
>
> What you say is that if I close the ppp after a while the rfcomm
> connection would stop automatically. That is nice but that is
> not what I want.
>
> So I am looking for an equivalent to pressing CTRL-C in the
> controlling terminate of the running rfcomm daemon using a
> C-API call.

this makes it even more unclear to me. You talked about PAN and RFCOMM.
What profiles do you wanna serve? What is your current setup?

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-12-11 12:14:04

by wim delvaux

[permalink] [raw]
Subject: Re: [Bluez-users] what API to use to disconnect an rfcomm connection

On Saturday 11 December 2004 10:08, Marcel Holtmann wrote:
> Hi Wim,
>
> > if you started
> >
> > rfcomm x XXXXXXXXXX y &
> > and the connection to XXXXXXXXXXX is running,
> >
> > How can other application terminate that connection (much like pand -k
> > addr)
> >
> > What API (ioctl ?) should be used ? Code samples ?>
>
> the use of ACL connections is tracked with reference counting and as
> long as there is a upper layer connection using the ACL link it is not
> closed. If the last one is gone, the disconnect timer is started and
> after the timeout the ACL link is terminated.


I want to create a 'hangup' button that should disconnect from
a phone connection immediately. This means that is
should terminate say the ppp connection ontop of the serial
connection and also the serial connection to the phone.

What you say is that if I close the ppp after a while the rfcomm
connection would stop automatically. That is nice but that is
not what I want.

So I am looking for an equivalent to pressing CTRL-C in the
controlling terminate of the running rfcomm daemon using a
C-API call.

Is that more clear ?

Thanx

W


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2004-12-11 09:08:28

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] what API to use to disconnect an rfcomm connection

Hi Wim,

> if you started
>
> rfcomm x XXXXXXXXXX y &
> and the connection to XXXXXXXXXXX is running,
>
> How can other application terminate that connection (much like pand -k addr)
>
> What API (ioctl ?) should be used ? Code samples ?>

the use of ACL connections is tracked with reference counting and as
long as there is a upper layer connection using the ACL link it is not
closed. If the last one is gone, the disconnect timer is started and
after the timeout the ACL link is terminated.

I hope you asked for this otherwise I don't understand your question.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users