00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 # include <dtn-config.h>
00019 #endif
00020
00021 #ifdef OASYS_BLUETOOTH_ENABLED
00022
00023 #include <oasys/util/OptParser.h>
00024 #include <oasys/bluez/Bluetooth.h>
00025 #include "bundling/BundleDaemon.h"
00026 #include "conv_layers/BluetoothConvergenceLayer.h"
00027
00028 #include "BluetoothAnnounce.h"
00029
00030 namespace dtn {
00031
00032 BluetoothAnnounce::BluetoothAnnounce()
00033 : sdp_reg_(BundleDaemon::instance()->local_eid().c_str())
00034 {
00035 oasys::Bluetooth::hci_get_bdaddr(&cl_addr_);
00036 }
00037
00038 bool
00039 BluetoothAnnounce::configure(const std::string& name, ConvergenceLayer* cl,
00040 int argc, const char* argv[])
00041 {
00042 cl_ = cl;
00043 name_ = name;
00044 type_.assign(cl->name());
00045
00046 oasys::OptParser p;
00047 p.addopt(new oasys::BdAddrOpt("cl_addr",&cl_addr_));
00048 bool setinterval = false;
00049 p.addopt(new oasys::UIntOpt("interval",&interval_,"","",&setinterval));
00050 cl_channel_ = BluetoothConvergenceLayer::BTCL_DEFAULT_CHANNEL;
00051
00052 const char* invalid;
00053 if (! p.parse(argc, argv, &invalid))
00054 {
00055 log_err("bad parameter %s",invalid);
00056 return false;
00057 }
00058
00059 if (! setinterval)
00060 {
00061 log_err("required parameter missing: interval");
00062 return false;
00063 }
00064 else
00065 {
00066
00067 interval_ *= 1000;
00068 }
00069
00070 local_.assign(bd2str(cl_addr_));
00071 return true;
00072 }
00073
00074 size_t
00075 BluetoothAnnounce::format_advertisement(u_char*,size_t)
00076 {
00077 return 0;
00078 }
00079
00080 }
00081
00082 #endif // OASYS_BLUETOOTH_ENABLED