option(bluemonkey_plugin "bluemonkey irc plugin" OFF)
option(gpsnmea_plugin "gps NMEA location plugin" OFF)
option(openxc_plugin "OpenXC plugin" OFF)
-option(obdlinkcan_plugin "ObdLink mx CAN plugin" OFF)
+option(bluetooth_plugin "bluetooth plugin" OFF)
option(cansim_plugin "Can simulator plugin" OFF)
option(cangen_plugin "Can generator plugin" OFF)
option(enable_icecc "Enable icecc checking, for distributed compilation" ON)
add_subdirectory(bluemonkey)
add_subdirectory(gpsnmea)
add_subdirectory(openxc)
+add_subdirectory(bluetooth)
add_subdirectory(cansimplugin)
add_subdirectory(cangenplugin)
--- /dev/null
+if(bluetooth_plugin)
+
+set(bluetooth_headers bluetoothplugin.h)
+set(bluetooth_sources bluetoothplugin.cpp )
+
+find_package(Qt5Core REQUIRED)
+find_package(Qt5DBus REQUIRED)
+find_package(Qt5Network REQUIRED)
+
+message(STATUS ${Qt5DBus_INCLUDE_DIRS})
+
+set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
+set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES})
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+add_definitions(${Qt5Core_DEFINITIONS})
+
+set(CMAKE_AUTOMOC ON)
+
+include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${gio_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/plugins/common ${QT_INCLUDE_DIRS})
+
+add_library(bluetoothplugin MODULE ${bluetooth_sources})
+set_target_properties(bluetoothplugin PROPERTIES PREFIX "")
+target_link_libraries(bluetoothplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common ${link_libraries} ${gio_LIBRARIES} ${QT_LIBRARIES})
+
+install(TARGETS bluetoothplugin LIBRARY DESTINATION lib/automotive-message-broker)
+
+add_executable(testAmbBt "testAmbBt.cpp")
+target_link_libraries(testAmbBt ${link_libraries} amb -L${CMAKE_CURRENT_BINARY_DIR}/lib amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common ${QT_LIBRARIES})
+
+endif(bluetooth_plugin)
--- /dev/null
+/*
+Copyright (C) 2012 Intel Corporation
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "bluetoothplugin.h"
+#include "timestamp.h"
+#include "listplusplus.h"
+
+#include <iostream>
+#include <boost/assert.hpp>
+#include <boost/lexical_cast.hpp>
+#include <glib.h>
+
+#include <QDBusConnection>
+#include <QDBusInterface>
+
+using namespace std;
+
+#include "debugout.h"
+
+BluetoothSinkPlugin::BluetoothSinkPlugin(AbstractRoutingEngine* re, map<string, string> config)
+:AbstractSink(re, config)
+{
+ new BtProfileAdaptor(this);
+
+ QDBusConnection::systemBus().registerObject("/org/bluez/spp", this);
+}
+
+
+
+extern "C" AbstractSink * create(AbstractRoutingEngine* routingengine, map<string, string> config)
+{
+ return new BluetoothSinkPlugin(routingengine, config);
+
+}
+
+const string BluetoothSinkPlugin::uuid()
+{
+ return "47ec4ed0-dc45-11e3-9c1a-0800200c9a66";
+}
+
+void BluetoothSinkPlugin::propertyChanged(AbstractPropertyType *value)
+{
+
+}
+
+void BluetoothSinkPlugin::release()
+{
+ DebugOut()<<"release called."<<endl;
+}
+
+void BluetoothSinkPlugin::newConnection(string path, int fd, QVariantMap props)
+{
+ DebugOut()<<"new Connection! Path: "<<path<<endl;
+
+ socket.setSocketDescriptor(fd);
+
+ connect(&socket, &QTcpSocket::readyRead, this, &BluetoothSinkPlugin::canHasData);
+}
+
+void BluetoothSinkPlugin::requestDisconnection(string path)
+{
+ DebugOut()<<"requestDisconnection called. Path: "<<path<<endl;
+ socket.close();
+}
+
+void BluetoothSinkPlugin::canHasData()
+{
+ QByteArray data = socket.readAll();
+
+ DebugOut()<<"data read: "<<data.constData()<<endl;
+}
+
+BtProfileAdaptor::BtProfileAdaptor(BluetoothSinkPlugin *parent)
+ :QDBusAbstractAdaptor(parent), mParent(parent)
+{
+ QDBusInterface profileManagerIface("org.bluez", "/org/bluez", "org.bluez.ProfileManager1", QDBusConnection::systemBus());
+
+ QVariantMap options;
+ options["Name"] = "spp";
+ options["Role"] = "server";
+
+ profileManagerIface.call("RegisterProfile", "/org/bluez/spp", "00001101-0000-1000-8000-00805F9B34FB", options);
+}
+
+void BtProfileAdaptor::Release()
+{
+ mParent->release();
+}
+
+void BtProfileAdaptor::NewConnection(QDBusObjectPath device, int fd, QVariantMap fd_properties)
+{
+ mParent->newConnection(device.path().toStdString(), fd, fd_properties);
+}
+
+void BtProfileAdaptor::RequestDisconnection(QDBusObjectPath device)
+{
+ mParent->requestDisconnection(device.path().toStdString());
+}
--- /dev/null
+/*
+Copyright (C) 2012 Intel Corporation
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef BT_PLUGIN_H_
+#define BT_PLUGIN_H_
+
+#include <abstractsink.h>
+#include <string>
+
+#include <QDBusAbstractAdaptor>
+#include <QDBusObjectPath>
+#include <QVariantMap>
+#include <QTcpSocket>
+
+class BluetoothSinkPlugin;
+
+class BtProfileAdaptor : public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.bluez.Profile1")
+
+public:
+
+ BtProfileAdaptor(BluetoothSinkPlugin* parent);
+
+public Q_SLOTS:
+
+ void Release();
+
+ void NewConnection(QDBusObjectPath device, int fd, QVariantMap fd_properties);
+
+ void RequestDisconnection(QDBusObjectPath device);
+
+private:
+
+ BluetoothSinkPlugin* mParent;
+
+};
+
+class BluetoothSinkPlugin: public QObject, public AbstractSink
+{
+Q_OBJECT
+
+public:
+ BluetoothSinkPlugin(AbstractRoutingEngine* re, map<string, string> config);
+
+ const string uuid();
+
+ void supportedChanged(const PropertyList &) {}
+
+ void propertyChanged(AbstractPropertyType* value);
+
+ void release();
+
+ void newConnection(std::string path, int fd, QVariantMap props);
+
+ void requestDisconnection(std::string path);
+
+private Q_SLOTS:
+ void canHasData();
+
+private:
+ QTcpSocket socket;
+};
+
+
+
+#endif // EXAMPLEPLUGIN_H
--- /dev/null
+#include <bluetooth.hpp>
+#include <debugout.h>
+#include <QFile>
+#include <QCoreApplication>
+#include <QJsonDocument>
+#include <QStringList>
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+
+ QString addy = app.arguments().at(1);
+
+ BluetoothDevice dev;
+ std::string devPath = dev.getDeviceForAddress(addy.toStdString());
+
+ QFile f(devPath.c_str());
+ f.open(QIODevice::ReadWrite);
+
+ QObject::connect(&f, &QFile::readyRead, [&f](){
+ QByteArray d = f.readAll();
+
+ DebugOut(DebugOut::Warning)<<"Data read: "<<d.constData()<<endl;
+ });
+
+
+ return app.exec();
+}
-#ifndef OBDBLUETOOTH
-#define OBDBLUETOOTH
+#ifndef BLUETOOTHWRAPPER
+#define BLUETOOTHWRAPPER
#include <string>
+#include <debugout.h>
+
#include "bluetoothmanagerproxy.h"
#include "bluetoothadapterproxy.h"
#include "bluetoothserialproxy.h"
addPropertySupport(VehicleProperty::Direction, Zone::None);
addPropertySupport(GPSTIME, Zone::None);
-
///test:
if(config.find("test") != config.end())
+++ /dev/null
-if(obdlinkcan_plugin)
-
-set(obdlinkcan_headers obdlinkcan.h obdlinkmx.h)
-set(obdlinkcan_sources obdlinkcan.cpp obdlinkmx.cpp)
-
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${gio_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/plugins/common)
-
-add_library(obdlinkcan MODULE ${obdlinkcan_sources})
-set_target_properties(obdlinkcan PROPERTIES PREFIX "")
-target_link_libraries(obdlinkcan amb -L${CMAKE_CURRENT_BINARY_DIR}/lib amb-plugins-common -L${CMAKE_CURRENT_BINARY_DIR}/plugins/common ${link_libraries} boost_regex ${gio_LIBRARIES})
-
-install(TARGETS obdlinkcan LIBRARY DESTINATION lib/automotive-message-broker)
-
-endif(obdlinkcan_plugin)
+++ /dev/null
-/*
-Copyright (C) 2012 Intel Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "obdlinkcan.h"
-#include "timestamp.h"
-#include "listplusplus.h"
-
-#include <iostream>
-#include <boost/assert.hpp>
-#include <glib.h>
-
-using namespace std;
-
-#include "debugout.h"
-
-
-ObdLinkCAN::ObdLinkCAN(AbstractRoutingEngine* re, map<string, string> config)
-:AbstractSource(re, config), velocity(0), engineSpeed(0)
-{
- debugOut("setting timeout");
- g_timeout_add(1000, timeoutCallback, this );
-
- addPropertySupport(VehicleProperty::EngineSpeed, Zone::None);
- addPropertySupport(VehicleProperty::VehicleSpeed, Zone::None);
- addPropertySupport(VehicleProperty::AccelerationX, Zone::None);
- addPropertySupport(VehicleProperty::TransmissionShiftPosition, Zone::None);
- addPropertySupport(VehicleProperty::SteeringWheelAngle, Zone::None);
- addPropertySupport(VehicleProperty::ThrottlePosition, Zone::None);
- addPropertySupport(VehicleProperty::EngineCoolantTemperature, Zone::None);
- addPropertySupport(VehicleProperty::VIN, Zone::None);
- addPropertySupport(VehicleProperty::WMI, Zone::None);
- addPropertySupport(VehicleProperty::BatteryVoltage, Zone::None);
- addPropertySupport(VehicleProperty::MachineGunTurretStatus, Zone::None);
- addPropertySupport(VehicleProperty::ExteriorBrightness, Zone::None);
- addPropertySupport(VehicleProperty::DoorsPerRow, Zone::None);
- addPropertySupport(VehicleProperty::AirbagStatus, Zone::None);
-
- Zone::ZoneList airbagZones;
- airbagZones.push_back(Zone::FrontLeft | Zone::FrontSide);
- airbagZones.push_back(Zone::FrontRight | Zone::FrontSide);
- airbagZones.push_back(Zone::RearLeft | Zone::LeftSide);
- airbagZones.push_back(Zone::RearRight | Zone::RightSide);
-
- airbagStatus[Zone::FrontLeft | Zone::FrontSide] = Airbag::Active;
- airbagStatus[Zone::FrontRight | Zone::FrontSide] = Airbag::Inactive;
- airbagStatus[Zone::RearLeft | Zone::LeftSide] = Airbag::Deployed;
- airbagStatus[Zone::RearRight | Zone::RightSide] = Airbag::Deployed;
-
- PropertyInfo airbagInfo(0,airbagZones);
-
- propertyInfoMap[VehicleProperty::AirbagStatus] = airbagInfo;
-
- addPropertySupport(VehicleProperty::AirConditioning, Zone::None);
-
- Zone::ZoneList acZones;
- acZones.push_back(Zone::FrontLeft);
- acZones.push_back(Zone::Front | Zone::Right);
-
- acStatus[Zone::Front | Zone::Left] = true;
- acStatus[Zone::Front | Zone::Right] = false;
-
- PropertyInfo acInfo(0,acZones);
- propertyInfoMap[VehicleProperty::AirConditioning] = acInfo;
-
- re->setSupported(supported(), this);
-}
-
-
-
-extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config)
-{
- return new ObdLinkCAN(routingengine, config);
-
-}
-
-const string ObdLinkCAN::uuid()
-{
- return "6dd4268a-c605-4a06-9034-59c1e8344c8e";
-}
-
-
-void ObdLinkCAN::getPropertyAsync(AsyncPropertyReply *reply)
-{
- DebugOut()<<"ExampleSource: getPropertyAsync called for property: "<<reply->property<<endl;
-
-
-
- if(reply->property == VehicleProperty::VehicleSpeed)
- {
- VehicleProperty::VehicleSpeedType temp(velocity);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::EngineSpeed)
- {
- VehicleProperty::EngineSpeedType temp(engineSpeed);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::AccelerationX)
- {
- VehicleProperty::AccelerationXType temp(accelerationX);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::TransmissionShiftPosition)
- {
- VehicleProperty::TransmissionShiftPositionType temp(transmissionShiftPostion);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::SteeringWheelAngle)
- {
- VehicleProperty::SteeringWheelAngleType temp(steeringWheelAngle);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::VIN)
- {
- VehicleProperty::VINType temp("ABC00000000000000");
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::WMI)
- {
- VehicleProperty::WMIType temp("abc");
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::BatteryVoltage)
- {
- VehicleProperty::BatteryVoltageType temp(12.6);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::ExteriorBrightness)
- {
- VehicleProperty::ExteriorBrightnessType temp(1000);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::DoorsPerRow)
- {
- VehicleProperty::DoorsPerRowType temp;
-
- BasicPropertyType<uint16_t> row1(2);
- BasicPropertyType<uint16_t> row2(2);
- BasicPropertyType<uint16_t> row3(1);
-
- temp.append(&row1);
- temp.append(&row2);
- temp.append(&row3);
-
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::AirbagStatus)
- {
- if(airbagStatus.find(reply->zoneFilter) == airbagStatus.end())
- {
- reply->success = false;
- reply->error = AsyncPropertyReply::ZoneNotSupported;
- reply->completed(reply);
- }
-
- else
- {
-
- VehicleProperty::AirbagStatusType temp;
- temp.setValue(airbagStatus[reply->zoneFilter]);
- temp.zone = reply->zoneFilter;
-
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- }
- else if(reply->property == VehicleProperty::MachineGunTurretStatus)
- {
- VehicleProperty::MachineGunTurretStatusType temp(true);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::ThrottlePosition)
- {
- VehicleProperty::ThrottlePositionType temp(throttlePos);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::EngineCoolantTemperature)
- {
- VehicleProperty::EngineCoolantTemperatureType temp(engineCoolant);
- reply->value = &temp;
- reply->success = true;
- reply->completed(reply);
- }
- else if(reply->property == VehicleProperty::AirbagStatus)
- {
- if(airbagStatus.find(reply->zoneFilter) == airbagStatus.end())
- {
- reply->success = false;
- reply->error = AsyncPropertyReply::ZoneNotSupported;
- reply->completed(reply);
- }
- else
- {
- VehicleProperty::AirbagStatusType temp(airbagStatus[reply->zoneFilter]);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- }
- else if(reply->property == VehicleProperty::AirConditioning)
- {
- if(acStatus.find(reply->zoneFilter) == acStatus.end())
- {
- reply->success = false;
- reply->error = AsyncPropertyReply::ZoneNotSupported;
- reply->completed(reply);
- }
- else
- {
- VehicleProperty::AirConditioningType temp(acStatus[reply->zoneFilter]);
- reply->success = true;
- reply->value = &temp;
- reply->completed(reply);
- }
- }
-
- else
- {
- reply->success=false;
- reply->error = AsyncPropertyReply::InvalidOperation;
- reply->completed(reply);
- }
-}
-
-void ObdLinkCAN::getRangePropertyAsync(AsyncRangePropertyReply *reply)
-{
-
-}
-
-AsyncPropertyReply *ObdLinkCAN::setProperty(AsyncSetPropertyRequest request )
-{
- AsyncPropertyReply *reply = new AsyncPropertyReply(request);
-
- if(reply->property == VehicleProperty::AirConditioning)
- {
- if(acStatus.find(reply->zoneFilter) == acStatus.end())
- {
- reply->success = false;
- reply->error = AsyncPropertyReply::ZoneNotSupported;
- reply->completed(reply);
- }
- else
- {
- acStatus[reply->zoneFilter] = reply->value->value<bool>();
-
- ///we need to update subscribers of this change:
- routingEngine->updateProperty(reply->value,uuid());
-
- ///Now reply to the set request:
- reply->success = true;
- reply->completed(reply);
-
- }
- }
-}
-
-void ObdLinkCAN::subscribeToPropertyChanges(VehicleProperty::Property property)
-{
- mRequests.push_back(property);
-}
-
-PropertyList ObdLinkCAN::supported()
-{
- return mSupported;
-}
-
-int ObdLinkCAN::supportedOperations()
-{
- return Get | Set | GetRanged;
-}
-
-void ObdLinkCAN::unsubscribeToPropertyChanges(VehicleProperty::Property property)
-{
- if(contains(mRequests,property))
- mRequests.remove(property);
-}
-
-void ObdLinkCAN::randomizeProperties()
-{
- velocity = 1 + (255.00 * (rand() / (RAND_MAX + 1.0)));
- engineSpeed = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
- accelerationX = 1 + (15000.00 * (rand() / (RAND_MAX + 1.0)));
- transmissionShiftPostion = Transmission::TransmissionPositions(1 + (6.00 * (rand() / (RAND_MAX + 1.0))));
- steeringWheelAngle = 1 + (359.00 * (rand() / (RAND_MAX + 1.0)));
- throttlePos = 1 + (100.00 * (rand() / (RAND_MAX + 1.0)));
- engineCoolant = 1 + (40.00 * (rand() / (RAND_MAX + 140.0)));
-
- DebugOut()<<"setting velocity to: "<<velocity<<endl;
- DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;
-
- VehicleProperty::VehicleSpeedType vel(velocity);
- VehicleProperty::EngineSpeedType es(engineSpeed);
- VehicleProperty::AccelerationXType ac(accelerationX);
- VehicleProperty::SteeringWheelAngleType swa(steeringWheelAngle);
- VehicleProperty::TransmissionShiftPositionType tsp(transmissionShiftPostion);
- VehicleProperty::ThrottlePositionType tp(throttlePos);
- VehicleProperty::EngineCoolantTemperatureType ec(engineCoolant);
- VehicleProperty::MachineGunTurretStatusType mgt(machineGun);
-
- machineGun = !machineGun;
-
- routingEngine->updateProperty(&vel, uuid());
- routingEngine->updateProperty(&es, uuid());
- routingEngine->updateProperty(&ac, uuid());
- routingEngine->updateProperty(&swa, uuid());
- routingEngine->updateProperty(&tsp, uuid());
- routingEngine->updateProperty(&tp, uuid());
- routingEngine->updateProperty(&ec, uuid());
-
-}
-
-void ObdLinkCAN::addPropertySupport(VehicleProperty::Property property, Zone::Type zone)
-{
- mSupported.push_back(property);
-
- std::list<Zone::Type> zones;
-
- zones.push_back(zone);
-
- PropertyInfo info(0, zones);
-
- propertyInfoMap[property] = info;
-}
+++ /dev/null
-/*
-Copyright (C) 2012 Intel Corporation
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef ObdLinkCANPLUGIN_H
-#define ObdLinkCANPLUGIN_H
-
-#include <abstractsource.h>
-#include <string>
-
-using namespace std;
-
-class ObdLinkCAN: public AbstractSource
-{
-
-public:
- ObdLinkCAN(AbstractRoutingEngine* re, map<string, string> config);
-
- const string uuid();
- void getPropertyAsync(AsyncPropertyReply *reply);
- void getRangePropertyAsync(AsyncRangePropertyReply *reply);
- AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
- void subscribeToPropertyChanges(VehicleProperty::Property property);
- void unsubscribeToPropertyChanges(VehicleProperty::Property property);
- PropertyList supported();
-
- int supportedOperations();
-
- void supportedChanged(PropertyList) {}
-
- void randomizeProperties();
-
- PropertyInfo getPropertyInfo(VehicleProperty::Property property)
- {
- if(propertyInfoMap.find(property) != propertyInfoMap.end())
- return propertyInfoMap[property];
-
- return PropertyInfo::invalid();
- }
-
-private:
-
- void addPropertySupport(VehicleProperty::Property property, Zone::Type zone);
-
- std::map<VehicleProperty::Property, PropertyInfo> propertyInfoMap;
- std::map<Zone::Type, Airbag::Status> airbagStatus;
- std::map<Zone::Type, bool> acStatus;
- PropertyList mRequests;
- PropertyList mSupported;
- uint16_t velocity;
- uint16_t engineSpeed;
-};
-
-#endif // ObdLinkCANPLUGIN_H
+++ /dev/null
-#include "obdlinkmx.h"
+++ /dev/null
-#ifndef ObdLinkMx_H_
-#define ObdLinkMx_H_
-
-#include <string>
-
-
-class ObdLinkMx
-{
-public:
- enum Protocol{
- J1850PWM = 11,
- J1850VPW = 12,
- ISO9141 = 21,
- ISO9141_2 = 22,
- ISO14230 = 23,
- ISO14230_autoinit = 24,
- ISO14230_fastautoinit = 24,
- HSCAN_ISO11898_11bit_500kbps_varDLC = 31,
- HSCAN_ISO11898_29bit_500kbps_varDLC = 32,
- HSCAN_ISO15765_11bit_500kbps_DLC8 = 33,
- HSCAN_ISO15765_29bit_500kbps_DLC8 = 34,
- HSCAN_ISO15765_11bit_250kbps_DLC8 = 35,
- HSCAN_ISO15765_29bit_250kbps_DLC8 = 36,
- J1939_11bit = 41,
- J1939_29bit = 42,
- MSCAN_ISO11898_11bit_125kbps_varDLC = 51,
- MSCAN_ISO11898_29bit_125kbps_varDLC = 52,
- MSCAN_ISO15765_11bit_125kbps_DLC8 = 53,
- MSCAN_ISO15765_29bit_125kbps_DLC8 = 54,
- SWCAN_ISO11898_11bit_33kbps_varDLC = 61,
- SWCAN_ISO11898_29bit_33kbps_varDLC = 62,
- SWCAN_ISO15765_11bit_33kbps_DLC8 = 63,
- SWCAN_ISO15765_29bit_33kbps_DLC8 = 64
- };
-
- enum SWCanMode {
- Sleep = 0,
- HighSpeed,
- Wakeup,
- Normal
- };
-
- ObdLinkMx();
-
- void connect();
- void disconnect();
-
- void setProtocol(Protocol protocol);
-
- Protocol protocol();
-
- std::string protocolString();
-
- void setSwCanMode(SWCanMode mode);
-
- void monitor();
-};
-
-
-#endif //ObdLinkMx_H_