From 36be33c73fac21247a983640aece606f4468e6df Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Sat, 1 Dec 2012 00:42:14 +0200 Subject: [PATCH] Add DRAFT stubs for Vehicle plugin --- packaging/wrt-plugins-tizen.spec | 2 +- src/platform/API/Vehicle/Vehicle.cpp | 67 ++++ src/platform/API/Vehicle/Vehicle.h | 77 +++++ src/platform/API/Vehicle/VehicleEventGet.cpp | 78 +++++ src/platform/API/Vehicle/VehicleEventGet.h | 71 ++++ .../Vehicle/VehicleEventGetSupportedEventTypes.cpp | 88 +++++ .../Vehicle/VehicleEventGetSupportedEventTypes.h | 74 +++++ src/platform/API/Vehicle/VehicleEventSet.cpp | 78 +++++ src/platform/API/Vehicle/VehicleEventSet.h | 71 ++++ src/platform/API/Vehicle/VehicleFactory.cpp | 60 ++++ src/platform/API/Vehicle/VehicleFactory.h | 64 ++++ src/platform/API/Vehicle/config.cmake | 10 + src/platform/API/config.cmake | 1 + src/platform/Tizen/Vehicle/Vehicle.cpp | 108 ++++++ src/platform/Tizen/Vehicle/Vehicle.h | 73 +++++ src/platform/Tizen/Vehicle/config.cmake | 17 + src/platform/Tizen/config.cmake | 1 + src/standards/Tizen/CMakeLists.txt | 1 + src/standards/Tizen/Vehicle/CMakeLists.txt | 49 +++ src/standards/Tizen/Vehicle/JSVehicle.cpp | 365 +++++++++++++++++++++ src/standards/Tizen/Vehicle/JSVehicle.h | 101 ++++++ src/standards/Tizen/Vehicle/PluginConfig.cpp | 112 +++++++ src/standards/Tizen/Vehicle/PluginConfig.h | 50 +++ src/standards/Tizen/Vehicle/PluginInitializer.cpp | 63 ++++ .../Tizen/Vehicle/VehicleAsyncCallbackManager.cpp | 40 +++ .../Tizen/Vehicle/VehicleAsyncCallbackManager.h | 60 ++++ src/standards/Tizen/Vehicle/VehicleConverter.cpp | 70 ++++ src/standards/Tizen/Vehicle/VehicleConverter.h | 68 ++++ .../Tizen/Vehicle/VehicleListenerManager.cpp | 56 ++++ .../Tizen/Vehicle/VehicleListenerManager.h | 77 +++++ .../Tizen/Vehicle/VehicleResponseDispatcher.cpp | 94 ++++++ .../Tizen/Vehicle/VehicleResponseDispatcher.h | 70 ++++ src/standards/Tizen/Vehicle/config.xml | 15 + 33 files changed, 2230 insertions(+), 1 deletion(-) create mode 100644 src/platform/API/Vehicle/Vehicle.cpp create mode 100644 src/platform/API/Vehicle/Vehicle.h create mode 100644 src/platform/API/Vehicle/VehicleEventGet.cpp create mode 100644 src/platform/API/Vehicle/VehicleEventGet.h create mode 100644 src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.cpp create mode 100644 src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.h create mode 100644 src/platform/API/Vehicle/VehicleEventSet.cpp create mode 100644 src/platform/API/Vehicle/VehicleEventSet.h create mode 100644 src/platform/API/Vehicle/VehicleFactory.cpp create mode 100644 src/platform/API/Vehicle/VehicleFactory.h create mode 100644 src/platform/API/Vehicle/config.cmake create mode 100644 src/platform/Tizen/Vehicle/Vehicle.cpp create mode 100644 src/platform/Tizen/Vehicle/Vehicle.h create mode 100644 src/platform/Tizen/Vehicle/config.cmake create mode 100644 src/standards/Tizen/Vehicle/CMakeLists.txt create mode 100644 src/standards/Tizen/Vehicle/JSVehicle.cpp create mode 100644 src/standards/Tizen/Vehicle/JSVehicle.h create mode 100644 src/standards/Tizen/Vehicle/PluginConfig.cpp create mode 100644 src/standards/Tizen/Vehicle/PluginConfig.h create mode 100644 src/standards/Tizen/Vehicle/PluginInitializer.cpp create mode 100644 src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.cpp create mode 100644 src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.h create mode 100644 src/standards/Tizen/Vehicle/VehicleConverter.cpp create mode 100644 src/standards/Tizen/Vehicle/VehicleConverter.h create mode 100644 src/standards/Tizen/Vehicle/VehicleListenerManager.cpp create mode 100644 src/standards/Tizen/Vehicle/VehicleListenerManager.h create mode 100644 src/standards/Tizen/Vehicle/VehicleResponseDispatcher.cpp create mode 100644 src/standards/Tizen/Vehicle/VehicleResponseDispatcher.h create mode 100644 src/standards/Tizen/Vehicle/config.xml diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index 1fbb308..2243ba1 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,6 +1,6 @@ Name: wrt-plugins-tizen Summary: JavaScript plugins for WebRuntime -Version: 0.2.85 +Version: 0.2.86 Release: 0 Group: TO_BE_FILLED License: TO_BE_FILLED diff --git a/src/platform/API/Vehicle/Vehicle.cpp b/src/platform/API/Vehicle/Vehicle.cpp new file mode 100644 index 0000000..1e4eed5 --- /dev/null +++ b/src/platform/API/Vehicle/Vehicle.cpp @@ -0,0 +1,67 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "Vehicle.h" +#include + + +namespace TizenApis { +namespace Vehicle { + +Vehicle::Vehicle() +/* TODO: Check thread id as it may not be same as module name */ + : WrtDeviceApis::Commons::EventRequestReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD), + WrtDeviceApis::Commons::EventRequestReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD), + WrtDeviceApis::Commons::EventRequestReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD) +{ + LogDebug("entered: src/platform/API/Vehicle/Vehicle.cpp"); +} + +Vehicle::~Vehicle() +{ +} + +void Vehicle::getSupportedEventTypes(DPL::SharedPtr &event) +{ + WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(event); +} + +void Vehicle::get(DPL::SharedPtr &event) +{ + WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(event); +} + +void Vehicle::set(DPL::SharedPtr &event) +{ + WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(event); +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/platform/API/Vehicle/Vehicle.h b/src/platform/API/Vehicle/Vehicle.h new file mode 100644 index 0000000..3f61b88 --- /dev/null +++ b/src/platform/API/Vehicle/Vehicle.h @@ -0,0 +1,77 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLE_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLE_H + +#include +#include +#include +#include +#include +#include "VehicleEventGet.h" +#include "VehicleEventGetSupportedEventTypes.h" +#include "VehicleEventSet.h" + + +namespace TizenApis { +namespace Vehicle { + +class Vehicle + : public WrtDeviceApis::Commons::EventRequestReceiver, + public WrtDeviceApis::Commons::EventRequestReceiver, + public WrtDeviceApis::Commons::EventRequestReceiver +{ +public: + Vehicle(); + + virtual ~Vehicle(); + + virtual void getSupportedEventTypes(DPL::SharedPtr &event); + + virtual void get(DPL::SharedPtr &event); + + virtual void set(DPL::SharedPtr &event); + +protected: + virtual void OnRequestReceived(const DPL::SharedPtr< VehicleEventGetSupportedEventTypes > &event) = 0; + + virtual void OnRequestReceived(const DPL::SharedPtr< VehicleEventGet > &event) = 0; + + virtual void OnRequestReceived(const DPL::SharedPtr< VehicleEventSet > &event) = 0; + +}; + +typedef DPL::SharedPtr VehiclePtr; +typedef std::vector< VehiclePtr > VehiclePtrArray; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLE_H + diff --git a/src/platform/API/Vehicle/VehicleEventGet.cpp b/src/platform/API/Vehicle/VehicleEventGet.cpp new file mode 100644 index 0000000..433ed83 --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventGet.cpp @@ -0,0 +1,78 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VehicleEventGet.h" + + +namespace TizenApis { +namespace Vehicle { + +VehicleEventGet::VehicleEventGet() +: m_result(false) +{ +} + +VehicleEventGet::~VehicleEventGet() +{ +} + +bool VehicleEventGet::getResult() const +{ + return m_result; +} + +void VehicleEventGet::setResult(bool res) +{ + m_result = res; +} + +std::string VehicleEventGet::getEvent() const +{ + return m_mevent; +} + +void VehicleEventGet::setEvent(const std::string& arg) +{ + /* TODO: Add more implementation specific details */ +} + + +DPL::SharedPtr VehicleEventGet::getInt() const +{ + return m_mint; +} + +void VehicleEventGet::setInt(const DPL::SharedPtr& arg) +{ + /* TODO: Add more implementation specific details */ +} + + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/platform/API/Vehicle/VehicleEventGet.h b/src/platform/API/Vehicle/VehicleEventGet.h new file mode 100644 index 0000000..ae1c7ef --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventGet.h @@ -0,0 +1,71 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGET_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGET_H + +#include +#include +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleEventGet : public WrtDeviceApis::Commons::IEvent +{ +public: + VehicleEventGet(); + + ~VehicleEventGet(); + + bool getResult() const; + + void setResult(bool res); + + std::string getEvent() const; + void setEvent(const std::string& arg); + + DPL::SharedPtr getInt() const; + void setInt(const DPL::SharedPtr& arg); + + /* TODO: Manually declare callback arguments (if any required) */ + +protected: + bool m_result; + std::string m_mevent; + DPL::SharedPtr m_mint; +}; + +typedef DPL::SharedPtr VehicleEventGetPtr; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGET_H + diff --git a/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.cpp b/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.cpp new file mode 100644 index 0000000..35b3851 --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.cpp @@ -0,0 +1,88 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VehicleEventGetSupportedEventTypes.h" + + +namespace TizenApis { +namespace Vehicle { + +VehicleEventGetSupportedEventTypes::VehicleEventGetSupportedEventTypes() +: m_result(false) +{ +} + +VehicleEventGetSupportedEventTypes::~VehicleEventGetSupportedEventTypes() +{ +} + +bool VehicleEventGetSupportedEventTypes::getResult() const +{ + return m_result; +} + +void VehicleEventGetSupportedEventTypes::setResult(bool res) +{ + m_result = res; +} + +std::string VehicleEventGetSupportedEventTypes::getType() const +{ + return m_mtype; +} + +void VehicleEventGetSupportedEventTypes::setType(const std::string& arg) +{ + m_mtype = arg; +} + + +bool VehicleEventGetSupportedEventTypes::getWriteable() const +{ + return m_mwriteable; +} + +void VehicleEventGetSupportedEventTypes::setWriteable(bool arg) +{ + m_mwriteable = arg; +} + +std::vector< std::string > VehicleEventGetSupportedEventTypes::getCallbackFuncReturnData() const +{ + return m_mreturnData; +} + +void VehicleEventGetSupportedEventTypes::setCallbackFuncReturnData(const std::vector< std::string >& arg) +{ + m_mreturnData = arg; +} + + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.h b/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.h new file mode 100644 index 0000000..c5bcf0a --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.h @@ -0,0 +1,74 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGETSUPPORTEDEVENTTYPES_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGETSUPPORTEDEVENTTYPES_H + +#include +#include +#include +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleEventGetSupportedEventTypes : public WrtDeviceApis::Commons::IEvent +{ +public: + VehicleEventGetSupportedEventTypes(); + + ~VehicleEventGetSupportedEventTypes(); + + bool getResult() const; + + void setResult(bool res); + + std::string getType() const; + void setType(const std::string& arg); + + bool getWriteable() const; + void setWriteable(bool arg); + + std::vector< std::string > getCallbackFuncReturnData() const; + void setCallbackFuncReturnData(const std::vector< std::string >& arg); + +protected: + bool m_result; + std::string m_mtype; + bool m_mwriteable; + std::vector< std::string > m_mreturnData; +}; + +typedef DPL::SharedPtr VehicleEventGetSupportedEventTypesPtr; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTGETSUPPORTEDEVENTTYPES_H + diff --git a/src/platform/API/Vehicle/VehicleEventSet.cpp b/src/platform/API/Vehicle/VehicleEventSet.cpp new file mode 100644 index 0000000..4262984 --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventSet.cpp @@ -0,0 +1,78 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VehicleEventSet.h" + + +namespace TizenApis { +namespace Vehicle { + +VehicleEventSet::VehicleEventSet() +: m_result(false) +{ +} + +VehicleEventSet::~VehicleEventSet() +{ +} + +bool VehicleEventSet::getResult() const +{ + return m_result; +} + +void VehicleEventSet::setResult(bool res) +{ + m_result = res; +} + +std::string VehicleEventSet::getEvent() const +{ + return m_mevent; +} + +void VehicleEventSet::setEvent(const std::string& arg) +{ + /* TODO: Add more implementation specific details */ +} + + +DPL::SharedPtr VehicleEventSet::getValue() const +{ + return m_mvalue; +} + +void VehicleEventSet::setValue(const DPL::SharedPtr& arg) +{ + /* TODO: Add more implementation specific details */ +} + + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/platform/API/Vehicle/VehicleEventSet.h b/src/platform/API/Vehicle/VehicleEventSet.h new file mode 100644 index 0000000..08df069 --- /dev/null +++ b/src/platform/API/Vehicle/VehicleEventSet.h @@ -0,0 +1,71 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTSET_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTSET_H + +#include +#include +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleEventSet : public WrtDeviceApis::Commons::IEvent +{ +public: + VehicleEventSet(); + + ~VehicleEventSet(); + + bool getResult() const; + + void setResult(bool res); + + std::string getEvent() const; + void setEvent(const std::string& arg); + + DPL::SharedPtr getValue() const; + void setValue(const DPL::SharedPtr& arg); + + /* TODO: Manually declare callback arguments (if any required) */ + +protected: + bool m_result; + std::string m_mevent; + DPL::SharedPtr m_mvalue; +}; + +typedef DPL::SharedPtr VehicleEventSetPtr; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLE_VEHICLEEVENTSET_H + diff --git a/src/platform/API/Vehicle/VehicleFactory.cpp b/src/platform/API/Vehicle/VehicleFactory.cpp new file mode 100644 index 0000000..68e2cba --- /dev/null +++ b/src/platform/API/Vehicle/VehicleFactory.cpp @@ -0,0 +1,60 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "VehicleFactory.h" +#include "Vehicle.h" +#include + + +namespace TizenApis { +namespace Vehicle { + +VehicleFactory::VehicleFactory() +{ +} + +VehicleFactory::~VehicleFactory() +{ +} + +VehicleFactory& VehicleFactory::getInstance() +{ + static VehicleFactory theInstance; + return theInstance; +} + +DPL::SharedPtr< Vehicle > VehicleFactory::createVehicleObject() +{ + + VehiclePtr result(new TizenApis::Platform::Vehicle::Vehicle()); + return result; +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/platform/API/Vehicle/VehicleFactory.h b/src/platform/API/Vehicle/VehicleFactory.h new file mode 100644 index 0000000..247a0d3 --- /dev/null +++ b/src/platform/API/Vehicle/VehicleFactory.h @@ -0,0 +1,64 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLEFACTORY_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLEFACTORY_H + +#include +#include + +namespace TizenApis { +namespace Vehicle { + +class Vehicle; + +} //namespace Vehicle +} //namespace TizenApis + + +namespace TizenApis { +namespace Vehicle { + +class VehicleFactory : private DPL::Noncopyable +{ +public: + static VehicleFactory& getInstance(); + + virtual ~VehicleFactory(); + + DPL::SharedPtr< Vehicle > createVehicleObject(); + +private: + VehicleFactory(); +}; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLEFACTORY_H + diff --git a/src/platform/API/Vehicle/config.cmake b/src/platform/API/Vehicle/config.cmake new file mode 100644 index 0000000..20d5c79 --- /dev/null +++ b/src/platform/API/Vehicle/config.cmake @@ -0,0 +1,10 @@ + +get_current_path() +set(SRCS_PLATFORM_API_VEHICLE + ${CURRENT_PATH}/VehicleEventGet.cpp + ${CURRENT_PATH}/VehicleEventGetSupportedEventTypes.cpp + ${CURRENT_PATH}/VehicleFactory.cpp + ${CURRENT_PATH}/VehicleEventSet.cpp + ${CURRENT_PATH}/Vehicle.cpp + PARENT_SCOPE +) diff --git a/src/platform/API/config.cmake b/src/platform/API/config.cmake index 334cd93..c8455fa 100755 --- a/src/platform/API/config.cmake +++ b/src/platform/API/config.cmake @@ -16,3 +16,4 @@ include_config_file(Power) include_config_file(Notification) include_config_file(Download) include_config_file(Device) +include_config_file(Vehicle) diff --git a/src/platform/Tizen/Vehicle/Vehicle.cpp b/src/platform/Tizen/Vehicle/Vehicle.cpp new file mode 100644 index 0000000..3f48a3b --- /dev/null +++ b/src/platform/Tizen/Vehicle/Vehicle.cpp @@ -0,0 +1,108 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "Vehicle.h" +//#include "MessageSender.h" +#include +#include +#include + +using namespace TizenApis::Platform::DBus; +using namespace WrtDeviceApis::Commons; + +namespace TizenApis { +namespace Platform { +namespace Vehicle { + +Vehicle::Vehicle() : + m_dbusConnection(new DBus::Connection()), + m_dbusWorkerThread(new DPL::Thread()) +{ + LogDebug("!#!entered: src/platform/Tizen/Vehicle/Vehicle.cpp"); + m_dbusWorkerThread->Run(); + m_dbusConnection->setWorkerThread(m_dbusWorkerThread); + m_dbusConnection->addFilter("interface='org.automotive'"); + m_dbusConnection->AddListener(this); +} + +Vehicle::~Vehicle() +{ + /*TODO: add details*/ + LogDebug("entered"); + m_dbusConnection->RemoveListener(this); + m_dbusWorkerThread->Quit(); + delete m_dbusWorkerThread; +} + +void Vehicle::OnEventReceived(const DBus::MessageEvent& event) +{ + LogDebug("entered Vehicle::OnEventReceived2"); + DBus::MessagePtr message = event.GetArg0(); + DBus::Message::ReadIterator it = message->getReadIterator(); + + while (it->isValid()) { + LogDebug("message: " << it->getArgType() << " (arg type), " << it->getInt() << "(int)."); + it->next(); + } +} + +void Vehicle::OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventGetSupportedEventTypes > &event) +{ + + LogDebug("received function parameters " << event->getWriteable() << " and " << event->getType()); + + std::vector< std::string > vec; + + vec.push_back("running_status_speedometer"); + vec.push_back("running_status_engine_speed"); + vec.push_back("running_status_transmission_gear_status"); + vec.push_back("running_status_steering_wheel_angle"); + + + event->setCallbackFuncReturnData(vec); + event->setResult(true); + + //m_dbusConnection->open(DBUS_BUS_SYSTEM); +} + +void Vehicle::OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventGet > &event) +{ + /*TODO: add details*/ + LogDebug("entered"); +} + +void Vehicle::OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventSet > &event) +{ + /*TODO: add details*/ + LogDebug("entered"); +} + +} //namespace Vehicle +} //namespace Platform +} //namespace TizenApis + diff --git a/src/platform/Tizen/Vehicle/Vehicle.h b/src/platform/Tizen/Vehicle/Vehicle.h new file mode 100644 index 0000000..073d958 --- /dev/null +++ b/src/platform/Tizen/Vehicle/Vehicle.h @@ -0,0 +1,73 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_PLATFORM_VEHICLE_VEHICLE_H +#define TIZENAPIS_TIZEN_PLATFORM_VEHICLE_VEHICLE_H + +#include +#include +#include +#include +#include + + +namespace TizenApis { +namespace Platform { +namespace Vehicle { + +class Vehicle + : public TizenApis::Vehicle::Vehicle, + private DPL::Event::EventListener +{ +public: + Vehicle(); + + virtual ~Vehicle(); + +protected: + virtual void OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventGetSupportedEventTypes > &event); + + virtual void OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventGet > &event); + + virtual void OnRequestReceived(const DPL::SharedPtr< TizenApis::Vehicle::VehicleEventSet > &event); + + protected: + void OnEventReceived(const DBus::MessageEvent& event); + + private: + DBus::ConnectionPtr m_dbusConnection; + DPL::Thread* m_dbusWorkerThread; + +}; + +} //namespace Vehicle +} //namespace Platform +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_PLATFORM_VEHICLE_VEHICLE_H + diff --git a/src/platform/Tizen/Vehicle/config.cmake b/src/platform/Tizen/Vehicle/config.cmake new file mode 100644 index 0000000..a6ce8ef --- /dev/null +++ b/src/platform/Tizen/Vehicle/config.cmake @@ -0,0 +1,17 @@ +get_current_path() + +set(INCLUDES_PLATFORM_IMPLEMENTATION_VEHICLE + ${INCLUDES_PLATFORM_IMPLEMENTATION_DBUS} + PARENT_SCOPE +) + +set(LIBS_PLATFORM_IMPLEMENTATION_VEHICLE + ${LIBS_PLATFORM_IMPLEMENTATION_DBUS} + PARENT_SCOPE +) + +set(SRCS_PLATFORM_IMPLEMENTATION_VEHICLE + ${CURRENT_PATH}/Vehicle.cpp + ${SRCS_PLATFORM_IMPLEMENTATION_DBUS} + PARENT_SCOPE +) diff --git a/src/platform/Tizen/config.cmake b/src/platform/Tizen/config.cmake index 7aa633f..d79b9b7 100755 --- a/src/platform/Tizen/config.cmake +++ b/src/platform/Tizen/config.cmake @@ -16,3 +16,4 @@ include_config_file(Power) include_config_file(Notification) include_config_file(Download) include_config_file(Device) +include_config_file(Vehicle) diff --git a/src/standards/Tizen/CMakeLists.txt b/src/standards/Tizen/CMakeLists.txt index 4162aa0..5a21c19 100755 --- a/src/standards/Tizen/CMakeLists.txt +++ b/src/standards/Tizen/CMakeLists.txt @@ -46,6 +46,7 @@ add_subdir(Power) add_subdir(Notification) add_subdir(Download) add_subdir(Device) +add_subdir(Vehicle) #add_subdir(SecureStorage) #add_subdir(Account) #add_subdir(DeviceInteraction) diff --git a/src/standards/Tizen/Vehicle/CMakeLists.txt b/src/standards/Tizen/Vehicle/CMakeLists.txt new file mode 100644 index 0000000..4efe6fe --- /dev/null +++ b/src/standards/Tizen/Vehicle/CMakeLists.txt @@ -0,0 +1,49 @@ +set(TARGET_NAME "wrt-plugins-tizen-1.0-vehicle") +set(DESTINATION_NAME "tizen-1.0-vehicle") +set(TARGET_IMPL_NAME "wrt-plugins-tizen-1.0-vehicle-impl") + +# TODO: Add package dependences here e.g. +# pkg_search_module(wrt-plugins-plugin-manager REQUIRED wrt-plugins-plugin-manager) +# include_directories( +# ${wrt-plugins-plugin-manager_INCLUDE_DIRS} +# ) + +include_directories( + ${INCLUDES_PLATFORM_IMPLEMENTATION_VEHICLE} +) + +set(CMAKE_INSTALL_RPATH + ${CMAKE_INSTALL_RPATH} + ${CMAKE_INSTALL_PREFIX}/${DESTINATION_NAME} + ${CMAKE_INSTALL_PREFIX}/tizen-1.0-tizen +) + +set(SRCS_IMPL + ${SRCS_PLATFORM_API_VEHICLE} + ${SRCS_PLATFORM_IMPLEMENTATION_VEHICLE} + VehicleAsyncCallbackManager.cpp + JSVehicle.cpp + VehicleResponseDispatcher.cpp + VehicleListenerManager.cpp + VehicleConverter.cpp + PluginConfig.cpp +) + +add_library(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL}) +target_link_libraries(${TARGET_IMPL_NAME} + ${LIBS_COMMON} + ${LIBS_PLATFORM_IMPLEMENTATION_VEHICLE} + wrt-plugins-tizen-1.0-tizen-impl +) + +set(SRCS + PluginInitializer.cpp +) + +add_library(${TARGET_NAME} SHARED ${SRCS}) +target_link_libraries(${TARGET_NAME} + ${TARGET_IMPL_NAME} +) + +INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_NAME}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_NAME}) diff --git a/src/standards/Tizen/Vehicle/JSVehicle.cpp b/src/standards/Tizen/Vehicle/JSVehicle.cpp new file mode 100644 index 0000000..dc96e73 --- /dev/null +++ b/src/standards/Tizen/Vehicle/JSVehicle.cpp @@ -0,0 +1,365 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "JSVehicle.h" +#include +#include +#include +#include +#include +#include "VehicleConverter.h" +#include "VehicleConverter.h" +#include "PluginConfig.h" + +#include "VehicleResponseDispatcher.h" +#include "VehicleAsyncCallbackManager.h" + + +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; +using namespace TizenApis::Commons; + +namespace TizenApis { +namespace Vehicle { + +typedef WrtDeviceApis::CommonsJavaScript::PrivateObject< DPL::SharedPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSVehiclePriv; + +JSClassRef JSVehicle::m_classRef = NULL; + +JSStaticFunction JSVehicle::m_functions[] = { + { VEHICLE_FUNCTION_API_GETSUPPORTEDEVENTTYPES, JSVehicle::getSupportedEventTypes, kJSPropertyAttributeNone}, + { VEHICLE_FUNCTION_API_GET, JSVehicle::get, kJSPropertyAttributeNone}, + { VEHICLE_FUNCTION_API_SET, JSVehicle::set, kJSPropertyAttributeNone}, + { 0, 0, 0 }/*name, callAsFunction, attributes*/ +}; + +JSStaticValue JSVehicle::m_properties[] = { + { 0, 0, 0, 0 } /*name, getProperty, setProperty, attributes*/ +}; + +JSClassDefinition JSVehicle::m_classDefinition = { + 0, /* int version; current (and only) version is 0 */ + kJSClassAttributeNone, /* JSClassAttributes attributes; */ + "Vehicle", /* const char* className; */ + NULL, /* JSClassRef parentClass; */ + JSVehicle::m_properties, /* const JSStaticValue* staticValues; */ + JSVehicle::m_functions, /* const JSStaticFunction* staticFunctions; */ + JSVehicle::initialize, /* JSObjectInitializeCallback initialize; */ + JSVehicle::finalize, /* JSObjectFinalizeCallback finalize; */ + NULL, /* JSObjectHasPropertyCallback hasProperty; */ + NULL, /* JSObjectGetPropertyCallback getProperty; */ + NULL, /* JSObjectSetPropertyCallback setProperty; */ + NULL, /* JSObjectDeletePropertyCallback deleteProperty; */ + NULL, /* JSObjectGetPropertyNamesCallback getPropertyNames; */ + NULL, /* JSObjectCallAsFunctionCallback callAsFunction; */ + NULL, /* JSObjectCallAsConstructorCallback callAsConstructor; */ + NULL, /* JSObjectHasInstanceCallback hasInstance; */ + NULL /* JSObjectConvertToTypeCallback convertToType; */ +}; + +JSVehicle::JSVehicle() +{ + /* TODO: Add more implementation specific details */ +} + +JSVehicle::~JSVehicle() +{ + /* TODO: Add more implementation specific details */ +} + +const JSClassRef JSVehicle::getClassRef() +{ + if (!m_classRef) { + m_classRef = JSClassCreate(&m_classDefinition); + } + return m_classRef; +} + +JSValueRef JSVehicle::createJSObject(JSContextRef context, + const DPL::SharedPtr& impl) +{ + JSVehiclePriv *priv = new JSVehiclePriv(context, impl); + JSObjectRef result = JSObjectMake(context, getClassRef(), static_cast(priv)); + if (result == NULL) { + LogError("object creation error"); + return JSValueMakeUndefined(context); + } + return result; +} + +DPL::SharedPtr JSVehicle::getVehiclePtr(JSContextRef context, + JSValueRef value) +{ + if (!JSValueIsObjectOfClass(context, value, getClassRef())) { + ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Invalid Argument"); + } + JSObjectRef object = JSValueToObject(context, value, NULL); + return getVehiclePtr(context, object); +} + +DPL::SharedPtr JSVehicle::getVehiclePtr(JSContextRef context, + JSObjectRef object) +{ + if (!object) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Object is null"); + } + JSVehiclePriv *priv = static_cast(JSObjectGetPrivate(object)); + if (!priv) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); + } + DPL::SharedPtr result = priv->getObject(); + if (!result) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); + } + return result; +} + +void JSVehicle::initialize(JSContextRef context, + JSObjectRef object) +{ + LogDebug("entered"); + if (!JSObjectGetPrivate(object)) { + LogDebug("Create private object"); + DPL::SharedPtr obj = VehicleFactory::getInstance().createVehicleObject(); + JSVehiclePriv *priv = new JSVehiclePriv(context, obj); + if (!JSObjectSetPrivate(object, static_cast(priv))) { + delete priv; + } + } +} + +void JSVehicle::finalize(JSObjectRef object) +{ + LogDebug("entered"); + JSVehiclePriv *priv = static_cast(JSObjectGetPrivate(object)); + if (priv) { + delete priv; + JSObjectSetPrivate(object, NULL); + } +} + +JSValueRef JSVehicle::getSupportedEventTypes(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + + AceSecurityStatus status = VEHICLE_CHECK_ACCESS(VEHICLE_FUNCTION_API_GETSUPPORTEDEVENTTYPES); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + + Try + { + LogDebug("entered, argc = " << argumentCount); + + JSVehiclePriv *privateObject = static_cast(JSObjectGetPrivate(thisObject)); + if (!privateObject) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); + } + + DPL::SharedPtr vehicle = privateObject->getObject(); + + VehicleConverter converter(context); +#if 0 + /* ASYNC CALL EXAMPLE */ + JSContextRef globalContext = privateObject->getContext(); + JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext); + + callbackManager->setOnSuccess(arguments[2]); + callbackManager->setObject(thisObject); +#endif + VehicleEventGetSupportedEventTypesPtr event(new VehicleEventGetSupportedEventTypes()); + +#if 0 + event->setPrivateData(DPL::StaticPointerCast(callbackManager)); + event->setForAsynchronousCall(&VehicleResponseDispatcher::getInstance()); + + vehicle->getSupportedEventTypes(event); + VehicleAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, globalContext); +#endif + + event->setForSynchronousCall(); + event->setType(converter.toString(arguments[0])); + event->setWriteable(converter.toBool(arguments[1])); + + vehicle->getSupportedEventTypes(event); + if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) { + ThrowMsg(NotFoundException, "Given package not found."); + } else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::UnknownException) { + ThrowMsg(Exception, "Unknown error occurred."); + } + LogDebug("return data to the application"); + return converter.toJSValueRef(event->getCallbackFuncReturnData()); + + } + Catch(UnsupportedException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); + } + Catch(InvalidArgumentException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); + } + Catch(ConversionException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); + } + Catch (NotFoundException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); + } + Catch(Exception) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); + } + + return JSValueMakeUndefined(context); +} + +JSValueRef JSVehicle::get(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered, argc = " << argumentCount); + + AceSecurityStatus status = VEHICLE_CHECK_ACCESS(VEHICLE_FUNCTION_API_GET); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + + Try + { + JSVehiclePriv *privateObject = static_cast(JSObjectGetPrivate(thisObject)); + if (!privateObject) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); + } + + /* TODO: Add implementational specific details here */ + } + Catch(UnsupportedException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); + } + Catch(InvalidArgumentException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); + } + Catch(ConversionException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); + } + Catch (NotFoundException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); + } + Catch(Exception) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); + } + + return JSValueMakeUndefined(context); +} + +JSValueRef JSVehicle::set(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered, argc = " << argumentCount); + + AceSecurityStatus status = VEHICLE_CHECK_ACCESS(VEHICLE_FUNCTION_API_SET); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + + Try + { + JSVehiclePriv *privateObject = static_cast(JSObjectGetPrivate(thisObject)); + if (!privateObject) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); + } + + /* TODO: Add implementational specific details here */ + } + Catch(UnsupportedException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); + } + Catch(InvalidArgumentException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); + } + Catch(ConversionException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); + } + Catch (NotFoundException) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); + } + Catch(Exception) + { + LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); + } + + return JSValueMakeUndefined(context); +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/JSVehicle.h b/src/standards/Tizen/Vehicle/JSVehicle.h new file mode 100644 index 0000000..41bfa59 --- /dev/null +++ b/src/standards/Tizen/Vehicle/JSVehicle.h @@ -0,0 +1,101 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_JSVEHICLE_H +#define TIZENAPIS_TIZEN_VEHICLE_JSVEHICLE_H + +#include +#include +#include +#include + +namespace TizenApis { +namespace Vehicle { + +class JSVehicle +{ +public: + virtual ~JSVehicle(); + + static const JSClassRef getClassRef(); + + static JSValueRef createJSObject(JSContextRef context, + const DPL::SharedPtr& impl); + + static DPL::SharedPtr getVehiclePtr(JSContextRef context, + JSValueRef value); + + static DPL::SharedPtr getVehiclePtr(JSContextRef context, + JSObjectRef object); + + +private: + JSVehicle(); + + static void initialize(JSContextRef context, + JSObjectRef object); + + static void finalize(JSObjectRef object); + + // Methods + static JSValueRef getSupportedEventTypes(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef get(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef set(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + // Class members + static JSClassDefinition m_classDefinition; + static JSClassRef m_classRef; + static JSStaticFunction m_functions[]; + static JSStaticValue m_properties[]; + +}; + +typedef DPL::SharedPtr JSVehiclePtr; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_JSVEHICLE_H + diff --git a/src/standards/Tizen/Vehicle/PluginConfig.cpp b/src/standards/Tizen/Vehicle/PluginConfig.cpp new file mode 100644 index 0000000..24d0128 --- /dev/null +++ b/src/standards/Tizen/Vehicle/PluginConfig.cpp @@ -0,0 +1,112 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include "PluginConfig.h" + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; + +namespace TizenApis { +namespace Vehicle { + +#define VEHICLE_FEATURE_API "http://tizen.org/api/vehicle" + +#define VEHICLE_DEVICE_CAP "vehicle" + +static FunctionMapping createVehicleFunctions(); + +static FunctionMapping VehicleFunctions = createVehicleFunctions(); + +DEFINE_FUNCTION_GETTER(Vehicle, VehicleFunctions); + +static FunctionMapping createVehicleFunctions() +{ + + /** + * Device capabilities + */ + ACE_CREATE_DEVICE_CAP(DEVICE_CAP_VEHICLE, VEHICLE_DEVICE_CAP); + + ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_VEHICLE); + ACE_ADD_DEVICE_CAP(DEVICE_LIST_VEHICLE, DEVICE_CAP_VEHICLE); + + /** + * Api Features + */ + ACE_CREATE_FEATURE(FEATURE_VEHICLE, VEHICLE_FEATURE_API); + + ACE_CREATE_FEATURE_LIST(VEHICLE_FEATURES); + + + /** TODO: add features to features list */ + ACE_ADD_API_FEATURE(VEHICLE_FEATURES, FEATURE_VEHICLE); + + /** + * Functions + */ + FunctionMapping vehicleMapping; + + /** TODO: create function(s) and insert it into the map e.g. */ + AceFunction getSupported = ACE_CREATE_FUNCTION( + FUNCTION_GET, + VEHICLE_FUNCTION_API_GETSUPPORTEDEVENTTYPES, + VEHICLE_FEATURES, + DEVICE_LIST_VEHICLE); + + vehicleMapping.insert( + std::make_pair(VEHICLE_FUNCTION_API_GETSUPPORTEDEVENTTYPES, + getSupported)); + + + AceFunction getFunc = ACE_CREATE_FUNCTION( + FUNCTION_GET, + VEHICLE_FUNCTION_API_GET, + VEHICLE_FEATURES, + DEVICE_LIST_VEHICLE); + + vehicleMapping.insert(std::make_pair(VEHICLE_FUNCTION_API_GET, getFunc)); + + AceFunction setFunc = ACE_CREATE_FUNCTION( + FUNCTION_SET, + VEHICLE_FUNCTION_API_SET, + VEHICLE_FEATURES, + DEVICE_LIST_VEHICLE); + + vehicleMapping.insert(std::make_pair(VEHICLE_FUNCTION_API_SET, setFunc)); + + return vehicleMapping; +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/PluginConfig.h b/src/standards/Tizen/Vehicle/PluginConfig.h new file mode 100644 index 0000000..2597bd5 --- /dev/null +++ b/src/standards/Tizen/Vehicle/PluginConfig.h @@ -0,0 +1,50 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_PLUGINCONFIG_H +#define TIZENAPIS_TIZEN_VEHICLE_PLUGINCONFIG_H + +#include +#include + +namespace TizenApis { +namespace Vehicle { + +#define VEHICLE_FUNCTION_API_GETSUPPORTEDEVENTTYPES "getSupportedEventTypes" +#define VEHICLE_FUNCTION_API_GET "get" +#define VEHICLE_FUNCTION_API_SET "set" + +DECLARE_FUNCTION_GETTER(Vehicle); + +#define VEHICLE_CHECK_ACCESS(functionName) aceCheckAccess >( getVehicleFunctionData, functionName) + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_PLUGINCONFIG_H + diff --git a/src/standards/Tizen/Vehicle/PluginInitializer.cpp b/src/standards/Tizen/Vehicle/PluginInitializer.cpp new file mode 100644 index 0000000..0d508e5 --- /dev/null +++ b/src/standards/Tizen/Vehicle/PluginInitializer.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include "VehicleAsyncCallbackManager.h" +#include "VehicleListenerManager.h" +#include "JSVehicle.h" + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; + +namespace TizenApis { +namespace Vehicle { + +void on_widget_start_callback(int widgetId) +{ + LogDebug("[Tizen/Vehicle] on_widget_start_callback (" << widgetId << ")"); + Try { + WrtAccessSingleton::Instance().initialize(widgetId); + } Catch (Exception) { + LogError("WrtAccess initialization failed"); + } +} + +void on_widget_stop_callback(int widgetId) +{ + LogDebug("[Tizen/Vehicle] on_widget_stop_callback (" << widgetId << ")"); + Try { + WrtAccessSingleton::Instance().deinitialize(widgetId); + } Catch (Exception) { + LogError("WrtAccess deinitialization failed"); + } +} + +void on_frame_load_callback(const void * context) +{ +} + +void on_frame_unload_callback(const void * context) +{ + VehicleAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); + VehicleListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); +} + +PLUGIN_ON_WIDGET_START(on_widget_start_callback) +PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback) + +PLUGIN_ON_FRAME_LOAD(on_frame_load_callback) +PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback) + +PLUGIN_CLASS_MAP_BEGIN + + PLUGIN_CLASS_MAP_ADD_CLASS( + WRT_JS_EXTENSION_OBJECT_TIZEN, + "vehicle", + (js_class_template_getter)JSVehicle::getClassRef, + NULL) + +PLUGIN_CLASS_MAP_END + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.cpp b/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.cpp new file mode 100644 index 0000000..fe7ac99 --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.cpp @@ -0,0 +1,40 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "VehicleAsyncCallbackManager.h" + +IMPLEMENT_SINGLETON( TizenApis::Vehicle::VehicleAsyncCallbackManager ) + +namespace TizenApis { +namespace Vehicle { + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.h b/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.h new file mode 100644 index 0000000..275cb7b --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.h @@ -0,0 +1,60 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLEASYNCCALLBACKMANAGER_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLEASYNCCALLBACKMANAGER_H + +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleAsyncCallbackManager : public TizenApis::Commons::AsyncCallbackManager +{ +public: + virtual ~VehicleAsyncCallbackManager() + { + } + +private: + VehicleAsyncCallbackManager() + { + } + + friend class DPL::Singleton< VehicleAsyncCallbackManager >; + +}; + +typedef DPL::Singleton< VehicleAsyncCallbackManager > VehicleAsyncCallbackManagerSingleton; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLEASYNCCALLBACKMANAGER_H + diff --git a/src/standards/Tizen/Vehicle/VehicleConverter.cpp b/src/standards/Tizen/Vehicle/VehicleConverter.cpp new file mode 100644 index 0000000..410825f --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleConverter.cpp @@ -0,0 +1,70 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "VehicleConverter.h" + +#include +#include "JSVehicle.h" + +namespace TizenApis { +namespace Vehicle { + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::CommonsJavaScript; + +VehicleConverter::VehicleConverter(JSContextRef context) : Converter(context) +{ +} + +VehicleConverter::~VehicleConverter() +{ +} + +JSValueRef VehicleConverter::toJSValueRefVehicle(const DPL::SharedPtr &arg) +{ + if(arg == NULL) { + ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Object is null"); + } + return CommonsJavaScript::JSUtils::makeObject(m_context, JSVehicle::getClassRef(), arg); +} + +const DPL::SharedPtr VehicleConverter::toVehicle(const JSValueRef &arg) +{ + if (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, arg)) { + ThrowMsg(Commons::ConversionException, "Invalid Argument"); + } + /* TODO: Add/change more implementation specific details */ + DPL::SharedPtr createme; + return createme; +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/VehicleConverter.h b/src/standards/Tizen/Vehicle/VehicleConverter.h new file mode 100644 index 0000000..769ef47 --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleConverter.h @@ -0,0 +1,68 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLECONVERTER_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLECONVERTER_H + +#include +#include + +namespace TizenApis { +namespace Vehicle { + +class Vehicle; + +} //namespace Vehicle +} //namespace TizenApis + + +namespace TizenApis { +namespace Vehicle { + +class VehicleConverter : public WrtDeviceApis::CommonsJavaScript::Converter +{ +public: + using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef; + +public: + explicit VehicleConverter(JSContextRef context); + + virtual ~VehicleConverter(); + + // interfaces + JSValueRef toJSValueRefVehicle(const DPL::SharedPtr &arg); + + const DPL::SharedPtr toVehicle(const JSValueRef &arg); + +}; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLECONVERTER_H + diff --git a/src/standards/Tizen/Vehicle/VehicleListenerManager.cpp b/src/standards/Tizen/Vehicle/VehicleListenerManager.cpp new file mode 100644 index 0000000..025b9fc --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleListenerManager.cpp @@ -0,0 +1,56 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "VehicleListenerManager.h" + + +IMPLEMENT_SINGLETON( TizenApis::Vehicle::VehicleListenerManager ) + +namespace TizenApis { +namespace Vehicle { + +VehicleListenerCanceller::VehicleListenerCanceller(JSContextRef context, JSObjectRef object, long watchId) + : TizenApis::Commons::IListenerItem(context, object, watchId) +{ +} + +VehicleListenerCanceller::~VehicleListenerCanceller() +{ +} + +void VehicleListenerCanceller::cancelListener() +{ + /** TODO: add cancellation logic here + */ +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/VehicleListenerManager.h b/src/standards/Tizen/Vehicle/VehicleListenerManager.h new file mode 100644 index 0000000..717e075 --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleListenerManager.h @@ -0,0 +1,77 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLELISTENERMANAGER_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLELISTENERMANAGER_H + +#include +#include +#include +#include +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleListenerManager : public TizenApis::Commons::IListenerController +{ +public: + virtual ~VehicleListenerManager() + { + } + +private: + VehicleListenerManager() + { + } + + friend class DPL::Singleton< VehicleListenerManager >; + +}; + +typedef DPL::Singleton< VehicleListenerManager > VehicleListenerManagerSingleton; + +class VehicleListenerCanceller : public TizenApis::Commons::IListenerItem +{ +public: + VehicleListenerCanceller(JSContextRef context, JSObjectRef object, long watchId); + + virtual ~VehicleListenerCanceller(); + + virtual void cancelListener(); + +}; + +typedef DPL::SharedPtr< VehicleListenerCanceller > VehicleListenerCancellerPtr; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLELISTENERMANAGER_H + diff --git a/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.cpp b/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.cpp new file mode 100644 index 0000000..3e86fea --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.cpp @@ -0,0 +1,94 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "VehicleResponseDispatcher.h" +#include "VehicleAsyncCallbackManager.h" +#include "VehicleConverter.h" + +using namespace WrtDeviceApis::CommonsJavaScript; + +namespace TizenApis { +namespace Vehicle { + +VehicleResponseDispatcher& VehicleResponseDispatcher::getInstance() +{ + static VehicleResponseDispatcher instance; + return instance; +} + +VehicleResponseDispatcher::VehicleResponseDispatcher() + : WrtDeviceApis::Commons::EventAnswerReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD), + WrtDeviceApis::Commons::EventAnswerReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD), + WrtDeviceApis::Commons::EventAnswerReceiver(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD) +{ + /*TODO: add details*/ +} + +VehicleResponseDispatcher::~VehicleResponseDispatcher() +{ + /*TODO: add details*/ +} + +void VehicleResponseDispatcher::OnAnswerReceived(const DPL::SharedPtr &event) +{ +#if 0 + /* ASYNC CALL EXAMPLE */ + LogDebug("entered"); + JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); + if (!callbackManager) { + LogError("no callback manager"); + return; + } + + JSContextRef context = callbackManager->getContext(); + VehicleAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); + + if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) { + VehicleConverter converter(context); + JSValueRef result = converter.toJSValueRef(event->getCallbackFuncReturnData()); + callbackManager->callOnSuccess(result); + } + LogDebug("exit"); +#endif +} + +void VehicleResponseDispatcher::OnAnswerReceived(const DPL::SharedPtr &event) +{ + /* TODO: Add implementation specific details */ +} + +void VehicleResponseDispatcher::OnAnswerReceived(const DPL::SharedPtr &event) +{ + /* TODO: Add implementation specific details */ +} + +} //namespace Vehicle +} //namespace TizenApis + diff --git a/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.h b/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.h new file mode 100644 index 0000000..501e053 --- /dev/null +++ b/src/standards/Tizen/Vehicle/VehicleResponseDispatcher.h @@ -0,0 +1,70 @@ +/* + * Tizen JavaScript bindings + * Copyright (c) 2011-2012, Intel Corporation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TIZENAPIS_TIZEN_VEHICLE_VEHICLERESPONSEDISPATCHER_H +#define TIZENAPIS_TIZEN_VEHICLE_VEHICLERESPONSEDISPATCHER_H + +#include +#include +#include + +#include +#include +#include + + +namespace TizenApis { +namespace Vehicle { + +class VehicleResponseDispatcher + : public WrtDeviceApis::Commons::EventAnswerReceiver, + public WrtDeviceApis::Commons::EventAnswerReceiver, + public WrtDeviceApis::Commons::EventAnswerReceiver +{ +public: + static VehicleResponseDispatcher& getInstance(); + + virtual ~VehicleResponseDispatcher(); + +protected: + void OnAnswerReceived(const DPL::SharedPtr &event); + + void OnAnswerReceived(const DPL::SharedPtr &event); + + void OnAnswerReceived(const DPL::SharedPtr &event); + +private: + VehicleResponseDispatcher(); + +}; + +} //namespace Vehicle +} //namespace TizenApis + +#endif // TIZENAPIS_TIZEN_VEHICLE_VEHICLERESPONSEDISPATCHER_H + diff --git a/src/standards/Tizen/Vehicle/config.xml b/src/standards/Tizen/Vehicle/config.xml new file mode 100644 index 0000000..c798174 --- /dev/null +++ b/src/standards/Tizen/Vehicle/config.xml @@ -0,0 +1,15 @@ + + + + libwrt-plugins-tizen-1.0-vehicle.so + vehicle.install.uri + SAMSUNG plugin group + SAMSUNG certificate authority + AAAABBBBCCCCDDDEEEE0000 + + + http://tizen.org/api/vehicle + vehicle + + + -- 2.7.4