Add DRAFT stubs for Vehicle plugin 63/2463/1 2.0alpha
authorMikko Ylinen <mikko.ylinen@intel.com>
Fri, 30 Nov 2012 22:42:14 +0000 (00:42 +0200)
committerMikko Ylinen <mikko.ylinen@intel.com>
Fri, 30 Nov 2012 22:42:14 +0000 (00:42 +0200)
33 files changed:
packaging/wrt-plugins-tizen.spec
src/platform/API/Vehicle/Vehicle.cpp [new file with mode: 0644]
src/platform/API/Vehicle/Vehicle.h [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventGet.cpp [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventGet.h [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.cpp [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventGetSupportedEventTypes.h [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventSet.cpp [new file with mode: 0644]
src/platform/API/Vehicle/VehicleEventSet.h [new file with mode: 0644]
src/platform/API/Vehicle/VehicleFactory.cpp [new file with mode: 0644]
src/platform/API/Vehicle/VehicleFactory.h [new file with mode: 0644]
src/platform/API/Vehicle/config.cmake [new file with mode: 0644]
src/platform/API/config.cmake
src/platform/Tizen/Vehicle/Vehicle.cpp [new file with mode: 0644]
src/platform/Tizen/Vehicle/Vehicle.h [new file with mode: 0644]
src/platform/Tizen/Vehicle/config.cmake [new file with mode: 0644]
src/platform/Tizen/config.cmake
src/standards/Tizen/CMakeLists.txt
src/standards/Tizen/Vehicle/CMakeLists.txt [new file with mode: 0644]
src/standards/Tizen/Vehicle/JSVehicle.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/JSVehicle.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/PluginConfig.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/PluginConfig.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/PluginInitializer.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleAsyncCallbackManager.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleConverter.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleConverter.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleListenerManager.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleListenerManager.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleResponseDispatcher.cpp [new file with mode: 0644]
src/standards/Tizen/Vehicle/VehicleResponseDispatcher.h [new file with mode: 0644]
src/standards/Tizen/Vehicle/config.xml [new file with mode: 0644]

index 1fbb308..2243ba1 100755 (executable)
@@ -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 (file)
index 0000000..1e4eed5
--- /dev/null
@@ -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 <Commons/ThreadPool.h>
+#include "Vehicle.h"
+#include <dpl/log/log.h>
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+Vehicle::Vehicle()
+/* TODO: Check thread id as it may not be same as module name */
+ : WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGetSupportedEventTypes>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD),
+   WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGet>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD),
+   WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventSet>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD)
+{
+    LogDebug("entered: src/platform/API/Vehicle/Vehicle.cpp");
+}
+
+Vehicle::~Vehicle()
+{
+}
+
+void Vehicle::getSupportedEventTypes(DPL::SharedPtr<VehicleEventGetSupportedEventTypes> &event)
+{
+    WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGetSupportedEventTypes>::PostRequest(event);
+}
+
+void Vehicle::get(DPL::SharedPtr<VehicleEventGet> &event)
+{
+    WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGet>::PostRequest(event);
+}
+
+void Vehicle::set(DPL::SharedPtr<VehicleEventSet> &event)
+{
+    WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventSet>::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 (file)
index 0000000..3f61b88
--- /dev/null
@@ -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 <dpl/shared_ptr.h>
+#include <vector>
+#include <Commons/EventReceiver.h>
+#include <vector>
+#include <string>
+#include "VehicleEventGet.h" 
+#include "VehicleEventGetSupportedEventTypes.h" 
+#include "VehicleEventSet.h" 
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+class Vehicle
+ : public WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGetSupportedEventTypes>,
+   public WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventGet>,
+   public WrtDeviceApis::Commons::EventRequestReceiver<VehicleEventSet>
+{
+public:
+    Vehicle();
+
+    virtual ~Vehicle();
+
+    virtual void getSupportedEventTypes(DPL::SharedPtr<VehicleEventGetSupportedEventTypes> &event);
+
+    virtual void get(DPL::SharedPtr<VehicleEventGet> &event);
+
+    virtual void set(DPL::SharedPtr<VehicleEventSet> &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<Vehicle> 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 (file)
index 0000000..433ed83
--- /dev/null
@@ -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<int> VehicleEventGet::getInt() const
+{
+    return m_mint;
+}
+
+void VehicleEventGet::setInt(const DPL::SharedPtr<int>& 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 (file)
index 0000000..ae1c7ef
--- /dev/null
@@ -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 <Commons/IEvent.h>
+#include <dpl/shared_ptr.h>
+#include <string>
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+class VehicleEventGet : public WrtDeviceApis::Commons::IEvent<VehicleEventGet>
+{
+public:
+    VehicleEventGet();
+
+    ~VehicleEventGet();
+
+    bool getResult() const;
+
+    void setResult(bool res);
+
+    std::string getEvent() const;
+    void setEvent(const std::string& arg);
+
+    DPL::SharedPtr<int> getInt() const;
+    void setInt(const DPL::SharedPtr<int>& arg);
+
+    /* TODO: Manually declare callback arguments (if any required) */
+
+protected:
+    bool m_result;
+    std::string m_mevent;
+    DPL::SharedPtr<int> m_mint;
+};
+
+typedef DPL::SharedPtr<VehicleEventGet> 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 (file)
index 0000000..35b3851
--- /dev/null
@@ -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 (file)
index 0000000..c5bcf0a
--- /dev/null
@@ -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 <Commons/IEvent.h>
+#include <dpl/shared_ptr.h>
+#include <vector>
+#include <string>
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+class VehicleEventGetSupportedEventTypes : public WrtDeviceApis::Commons::IEvent<VehicleEventGetSupportedEventTypes>
+{
+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<VehicleEventGetSupportedEventTypes> 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 (file)
index 0000000..4262984
--- /dev/null
@@ -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<int> VehicleEventSet::getValue() const
+{
+    return m_mvalue;
+}
+
+void VehicleEventSet::setValue(const DPL::SharedPtr<int>& 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 (file)
index 0000000..08df069
--- /dev/null
@@ -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 <Commons/IEvent.h>
+#include <dpl/shared_ptr.h>
+#include <string>
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+class VehicleEventSet : public WrtDeviceApis::Commons::IEvent<VehicleEventSet>
+{
+public:
+    VehicleEventSet();
+
+    ~VehicleEventSet();
+
+    bool getResult() const;
+
+    void setResult(bool res);
+
+    std::string getEvent() const;
+    void setEvent(const std::string& arg);
+
+    DPL::SharedPtr<int> getValue() const;
+    void setValue(const DPL::SharedPtr<int>& arg);
+
+    /* TODO: Manually declare callback arguments (if any required) */
+
+protected:
+    bool m_result;
+    std::string m_mevent;
+    DPL::SharedPtr<int> m_mvalue;
+};
+
+typedef DPL::SharedPtr<VehicleEventSet> 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 (file)
index 0000000..68e2cba
--- /dev/null
@@ -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 <Tizen/Vehicle/Vehicle.h>
+
+
+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 (file)
index 0000000..247a0d3
--- /dev/null
@@ -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 <dpl/shared_ptr.h>
+#include <dpl/noncopyable.h>
+
+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 (file)
index 0000000..20d5c79
--- /dev/null
@@ -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
+)
index 334cd93..c8455fa 100755 (executable)
@@ -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 (file)
index 0000000..3f48a3b
--- /dev/null
@@ -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 <DBus/Connection.h>
+#include <DBus/MessageEvent.h>
+#include <dpl/log/log.h>
+
+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 (file)
index 0000000..073d958
--- /dev/null
@@ -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 <dpl/shared_ptr.h>
+#include <dpl/event/event_listener.h>
+#include <API/Vehicle/Vehicle.h>
+#include <DBus/Connection.h>
+#include <DBus/MessageEvent.h>
+
+
+namespace TizenApis {
+namespace Platform {
+namespace Vehicle {
+
+class Vehicle
+ : public TizenApis::Vehicle::Vehicle,
+   private DPL::Event::EventListener<DBus::MessageEvent>
+{
+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 (file)
index 0000000..a6ce8ef
--- /dev/null
@@ -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
+)
index 7aa633f..d79b9b7 100755 (executable)
@@ -16,3 +16,4 @@ include_config_file(Power)
 include_config_file(Notification)
 include_config_file(Download)
 include_config_file(Device)
+include_config_file(Vehicle)
index 4162aa0..5a21c19 100755 (executable)
@@ -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 (file)
index 0000000..4efe6fe
--- /dev/null
@@ -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 (file)
index 0000000..dc96e73
--- /dev/null
@@ -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 <Tizen/Common/JSTizenException.h>
+#include <Tizen/Common/JSTizenExceptionFactory.h>
+#include <Tizen/Common/SecurityExceptions.h>
+#include <CommonsJavaScript/PrivateObject.h>
+#include <CommonsJavaScript/Converter.h>
+#include <CommonsJavaScript/JSUtils.h>
+#include <CommonsJavaScript/Utils.h>
+#include <CommonsJavaScript/Validator.h>
+#include <CommonsJavaScript/ScopedJSStringRef.h>
+#include <CommonsJavaScript/JSCallbackManager.h>
+#include <dpl/log/log.h>
+#include <API/Vehicle/VehicleFactory.h>
+
+#include "JSVehicle.h"
+#include <vector>
+#include <string>
+#include <API/Vehicle/VehicleEventGet.h>
+#include <API/Vehicle/VehicleEventSet.h>
+#include <API/Vehicle/VehicleEventGetSupportedEventTypes.h>
+#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<Vehicle>, 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<Vehicle>& impl)
+{
+    JSVehiclePriv *priv = new JSVehiclePriv(context, impl);
+    JSObjectRef result = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
+    if (result == NULL) {
+        LogError("object creation error");
+        return JSValueMakeUndefined(context);
+    }
+    return result;
+}
+
+DPL::SharedPtr<Vehicle> 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<Vehicle> JSVehicle::getVehiclePtr(JSContextRef context,
+                                                 JSObjectRef object)
+{
+    if (!object) {
+        ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Object is null");
+    }
+    JSVehiclePriv *priv = static_cast<JSVehiclePriv*>(JSObjectGetPrivate(object));
+    if (!priv) {
+        ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+    }
+    DPL::SharedPtr<Vehicle> 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<Vehicle> obj = VehicleFactory::getInstance().createVehicleObject();
+        JSVehiclePriv *priv = new JSVehiclePriv(context, obj);
+        if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
+            delete priv;
+        }
+    }
+}
+
+void JSVehicle::finalize(JSObjectRef object)
+{
+    LogDebug("entered");
+    JSVehiclePriv *priv = static_cast<JSVehiclePriv*>(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<JSVehiclePriv*>(JSObjectGetPrivate(thisObject));
+        if (!privateObject) {
+            ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+        }
+
+       DPL::SharedPtr<Vehicle> 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<IEventPrivateData>(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<JSVehiclePriv*>(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<JSVehiclePriv*>(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 (file)
index 0000000..41bfa59
--- /dev/null
@@ -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 <JavaScriptCore/JavaScript.h>
+#include <CommonsJavaScript/PrivateObject.h>
+#include <dpl/shared_ptr.h>
+#include <API/Vehicle/Vehicle.h>
+
+namespace TizenApis {
+namespace Vehicle {
+
+class JSVehicle
+{
+public:
+    virtual ~JSVehicle();
+
+    static const JSClassRef getClassRef();
+
+    static JSValueRef createJSObject(JSContextRef context,
+                                     const DPL::SharedPtr<Vehicle>& impl);
+
+    static DPL::SharedPtr<Vehicle> getVehiclePtr(JSContextRef context,
+                                                 JSValueRef value);
+
+    static DPL::SharedPtr<Vehicle> 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<JSVehicle> 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 (file)
index 0000000..24d0128
--- /dev/null
@@ -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 <iostream>
+#include <Commons/Exception.h>
+#include <dpl/exception.h>
+#include <Commons/FunctionDefinition.h>
+#include <map>
+#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 (file)
index 0000000..2597bd5
--- /dev/null
@@ -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 <string>
+#include <Commons/FunctionDeclaration.h>
+
+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<AceFunctionGetter, DefaultArgsVerifier<> >( 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 (file)
index 0000000..0d508e5
--- /dev/null
@@ -0,0 +1,63 @@
+#include <Commons/plugin_initializer_def.h>
+#include <Commons/WrtAccess/WrtAccess.h>
+#include <Commons/Exception.h>
+#include <dpl/log/log.h>
+#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<JSContextRef>(context));
+    VehicleListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(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 (file)
index 0000000..fe7ac99
--- /dev/null
@@ -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 <dpl/singleton.h>
+#include <dpl/singleton_impl.h>
+#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 (file)
index 0000000..275cb7b
--- /dev/null
@@ -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 <Tizen/Common/AsyncCallbackManager.h>
+
+
+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 (file)
index 0000000..410825f
--- /dev/null
@@ -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 <Commons/Exception.h>
+#include <CommonsJavaScript/JSUtils.h>
+#include "VehicleConverter.h" 
+
+#include <API/Vehicle/Vehicle.h>
+#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<Vehicle> &arg)
+{
+    if(arg == NULL) {
+        ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Object is null");
+    }
+    return CommonsJavaScript::JSUtils::makeObject(m_context, JSVehicle::getClassRef(), arg);
+}
+
+const DPL::SharedPtr<Vehicle> 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<Vehicle> 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 (file)
index 0000000..769ef47
--- /dev/null
@@ -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 <JavaScriptCore/JavaScript.h>
+#include <CommonsJavaScript/Converter.h>
+
+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<Vehicle> &arg);
+
+    const DPL::SharedPtr<Vehicle> 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 (file)
index 0000000..025b9fc
--- /dev/null
@@ -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 <map>
+#include <dpl/log/log.h>
+#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 (file)
index 0000000..717e075
--- /dev/null
@@ -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 <dpl/singleton.h>
+#include <dpl/singleton_impl.h>
+#include <dpl/shared_ptr.h>
+#include <JavaScriptCore/JavaScript.h>
+#include <Tizen/Common/IListenerManager.h>
+
+
+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 (file)
index 0000000..3e86fea
--- /dev/null
@@ -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 <Commons/ThreadPool.h>
+#include <CommonsJavaScript/JSCallbackManager.h>
+#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<VehicleEventGetSupportedEventTypes>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD),
+   WrtDeviceApis::Commons::EventAnswerReceiver<VehicleEventGet>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD),
+   WrtDeviceApis::Commons::EventAnswerReceiver<VehicleEventSet>(WrtDeviceApis::Commons::ThreadEnum::VEHICLE_THREAD)
+{
+    /*TODO: add details*/
+}
+
+VehicleResponseDispatcher::~VehicleResponseDispatcher()
+{
+    /*TODO: add details*/
+}
+
+void VehicleResponseDispatcher::OnAnswerReceived(const DPL::SharedPtr<VehicleEventGetSupportedEventTypes> &event)
+{
+#if 0
+       /* ASYNC CALL EXAMPLE */
+       LogDebug("entered");
+       JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast<JSCallbackManager>(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<VehicleEventGet> &event)
+{
+    /* TODO: Add implementation specific details */
+}
+
+void VehicleResponseDispatcher::OnAnswerReceived(const DPL::SharedPtr<VehicleEventSet> &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 (file)
index 0000000..501e053
--- /dev/null
@@ -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 <JavaScriptCore/JavaScript.h>
+#include <Commons/EventReceiver.h>
+#include <Commons/EventListener.h>
+
+#include <API/Vehicle/VehicleEventGet.h>
+#include <API/Vehicle/VehicleEventGetSupportedEventTypes.h>
+#include <API/Vehicle/VehicleEventSet.h>
+
+
+namespace TizenApis {
+namespace Vehicle {
+
+class VehicleResponseDispatcher
+ : public WrtDeviceApis::Commons::EventAnswerReceiver<VehicleEventGetSupportedEventTypes>,
+   public WrtDeviceApis::Commons::EventAnswerReceiver<VehicleEventGet>,
+   public WrtDeviceApis::Commons::EventAnswerReceiver<VehicleEventSet>
+{
+public:
+    static VehicleResponseDispatcher& getInstance();
+
+    virtual ~VehicleResponseDispatcher();
+
+protected:
+    void OnAnswerReceived(const DPL::SharedPtr<VehicleEventGetSupportedEventTypes> &event);
+
+    void OnAnswerReceived(const DPL::SharedPtr<VehicleEventGet> &event);
+
+    void OnAnswerReceived(const DPL::SharedPtr<VehicleEventSet> &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 (file)
index 0000000..c798174
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<!DOCTYPE plugin-properties SYSTEM "/usr/etc/tizen-apis/config.dtd">
+<plugin-properties>
+    <library-name>libwrt-plugins-tizen-1.0-vehicle.so</library-name>
+    <feature-install-uri>vehicle.install.uri</feature-install-uri>
+    <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
+    <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
+    <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
+
+    <api-feature>
+        <name>http://tizen.org/api/vehicle</name>
+        <device-capability>vehicle</device-capability>
+    </api-feature>
+
+</plugin-properties>