diff options
author | Kevron Rees <kevron.m.rees@intel.com> | 2015-03-27 11:27:19 -0700 |
---|---|---|
committer | Kevron Rees <kevron.m.rees@intel.com> | 2015-03-27 11:27:19 -0700 |
commit | 2f8cb4b816668efb700b71f964cc6e4ef5366e5a (patch) | |
tree | bc811dcfb33940318a857bc0b69f36c5677439bf | |
parent | e522964356e3d2e7f0f9be632fa478cbd1e59c77 (diff) | |
download | automotive-message-broker-2f8cb4b816668efb700b71f964cc6e4ef5366e5a.tar.gz |
Fix license
-rw-r--r-- | README.md | 24 | ||||
-rw-r--r-- | plugins/cangenplugin/test/main.cpp | 90 | ||||
-rw-r--r-- | plugins/cangenplugin/test/ut_cangenplugin.cpp | 506 | ||||
-rw-r--r-- | plugins/common/canbus.h | 116 | ||||
-rw-r--r-- | plugins/common/canobserver.h | 118 | ||||
-rw-r--r-- | plugins/common/cansocketadapter.cpp | 104 | ||||
-rw-r--r-- | plugins/common/cansocketadapter.h | 124 | ||||
-rw-r--r-- | tools/AmbSignalMapper/lib/Intel/IviPoc/AmbCommon.pm | 179 | ||||
-rw-r--r-- | tools/AmbSignalMapper/lib/Intel/IviPoc/AmbPluginGenerator.pm | 890 | ||||
-rw-r--r-- | tools/AmbSignalMapper/lib/Intel/IviPoc/DbcGrammar.pod | 49 |
10 files changed, 1063 insertions, 1137 deletions
@@ -47,32 +47,10 @@ ambd For information on ambd's configuration, please see ambd-configuration.idl. -## Packaging - -To generate packaging, you must first run cmake to generate the necessary packaging files: - -~~~~~~~~~~~~~{.bash} -mkdir build -cd build && cmake .. -cd .. -~~~~~~~~~~~~~ - -After running cmake, to create a debian package run: - -~~~~~~~~~~~~~{.bash} -debuild -~~~~~~~~~~~~~ - -To create an RPM package, run: - -~~~~~~~~~~~~~{.bash} -rpmbuild [options] packaging/automotive-message-broker.spec -~~~~~~~~~~~~~ - ## Running with the Qt mainloop: Some source and sink plugins may want to use the Qt-based mainloop to take advantage of Qt features. To enable -the Qt mainloop, run cmake with -Dqtmainloop=On: +the Qt mainloop, run cmake with -Duse_qtcore=On: ~~~~~~~~~~~~~{.bash} cmake .. -Dqtmainloop=On diff --git a/plugins/cangenplugin/test/main.cpp b/plugins/cangenplugin/test/main.cpp index 8e870abc..301510d1 100644 --- a/plugins/cangenplugin/test/main.cpp +++ b/plugins/cangenplugin/test/main.cpp @@ -1,73 +1,67 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 <glib-object.h> #include <CppUTest/CommandLineTestRunner.h> #include "logger.h" struct ThreadData{ - int argc; - char** argv; - int testResult; - GMainLoop* mainLoop; + int argc; + char** argv; + int testResult; + GMainLoop* mainLoop; }; static void* tests_thread(void *data) { - ThreadData* td = static_cast<ThreadData*>(data); - if(td){ - td->testResult = CommandLineTestRunner::RunAllTests(td->argc, td->argv); - g_main_loop_quit(td->mainLoop); - } - return td; + ThreadData* td = static_cast<ThreadData*>(data); + if(td){ + td->testResult = CommandLineTestRunner::RunAllTests(td->argc, td->argv); + g_main_loop_quit(td->mainLoop); + } + return td; } int main(int ac, char **av) { - ThreadData td; - td.argc = ac; - td.argv = av; - td.testResult = 0; + ThreadData td; + td.argc = ac; + td.argv = av; + td.testResult = 0; - DEBUG_CONF("ut_cangenplugin", + DEBUG_CONF("ut_cangenplugin", #ifdef _DEBUG - CUtil::Logger::file_on|CUtil::Logger::screen_on, + CUtil::Logger::file_on|CUtil::Logger::screen_on, #else - CUtil::Logger::file_on|CUtil::Logger::screen_off, + CUtil::Logger::file_on|CUtil::Logger::screen_off, #endif - CUtil::Logger::EInfo, CUtil::Logger::EWarning); + CUtil::Logger::EInfo, CUtil::Logger::EWarning); - td.mainLoop = g_main_loop_new(NULL, FALSE); + td.mainLoop = g_main_loop_new(NULL, FALSE); - // Run the mainloop and the tests thread - GThread* testThread = g_thread_new("tests thread", &tests_thread, &td); + // Run the mainloop and the tests thread + GThread* testThread = g_thread_new("tests thread", &tests_thread, &td); - g_main_loop_run(td.mainLoop); - g_thread_join(testThread); + g_main_loop_run(td.mainLoop); + g_thread_join(testThread); - g_main_loop_unref(td.mainLoop); + g_main_loop_unref(td.mainLoop); - return td.testResult; + return td.testResult; } diff --git a/plugins/cangenplugin/test/ut_cangenplugin.cpp b/plugins/cangenplugin/test/ut_cangenplugin.cpp index 76c211c9..2fee3d46 100644 --- a/plugins/cangenplugin/test/ut_cangenplugin.cpp +++ b/plugins/cangenplugin/test/ut_cangenplugin.cpp @@ -1,26 +1,20 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 "logger.h" @@ -39,307 +33,307 @@ typedef void* create_t(AbstractRoutingEngine*, std::map<std::string, std::string class Loader{ public: - Loader() - { - if(lt_dlinit()) - { - cerr<<"error initializing libtool: "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<lt_dlerror()<<endl; - throw std::runtime_error("Error initializing libtool. aborting"); - } - } - - ~Loader() - { - auto handle = openHandles.begin(); - while(handle != openHandles.end()) - lt_dlclose(*handle++); - lt_dlexit(); - } - - template<class T> - T loadPlugin(std::string pluginName, AbstractRoutingEngine* routingEngine, std::map<std::string, std::string> config) - { - DebugOut()<<"Loading plugin: "<<pluginName<<endl; - - lt_dlhandle handle = lt_dlopenext(pluginName.c_str()); - - if(!handle) - { - cerr<<"error opening plugin: "<<pluginName<<" in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<lt_dlerror()<<endl; - return nullptr; - } - - openHandles.push_back(handle); - create_t* f_create = (create_t *)lt_dlsym(handle, "create"); - - //mErrorString = lt_dlerror(); - - if(f_create) - { - void* obj = f_create(routingEngine, config); - return static_cast<T>( obj ); - } - - return nullptr; - } + Loader() + { + if(lt_dlinit()) + { + cerr<<"error initializing libtool: "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<lt_dlerror()<<endl; + throw std::runtime_error("Error initializing libtool. aborting"); + } + } + + ~Loader() + { + auto handle = openHandles.begin(); + while(handle != openHandles.end()) + lt_dlclose(*handle++); + lt_dlexit(); + } + + template<class T> + T loadPlugin(std::string pluginName, AbstractRoutingEngine* routingEngine, std::map<std::string, std::string> config) + { + DebugOut()<<"Loading plugin: "<<pluginName<<endl; + + lt_dlhandle handle = lt_dlopenext(pluginName.c_str()); + + if(!handle) + { + cerr<<"error opening plugin: "<<pluginName<<" in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<lt_dlerror()<<endl; + return nullptr; + } + + openHandles.push_back(handle); + create_t* f_create = (create_t *)lt_dlsym(handle, "create"); + + //mErrorString = lt_dlerror(); + + if(f_create) + { + void* obj = f_create(routingEngine, config); + return static_cast<T>( obj ); + } + + return nullptr; + } private: - std::vector<lt_dlhandle> openHandles; + std::vector<lt_dlhandle> openHandles; }; class TestCANGenPluginImpl : public CANGenPlugin { public: - TestCANGenPluginImpl(AbstractRoutingEngine* re, map<string, string> config, AbstractSource& parent) : - CANGenPlugin(re, config, parent) - { - mock().actualCall("CANGenPlugin::CANGenPlugin"); - } - - virtual ~TestCANGenPluginImpl() - { - mock().actualCall("CANGenPlugin::~CANGenPlugin"); - } - - void TestAddPropertyToMappingTable(const char* source, const int can_id, const char* name, const Zone::Type& zone) - { - std::unique_ptr<json_object, decltype(&json_object_put)> prop(json_object_new_object(), &json_object_put); - json_object_object_add(prop.get(), "can_id", json_object_new_int(can_id)); - json_object_object_add(prop.get(), "name", json_object_new_string(name)); - json_object_object_add(prop.get(), "zone", json_object_new_int(static_cast<int>(zone))); - mappingTable.addProperty(source, prop.get()); - } - - inline bool TestSendValue(const string& interface, AbstractPropertyType* value){ return sendValue(interface, value); } - inline void TestSetCanBusInterface(const string& interface){ - interfaces[interface] = std::shared_ptr<CANBus>(new MockCANBus(*this)); - } - inline int getCanId(const std::string& source, const Zone::Type& zone, const VehicleProperty::Property& name){ - return mappingTable.getCanId(source, zone, name); - } - inline bool TestSetAndGetValue(const std::string& property, const std::string& value, int zone, const std::string& interface, const std::string& transactionId) - { - setValue(nullptr, property, value, zone, interface, transactionId); - - getValue(nullptr, property, zone, transactionId); - } + TestCANGenPluginImpl(AbstractRoutingEngine* re, map<string, string> config, AbstractSource& parent) : + CANGenPlugin(re, config, parent) + { + mock().actualCall("CANGenPlugin::CANGenPlugin"); + } + + virtual ~TestCANGenPluginImpl() + { + mock().actualCall("CANGenPlugin::~CANGenPlugin"); + } + + void TestAddPropertyToMappingTable(const char* source, const int can_id, const char* name, const Zone::Type& zone) + { + std::unique_ptr<json_object, decltype(&json_object_put)> prop(json_object_new_object(), &json_object_put); + json_object_object_add(prop.get(), "can_id", json_object_new_int(can_id)); + json_object_object_add(prop.get(), "name", json_object_new_string(name)); + json_object_object_add(prop.get(), "zone", json_object_new_int(static_cast<int>(zone))); + mappingTable.addProperty(source, prop.get()); + } + + inline bool TestSendValue(const string& interface, AbstractPropertyType* value){ return sendValue(interface, value); } + inline void TestSetCanBusInterface(const string& interface){ + interfaces[interface] = std::shared_ptr<CANBus>(new MockCANBus(*this)); + } + inline int getCanId(const std::string& source, const Zone::Type& zone, const VehicleProperty::Property& name){ + return mappingTable.getCanId(source, zone, name); + } + inline bool TestSetAndGetValue(const std::string& property, const std::string& value, int zone, const std::string& interface, const std::string& transactionId) + { + setValue(nullptr, property, value, zone, interface, transactionId); + + getValue(nullptr, property, zone, transactionId); + } }; class TestCANGenPlugin : public AmbPlugin<TestCANGenPluginImpl> { public: - TestCANGenPlugin(AbstractRoutingEngine* re, map<string, string> config) : - AmbPlugin<TestCANGenPluginImpl>(re, config) - { - mock().actualCall("AmbPlugin::AmbPlugin"); - } - - virtual ~TestCANGenPlugin() - { - mock().actualCall("AmbPlugin::~AmbPlugin"); - } - - inline TestCANGenPluginImpl* getImplementation() { return dynamic_cast<TestCANGenPluginImpl*>(d.get()); } + TestCANGenPlugin(AbstractRoutingEngine* re, map<string, string> config) : + AmbPlugin<TestCANGenPluginImpl>(re, config) + { + mock().actualCall("AmbPlugin::AmbPlugin"); + } + + virtual ~TestCANGenPlugin() + { + mock().actualCall("AmbPlugin::~AmbPlugin"); + } + + inline TestCANGenPluginImpl* getImplementation() { return dynamic_cast<TestCANGenPluginImpl*>(d.get()); } }; TEST_GROUP(CANGenPlugin) { - MockAbstractRoutingEngine *routingEngine; - std::map<std::string, std::string> config; - TestCANGenPlugin *plugin; - - void setup() - { - DebugOut::setDebugThreshhold(0); - VehicleProperty::factory(); - routingEngine = new MockAbstractRoutingEngine(); - plugin = nullptr; - mock().expectOneCall("AmbPlugin::AmbPlugin"); - mock().expectOneCall("CANGenPlugin::CANGenPlugin"); - //mock().expectOneCall("CANBus::start").andReturnValue(1); - mock().expectOneCall("AbstractRoutingEngine::setSupported"); - plugin = new TestCANGenPlugin(routingEngine, config); - } - void teardown() - { - //mock().expectOneCall("CANBus::stop"); - mock().expectOneCall("CANGenPlugin::~CANGenPlugin"); - mock().expectOneCall("AmbPlugin::~AmbPlugin"); - if(plugin != nullptr) { - delete plugin; - plugin = nullptr; - } - VehicleProperty::shutdown(); - - delete routingEngine; - routingEngine = nullptr; - - mock().checkExpectations(); - mock().clear(); - } + MockAbstractRoutingEngine *routingEngine; + std::map<std::string, std::string> config; + TestCANGenPlugin *plugin; + + void setup() + { + DebugOut::setDebugThreshhold(0); + VehicleProperty::factory(); + routingEngine = new MockAbstractRoutingEngine(); + plugin = nullptr; + mock().expectOneCall("AmbPlugin::AmbPlugin"); + mock().expectOneCall("CANGenPlugin::CANGenPlugin"); + //mock().expectOneCall("CANBus::start").andReturnValue(1); + mock().expectOneCall("AbstractRoutingEngine::setSupported"); + plugin = new TestCANGenPlugin(routingEngine, config); + } + void teardown() + { + //mock().expectOneCall("CANBus::stop"); + mock().expectOneCall("CANGenPlugin::~CANGenPlugin"); + mock().expectOneCall("AmbPlugin::~AmbPlugin"); + if(plugin != nullptr) { + delete plugin; + plugin = nullptr; + } + VehicleProperty::shutdown(); + + delete routingEngine; + routingEngine = nullptr; + + mock().checkExpectations(); + mock().clear(); + } }; TEST(CANGenPlugin, create) { - //mock().expectOneCall("CANSimPlugin::CANSimPlugin"); - Loader ldr; + //mock().expectOneCall("CANSimPlugin::CANSimPlugin"); + Loader ldr; - mock().expectOneCall("AbstractRoutingEngine::setSupported"); - AbstractSource* myplugin = ldr.loadPlugin<AbstractSource*>("./build/cangenplugin.so", routingEngine, config); - CHECK( myplugin != nullptr); - delete myplugin; + mock().expectOneCall("AbstractRoutingEngine::setSupported"); + AbstractSource* myplugin = ldr.loadPlugin<AbstractSource*>("./build/cangenplugin.so", routingEngine, config); + CHECK( myplugin != nullptr); + delete myplugin; } TEST(CANGenPlugin, uuid) { - std::string uuid = plugin->uuid(); - //CHECK_EQUAL_C_STRING("3f43e231-11ec-4782-9b5a-3dbcc5221eeb", uuid.c_str()); - CHECK(uuid.length() > 0); + std::string uuid = plugin->uuid(); + //CHECK_EQUAL_C_STRING("3f43e231-11ec-4782-9b5a-3dbcc5221eeb", uuid.c_str()); + CHECK(uuid.length() > 0); } TEST(CANGenPlugin, propertyChanged) { - plugin->propertyChanged(nullptr); + plugin->propertyChanged(nullptr); - std::unique_ptr<AbstractPropertyType> value(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::VehicleSpeed, "55")); - value->zone = Zone::None; - value->sourceUuid = plugin->uuid(); + std::unique_ptr<AbstractPropertyType> value(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::VehicleSpeed, "55")); + value->zone = Zone::None; + value->sourceUuid = plugin->uuid(); - plugin->propertyChanged(value.get()); + plugin->propertyChanged(value.get()); - value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{}")); - plugin->propertyChanged(value.get()); + value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{}")); + plugin->propertyChanged(value.get()); } TEST(CANGenPlugin, parseMappingTable) { - std::unique_ptr<AbstractPropertyType> value(new StringPropertyType("MappingTable", "{")); - plugin->propertyChanged(value.get()); - - value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{ " - "'sources': [ { 'source': { 'guid': '3f43e231-11ec-4782-9b5a-3dbcc5221eeb' }, " - "'signals': [ " - "{ 'can_id': 10, 'name': 'SeatHeater', 'zone': 0 }, " - "{ 'can_id': 11, 'name': 'SeatHeater', 'zone': 2 }, " - "{ 'can_id': 12, 'name': 'SeatHeater', 'zone': 4 }, " - "{ 'can_id': 13, 'name': 'SeatHeater', 'zone': 8 }, " - "{ 'can_id': 14, 'name': 'SeatHeater', 'zone': 16 }, " - "{ 'can_id': 15, 'name': 'SeatHeater', 'zone': 32 }, " - "{ 'can_id': 16, 'name': 'SeatHeater', 'zone': 64 }, " - "{ 'can_id': 17, 'name': 'SeatHeater', 'zone': 128 }, " - "{ 'can_id': 18, 'name': 'SeatHeater', 'zone': 256 }, " - "{ 'can_id': 19, 'name': 'SeatHeater', 'zone': 512 }, " - "{ 'can_id': 20, 'name': 'SeatHeater', 'zone': 5 }, " - "{ 'can_id': 21, 'name': 'SeatHeater', 'zone': 9 }, " - "{ 'can_id': 22, 'name': 'SeatHeater', 'zone': 6 }, " - "{ 'can_id': 23, 'name': 'SeatHeater', 'zone': 10 }, " - "{ 'can_id': 24, 'name': 'SeatHeater', 'zone': 20 }, " - "{ 'can_id': 25, 'name': 'SeatHeater', 'zone': 24 }" - " ] } ] }")); - plugin->propertyChanged(value.get()); - CHECK(20 == plugin->getImplementation()->getCanId( - std::string("3f43e231-11ec-4782-9b5a-3dbcc5221eeb"), - Zone::Type(5), VehicleProperty::Property("SeatHeater"))); - - value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{ " - "'signals': [ " - "{ 'can_id': 10, 'name': 'SeatHeater', 'zone': 0 }, " - "{ 'can_id': 11, 'name': 'SeatHeater', 'zone': 2 }, " - "{ 'can_id': 12, 'name': 'SeatHeater', 'zone': 4 }, " - "{ 'can_id': 13, 'name': 'SeatHeater', 'zone': 8 }, " - "{ 'can_id': 14, 'name': 'SeatHeater', 'zone': 16 }, " - "{ 'can_id': 15, 'name': 'SeatHeater', 'zone': 32 }, " - "{ 'can_id': 16, 'name': 'SeatHeater', 'zone': 64 }, " - "{ 'can_id': 17, 'name': 'SeatHeater', 'zone': 128 }, " - "{ 'can_id': 18, 'name': 'SeatHeater', 'zone': 256 }, " - "{ 'can_id': 19, 'name': 'SeatHeater', 'zone': 512 }, " - "{ 'can_id': 20, 'name': 'SeatHeater', 'zone': 5 }, " - "{ 'can_id': 21, 'name': 'SeatHeater', 'zone': 9 }, " - "{ 'can_id': 22, 'name': 'SeatHeater', 'zone': 6 }, " - "{ 'can_id': 23, 'name': 'SeatHeater', 'zone': 10 }, " - "{ 'can_id': 24, 'name': 'SeatHeater', 'zone': 20 }, " - "{ 'can_id': 25, 'name': 'SeatHeater', 'zone': 24 }" - " ] } ] }")); - plugin->propertyChanged(value.get()); - CHECK(20 != plugin->getImplementation()->getCanId( - std::string("3f43e231-11ec-4782-9b5a-3dbcc5221eeb"), - Zone::Type(5), VehicleProperty::Property("SeatHeater")) - ); + std::unique_ptr<AbstractPropertyType> value(new StringPropertyType("MappingTable", "{")); + plugin->propertyChanged(value.get()); + + value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{ " + "'sources': [ { 'source': { 'guid': '3f43e231-11ec-4782-9b5a-3dbcc5221eeb' }, " + "'signals': [ " + "{ 'can_id': 10, 'name': 'SeatHeater', 'zone': 0 }, " + "{ 'can_id': 11, 'name': 'SeatHeater', 'zone': 2 }, " + "{ 'can_id': 12, 'name': 'SeatHeater', 'zone': 4 }, " + "{ 'can_id': 13, 'name': 'SeatHeater', 'zone': 8 }, " + "{ 'can_id': 14, 'name': 'SeatHeater', 'zone': 16 }, " + "{ 'can_id': 15, 'name': 'SeatHeater', 'zone': 32 }, " + "{ 'can_id': 16, 'name': 'SeatHeater', 'zone': 64 }, " + "{ 'can_id': 17, 'name': 'SeatHeater', 'zone': 128 }, " + "{ 'can_id': 18, 'name': 'SeatHeater', 'zone': 256 }, " + "{ 'can_id': 19, 'name': 'SeatHeater', 'zone': 512 }, " + "{ 'can_id': 20, 'name': 'SeatHeater', 'zone': 5 }, " + "{ 'can_id': 21, 'name': 'SeatHeater', 'zone': 9 }, " + "{ 'can_id': 22, 'name': 'SeatHeater', 'zone': 6 }, " + "{ 'can_id': 23, 'name': 'SeatHeater', 'zone': 10 }, " + "{ 'can_id': 24, 'name': 'SeatHeater', 'zone': 20 }, " + "{ 'can_id': 25, 'name': 'SeatHeater', 'zone': 24 }" + " ] } ] }")); + plugin->propertyChanged(value.get()); + CHECK(20 == plugin->getImplementation()->getCanId( + std::string("3f43e231-11ec-4782-9b5a-3dbcc5221eeb"), + Zone::Type(5), VehicleProperty::Property("SeatHeater"))); + + value = std::unique_ptr<AbstractPropertyType>(new StringPropertyType("MappingTable", "{ " + "'signals': [ " + "{ 'can_id': 10, 'name': 'SeatHeater', 'zone': 0 }, " + "{ 'can_id': 11, 'name': 'SeatHeater', 'zone': 2 }, " + "{ 'can_id': 12, 'name': 'SeatHeater', 'zone': 4 }, " + "{ 'can_id': 13, 'name': 'SeatHeater', 'zone': 8 }, " + "{ 'can_id': 14, 'name': 'SeatHeater', 'zone': 16 }, " + "{ 'can_id': 15, 'name': 'SeatHeater', 'zone': 32 }, " + "{ 'can_id': 16, 'name': 'SeatHeater', 'zone': 64 }, " + "{ 'can_id': 17, 'name': 'SeatHeater', 'zone': 128 }, " + "{ 'can_id': 18, 'name': 'SeatHeater', 'zone': 256 }, " + "{ 'can_id': 19, 'name': 'SeatHeater', 'zone': 512 }, " + "{ 'can_id': 20, 'name': 'SeatHeater', 'zone': 5 }, " + "{ 'can_id': 21, 'name': 'SeatHeater', 'zone': 9 }, " + "{ 'can_id': 22, 'name': 'SeatHeater', 'zone': 6 }, " + "{ 'can_id': 23, 'name': 'SeatHeater', 'zone': 10 }, " + "{ 'can_id': 24, 'name': 'SeatHeater', 'zone': 20 }, " + "{ 'can_id': 25, 'name': 'SeatHeater', 'zone': 24 }" + " ] } ] }")); + plugin->propertyChanged(value.get()); + CHECK(20 != plugin->getImplementation()->getCanId( + std::string("3f43e231-11ec-4782-9b5a-3dbcc5221eeb"), + Zone::Type(5), VehicleProperty::Property("SeatHeater")) + ); } TEST(CANGenPlugin, errorOccured) { - plugin->getImplementation()->errorOccured(static_cast<CANObserver::CANError>(-1)); + plugin->getImplementation()->errorOccured(static_cast<CANObserver::CANError>(-1)); - CANObserver::CANError error(CANObserver::GENERAL_ERROR); - plugin->getImplementation()->errorOccured(error); + CANObserver::CANError error(CANObserver::GENERAL_ERROR); + plugin->getImplementation()->errorOccured(error); } TEST(CANGenPlugin, standardFrameReceived) { - can_frame frame; - memset(&frame, 0, sizeof(frame)); - frame.can_id = 0x00a; - plugin->getImplementation()->standardFrameReceived(frame); + can_frame frame; + memset(&frame, 0, sizeof(frame)); + frame.can_id = 0x00a; + plugin->getImplementation()->standardFrameReceived(frame); } TEST(CANGenPlugin, extendedFrameReceived) { - can_frame frame; - memset(&frame, 0, sizeof(frame)); - plugin->getImplementation()->extendedFrameReceived(frame); + can_frame frame; + memset(&frame, 0, sizeof(frame)); + plugin->getImplementation()->extendedFrameReceived(frame); } TEST(CANGenPlugin, errorFrameReceived) { - can_frame frame; - memset(&frame, 0, sizeof(frame)); - plugin->getImplementation()->errorFrameReceived(frame); + can_frame frame; + memset(&frame, 0, sizeof(frame)); + plugin->getImplementation()->errorFrameReceived(frame); } TEST(CANGenPlugin, remoteTransmissionRequest) { - can_frame frame; - memset(&frame, 0, sizeof(frame)); - plugin->getImplementation()->remoteTransmissionRequest(frame); + can_frame frame; + memset(&frame, 0, sizeof(frame)); + plugin->getImplementation()->remoteTransmissionRequest(frame); } TEST(CANGenPlugin, sendValue) { - plugin->getImplementation()->TestSetCanBusInterface("vcan98"); - CHECK(plugin->getImplementation()->TestSendValue("vcan98", nullptr) == false); - - std::unique_ptr<AbstractPropertyType> value(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::DoorsPerRow, "[2,2]")); - CHECK(plugin->getImplementation()->TestSendValue("vcan98", value.get()) == false); - - plugin->getImplementation()->TestAddPropertyToMappingTable(plugin->uuid().c_str(), 0xA, VehicleProperty::VehicleSpeed.c_str(), Zone::None); - value = std::unique_ptr<AbstractPropertyType>(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::VehicleSpeed, "55")); - value->zone = Zone::None; - value->sourceUuid = plugin->uuid(); - plugin->getImplementation()->TestSetCanBusInterface("vcan98"); - mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(0); - CHECK(plugin->getImplementation()->TestSendValue("vcan98", value.get()) == false); - - plugin->getImplementation()->TestSetCanBusInterface("vcan99"); - mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(1); - CHECK(plugin->getImplementation()->TestSendValue("vcan99", value.get()) == true); - mock().expectNCalls(2,"CANBus::stop"); + plugin->getImplementation()->TestSetCanBusInterface("vcan98"); + CHECK(plugin->getImplementation()->TestSendValue("vcan98", nullptr) == false); + + std::unique_ptr<AbstractPropertyType> value(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::DoorsPerRow, "[2,2]")); + CHECK(plugin->getImplementation()->TestSendValue("vcan98", value.get()) == false); + + plugin->getImplementation()->TestAddPropertyToMappingTable(plugin->uuid().c_str(), 0xA, VehicleProperty::VehicleSpeed.c_str(), Zone::None); + value = std::unique_ptr<AbstractPropertyType>(VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::VehicleSpeed, "55")); + value->zone = Zone::None; + value->sourceUuid = plugin->uuid(); + plugin->getImplementation()->TestSetCanBusInterface("vcan98"); + mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(0); + CHECK(plugin->getImplementation()->TestSendValue("vcan98", value.get()) == false); + + plugin->getImplementation()->TestSetCanBusInterface("vcan99"); + mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(1); + CHECK(plugin->getImplementation()->TestSendValue("vcan99", value.get()) == true); + mock().expectNCalls(2,"CANBus::stop"); } TEST(CANGenPlugin, SetAndGetValue) { - plugin->getImplementation()->TestSetCanBusInterface("vcan0"); - mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(1); - plugin->getImplementation()->TestAddPropertyToMappingTable(CANSimPluginUUID, 0xA, VehicleProperty::VehicleSpeed.c_str(), Zone::None); - plugin->getImplementation()->TestSetAndGetValue(VehicleProperty::VehicleSpeed, "33", 0, "vcan0", "trans1"); - mock().expectOneCall("CANBus::stop"); + plugin->getImplementation()->TestSetCanBusInterface("vcan0"); + mock().expectOneCall("CANBus::sendExtendedFrame").andReturnValue(1); + plugin->getImplementation()->TestAddPropertyToMappingTable(CANSimPluginUUID, 0xA, VehicleProperty::VehicleSpeed.c_str(), Zone::None); + plugin->getImplementation()->TestSetAndGetValue(VehicleProperty::VehicleSpeed, "33", 0, "vcan0", "trans1"); + mock().expectOneCall("CANBus::stop"); } TEST(CANGenPlugin, dataReceived) { - const char *get = R"({"type":"method","name":"get","transactionid":"862bb93d-a302-9a58-baa9-d90265ac843c","data":[{"property":"VehicleSpeed","zone":"0"}]})"; - plugin->getImplementation()->dataReceived(nullptr, get, strlen(get)); - const char *set = R"({"type":"method","name":"set","transactionid":"d5935c94-7b05-fd67-56bc-31c320185035","data":[{"interface":"vcan0","property":"VehicleSpeed","value":"33","zone":"0"}]})"; - plugin->getImplementation()->dataReceived(nullptr, set, strlen(set)); + const char *get = R"({"type":"method","name":"get","transactionid":"862bb93d-a302-9a58-baa9-d90265ac843c","data":[{"property":"VehicleSpeed","zone":"0"}]})"; + plugin->getImplementation()->dataReceived(nullptr, get, strlen(get)); + const char *set = R"({"type":"method","name":"set","transactionid":"d5935c94-7b05-fd67-56bc-31c320185035","data":[{"interface":"vcan0","property":"VehicleSpeed","value":"33","zone":"0"}]})"; + plugin->getImplementation()->dataReceived(nullptr, set, strlen(set)); } diff --git a/plugins/common/canbus.h b/plugins/common/canbus.h index b34f62d4..319c856a 100644 --- a/plugins/common/canbus.h +++ b/plugins/common/canbus.h @@ -1,26 +1,20 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 CANBUS_H #define CANBUS_H @@ -41,47 +35,47 @@ class CANBus { public: - /** - * @param observer Object derived from #CANObserver that will receive CAN bus frames - */ - CANBus(CANObserver& observer); - virtual ~CANBus(); + /** + * @param observer Object derived from #CANObserver that will receive CAN bus frames + */ + CANBus(CANObserver& observer); + virtual ~CANBus(); - /** - * Starts the CAN bus instance on the specified interface - * @fn start - * @param name Name of the CAN bus network interface - * @return True if no error occurs. - */ - virtual bool start(const char* name); - /** - * Stops the CAN bus instance - * @fn stop - */ - virtual void stop(); - /** - * Sends standard(11bit) CAN frame over the bus - * @fn sendStandardFrame - * @param frame CAN frame to be sent - * @return True if frame was sent - */ - virtual bool sendStandardFrame(const can_frame& frame); - /** - * Sends extended(29bit) CAN frame over the bus - * @fn sendExtendedFrame - * @param frame CAN frame to be sent - * @return True if frame was sent - */ - virtual bool sendExtendedFrame(const can_frame& frame); + /** + * Starts the CAN bus instance on the specified interface + * @fn start + * @param name Name of the CAN bus network interface + * @return True if no error occurs. + */ + virtual bool start(const char* name); + /** + * Stops the CAN bus instance + * @fn stop + */ + virtual void stop(); + /** + * Sends standard(11bit) CAN frame over the bus + * @fn sendStandardFrame + * @param frame CAN frame to be sent + * @return True if frame was sent + */ + virtual bool sendStandardFrame(const can_frame& frame); + /** + * Sends extended(29bit) CAN frame over the bus + * @fn sendExtendedFrame + * @param frame CAN frame to be sent + * @return True if frame was sent + */ + virtual bool sendExtendedFrame(const can_frame& frame); - class Impl; + class Impl; protected: - /** - * CANBus class private implementation - * @property d - * @protected - */ - Impl* d; + /** + * CANBus class private implementation + * @property d + * @protected + */ + Impl* d; }; #endif // CANBUS_H diff --git a/plugins/common/canobserver.h b/plugins/common/canobserver.h index cf4b4e4f..0518bd49 100644 --- a/plugins/common/canobserver.h +++ b/plugins/common/canobserver.h @@ -1,26 +1,20 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 CANOBSERVER_H #define CANOBSERVER_H @@ -42,46 +36,46 @@ class CANObserver { public: - /** - * General CAN bus error. Currently only GENERAL_ERROR is specified. - * @enum CANError - * @public - */ - enum CANError { - GENERAL_ERROR = 0 - }; + /** + * General CAN bus error. Currently only GENERAL_ERROR is specified. + * @enum CANError + * @public + */ + enum CANError { + GENERAL_ERROR = 0 + }; - virtual ~CANObserver(){} /*LCOV_EXCL_LINE*/ - /** - * Called when error occurred on the bus. - * @fn errorOccured - * @param error Bus error code - */ - virtual void errorOccured(CANObserver::CANError error) = 0; /* socket error */ - /** - * Called when standard frame was is received from the bus. - * @fn standardFrameReceived - * @param frame Received frame - */ - virtual void standardFrameReceived(const can_frame& frame) = 0; /* SFF was present */ - /** - * Called when extended frame was is received from the bus. - * @fn extendedFrameReceived - * @param frame Received frame - */ - virtual void extendedFrameReceived(const can_frame& frame) = 0; /* EFF was present */ - /** - * Called when error frame was received from the bus. - * @fn errorFrameReceived - * @param frame Error frame - */ - virtual void errorFrameReceived(const can_frame& frame) = 0; /* error frame */ - /** - * Called when remote transmission frame was received from the bus. - * @fn remoteTransmissionRequest - * @param frame RTR frame - */ - virtual void remoteTransmissionRequest(const can_frame& frame) = 0; /* remote transmission request (SFF/EFF is still present)*/ + virtual ~CANObserver(){} /*LCOV_EXCL_LINE*/ + /** + * Called when error occurred on the bus. + * @fn errorOccured + * @param error Bus error code + */ + virtual void errorOccured(CANObserver::CANError error) = 0; /* socket error */ + /** + * Called when standard frame was is received from the bus. + * @fn standardFrameReceived + * @param frame Received frame + */ + virtual void standardFrameReceived(const can_frame& frame) = 0; /* SFF was present */ + /** + * Called when extended frame was is received from the bus. + * @fn extendedFrameReceived + * @param frame Received frame + */ + virtual void extendedFrameReceived(const can_frame& frame) = 0; /* EFF was present */ + /** + * Called when error frame was received from the bus. + * @fn errorFrameReceived + * @param frame Error frame + */ + virtual void errorFrameReceived(const can_frame& frame) = 0; /* error frame */ + /** + * Called when remote transmission frame was received from the bus. + * @fn remoteTransmissionRequest + * @param frame RTR frame + */ + virtual void remoteTransmissionRequest(const can_frame& frame) = 0; /* remote transmission request (SFF/EFF is still present)*/ }; diff --git a/plugins/common/cansocketadapter.cpp b/plugins/common/cansocketadapter.cpp index fded5a22..c2e660b7 100644 --- a/plugins/common/cansocketadapter.cpp +++ b/plugins/common/cansocketadapter.cpp @@ -1,26 +1,20 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 "cansocketadapter.h" #include "cansocket.h" @@ -31,68 +25,68 @@ // TODO: handle socket errors CANSocketAdapter::CANSocketAdapter(CANObserver& observer) : - CANAdapter(observer), - mSocket(NULL), - mReader(NULL) + CANAdapter(observer), + mSocket(NULL), + mReader(NULL) { - LOG_TRACE(""); + LOG_TRACE(""); } CANSocketAdapter::~CANSocketAdapter() { - LOG_TRACE(""); + LOG_TRACE(""); - stop(); + stop(); } bool CANSocketAdapter::start(const char* ifName) { - LOG_TRACE(""); + LOG_TRACE(""); - if(!mSocket || !mReader) { - init(); - } + if(!mSocket || !mReader) { + init(); + } - if(mSocket && mReader && mSocket->start(ifName) && mReader->start()) { + if(mSocket && mReader && mSocket->start(ifName) && mReader->start()) { return true; } stop(); - return false; + return false; } void CANSocketAdapter::stop() { - LOG_TRACE(""); - - if(mReader) { - mReader->stop(); - delete mReader; - mReader = 0; - } - if(mSocket) { - mSocket->stop(); - delete mSocket; - mSocket = 0; - } + LOG_TRACE(""); + + if(mReader) { + mReader->stop(); + delete mReader; + mReader = 0; + } + if(mSocket) { + mSocket->stop(); + delete mSocket; + mSocket = 0; + } } bool CANSocketAdapter::sendFrame(const can_frame& frame) { - LOG_TRACE(""); + LOG_TRACE(""); - if(mSocket) { + if(mSocket) { int bytesWritten(0); return mSocket->write(frame, bytesWritten); - } - return false; + } + return false; } void CANSocketAdapter::init() { - if(!mSocket) - mSocket = new CANSocket(); - if(!mReader) - mReader = new CANSocketReader(mObserver, *mSocket); + if(!mSocket) + mSocket = new CANSocket(); + if(!mReader) + mReader = new CANSocketReader(mObserver, *mSocket); } diff --git a/plugins/common/cansocketadapter.h b/plugins/common/cansocketadapter.h index cb73404b..350563ce 100644 --- a/plugins/common/cansocketadapter.h +++ b/plugins/common/cansocketadapter.h @@ -1,26 +1,20 @@ -/***************************************************************** - * INTEL CONFIDENTIAL - * Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - * - * The source code contained or described herein and all documents related to the - * source code("Material") are owned by Intel Corporation or its suppliers or - * licensors.Title to the Material remains with Intel Corporation or its - * suppliers and licensors.The Material may contain trade secrets and proprietary - * and confidential information of Intel Corporation and its suppliers and - * licensors, and is protected by worldwide copyright and trade secret laws and - * treaty provisions.No part of the Material may be used, copied, reproduced, - * modified, published, uploaded, posted, transmitted, distributed, or disclosed - * in any way without Intels prior express written permission. - * No license under any patent, copyright, trade secret or other intellectual - * property right is granted to or conferred upon you by disclosure or delivery - * of the Materials, either expressly, by implication, inducement, estoppel or - * otherwise.Any license under such intellectual property rights must be - * express and approved by Intel in writing. - * - * Unless otherwise agreed by Intel in writing, you may not remove or alter this - * notice or any other notice embedded in Materials by Intel or Intels suppliers - * or licensors in any way. - *****************************************************************/ +/* +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 CANSOCKETADAPTER_H #define CANSOCKETADAPTER_H @@ -44,53 +38,53 @@ class CANSocketReader; class CANSocketAdapter : public CANAdapter { public: - /** - * @param observer @link CANObserver Observer @endlink that will receives CAN bus frames - */ - CANSocketAdapter(CANObserver& observer); - virtual ~CANSocketAdapter(); + /** + * @param observer @link CANObserver Observer @endlink that will receives CAN bus frames + */ + CANSocketAdapter(CANObserver& observer); + virtual ~CANSocketAdapter(); - /** - * Creates connection the specified network interface and starts listening on it. - * @fn start - * @param ifName Name of the CAN bus network interface - * @return True if no error occurs. - */ - virtual bool start(const char* ifName); - /** - * Closes socket connection and exits listening thread. - * @fn stop - */ - virtual void stop(); - /** - * Sends CAN frame over the socket CAN interface - * @fn sendFrame - * @param frame CAN frame to be sent - * @return True if frame was sent - */ - virtual bool sendFrame(const can_frame& frame); + /** + * Creates connection the specified network interface and starts listening on it. + * @fn start + * @param ifName Name of the CAN bus network interface + * @return True if no error occurs. + */ + virtual bool start(const char* ifName); + /** + * Closes socket connection and exits listening thread. + * @fn stop + */ + virtual void stop(); + /** + * Sends CAN frame over the socket CAN interface + * @fn sendFrame + * @param frame CAN frame to be sent + * @return True if frame was sent + */ + virtual bool sendFrame(const can_frame& frame); protected: - /** - * Socket initialization and starts reading thread - * @fn init - * @protected - */ - virtual void init(); + /** + * Socket initialization and starts reading thread + * @fn init + * @protected + */ + virtual void init(); private: - /** - * @link CANSocket CAN Socket wrapper @endlink instance reference - * @property mSocket - * @protected - */ - CANSocket* mSocket; - /** - * @link CANSocketReader CANSocket reader @endlink instance reference - * @property mReader - * @protected - */ - CANSocketReader* mReader; + /** + * @link CANSocket CAN Socket wrapper @endlink instance reference + * @property mSocket + * @protected + */ + CANSocket* mSocket; + /** + * @link CANSocketReader CANSocket reader @endlink instance reference + * @property mReader + * @protected + */ + CANSocketReader* mReader; }; #endif // CANSOCKETADAPTER_H diff --git a/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbCommon.pm b/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbCommon.pm index b2957a3c..395c8eb7 100644 --- a/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbCommon.pm +++ b/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbCommon.pm @@ -43,10 +43,10 @@ plugin project. The following little code snippet shows the module usage. - use Intel::IviPoc::AmbCommon; + use Intel::IviPoc::AmbCommon; - $signal->{'AMBPropertyType'} = &evaluateType($signal); - ... + $signal->{'AMBPropertyType'} = &evaluateType($signal); + ... =head1 EXPORT @@ -72,31 +72,31 @@ based on information comming from input JSON file. =cut sub evaluateType { - my $signal = $_[0]; - my $type = undef; - - if ($signal->{'factor'} == 1) { - if ($signal->{'length'} == 1) { - $type = 'bool'; - } else { - my $count = -1; - if ( exists( $signal->{'values'} ) ) { - $count = @{$signal->{'values'}}; - } - if ($count == (2**$signal->{'length'})) { - $type = 'enum'; - } else { - $type = &evalIntType( $signal ); - } - } - } - else { - if ( $signal->{'factor'} =~ /\.|[eE]/ ) { - $type = 'double'; - } else { - $type = &evalIntType( $signal ); - } - } + my $signal = $_[0]; + my $type = undef; + + if ($signal->{'factor'} == 1) { + if ($signal->{'length'} == 1) { + $type = 'bool'; + } else { + my $count = -1; + if ( exists( $signal->{'values'} ) ) { + $count = @{$signal->{'values'}}; + } + if ($count == (2**$signal->{'length'})) { + $type = 'enum'; + } else { + $type = &evalIntType( $signal ); + } + } + } + else { + if ( $signal->{'factor'} =~ /\.|[eE]/ ) { + $type = 'double'; + } else { + $type = &evalIntType( $signal ); + } + } return $type; } @@ -110,42 +110,42 @@ based on information comming from input JSON file. =cut sub evalIntType { - my $signal = $_[0]; - my $type = ''; - - my $signedness = ''; - - my $min = 0; - my $max = 0; - if ($signal->{'signedness'} eq '+') { - # unsigned - $min = $signal->{'offset'} + $signal->{'factor'} * 0; - $max = $signal->{'offset'} + $signal->{'factor'} * ((2**$signal->{'length'} ) - 1); - } else { - # signed - $min = $signal->{'offset'} - $signal->{'factor'} * (2**$signal->{'length'} - 1); - $max = $signal->{'offset'} + $signal->{'factor'} * (2**$signal->{'length'} - 1); - } - - if ( 0 <= $min && $max < (2**8) ) { - $type = "uint8_t"; - } elsif ( -1*(2**7) <= $min && $max < (2**7) ) { - $type = "int8_t"; - } elsif ( 0 <= $min && $max < (2**16) ) { - $type = "uint16_t"; - } elsif ( -1*(2**15) <= $min && $max < (2**15) ) { - $type = "int16_t"; - } elsif ( 0 <= $min && $max < (2**32) ) { - $type = "uint32_t"; - } elsif ( -1*(2**31) <= $min && $max < (2**31) ) { - $type = "int32_t"; - } elsif ( 0 <= $min && $max < (2**64) ) { - $type = "uint64_t"; - } else { - $type = "int64_t"; - } - - return $type; + my $signal = $_[0]; + my $type = ''; + + my $signedness = ''; + + my $min = 0; + my $max = 0; + if ($signal->{'signedness'} eq '+') { + # unsigned + $min = $signal->{'offset'} + $signal->{'factor'} * 0; + $max = $signal->{'offset'} + $signal->{'factor'} * ((2**$signal->{'length'} ) - 1); + } else { + # signed + $min = $signal->{'offset'} - $signal->{'factor'} * (2**$signal->{'length'} - 1); + $max = $signal->{'offset'} + $signal->{'factor'} * (2**$signal->{'length'} - 1); + } + + if ( 0 <= $min && $max < (2**8) ) { + $type = "uint8_t"; + } elsif ( -1*(2**7) <= $min && $max < (2**7) ) { + $type = "int8_t"; + } elsif ( 0 <= $min && $max < (2**16) ) { + $type = "uint16_t"; + } elsif ( -1*(2**15) <= $min && $max < (2**15) ) { + $type = "int16_t"; + } elsif ( 0 <= $min && $max < (2**32) ) { + $type = "uint32_t"; + } elsif ( -1*(2**31) <= $min && $max < (2**31) ) { + $type = "int32_t"; + } elsif ( 0 <= $min && $max < (2**64) ) { + $type = "uint64_t"; + } else { + $type = "int64_t"; + } + + return $type; } =head2 readFileContent @@ -155,16 +155,16 @@ Reads and returns the whole content of given file. =cut sub readFileContent { - my $fileName = $_[0]; - open(my $tmpl, '<', $fileName) - or die "Could not open file '$fileName' $!"; + my $fileName = $_[0]; + open(my $tmpl, '<', $fileName) + or die "Could not open file '$fileName' $!"; - # Copy data from one file to another. - my $fileContent = <$tmpl>; + # Copy data from one file to another. + my $fileContent = <$tmpl>; - close $tmpl; + close $tmpl; - return $fileContent; + return $fileContent; } ############################################################################## @@ -177,35 +177,28 @@ IntelIVIPoc, C<< <ivipoc at intel.com> >> You can find documentation for this module with the perldoc command. - perldoc Intel::IVIPoc::AmbCommon + perldoc Intel::IVIPoc::AmbCommon =head1 ACKNOWLEDGEMENTS =head1 LICENSE AND COPYRIGHT -INTEL CONFIDENTIAL -Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - -The source code contained or described herein and all documents related to the -source code("Material") are owned by Intel Corporation or its suppliers or -licensors.Title to the Material remains with Intel Corporation or its -suppliers and licensors.The Material may contain trade secrets and proprietary -and confidential information of Intel Corporation and its suppliers and -licensors, and is protected by worldwide copyright and trade secret laws and -treaty provisions.No part of the Material may be used, copied, reproduced, -modified, published, uploaded, posted, transmitted, distributed, or disclosed -in any way without Intels prior express written permission. -No license under any patent, copyright, trade secret or other intellectual -property right is granted to or conferred upon you by disclosure or delivery -of the Materials, either expressly, by implication, inducement, estoppel or -otherwise.Any license under such intellectual property rights must be -express and approved by Intel in writing. - -Unless otherwise agreed by Intel in writing, you may not remove or alter this -notice or any other notice embedded in Materials by Intel or Intels suppliers -or licensors in any way. +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 =cut diff --git a/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbPluginGenerator.pm b/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbPluginGenerator.pm index 88fb7088..4c603099 100644 --- a/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbPluginGenerator.pm +++ b/tools/AmbSignalMapper/lib/Intel/IviPoc/AmbPluginGenerator.pm @@ -49,13 +49,13 @@ plugin project. The following little code snippet shows the module usage. - use Intel::IviPoc::AmbPluginGenerator qw(processPlugin); + use Intel::IviPoc::AmbPluginGenerator qw(processPlugin); - my $hashingAllowed = "E"; - my $inputfile = "myfile.json"; - my $targetDir = '/home/user/project/automotive-message-broker/plugins'; - processPlugin ( $hashingAllowed, $inputfile, $targetDir ); - ... + my $hashingAllowed = "E"; + my $inputfile = "myfile.json"; + my $targetDir = '/home/user/project/automotive-message-broker/plugins'; + processPlugin ( $hashingAllowed, $inputfile, $targetDir ); + ... =head1 EXPORT @@ -83,69 +83,69 @@ based on information comming from input JSON file. my $hashingAllowed = 'E'; # Enabled by default sub processPlugin { - $hashingAllowed = $_[0]; - my $jsonfile = $_[1]; - my $targetDir = $_[2]; - - # Load the json - my $json_text = &readFileContent( $jsonfile ); - - my $json = JSON->new; - $json = $json->utf8; - - my $dbcjson = $json->decode( $json_text ); - if ($hashingAllowed eq 'E' ) { - &encryptAmbPropertyNames( $dbcjson ); - } - - my $pluginName = $dbcjson->{'pluginName'}; - - my $templatesDir = 'templates/'; - my $pluginDir = File::Spec->catdir( ($targetDir, lc($pluginName). '_plugin/') ); - - # make new folder - &createDirectory( $pluginDir ); - - my @templatesFiles = ( "CMakeLists.txt" - , "ambtmpl_cansignal.h" - , "ambtmpl_cansignal.cpp" - , "ambtmpl_plugin.h" - , "ambtmpl_plugin.cpp" - , "ambtmpl_cansignals.h" - , "ambtmpl_plugin.idl" - ); - - my @pluginFiles = ( "CMakeLists.txt" - , lc ($pluginName) . "_cansignal.h" - , lc ($pluginName) . "_cansignal.cpp" - , lc ($pluginName) . "_plugin.h" - , lc ($pluginName) . "_plugin.cpp" - , lc ($pluginName) . "_cansignals.h" - , lc ($pluginName) . "_plugin.idl" - ); - - my @generationSubs = ( undef - , undef - , undef - , \&generateUuid - , \&generateCppImplTypes - , \&generateSignalsTypes - , \&generateIdlTypes - ); - - my $templateFile = ''; - my $pluginFile = ''; - my ($volume, $directory) = File::Spec->splitpath( $INC{'Intel/IviPoc/AmbPluginGenerator.pm'} ); - for my $i (0..scalar(@pluginFiles)-1) { - # First join templates folder and filename - $templateFile = File::Spec->catfile( ($templatesDir), $templatesFiles[$i] ); - # Now prepend the module full path - $templateFile = File::Spec->catpath( $volume, $directory, $templateFile ); - # Join target directory with target filename - $pluginFile = File::Spec->catfile( ($pluginDir), $pluginFiles[$i] ); - # Generate each plugin files - &generatePluginFile( $templateFile, $pluginFile, $dbcjson, $generationSubs[$i]); - } + $hashingAllowed = $_[0]; + my $jsonfile = $_[1]; + my $targetDir = $_[2]; + + # Load the json + my $json_text = &readFileContent( $jsonfile ); + + my $json = JSON->new; + $json = $json->utf8; + + my $dbcjson = $json->decode( $json_text ); + if ($hashingAllowed eq 'E' ) { + &encryptAmbPropertyNames( $dbcjson ); + } + + my $pluginName = $dbcjson->{'pluginName'}; + + my $templatesDir = 'templates/'; + my $pluginDir = File::Spec->catdir( ($targetDir, lc($pluginName). '_plugin/') ); + + # make new folder + &createDirectory( $pluginDir ); + + my @templatesFiles = ( "CMakeLists.txt" + , "ambtmpl_cansignal.h" + , "ambtmpl_cansignal.cpp" + , "ambtmpl_plugin.h" + , "ambtmpl_plugin.cpp" + , "ambtmpl_cansignals.h" + , "ambtmpl_plugin.idl" + ); + + my @pluginFiles = ( "CMakeLists.txt" + , lc ($pluginName) . "_cansignal.h" + , lc ($pluginName) . "_cansignal.cpp" + , lc ($pluginName) . "_plugin.h" + , lc ($pluginName) . "_plugin.cpp" + , lc ($pluginName) . "_cansignals.h" + , lc ($pluginName) . "_plugin.idl" + ); + + my @generationSubs = ( undef + , undef + , undef + , \&generateUuid + , \&generateCppImplTypes + , \&generateSignalsTypes + , \&generateIdlTypes + ); + + my $templateFile = ''; + my $pluginFile = ''; + my ($volume, $directory) = File::Spec->splitpath( $INC{'Intel/IviPoc/AmbPluginGenerator.pm'} ); + for my $i (0..scalar(@pluginFiles)-1) { + # First join templates folder and filename + $templateFile = File::Spec->catfile( ($templatesDir), $templatesFiles[$i] ); + # Now prepend the module full path + $templateFile = File::Spec->catpath( $volume, $directory, $templateFile ); + # Join target directory with target filename + $pluginFile = File::Spec->catfile( ($pluginDir), $pluginFiles[$i] ); + # Generate each plugin files + &generatePluginFile( $templateFile, $pluginFile, $dbcjson, $generationSubs[$i]); + } } =head2 generatePluginFile @@ -157,31 +157,31 @@ based on information comming from input JSON file. =cut sub generatePluginFile { - my $srcFileName = $_[0]; - my $dstFileName = $_[1]; - my $dbcjson = $_[2]; - my $generationSub = $_[3]; + my $srcFileName = $_[0]; + my $dstFileName = $_[1]; + my $dbcjson = $_[2]; + my $generationSub = $_[3]; - my $pluginName = $dbcjson->{'pluginName'}; + my $pluginName = $dbcjson->{'pluginName'}; - # Open template file - my $content = &readFileContent( $srcFileName ); - $content = &replaceTemplateStrings( $content, $pluginName ); + # Open template file + my $content = &readFileContent( $srcFileName ); + $content = &replaceTemplateStrings( $content, $pluginName ); - if (defined $generationSub) { - my $generatedCode = $generationSub->( $dbcjson ); - my $place = '\/\*GENERATED_CODE\*\/'; - $content =~ s/$place/$generatedCode/g; - } + if (defined $generationSub) { + my $generatedCode = $generationSub->( $dbcjson ); + my $place = '\/\*GENERATED_CODE\*\/'; + $content =~ s/$place/$generatedCode/g; + } - # Create new file - my $pluginFileHandle = &createFile( $dstFileName ); + # Create new file + my $pluginFileHandle = &createFile( $dstFileName ); - # Copy data from one file to another. - print $pluginFileHandle $content; + # Copy data from one file to another. + print $pluginFileHandle $content; - # close the file - close ($pluginFileHandle); + # close the file + close ($pluginFileHandle); } =head2 createDirectory @@ -191,11 +191,11 @@ Creates directory for plugin. =cut sub createDirectory { - my $dirName = $_[0]; + my $dirName = $_[0]; - unless(-e $dirName or mkdir $dirName) { - die "Unable to create directory '$dirName' $!"; - } + unless(-e $dirName or mkdir $dirName) { + die "Unable to create directory '$dirName' $!"; + } } =head2 createFile @@ -205,13 +205,13 @@ Creates file and returns a file handle to it. =cut sub createFile { - my $fileName = $_[0]; + my $fileName = $_[0]; - # Open file or die - open(my $fileHandle, '>', $fileName) - or die "Could not open file '$fileName' $!"; + # Open file or die + open(my $fileHandle, '>', $fileName) + or die "Could not open file '$fileName' $!"; - return $fileHandle; + return $fileHandle; } =head2 replaceTemplateStrings @@ -221,15 +221,15 @@ Replaces all occurencies of template specific symbols with plugin name. =cut sub replaceTemplateStrings { - my $text = $_[0]; - my $pluginName = $_[1]; - - $text =~ s/AmbTmpl/$pluginName/g; - $pluginName = lc ($pluginName); - $text =~ s/ambtmpl/$pluginName/g; - $pluginName = uc ($pluginName); - $text =~ s/AMBTMPL/$pluginName/g; - return $text; + my $text = $_[0]; + my $pluginName = $_[1]; + + $text =~ s/AmbTmpl/$pluginName/g; + $pluginName = lc ($pluginName); + $text =~ s/ambtmpl/$pluginName/g; + $pluginName = uc ($pluginName); + $text =~ s/AMBTMPL/$pluginName/g; + return $text; } =head2 generateUuid @@ -240,12 +240,12 @@ Returns C++ code to be placed into the target plugin. =cut sub generateUuid { - my $dbcjson = $_[0]; + my $dbcjson = $_[0]; - my $ug = new Data::UUID; - my $uuidText = $ug->create_str(); + my $ug = new Data::UUID; + my $uuidText = $ug->create_str(); - return $uuidText; + return $uuidText; } =head2 generateCppImplTypes @@ -256,31 +256,31 @@ Returns C++ code to be placed into the target plugin. =cut sub generateCppImplTypes { - my $dbcjson = $_[0]; - - my $registerMessageText = ''; - my $hexValue = (); - - my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; - for my $ecui (0..scalar(@engineControlUnits)-1) { - if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { - my @messages = @{$engineControlUnits[$ecui]{'messages'}}; - for my $msgi (0..scalar(@messages)-1) { - $hexValue = '0x' . uc ( sprintf( "%x", $messages[$msgi]{'canId'} ) ); - $registerMessageText .= " registerMessage($hexValue, $messages[$msgi]{'canDlc'}"; - - my @signals = @{$messages[$msgi]{'signals'}}; - foreach my $signal ( @signals ) { - my $type = $signal->{'AMBPropertyType'}; - $registerMessageText .= &generateCppProperty( $signal, $type); - } - - $registerMessageText .= "\n );\n"; - } - } - } - - return $registerMessageText; + my $dbcjson = $_[0]; + + my $registerMessageText = ''; + my $hexValue = (); + + my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; + for my $ecui (0..scalar(@engineControlUnits)-1) { + if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { + my @messages = @{$engineControlUnits[$ecui]{'messages'}}; + for my $msgi (0..scalar(@messages)-1) { + $hexValue = '0x' . uc ( sprintf( "%x", $messages[$msgi]{'canId'} ) ); + $registerMessageText .= " registerMessage($hexValue, $messages[$msgi]{'canDlc'}"; + + my @signals = @{$messages[$msgi]{'signals'}}; + foreach my $signal ( @signals ) { + my $type = $signal->{'AMBPropertyType'}; + $registerMessageText .= &generateCppProperty( $signal, $type); + } + + $registerMessageText .= "\n );\n"; + } + } + } + + return $registerMessageText; } =head2 generateCppProperty @@ -291,23 +291,23 @@ definitions. =cut sub generateCppProperty { - my $signal = $_[0]; - my $type = $_[1]; - - my $generatedText = ''; - my $zonesInUse = 0; # TODO this needs to be in config file - - if ( exists( $signal->{'AMBPropertyName'} ) ) { - my $ambPropertyName = $signal->{'AMBPropertyName'}; - - # TODO CANSignal needs to take zone as argument - #my $zone = 'Zone::None'; - #if ($zonesInUse) { - # $zone = &calculateZone( $ambPropertyName ); - #} - $generatedText .= "\n , new ${ambPropertyName}Type()"; - } - return $generatedText; + my $signal = $_[0]; + my $type = $_[1]; + + my $generatedText = ''; + my $zonesInUse = 0; # TODO this needs to be in config file + + if ( exists( $signal->{'AMBPropertyName'} ) ) { + my $ambPropertyName = $signal->{'AMBPropertyName'}; + + # TODO CANSignal needs to take zone as argument + #my $zone = 'Zone::None'; + #if ($zonesInUse) { + # $zone = &calculateZone( $ambPropertyName ); + #} + $generatedText .= "\n , new ${ambPropertyName}Type()"; + } + return $generatedText; } =head2 generateSignalsTypes @@ -318,27 +318,27 @@ Returns C++ code to be placed into the target plugin. =cut sub generateSignalsTypes { - my $dbcjson = $_[0]; - - my $enumsText = ''; - my $propertiesText = ''; - - # First generate the c++ enums from signals with values - my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; - for my $ecui (0..scalar(@engineControlUnits)-1) { - if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { - my @messages = @{$engineControlUnits[$ecui]{'messages'}}; - for my $msgi (0..scalar(@messages)-1) { - my @signals = @{$messages[$msgi]{'signals'}}; - foreach my $signal ( @signals ) { - my $type = $signal->{'AMBPropertyType'}; - $enumsText .= &generateEnumOrValues( $signal, $type); - $propertiesText .= &generatePropertyClasses( $signal, $type ); - } - } - } - } - return $enumsText . $propertiesText; + my $dbcjson = $_[0]; + + my $enumsText = ''; + my $propertiesText = ''; + + # First generate the c++ enums from signals with values + my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; + for my $ecui (0..scalar(@engineControlUnits)-1) { + if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { + my @messages = @{$engineControlUnits[$ecui]{'messages'}}; + for my $msgi (0..scalar(@messages)-1) { + my @signals = @{$messages[$msgi]{'signals'}}; + foreach my $signal ( @signals ) { + my $type = $signal->{'AMBPropertyType'}; + $enumsText .= &generateEnumOrValues( $signal, $type); + $propertiesText .= &generatePropertyClasses( $signal, $type ); + } + } + } + } + return $enumsText . $propertiesText; } =head2 generateEnumOrValues @@ -349,60 +349,60 @@ definitions. =cut sub generateEnumOrValues { - my $signal = $_[0]; - my $type = $_[1]; - - my $generatedText = ""; - - my $ambPropertyName = $signal->{'canId'}; - if ( exists( $signal->{'AMBPropertyName'} ) ) { - $ambPropertyName = $signal->{'AMBPropertyName'}; - } - - if ( exists( $signal->{'values'} ) ) { - my @dupvalues = @{$signal->{'values'}}; - my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); - my $hexValue = (); - - if ( $type eq 'enum' or $type =~ m/int/) { - # Start with comments - $generatedText .= "/**< $ambPropertyName\n"; - for my $vali (0..scalar(@values) -1 ) { - $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); - $generatedText .= " * $hexValue = $values[$vali]->{'description'}\n"; - } - $generatedText .= " */\n"; - } - - if ( $type eq 'enum' ) { - # Enum definition - $generatedText .= "namespace ${ambPropertyName}s {\n"; - $generatedText .= "enum ${ambPropertyName}Type {\n"; - - # Generate enum values - for my $vali (0..scalar(@values) -1 ) { - $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); - $generatedText .= " $values[$vali]->{'name'} = $hexValue"; - if ($vali != scalar(@values)-1 ) { - $generatedText .= ","; - } - $generatedText .= "\n"; - } - $generatedText .= "};\n"; - $generatedText .= "}\n\n"; - } elsif ( $type =~ m/int/ ) { - $generatedText .= "namespace ${ambPropertyName}s {\n"; - # Generate values - for my $vali (0..scalar(@values) -1 ) { - $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); - $generatedText .= "static const $type $values[$vali]->{'name'} = $hexValue;"; - $generatedText .= "\n"; - } - $generatedText .= "}\n\n"; - } - } - - return $generatedText; + my $signal = $_[0]; + my $type = $_[1]; + + my $generatedText = ""; + + my $ambPropertyName = $signal->{'canId'}; + if ( exists( $signal->{'AMBPropertyName'} ) ) { + $ambPropertyName = $signal->{'AMBPropertyName'}; + } + + if ( exists( $signal->{'values'} ) ) { + my @dupvalues = @{$signal->{'values'}}; + my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); + my $hexValue = (); + + if ( $type eq 'enum' or $type =~ m/int/) { + # Start with comments + $generatedText .= "/**< $ambPropertyName\n"; + for my $vali (0..scalar(@values) -1 ) { + $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); + $generatedText .= " * $hexValue = $values[$vali]->{'description'}\n"; + } + $generatedText .= " */\n"; + } + + if ( $type eq 'enum' ) { + # Enum definition + $generatedText .= "namespace ${ambPropertyName}s {\n"; + $generatedText .= "enum ${ambPropertyName}Type {\n"; + + # Generate enum values + for my $vali (0..scalar(@values) -1 ) { + $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); + $generatedText .= " $values[$vali]->{'name'} = $hexValue"; + if ($vali != scalar(@values)-1 ) { + $generatedText .= ","; + } + $generatedText .= "\n"; + } + $generatedText .= "};\n"; + $generatedText .= "}\n\n"; + } elsif ( $type =~ m/int/ ) { + $generatedText .= "namespace ${ambPropertyName}s {\n"; + # Generate values + for my $vali (0..scalar(@values) -1 ) { + $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); + $generatedText .= "static const $type $values[$vali]->{'name'} = $hexValue;"; + $generatedText .= "\n"; + } + $generatedText .= "}\n\n"; + } + } + + return $generatedText; } =head2 generatePropertyClasses @@ -417,83 +417,83 @@ Returns C++ definitions of one signal property. =cut sub generatePropertyClasses { - my $signal = $_[0]; - my $type = $_[1]; + my $signal = $_[0]; + my $type = $_[1]; - my $generatedText = ''; + my $generatedText = ''; - my $ambPropertyName = $signal->{'canId'}; - if ( exists( $signal->{'AMBPropertyName'} ) ) { + my $ambPropertyName = $signal->{'canId'}; + if ( exists( $signal->{'AMBPropertyName'} ) ) { $ambPropertyName = $signal->{'AMBPropertyName'}; - } + } - my $byteOrdering = "Endian::Intel"; # LittleEndian by default - if ( exists( $signal->{'byteOrdering'} ) and $signal->{'byteOrdering'} eq '0') { + my $byteOrdering = "Endian::Intel"; # LittleEndian by default + if ( exists( $signal->{'byteOrdering'} ) and $signal->{'byteOrdering'} eq '0') { $byteOrdering = "Endian::Motorola"; # BigEndian - } + } - my $signedness; - if ($signal->{'signedness'} eq '+') { + my $signedness; + if ($signal->{'signedness'} eq '+') { $signedness = "Signedness::Unsigned"; # Unsigned - } else { + } else { $signedness = "Signedness::Signed"; # Signed - } - - my $convertFromFunction = "nullptr"; - if ( exists( $signal->{'AMBConversionFrom'} ) ) { - $convertFromFunction = $signal->{'AMBConversionFrom'}; - } - - my $convertToFunction = "nullptr"; - if ( exists( $signal->{'AMBConversionTo'} ) ) { - $convertToFunction = $signal->{'AMBConversionTo'}; - } - - $generatedText .= "\n"; - $generatedText .= "/**< $ambPropertyName.\n"; - - my $typeBasedText = ''; - my $cppType; - - if ( $type =~ m/enum/ ) { - if ( exists( $signal->{'values'} ) ) { - $generatedText .= " *\@see ${ambPropertyName}s::${ambPropertyName}Type\n"; - $cppType = "${ambPropertyName}s::${ambPropertyName}Type"; - } - } elsif ( $type =~ m/bool/ ) { - if ( exists( $signal->{'values'} ) ) { - my @dupvalues = @{$signal->{'values'}}; - my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); - my $hexValue = (); - for my $vali (0..scalar(@values) -1 ) { - $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); - $generatedText .= " * $hexValue = $values[$vali]->{'description'}\n"; - } - } - $cppType = "$type"; - } elsif ( $type =~ m/int8/ ) { - $cppType = "char"; - } elsif ( $type =~ m/int32/ ) { - if ( $type eq 'uint32_t' ) { - $cppType = "$type"; - } else { - $cppType = "int"; - } - } else { # (u)int16, (u)int64 - $cppType = "$type"; - } - - $typeBasedText .= "CANSIGNAL($ambPropertyName, $cppType, $signal->{'startBit'}, $signal->{'length'}, $byteOrdering, $signedness, $signal->{'factor'}, $signal->{'offset'}, static_cast<$cppType>($signal->{'minValue'}), static_cast<$cppType>($signal->{'maxValue'}), $convertFromFunction, $convertToFunction)\n"; - - $generatedText .= " */\n"; - my $shownPropertyName = $ambPropertyName; - if ($hashingAllowed eq 'E' ) { - $shownPropertyName = $signal->{'AMBPropertyNameEnc'}; - } - $generatedText .= "const VehicleProperty::Property $ambPropertyName = \"$shownPropertyName\";\n"; - $generatedText .= $typeBasedText; - - return $generatedText; + } + + my $convertFromFunction = "nullptr"; + if ( exists( $signal->{'AMBConversionFrom'} ) ) { + $convertFromFunction = $signal->{'AMBConversionFrom'}; + } + + my $convertToFunction = "nullptr"; + if ( exists( $signal->{'AMBConversionTo'} ) ) { + $convertToFunction = $signal->{'AMBConversionTo'}; + } + + $generatedText .= "\n"; + $generatedText .= "/**< $ambPropertyName.\n"; + + my $typeBasedText = ''; + my $cppType; + + if ( $type =~ m/enum/ ) { + if ( exists( $signal->{'values'} ) ) { + $generatedText .= " *\@see ${ambPropertyName}s::${ambPropertyName}Type\n"; + $cppType = "${ambPropertyName}s::${ambPropertyName}Type"; + } + } elsif ( $type =~ m/bool/ ) { + if ( exists( $signal->{'values'} ) ) { + my @dupvalues = @{$signal->{'values'}}; + my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); + my $hexValue = (); + for my $vali (0..scalar(@values) -1 ) { + $hexValue = '0x' . uc ( sprintf( "%x", $values[$vali]->{'value'} ) ); + $generatedText .= " * $hexValue = $values[$vali]->{'description'}\n"; + } + } + $cppType = "$type"; + } elsif ( $type =~ m/int8/ ) { + $cppType = "char"; + } elsif ( $type =~ m/int32/ ) { + if ( $type eq 'uint32_t' ) { + $cppType = "$type"; + } else { + $cppType = "int"; + } + } else { # (u)int16, (u)int64 + $cppType = "$type"; + } + + $typeBasedText .= "CANSIGNAL($ambPropertyName, $cppType, $signal->{'startBit'}, $signal->{'length'}, $byteOrdering, $signedness, $signal->{'factor'}, $signal->{'offset'}, static_cast<$cppType>($signal->{'minValue'}), static_cast<$cppType>($signal->{'maxValue'}), $convertFromFunction, $convertToFunction)\n"; + + $generatedText .= " */\n"; + my $shownPropertyName = $ambPropertyName; + if ($hashingAllowed eq 'E' ) { + $shownPropertyName = $signal->{'AMBPropertyNameEnc'}; + } + $generatedText .= "const VehicleProperty::Property $ambPropertyName = \"$shownPropertyName\";\n"; + $generatedText .= $typeBasedText; + + return $generatedText; } =head2 generateIdlTypes @@ -504,24 +504,24 @@ Returns IDL code to be placed into the target plugin. =cut sub generateIdlTypes { - my $dbcjson = $_[0]; - - my $generatedText = ''; - - my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; - for my $ecui (0..scalar(@engineControlUnits)-1) { - if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { - my @messages = @{$engineControlUnits[$ecui]{'messages'}}; - for my $msgi (0..scalar(@messages)-1) { - my @signals = @{$messages[$msgi]{'signals'}}; - foreach my $signal ( @signals ) { - my $type = $signal->{'AMBPropertyType'}; - $generatedText .= &generateIdlProperty( $signal, $type); - } - } - } - } - return $generatedText; + my $dbcjson = $_[0]; + + my $generatedText = ''; + + my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; + for my $ecui (0..scalar(@engineControlUnits)-1) { + if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { + my @messages = @{$engineControlUnits[$ecui]{'messages'}}; + for my $msgi (0..scalar(@messages)-1) { + my @signals = @{$messages[$msgi]{'signals'}}; + foreach my $signal ( @signals ) { + my $type = $signal->{'AMBPropertyType'}; + $generatedText .= &generateIdlProperty( $signal, $type); + } + } + } + } + return $generatedText; } =head2 generateIdlProperty @@ -532,58 +532,58 @@ definitions of one signal property. =cut sub generateIdlProperty { - my $signal = $_[0]; - my $type = $_[1]; - my $generatedText = ''; - - my $ambPropertyName = $signal->{'canId'}; - if ( exists( $signal->{'AMBPropertyName'} ) ) { - $ambPropertyName = $signal->{'AMBPropertyName'}; - } - - $generatedText .= "[NoInterfaceObject]\n"; - $generatedText .= "interface org.automotive.${ambPropertyName} : VehiclePropertyType {\n"; - if ( $type eq 'enum' ) { - if ( exists( $signal->{'values'} ) ) { - my @dupvalues = @{$signal->{'values'}}; - my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); - - my $hexValue = (); - for my $vali (0..scalar(@values) -1 ) { - # TODO const unsigned short migth be not enough, guess type based on values - $hexValue = '0x' . uc (sprintf( "%x", $values[$vali]->{'value'} ) ); - $generatedText .= " const unsigned short " . uc($values[$vali]->{'name'}) . " = $hexValue;\n"; - } - } - } - - $generatedText .= "\n"; - $generatedText .= " /** ${ambPropertyName}\n"; - $generatedText .= " * \\brief Returns ${ambPropertyName}\n"; - $generatedText .= " **/\n"; - - my $unsigned = ''; - if ( $type =~ m/uint/ ) { - $unsigned = 'unsigned '; - } - - if ( $type =~ m/enum/ ) { - # TODO const unsigned short migth be not enough, guess type based on values - $generatedText .= " readonly attribute octet ${ambPropertyName};\n"; - } elsif ( $type =~ m/bool/ ) { - $generatedText .= " readonly attribute boolean ${ambPropertyName};\n"; - } elsif ( $type =~ m/int8/ ) { - $generatedText .= " readonly attribute ${unsigned}octet ${ambPropertyName};\n"; - } elsif ( $type =~ m/int16/ ) { - $generatedText .= " readonly attribute ${unsigned}short ${ambPropertyName};\n"; - } elsif ( $type =~ m/int32/ ) { - $generatedText .= " readonly attribute ${unsigned}long ${ambPropertyName};\n"; - } else { - $generatedText .= " readonly attribute double ${ambPropertyName};\n"; - } - $generatedText .= "};\n\n"; - - return $generatedText; + my $signal = $_[0]; + my $type = $_[1]; + my $generatedText = ''; + + my $ambPropertyName = $signal->{'canId'}; + if ( exists( $signal->{'AMBPropertyName'} ) ) { + $ambPropertyName = $signal->{'AMBPropertyName'}; + } + + $generatedText .= "[NoInterfaceObject]\n"; + $generatedText .= "interface org.automotive.${ambPropertyName} : VehiclePropertyType {\n"; + if ( $type eq 'enum' ) { + if ( exists( $signal->{'values'} ) ) { + my @dupvalues = @{$signal->{'values'}}; + my @values = sort { $$a{'value'} <=> $$b{'value'} } (&removeDuplicates (\@dupvalues)); + + my $hexValue = (); + for my $vali (0..scalar(@values) -1 ) { + # TODO const unsigned short migth be not enough, guess type based on values + $hexValue = '0x' . uc (sprintf( "%x", $values[$vali]->{'value'} ) ); + $generatedText .= " const unsigned short " . uc($values[$vali]->{'name'}) . " = $hexValue;\n"; + } + } + } + + $generatedText .= "\n"; + $generatedText .= " /** ${ambPropertyName}\n"; + $generatedText .= " * \\brief Returns ${ambPropertyName}\n"; + $generatedText .= " **/\n"; + + my $unsigned = ''; + if ( $type =~ m/uint/ ) { + $unsigned = 'unsigned '; + } + + if ( $type =~ m/enum/ ) { + # TODO const unsigned short migth be not enough, guess type based on values + $generatedText .= " readonly attribute octet ${ambPropertyName};\n"; + } elsif ( $type =~ m/bool/ ) { + $generatedText .= " readonly attribute boolean ${ambPropertyName};\n"; + } elsif ( $type =~ m/int8/ ) { + $generatedText .= " readonly attribute ${unsigned}octet ${ambPropertyName};\n"; + } elsif ( $type =~ m/int16/ ) { + $generatedText .= " readonly attribute ${unsigned}short ${ambPropertyName};\n"; + } elsif ( $type =~ m/int32/ ) { + $generatedText .= " readonly attribute ${unsigned}long ${ambPropertyName};\n"; + } else { + $generatedText .= " readonly attribute double ${ambPropertyName};\n"; + } + $generatedText .= "};\n\n"; + + return $generatedText; } =head2 encryptAmbPropertyNames @@ -593,21 +593,21 @@ Encrypt AmbPropertyNames. =cut sub encryptAmbPropertyNames { - my $dbcjson = $_[0]; - - my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; - for my $ecui (0..scalar(@engineControlUnits)-1) { - if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { - my @messages = @{$engineControlUnits[$ecui]{'messages'}}; - for my $msgi (0..scalar(@messages)-1) { - my @signals = @{$messages[$msgi]{'signals'}}; - foreach my $signal ( @signals ) { - my $shownPropertyName = sha1_hex( $signal->{'AMBPropertyName'} ); - $signal->{'AMBPropertyNameEnc'} = 'S' . sha1_hex( $shownPropertyName ); - } - } - } - } + my $dbcjson = $_[0]; + + my @engineControlUnits = @{$dbcjson->{'electronicControlUnits'}}; + for my $ecui (0..scalar(@engineControlUnits)-1) { + if ( exists( $engineControlUnits[$ecui]{'messages'} ) ) { + my @messages = @{$engineControlUnits[$ecui]{'messages'}}; + for my $msgi (0..scalar(@messages)-1) { + my @signals = @{$messages[$msgi]{'signals'}}; + foreach my $signal ( @signals ) { + my $shownPropertyName = sha1_hex( $signal->{'AMBPropertyName'} ); + $signal->{'AMBPropertyNameEnc'} = 'S' . sha1_hex( $shownPropertyName ); + } + } + } + } } =head2 removeDuplicates @@ -617,38 +617,38 @@ Returns array of values witout duplicates. =cut sub removeDuplicates { - my @arr = sort { $a->{'name'} cmp $b->{'name'} } @{$_[0]}; - - my @duplicates; - my $prev = pop @arr; - - while (defined(my $x = pop @arr)) { - if ($prev->{'name'} eq $x->{'name'}) { - push @duplicates, $x; - while (defined(my $y = pop @arr)) { - if ($y->{'name'} ne $x->{'name'}) { - $prev = $y; - last; - } - } - } - else { - $prev = $x; - } - } - # Typically very small arrays - @arr = sort @{$_[0]}; - if (scalar @duplicates > 0) { - foreach my $x (@arr) { - foreach my $y (@duplicates) { - if ($x->{'name'} eq $y->{'name'}) { - $x->{'name'} .= '_' . $x->{'value'}; - } - } - } - } - - return @arr; + my @arr = sort { $a->{'name'} cmp $b->{'name'} } @{$_[0]}; + + my @duplicates; + my $prev = pop @arr; + + while (defined(my $x = pop @arr)) { + if ($prev->{'name'} eq $x->{'name'}) { + push @duplicates, $x; + while (defined(my $y = pop @arr)) { + if ($y->{'name'} ne $x->{'name'}) { + $prev = $y; + last; + } + } + } + else { + $prev = $x; + } + } + # Typically very small arrays + @arr = sort @{$_[0]}; + if (scalar @duplicates > 0) { + foreach my $x (@arr) { + foreach my $y (@duplicates) { + if ($x->{'name'} eq $y->{'name'}) { + $x->{'name'} .= '_' . $x->{'value'}; + } + } + } + } + + return @arr; } =head2 calculateZone @@ -658,19 +658,19 @@ Returns calculated Zone for given signal. =cut sub calculateZone { - my $ambPropertyName = $_[0]; - my $zone = 'Zone::None'; - - if ( $ambPropertyName =~ m/FrL/) { - $zone = 'Zone::FrontLeft'; - } elsif ( $ambPropertyName =~ m/FrR/) { - $zone = 'Zone::FrontRight'; - } elsif ( $ambPropertyName =~ m/ReL/) { - $zone = 'Zone::RearLeft'; - } elsif ( $ambPropertyName =~ m/ReR/) { - $zone = 'Zone::RearRight'; - } - return $zone; + my $ambPropertyName = $_[0]; + my $zone = 'Zone::None'; + + if ( $ambPropertyName =~ m/FrL/) { + $zone = 'Zone::FrontLeft'; + } elsif ( $ambPropertyName =~ m/FrR/) { + $zone = 'Zone::FrontRight'; + } elsif ( $ambPropertyName =~ m/ReL/) { + $zone = 'Zone::RearLeft'; + } elsif ( $ambPropertyName =~ m/ReR/) { + $zone = 'Zone::RearRight'; + } + return $zone; } ############################################################################## @@ -683,34 +683,28 @@ IntelIVIPoc, C<< <ivipoc at intel.com> >> You can find documentation for this module with the perldoc command. - perldoc Intel::IVIPoc::AMBPluginGenerator + perldoc Intel::IVIPoc::AMBPluginGenerator =head1 ACKNOWLEDGEMENTS =head1 LICENSE AND COPYRIGHT -INTEL CONFIDENTIAL -Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - -The source code contained or described herein and all documents related to the -source code("Material") are owned by Intel Corporation or its suppliers or -licensors.Title to the Material remains with Intel Corporation or its -suppliers and licensors.The Material may contain trade secrets and proprietary -and confidential information of Intel Corporation and its suppliers and -licensors, and is protected by worldwide copyright and trade secret laws and -treaty provisions.No part of the Material may be used, copied, reproduced, -modified, published, uploaded, posted, transmitted, distributed, or disclosed -in any way without Intels prior express written permission. -No license under any patent, copyright, trade secret or other intellectual -property right is granted to or conferred upon you by disclosure or delivery -of the Materials, either expressly, by implication, inducement, estoppel or -otherwise.Any license under such intellectual property rights must be -express and approved by Intel in writing. - -Unless otherwise agreed by Intel in writing, you may not remove or alter this -notice or any other notice embedded in Materials by Intel or Intels suppliers -or licensors in any way. +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 =cut diff --git a/tools/AmbSignalMapper/lib/Intel/IviPoc/DbcGrammar.pod b/tools/AmbSignalMapper/lib/Intel/IviPoc/DbcGrammar.pod index b6d3e44b..ac923a76 100644 --- a/tools/AmbSignalMapper/lib/Intel/IviPoc/DbcGrammar.pod +++ b/tools/AmbSignalMapper/lib/Intel/IviPoc/DbcGrammar.pod @@ -1,26 +1,27 @@ -#Copyright (C) 2014 Intel Corporation -# +#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 + =head1 NAME Intel::IviPoc::DbcGrammar - Vector CANdb++ (*.dbc) file format parser =head1 SYNOPSIS - use Intel::IviPoc::DbcGrammar; + use Intel::IviPoc::DbcGrammar; my $result; $result = $parser->DbcOutput($text); @@ -65,26 +66,22 @@ L<strict|http://search.cpan.org/~jtbraun/Parse-RecDescent-1.967009/lib/Parse/Rec =head1 LICENSE AND COPYRIGHT -INTEL CONFIDENTIAL -Copyright 2011 - 2013 Intel Corporation All Rights Reserved. - -The source code contained or described herein and all documents related to the -source code("Material") are owned by Intel Corporation or its suppliers or -licensors.Title to the Material remains with Intel Corporation or its -suppliers and licensors.The Material may contain trade secrets and proprietary -and confidential information of Intel Corporation and its suppliers and -licensors, and is protected by worldwide copyright and trade secret laws and -treaty provisions.No part of the Material may be used, copied, reproduced, -modified, published, uploaded, posted, transmitted, distributed, or disclosed -in any way without Intels prior express written permission. -No license under any patent, copyright, trade secret or other intellectual -property right is granted to or conferred upon you by disclosure or delivery -of the Materials, either expressly, by implication, inducement, estoppel or -otherwise.Any license under such intellectual property rights must be -express and approved by Intel in writing. - -Unless otherwise agreed by Intel in writing, you may not remove or alter this -notice or any other notice embedded in Materials by Intel or Intels suppliers -or licensors in any way. + +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 + =cut |