From: Kevron Rees Date: Wed, 24 Oct 2012 22:47:17 +0000 (-0700) Subject: configurable bt adapter X-Git-Tag: accepted/1.0/20121115.193422~7^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62c28f2d81a8ce6340387212b340c4b94e18cb16;p=profile%2Fivi%2Fautomotive-message-broker.git configurable bt adapter --- diff --git a/TODO b/TODO index 5693335..e1001f0 100644 --- a/TODO +++ b/TODO @@ -5,3 +5,4 @@ - historic data "get" interface in routing engine - sqlite database storage plugin - connect/disconnect on first/last subscription in obd2source +- improve obd2source speed via Physical Addressing and Fast polling (see https://www.scantool.net/forum/index.php?topic=6661.msg25024#msg25024) diff --git a/examples/obdsourceconfig b/examples/obdsourceconfig index d8b685e..f7403bd 100644 --- a/examples/obdsourceconfig +++ b/examples/obdsourceconfig @@ -4,7 +4,8 @@ "name" : "OBD2Source", "path" : "/usr/lib/automotive-message-broker/obd2sourceplugin.so", "device" : "/dev/ttyUSB0", - "baud" : "115200" + "baud" : "115200", + "bluetoothAdapter" : "" } ], "sinks": [ diff --git a/plugins/obd2plugin/bluetooth.hpp b/plugins/obd2plugin/bluetooth.hpp index f88491a..0e889c5 100644 --- a/plugins/obd2plugin/bluetooth.hpp +++ b/plugins/obd2plugin/bluetooth.hpp @@ -10,9 +10,9 @@ class ObdBluetoothDevice { public: - std::string getDeviceForAddress(std::string address) - { + std::string getDeviceForAddress( std::string address,std::string adapterAddy = "") + { GError* error = NULL; OrgBluezManager* manager = org_bluez_manager_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, @@ -28,14 +28,30 @@ public: error = NULL; gchar* adapterPath; - if(!org_bluez_manager_call_default_adapter_sync(manager,&adapterPath,NULL,&error)) + + if(adapterAddy != "") { - DebugOut(0)<<"Error getting bluetooth default adapter: "<message<message<message< config) //Default values std::string port = "/dev/ttyUSB0"; std::string baud = "115200"; + std::string btadapter = ""; //Try to load config //printf("OBD2Source::setConfiguration\n"); @@ -399,10 +400,15 @@ void OBD2Source::setConfiguration(map config) { port = (*i).second; } - if ((*i).first == "baud") + else if ((*i).first == "baud") { baud = (*i).second; } + + else if ((*i).first == "bluetoothAdapter") + { + btadapter = (*i).second; + } } if(port.find(":") != string::npos) @@ -411,7 +417,7 @@ void OBD2Source::setConfiguration(map config) DebugOut()<<"bluetooth device?"<