/* * * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2000-2001 Qualcomm Incorporated * Copyright (C) 2002-2003 Maxim Krasnyansky * Copyright (C) 2002-2005 Marcel Holtmann * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS * SOFTWARE IS DISCLAIMED. * * * $Id: l2test.c,v 1.16 2005/01/11 21:42:38 holtmann Exp $ */ /*Send program*/ #include #include #include #include #include #include #include #include #include #include #include #include "csr.h" unsigned char packet[256]; unsigned char buf[256]={'a','b','c','d','e','f',0x7c,'g',0x7c,'i'}; static unsigned char *rbuf; static int master = 0; static int auth = 0; static int encrypt = 0; static int secure = 0; static int reliable = 0; static int socktype = SOCK_SEQPACKET; /* Default mtu */ static int imtu = 672; static int omtu = 0; static int linger = 0; /* Default data size */ static long data_size = 672; /* Default addr and psm */ static bdaddr_t bdaddr; static unsigned short psm = 10; //const char str[18]="00:0B:0D:33:DA:F9"; void dump_mode(int); static int listen_connection(void); void accept_connection(int); static void do_listen(void); unsigned char formpacket(unsigned char device, unsigned char len ) { unsigned char temp=0x00; unsigned char i,j,pdlen; packet[0]=0x7c; switch(device) { case 1: packet[1]=0x01; break; case 2: packet[1]=0x02; break; case 3: packet[1]=0x03; break; case 4: packet[1]=0x04; break; } pdlen=len; for(i=3,j=0;j 0) { printf("\nRecevied %d bytes\n", len); hexdump(rbuf,len); } } close(s); } int main(void) { int fd; fd=remote_connect("00:0B:0D:33:DA:F9"); send_data(fd); //fd=listen_connection(); //accept_connection(fd); // do_listen(); }