public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-users] trying to send data at HCI level
@ 2005-02-22  6:24 Mohan K
  2005-02-22  7:05 ` Marcel Holtmann
  2005-02-24 15:22 ` BZ Benny
  0 siblings, 2 replies; 10+ messages in thread
From: Mohan K @ 2005-02-22  6:24 UTC (permalink / raw)
  To: bluez-users

Hi all,
       I am using two USB dongles on two different PCs. I want to send
and receive data on the either side at HCI level. I wrote one program
to send and receive the data, which is not working. I don't know how
to send and recevie the data at the HCI level. Previously I wrote
program for L2CAP level, which is working.
       Can any any one help me to do at HCI level. I am using blueZ
stack in linux platform
 The program is as follows:

/* program*/

	size_t datlen;
	int nb;
	bdaddr_t bdaddr;
	int opt, ptype, dd;
	uint16_t handle;
	uint8_t role;

	role = 0x01;
	ptype = HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 | HCI_DH5;

	str2ba("00:0B:0D:33:DA:F9", &bdaddr);

	if (dev_id < 0) {
		dev_id = hci_get_route(&bdaddr);
		if (dev_id < 0) {
			fprintf(stderr, "Device is not available.\n");
			exit(1);
		}
	}

	dd = hci_open_dev(dev_id);
	if (dd < 0) {
		perror("HCI device open failed");
		exit(1);
	}

	if (hci_create_connection(dd, &bdaddr, htobs(ptype),
					0, role, &handle, 25000) < 0)
		perror("Can't create connection");

	datlen=formpacket(0x01,0x04);

	if ((nb=send(dd,&packet[0],(datlen+4),MSG_DONTWAIT))< 0)
	{
			perror("\nCan't send data.\n");
	}
	else
	{
			printf("\nNo. of bytes sent=%d\n",nb);
	}
	

	hci_close_dev(dd);


-------------------------------------------------------
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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-02-25  9:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-22  6:24 [Bluez-users] trying to send data at HCI level Mohan K
2005-02-22  7:05 ` Marcel Holtmann
2005-02-22  7:19   ` Mohan K
2005-02-22  8:03     ` Marcel Holtmann
     [not found]       ` <7aa80ced050222002338e57eaf@mail.gmail.com>
     [not found]         ` <7aa80ced0502220057379ef414@mail.gmail.com>
2005-02-22  9:56           ` Marcel Holtmann
     [not found]             ` <7aa80ced0502220231161c0a3@mail.gmail.com>
2005-02-22 10:39               ` Marcel Holtmann
     [not found]                 ` <7aa80ced050222024634dce552@mail.gmail.com>
2005-02-22 10:51                   ` Fwd: " Marcel Holtmann
2005-02-25  8:25                 ` BZ Benny
2005-02-25  9:03                   ` Marcel Holtmann
2005-02-24 15:22 ` BZ Benny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox