summaryrefslogtreecommitdiff
path: root/src/sdpd-service.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-03-28 12:03:13 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-03-28 13:15:02 +0300
commite2f915b21efbd39b0cb690d6304c23a8c4eb6254 (patch)
treedcd3f7face27eca90cab39149a80daeca56c0b42 /src/sdpd-service.c
parentf7eb756f5289a35fab6085c4f86556b7bd50cb87 (diff)
downloadbluez-e2f915b21efbd39b0cb690d6304c23a8c4eb6254.tar.gz
Parse config DeviceID string on bluetoothd startup
Instead of parsing config DeviceID string on sdp server startup, parse it in main while reading config file. This allow to store logical DID values in main_opts (instead of raw config string) and make use of them in bluetoothd code.
Diffstat (limited to 'src/sdpd-service.c')
-rw-r--r--src/sdpd-service.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sdpd-service.c b/src/sdpd-service.c
index de115626b..eb4b74c90 100644
--- a/src/sdpd-service.c
+++ b/src/sdpd-service.c
@@ -44,6 +44,7 @@
#include <glib.h>
#include <dbus/dbus.h>
+#include "hcid.h"
#include "sdpd.h"
#include "log.h"
#include "adapter.h"
@@ -172,10 +173,9 @@ void register_server_service(void)
update_db_timestamp();
}
-void register_device_id(const uint16_t vendor, const uint16_t product,
- const uint16_t version)
+void register_device_id(void)
{
- const uint16_t spec = 0x0102, source = 0x0002;
+ const uint16_t spec = 0x0102;
const uint8_t primary = 1;
sdp_list_t *class_list, *group_list, *profile_list;
uuid_t class_uuid, group_uuid;
@@ -184,9 +184,11 @@ void register_device_id(const uint16_t vendor, const uint16_t product,
sdp_profile_desc_t profile;
sdp_record_t *record = sdp_record_alloc();
- info("Adding device id record for %04x:%04x", vendor, product);
+ info("Adding device id record for %04x:%04x:%04x", main_opts.did_vendor,
+ main_opts.did_product, main_opts.did_version);
- btd_manager_set_did(vendor, product, version);
+ btd_manager_set_did(main_opts.did_vendor, main_opts.did_product,
+ main_opts.did_version);
record->handle = sdp_next_handle();
@@ -213,19 +215,19 @@ void register_device_id(const uint16_t vendor, const uint16_t product,
spec_data = sdp_data_alloc(SDP_UINT16, &spec);
sdp_attr_add(record, 0x0200, spec_data);
- vendor_data = sdp_data_alloc(SDP_UINT16, &vendor);
+ vendor_data = sdp_data_alloc(SDP_UINT16, &main_opts.did_vendor);
sdp_attr_add(record, 0x0201, vendor_data);
- product_data = sdp_data_alloc(SDP_UINT16, &product);
+ product_data = sdp_data_alloc(SDP_UINT16, &main_opts.did_product);
sdp_attr_add(record, 0x0202, product_data);
- version_data = sdp_data_alloc(SDP_UINT16, &version);
+ version_data = sdp_data_alloc(SDP_UINT16, &main_opts.did_version);
sdp_attr_add(record, 0x0203, version_data);
primary_data = sdp_data_alloc(SDP_BOOL, &primary);
sdp_attr_add(record, 0x0204, primary_data);
- source_data = sdp_data_alloc(SDP_UINT16, &source);
+ source_data = sdp_data_alloc(SDP_UINT16, &main_opts.did_source);
sdp_attr_add(record, 0x0205, source_data);
update_db_timestamp();