- 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)
"name" : "OBD2Source",
"path" : "/usr/lib/automotive-message-broker/obd2sourceplugin.so",
"device" : "/dev/ttyUSB0",
- "baud" : "115200"
+ "baud" : "115200",
+ "bluetoothAdapter" : ""
}
],
"sinks": [
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,
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: "<<error->message<<endl;
- g_error_free(error);
- return "";
+ if(!org_bluez_manager_call_find_adapter_sync(manager,adapterAddy.c_str(), &adapterPath, NULL, &error))
+ {
+ DebugOut(0)<<"Error getting bluetooth adapter ("<<adapterAddy<<"): "<<error->message<<endl;
+ g_error_free(error);
+ return "";
+ }
+
+ error = NULL;
}
- error = NULL;
+ else
+ {
+ if(!org_bluez_manager_call_default_adapter_sync(manager,&adapterPath, NULL, &error))
+ {
+ DebugOut(0)<<"Error getting bluetooth default adapter: "<<error->message<<endl;
+ g_error_free(error);
+ return "";
+ }
+
+ error = NULL;
+ }
OrgBluezAdapter* adapter = org_bluez_adapter_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
return serialDeviceName;
}
+
};
//Default values
std::string port = "/dev/ttyUSB0";
std::string baud = "115200";
+ std::string btadapter = "";
//Try to load config
//printf("OBD2Source::setConfiguration\n");
{
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)
DebugOut()<<"bluetooth device?"<<endl;
ObdBluetoothDevice bt;
- std::string tempPort = bt.getDeviceForAddress(port);
+ std::string tempPort = bt.getDeviceForAddress(port, btadapter);
if(tempPort != "")
{
DebugOut(3)<<"Using bluetooth device \""<<port<<"\" bound to: "<<tempPort<<endl;