* [Bluez-devel] BlueZ rfcomm channel
@ 2005-01-20 13:28 # Björn Specht #
2005-01-20 13:55 ` Lars Grunewaldt
0 siblings, 1 reply; 3+ messages in thread
From: # Björn Specht # @ 2005-01-20 13:28 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 430 bytes --]
Hi guys,
I am working on BlueZ for a few days now and it is hard to start working with it for me. I want to write a program (Client/Server) in C which uses the rfcomm socket and I want to use a channel to transfer data between these two computers.
The HCI_inquiry function is running and finds the other PC. How can I establish a connection between these two computers with the rfcomm sockets?
Thanks for helping
Björn
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] BlueZ rfcomm channel
2005-01-20 13:28 [Bluez-devel] BlueZ rfcomm channel # Björn Specht #
@ 2005-01-20 13:55 ` Lars Grunewaldt
2005-01-21 10:22 ` # Björn Specht #
0 siblings, 1 reply; 3+ messages in thread
From: Lars Grunewaldt @ 2005-01-20 13:55 UTC (permalink / raw)
To: bluez-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
# Bj=F6rn Specht # wrote:
| Hi guys,
|
| I am working on BlueZ for a few days now and it is hard to start
working with it for me. I want to write a program (Client/Server) in C
which uses the rfcomm socket and I want to use a channel to transfer
data between these two computers.
| The HCI_inquiry function is running and finds the other PC. How can I
establish a connection between these two computers with the rfcomm socket=
s?
have a look at the example programs. it should be something like:
(this is for connection to a headset with rfcomm, but it should be
similar. There are other examples in bluez-tools, if I'm not mistaken.
static int rfcomm_connect(bdaddr_t * src, bdaddr_t * dst, uint8_t channel=
)
{
~ struct sockaddr_rc addr;
~ int s;
~ if ((s =3D socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < =
0) {
~ return -1;
~ }
~ memset(&addr, 0, sizeof(addr));
~ addr.rc_family =3D AF_BLUETOOTH;
~ bacpy(&addr.rc_bdaddr, src);
~ addr.rc_channel =3D 0;
~ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
~ close(s);
~ return -1;
~ }
~ memset(&addr, 0, sizeof(addr));
~ addr.rc_family =3D AF_BLUETOOTH;
~ bacpy(&addr.rc_bdaddr, dst);
~ addr.rc_channel =3D channel;
~ if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
~ close(s);
~ return -1;
~ }
~ return s;
}
have fun,
~ Lars
- --
Lars Grunewaldt
* software development
* multimedia design
skills: C/C++/Java/PHP/(X)HTML/Flash/audio/video
web: http://www.dark-reality.de
mail: lgw@dark-reality.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB77hLQWC6DTWkDAoRAqv0AJoCI5XuhYrqFGAM9qvqmbJr/VEQawCcD0uj
34s/2fQhdoiN+maE7liaH2M=3D
=3DPhyO
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] BlueZ rfcomm channel
2005-01-20 13:55 ` Lars Grunewaldt
@ 2005-01-21 10:22 ` # Björn Specht #
0 siblings, 0 replies; 3+ messages in thread
From: # Björn Specht # @ 2005-01-21 10:22 UTC (permalink / raw)
To: bluez-devel
[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]
THX Lars,
I also found some stuff in rctest.c . I will have a go with that,too.
Cheers
Björn
On Thu, 20 Jan 2005 14:55:23 +0100
Lars Grunewaldt <lgw@dark-reality.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> # Björn Specht # wrote:
> | Hi guys,
> |
> | I am working on BlueZ for a few days now and it is hard to start
> working with it for me. I want to write a program (Client/Server) in C
> which uses the rfcomm socket and I want to use a channel to transfer
> data between these two computers.
> | The HCI_inquiry function is running and finds the other PC. How can I
> establish a connection between these two computers with the rfcomm sockets?
>
> have a look at the example programs. it should be something like:
>
> (this is for connection to a headset with rfcomm, but it should be
> similar. There are other examples in bluez-tools, if I'm not mistaken.
>
> static int rfcomm_connect(bdaddr_t * src, bdaddr_t * dst, uint8_t channel)
> {
> ~ struct sockaddr_rc addr;
> ~ int s;
>
> ~ if ((s = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0) {
> ~ return -1;
> ~ }
>
> ~ memset(&addr, 0, sizeof(addr));
> ~ addr.rc_family = AF_BLUETOOTH;
> ~ bacpy(&addr.rc_bdaddr, src);
> ~ addr.rc_channel = 0;
> ~ if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
> ~ close(s);
> ~ return -1;
> ~ }
>
> ~ memset(&addr, 0, sizeof(addr));
> ~ addr.rc_family = AF_BLUETOOTH;
> ~ bacpy(&addr.rc_bdaddr, dst);
> ~ addr.rc_channel = channel;
> ~ if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
> ~ close(s);
> ~ return -1;
> ~ }
>
> ~ return s;
> }
>
> have fun,
> ~ Lars
>
>
> - --
> Lars Grunewaldt
> * software development
> * multimedia design
> skills: C/C++/Java/PHP/(X)HTML/Flash/audio/video
> web: http://www.dark-reality.de
> mail: lgw@dark-reality.de
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFB77hLQWC6DTWkDAoRAqv0AJoCI5XuhYrqFGAM9qvqmbJr/VEQawCcD0uj
> 34s/2fQhdoiN+maE7liaH2M=
> =PhyO
> -----END PGP SIGNATURE-----
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-01-21 10:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 13:28 [Bluez-devel] BlueZ rfcomm channel # Björn Specht #
2005-01-20 13:55 ` Lars Grunewaldt
2005-01-21 10:22 ` # Björn Specht #
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox