Ignore:
Timestamp:
Jul 16, 2009, 9:23:30 AM (15 years ago)
Author:
stud-florian
Message:

Fixed some minor things

Location:
source/ariba/utility/bootstrap/modules/bluetoothsdp
Files:
2 edited

Legend:

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

    r4905 r4970  
    6262namespace ariba {
    6363namespace utility {
    64 use_logging_cpp(BluetoothSdp)
    65 ;
    66 
    67 //TODO: figure out this compiler flag stuff
     64use_logging_cpp(BluetoothSdp);
    6865
    6966BluetoothSdp::BluetoothSdp(BootstrapInformationCallback* _callback) :
     
    7168#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
    7269
    73         // TODO: think about this!
    74         channel_ = 7;
    75         // TODO: what about the callback?
     70        // This can be ignored, as the channel we really be saved in one
     71        // of the info strings (as an attribute)
     72        channel_ = 1;
    7673
    7774#endif // HAVE_BLUETOOTH_BLUETOOTH_H
     
    149146
    150147        // prepare the info attribute buffers
    151         string namebuf, info1buf, info2buf, info3buf;
     148        //string namebuf, info1buf, info2buf, info3buf;
    152149        uint8_t namelen, info1len, info2len, info3len;
    153150
     
    162159        }
    163160
    164         // we need to save the string len for sdp
     161        // we need to save the string len for sdp; do we?
     162        /*
    165163        namebuf = (char)namelen;
    166164        namebuf.append(name);
     
    171169        info3buf = (char)info3len;
    172170        info3buf.append(info3);
     171        */
    173172
    174173        // set the general service ID
     
    212211        // add the spovnet attributes
    213212        sdp_attr_add_new(&record, SDP_ATTR_SPOVNET_NAME, SDP_TEXT_STR8,
    214                         namebuf.data());
     213                        name.data());
    215214
    216215        sdp_attr_add_new(&record, SDP_ATTR_SPOVNET_INFO1, SDP_TEXT_STR8,
    217                         info1buf.data());
     216                        info1.data());
    218217
    219218        sdp_attr_add_new(&record, SDP_ATTR_SPOVNET_INFO2, SDP_TEXT_STR8,
    220                         info2buf.data());
     219                        info2.data());
    221220
    222221        sdp_attr_add_new(&record, SDP_ATTR_SPOVNET_INFO3, SDP_TEXT_STR8,
    223                         info3buf.data());
     222                        info3.data());
    224223
    225224        // connect to the local SDP server, register the service record,
     
    271270        int i;
    272271
    273         /*
    274          char addr[19] = { 0 };
    275          char name[248] = { 0 };
    276          */
    277272        bdaddr_t address;
    278273        uint8_t channel;
     
    306301                address = (ii + i)->bdaddr;
    307302
    308                 logging_info("Peer found.")
     303                logging_info("Found peer " << ba2string(&address) << ", querying SDP.")
    309304
    310305                // TODO: sdp_search can be very slow, fork it!
     
    343338
    344339        if (session == 0) {
    345                 // TODO: put the remote's address here
    346                 logging_error("Failed to connect to remote SDP server.");
     340                logging_error("Failed to connect to SDP server at " << ba2string(&target) <<".");
    347341                return;
    348342        }
     
    382376                                logging_info("Remote peer info2 is: " << info2);
    383377                                logging_info("Remote peer info3 is: " << info3);
    384                                 //TODO: callback here + extract info's and stuff
     378
     379                                // Callback
     380                                callback->onBootstrapServiceFound(name, info1, info2, info3);
     381
    385382                        }
    386383                        sdp_record_free(rec);
     
    394391}
    395392
     393string BluetoothSdp::ba2string(bdaddr_t *ba) {
     394        /*
     395         * Returns a string holding the bt adress in human readable form.
     396         */
     397        char *str;
     398        ba2str(ba, str);
     399        string result = str;
     400        return result;
     401}
     402
    396403#endif // HAVE_BLUETOOTH_BLUETOOTH_H
    397404
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h

    r4879 r4970  
    8585        void bt_scan();
    8686        void sdp_search(bdaddr_t target);
     87        string ba2string(bdaddr_t *ba);
    8788
    8889        sdp_session_t *sdp_session_;
Note: See TracChangeset for help on using the changeset viewer.