From: Michael Carpenter Date: Wed, 21 Nov 2012 22:56:21 +0000 (-0500) Subject: Change so BT rfcomm port name is re-reqested every time a connect is requested X-Git-Tag: 0.6.0~8^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F2513%2F1;p=profile%2Fivi%2Fautomotive-message-broker.git Change so BT rfcomm port name is re-reqested every time a connect is requested --- diff --git a/plugins/obd2plugin/obd2source.cpp b/plugins/obd2plugin/obd2source.cpp index d3899c1..8eb2c48 100644 --- a/plugins/obd2plugin/obd2source.cpp +++ b/plugins/obd2plugin/obd2source.cpp @@ -157,13 +157,39 @@ void threadLoop(gpointer data) DebugOut() << __SMALLFILE__ <<":"<< __LINE__ << "Command:" << req->req << endl; if (req->req == "connect") { - connect(obd,req->arglist[0],req->arglist[1]); + + if (source->m_isBluetooth) + { + ObdBluetoothDevice bt; + std::string tempPort = bt.getDeviceForAddress(source->m_btDeviceAddress, source->m_btAdapterAddress); + if(tempPort != "") + { + DebugOut(3)<<"Using bluetooth device \""<m_btDeviceAddress<<"\" bound to: "<arglist[0]; + baud = req->arglist[1]; + } + connect(obd,port,baud); connected = true; } else if (req->req == "connectifnot") { if (!connected) { + if (source->m_isBluetooth) + { + ObdBluetoothDevice bt; + std::string tempPort = bt.getDeviceForAddress(source->m_btDeviceAddress, source->m_btAdapterAddress); + if(tempPort != "") + { + DebugOut(3)<<"Using bluetooth device \""<m_btDeviceAddress<<"\" bound to: "< config) std::string port = "/dev/ttyUSB0"; std::string baud = "115200"; std::string btadapter = ""; + m_isBluetooth = false; //Try to load config //printf("OBD2Source::setConfiguration\n"); @@ -479,6 +506,9 @@ void OBD2Source::setConfiguration(map config) if(port.find(":") != string::npos) { + m_btDeviceAddress = port; + m_btAdapterAddress = btadapter; + m_isBluetooth = true; ///TODO: bluetooth!! DebugOut()<<"bluetooth device?"< propertyReplyMap; void updateProperty(VehicleProperty::Property property,AbstractPropertyType *value); obdLib * obd;