BluetoothInquiry.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2006 Baylor University
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 #ifndef _OASYS_BT_INQUIRY_H_
00018 #define _OASYS_BT_INQUIRY_H_
00019 
00020 #include <config.h> 
00021 #ifdef OASYS_BLUETOOTH_ENABLED
00022 
00023 #include <bluetooth/bluetooth.h> // for bdaddr_t
00024 #include <bluetooth/hci.h>       // for inquiry_info
00025 
00026 #include "../debug/Log.h"
00027 
00028 #define MAX_BTNAME_SZ 248
00029 
00030 #ifndef MIN
00031 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00032 #endif
00033 
00034 namespace oasys {
00035 
00036 class BluetoothInquiry : public Logger {
00037 
00038 public:
00039 
00040 #define BT_INQ_NUM_RESP 20
00041 #define BT_INQ_LENGTH 8
00042 
00043     BluetoothInquiry(const char * logbase = "/dtn/btinquiry");
00044     virtual ~BluetoothInquiry();
00045 
00046     /*
00047      * Perform inquiry action
00048      */
00049     int inquire();
00050 
00051     /*
00052      * Enumerate over discovered device adapter addresses
00053      */
00054     int first(bdaddr_t&);
00055     int next(bdaddr_t&);
00056 
00057 protected:
00058     void reset();  // performed internally between inquiries
00059 
00060     // state and iterator over info_
00061     int num_responses_i_, pos_;
00062     // buffer for query data
00063     inquiry_info info_[BT_INQ_NUM_RESP];
00064     // flags to change default inquiry behavior
00065     long flags_;
00066 };
00067 
00068 }
00069 #endif // OASYS_BLUETOOTH_ENABLED
00070 #endif // _OASYS_BT_INQUIRY_H_

Generated on Thu Jun 7 16:56:48 2007 for DTN Reference Implementation by  doxygen 1.5.1