Changeset 4879 for source/ariba/utility


Ignore:
Timestamp:
Jul 13, 2009, 5:41:44 PM (15 years ago)
Author:
Christoph Mayer
Message:

bluetooth zeugs leicht gefixt

Location:
source/ariba/utility/bootstrap
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/bootstrap/BootstrapManager.cpp

    r4850 r4879  
    4141#include "ariba/utility/bootstrap/modules/multicastdns/MulticastDns.h"
    4242#include "ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.h"
     43#include "ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h"
    4344
    4445namespace ariba {
     
    7273                module = new PeriodicBroadcast(this);
    7374                break;
     75        case BootstrapTypeBluetoothSdp:
     76                module = new BluetoothSdp(this);
     77                break;
    7478        }
    7579
     
    130134        }
    131135
     136        { // bluetooth sdp
     137                        RegistrationResult resone = RegistrationSucceeded;
     138                        resone = registerModule(BootstrapTypeBluetoothSdp);
     139
     140                        if(resone != RegistrationSucceeded)
     141                                result = resone;
     142                }
     143
    132144        { // todo
    133145                /*  ...   */
     
    140152        unregisterModule(BootstrapTypeMulticastDns);
    141153        unregisterModule(BootstrapTypePeriodicBroadcast);
     154        unregisterModule(BootstrapTypeBluetoothSdp);
    142155        /*  todo  ...  */
    143156
  • source/ariba/utility/bootstrap/BootstrapManager.h

    r4850 r4879  
    7575                BootstrapTypeMulticastDns,                      // use mDNS bootstrapping
    7676                BootstrapTypePeriodicBroadcast,         // stupid periodic broadcasting
     77                BootstrapTypeBluetoothSdp,                      // bluetooth service discovery
    7778        };
    7879
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.cpp

    r4870 r4879  
    4343// Attribute descriptors for SDP
    4444// base was chosen randomly
    45 #define SDP_SPOVNET_BASE                0x4000
     45#define SDP_SPOVNET_BASE                        0x4000
    4646#define SDP_ATTR_SPOVNET_NAME           0x0000 + SDP_SPOVNET_BASE
    4747#define SDP_ATTR_SPOVNET_INFO1          0x0001 + SDP_SPOVNET_BASE
     
    133133         */
    134134
    135         logging_info("Registering SDP service.\n");
     135        logging_info("Registering SDP service");
    136136
    137137        uint8_t rfcomm_channel = channel_;
     
    239239
    240240        if (sdp_session_ == 0) {
    241                 std::cout
    242                 << "Something is wrong with your SDP server, nothing registered.";
     241                logging_error( "Something is wrong with your SDP server, nothing registered" );
    243242        } else {
    244243                sdp_record_register(sdp_session_, &record, 0);
     
    260259#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
    261260
    262         logging_info("Unregistering SDP service.\n");
     261        logging_info("Unregistering SDP service");
    263262        sdp_close(sdp_session_);
    264263
     
    276275         */
    277276
    278         logging_info("Scanning for peers.\n");
     277        logging_info("Scanning for peers");
    279278
    280279        inquiry_info *ii = NULL;
     
    293292        sock = hci_open_dev(dev_id);
    294293        if (dev_id < 0 || sock < 0) {
    295                 perror("opening socket");
     294                logging_error("opening socket");
    296295                exit(1);
    297296        }
     
    304303        num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
    305304        if (num_rsp < 0)
    306         perror("hci_inquiry");
     305                logging_error("hci_inquiry");
    307306
    308307        for (i = 0; i < num_rsp; i++) {
     
    324323        close(sock);
    325324
    326         logging_info("Next scan in 20 seconds.\n");
     325        logging_info("Next scan in 20 seconds");
    327326
    328327        scan_timer_.expires_from_now(boost::posix_time::seconds(20));
    329328        scan_timer_.async_wait(boost::bind(&BluetoothSdp::bt_scan, this));
    330 
    331 
    332329}
    333330
     
    399396#endif // HAVE_BLUETOOTH_BLUETOOTH_H
    400397
    401 }
    402 } //namespace ariba, utility
     398}} //namespace ariba, utility
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h

    r4870 r4879  
    5353
    5454#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
    55 #include <bluetooth/bluetooth.h>
    56 #include <bluetooth/sdp.h>
    57 #include <bluetooth/sdp_lib.h>
    58 #include <bluetooth/hci.h>
    59 #include <bluetooth/hci_lib.h>
     55  #include <bluetooth/bluetooth.h>
     56  #include <bluetooth/sdp.h>
     57  #include <bluetooth/sdp_lib.h>
     58  #include <bluetooth/hci.h>
     59  #include <bluetooth/hci_lib.h>
    6060#endif
    6161
     
    8080        virtual void revokeService(string name);
    8181
     82private:
     83
    8284#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
    83 
    84 private:
    8585        void bt_scan();
    8686        void sdp_search(bdaddr_t target);
     
    8888        sdp_session_t *sdp_session_;
    8989        uint8_t channel_;
    90 
    9190#endif // HAVE_BLUETOOTH_BLUETOOTH_H
    9291
     
    9594        boost::thread t_;
    9695
    97 
    9896};
    9997
Note: See TracChangeset for help on using the changeset viewer.