00001
00002 #ifndef _OASYS_BT_H_
00003 #define _OASYS_BT_H_
00004
00005 #include <config.h>
00006 #ifdef OASYS_BLUETOOTH_ENABLED
00007
00008 #include <fcntl.h>
00009 #include <stdlib.h>
00010 #include <sys/uio.h>
00011 #include <sys/socket.h>
00012
00013 #include <bluetooth/bluetooth.h>
00014 #include <bluetooth/hci.h>
00015 #include <bluetooth/rfcomm.h>
00016
00017 #include <vector>
00018 using namespace std;
00019
00020 namespace oasys {
00021
00022 struct Bluetooth {
00023
00024 #ifndef HCIDEVNAMSIZ
00025 #define HCIDEVNAMSIZ 32
00026 #endif
00027
00029
00030 static int hci_devid(const char* hcidev,
00031 const char* log = NULL );
00032
00033 static int hci_inquiry(int dev_id, int len, int nrsp,
00034 const uint8_t *lap, inquiry_info **ii,
00035 long flags, const char* log = NULL );
00036
00037 static int hci_open_dev(int dev_id,
00038 const char* log = NULL );
00039
00040 static int hci_close_dev(int dd,
00041 const char* log = NULL );
00042
00043 static int hci_read_remote_name(int dd, const bdaddr_t *bdaddr,
00044 int len, char *name, int to,
00045 const char* log = NULL );
00046
00047 static void hci_get_bdaddr(const char *hcidev, bdaddr_t *bdaddr,
00048 const char *log = NULL);
00049
00050 static int hci_dev_up(int dd, const char *hcidev,
00051 const char *log = NULL);
00053
00054 static char * batostr(const bdaddr_t *ba, char * str, size_t strsize = 18);
00055
00056 static bdaddr_t * strtoba(const char *str, bdaddr_t *addr);
00057
00058 static void baswap(bdaddr_t *dst, const bdaddr_t *src);
00059
00060 };
00061
00062 }
00063
00064 #endif
00065 #endif