Changeset 5358 for source/ariba/utility


Ignore:
Timestamp:
Jul 26, 2009, 5:17:30 PM (15 years ago)
Author:
Christoph Mayer
Message:

sideport und sdp bootstrap

Location:
source/ariba/utility
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.cpp

    r5344 r5358  
    283283
    284284        for (i = 0; i < num_rsp; i++) {
    285 
    286285                address = (ii + i)->bdaddr;
    287                 logging_debug("found peer " << ba2string(&address) << ", querying SDP.")
     286
     287                string saddress = ba2string(&address);
     288                string sname = ba2name(&address, sock);
     289
     290                logging_debug("found peer [" << saddress << "] [" << sname << "]");
    288291
    289292                // TODO: sdp_search can be very slow, fork it!
    290                 sdp_search(address);
     293                sdp_search( address, sname );
    291294        }
    292295
     
    295298
    296299        int nextscan = (rand() % 40) + 5;
    297         logging_debug("Next sdp scan in " << nextscan << " seconds");
    298 
    299         scan_timer_.expires_from_now(boost::posix_time::seconds(nextscan));
    300         scan_timer_.async_wait(boost::bind(&BluetoothSdp::bt_scan, this));
    301 }
    302 
    303 void BluetoothSdp::sdp_search(bdaddr_t target) {
     300        logging_debug("next sdp scan in " << nextscan << " seconds");
     301
     302        scan_timer_.expires_from_now( boost::posix_time::seconds(nextscan) );
     303        scan_timer_.async_wait( boost::bind(&BluetoothSdp::bt_scan, this) );
     304}
     305
     306void BluetoothSdp::sdp_search(bdaddr_t target, string devicename) {
    304307
    305308        /*
     
    315318        uint8_t port = 0;
    316319
     320        // connect to the SDP server running on the remote machine
     321        logging_debug("querying services from bt device ["
     322                        << ba2string(&target) << "] [" << devicename << "]");
     323
    317324        // prepare the buffers for the attributes
    318325        char name[256], info1[256], info2[256], info3[256];
    319326
    320         // connect to the SDP server running on the remote machine
    321         logging_debug("querying services from bt device " << ba2string(&target));
    322327        session = sdp_connect(BDADDR_ANY, &target, SDP_RETRY_IF_BUSY);
    323328
     
    377382}
    378383
    379 string BluetoothSdp::ba2string(bdaddr_t *ba) {
     384string BluetoothSdp::ba2string(bdaddr_t* ba) {
    380385        /*
    381386         * Returns a string holding the bt adress in human readable form.
     
    388393}
    389394
     395string BluetoothSdp::ba2name(bdaddr_t* ba, int sock){
     396
     397        char name[256] = {0};
     398        memset(name, 0, sizeof(name));
     399
     400        if( hci_read_remote_name(sock, ba, sizeof(name), name, 0) < 0 )
     401                strcpy(name, "unknown");
     402
     403        string result = name;
     404        return result;
     405}
     406
    390407#endif // HAVE_BLUETOOTH_BLUETOOTH_H
    391408
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h

    r5316 r5358  
    8585#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
    8686        void bt_scan();
    87         void sdp_search(bdaddr_t target);
    88         string ba2string(bdaddr_t *ba);
     87        void sdp_search(bdaddr_t target, string devicename);
     88        string ba2string(bdaddr_t* ba);
     89        string ba2name(bdaddr_t* ba, int sock);
    8990
    9091        sdp_session_t *sdp_session_;
  • source/ariba/utility/system/StartupWrapper.cpp

    r5344 r5358  
    9898        {
    9999                log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
    100                 logger->setLevel(log4cxx::Level::getWarn());
     100                logger->setLevel(log4cxx::Level::getDebug());
    101101        }
    102102
    103103        // set up again an individual level if you like
     104        /*
    104105        {
    105106                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("PingPong"));
     
    122123                        logger->setLevel(log4cxx::Level::getDebug());
    123124        }
     125        */
    124126
    125127        //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Note: See TracChangeset for help on using the changeset viewer.