--- /dev/null
+CMakeCache.txt
+CMakeFiles/
+build-stamp
+cmake_install.cmake
+config.guess
+config.sub
+configure-stamp
+debian/files
+debian/tmp/
+install_manifest.txt
+Makefile
+debian/wrt-plugins-dev.install
+debian/wrt-plugins.install
+debian/wrt-plugins.postinst
+debian/wrt-plugins-common-dbg.debhelper.log
+debian/wrt-plugins-common-dbg.substvars
+debian/wrt-plugins-common-dbg/
+debian/wrt-plugins-common.debhelper.log
+debian/wrt-plugins-common.substvars
+debian/wrt-plugins-common/
+src/Makefile
+
+debian/wrt-plugins-common-dev.debhelper.log
+debian/wrt-plugins-common-dev.install
+debian/wrt-plugins-common-dev.substvars
+debian/wrt-plugins-common-dev/
+debian/wrt-plugins-common.install
+debian/wrt-plugins-common.postinst
+debian/wrt-plugins-common.postinst.debhelper
+debian/wrt-plugins-common.postrm.debhelper
+
+pkgconfigs/*.pc
+
+*~
+*.swp
+cmake_build/*
+
+src/modules/slp2.0/WidgetInterfaceDAO/.widget_interface.db
+src/modules/slp2.0/WidgetInterfaceDAO/.widget_interface.db-journal
+src/modules/slp2.0/WidgetInterfaceDAO/widget_interface_db.sql
+
+/bin
\ No newline at end of file
ADD_DEFINITIONS("-Wextra")
ADD_DEFINITIONS("-Wno-deprecated")
#ADD_DEFINITIONS("-DDEVPKG")
+# GCC 4.7 changes the scheme of name lookup. Guide: http://gcc.gnu.org/gcc-4.7/porting_to.html
+ADD_DEFINITIONS("-fpermissive")
##############################################################################
# CMake flags
+wrt-plugins-common (0.3.75) unstable; urgency=low
+
+ * Update unmerged source code
+ * Converter::toULong converts values from type double via type long
+ * Fix for GCC 4.7 compatibility
+
+ -- Jihoon Chung <jihoon.chung@samsung.com> Thu, 21 Mar 2013 12:50:31 +0900
+
wrt-plugins-common (0.3.74) unstable; urgency=low
* Bug Fix for crash while webapi notification TC is running.
-#git:framework/web/wrt-plugins-common wrt-plugins-common_0.3.74
+#git:framework/web/wrt-plugins-common wrt-plugins-common_0.3.75
Name: wrt-plugins-common
Summary: wrt-plugins common library
-Version: 0.3.74
+Version: 0.3.75
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
unsigned long Converter::toULong(const JSValueRef& arg)
{
- return static_cast<unsigned long>(toLong(arg));
+ double tmp = toNumber_(arg);
+ return (isNan(tmp) ? 0 : static_cast<unsigned long>(tmp));
}
std::size_t Converter::toSizeT(const JSValueRef& arg)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file AppLauncherFactory.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#include <AppLauncher/AppLauncherManager.h>
-#include "AppLauncherFactory.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-IAppLauncherManagerPtr AppLauncherFactory::createAppLauncherManagerObject()
-{
- IAppLauncherManagerPtr result(new WrtPlugins::Platform::AppLauncherManager());
- return result;
-}
-
-AppLauncherFactory& AppLauncherFactory::getInstance()
-{
- static AppLauncherFactory theInstance;
- return theInstance;
-}
-}
-}
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file ApplauncherFactory.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_APPLAUNCHER_FACTORY_H_
-#define _ABSTRACT_LAYER_APPLAUNCHER_FACTORY_H_
-
-#include <dpl/shared_ptr.h>
-#include "IAppLauncherManager.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-class AppLauncherFactory : private DPL::Noncopyable
-{
- private:
- AppLauncherFactory()
- {}
-
- public:
- static AppLauncherFactory& getInstance();
- IAppLauncherManagerPtr createAppLauncherManagerObject();
-};
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_APPLAUNCHER_FACTORY_H_ */
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file ApplauncherFactory.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_APPLICATION_TYPES_H_
-#define _ABSTRACT_LAYER_APPLICATION_TYPES_H_
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-typedef enum
-{
- APPLICATION_TYPE_UNDEFINED,
- APPLICATION_TYPE_ALARM,
- APPLICATION_TYPE_BROWSER,
- APPLICATION_TYPE_CALCULATOR,
- APPLICATION_TYPE_CALENDAR,
- APPLICATION_TYPE_CAMERA,
- APPLICATION_TYPE_CONTACTS,
- APPLICATION_TYPE_FILES,
- APPLICATION_TYPE_GAMES,
- APPLICATION_TYPE_MAIL,
- APPLICATION_TYPE_MEDIAPLAYER,
- APPLICATION_TYPE_MESSAGING,
- APPLICATION_TYPE_PHONECALL,
- APPLICATION_TYPE_PICTURES,
- APPLICATION_TYPE_PROG_MANAGER,
- APPLICATION_TYPE_SETTINGS,
- APPLICATION_TYPE_TASKS,
- APPLICATION_TYPE_WIDGET_MANAGER
-} ApplicationType;
-
-typedef enum
-{
- APPLICATION_URI_TYPE_UNDEFINED,
- APPLICATION_URI_TYPE_HTTP,
- APPLICATION_URI_TYPE_HTTPS,
- APPLICATION_URI_TYPE_TEL,
- APPLICATION_URI_TYPE_MAILTO,
- APPLICATION_URI_TYPE_SMS,
- APPLICATION_URI_TYPE_FILE,
- APPLICATION_URI_TYPE_APPLICATION_BY_NAME
-} ApplicationUriType;
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_APPLICATION_TYPES_H_ */
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file EventGetDefaultApplication.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_EVENT_GET_DEFAULT_APPLICATION_H_
-#define _ABSTRACT_LAYER_EVENT_GET_DEFAULT_APPLICATION_H_
-
-#include <string>
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include <commons/EventReceiver.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-/* this event is sent when default application is get */
-class EventGetDefaultApplication : public WrtPlugins::Platform::IEvent<
- EventGetDefaultApplication>
-{
- std::string m_applicationFullPath;
- std::string m_applicationName;
- std::string m_mime;
-
- public:
- void setMime(const std::string &value)
- {
- m_mime = value;
- }
- std::string getMime() const
- {
- return m_mime;
- }
- void setApplicationFullPath(const std::string &value)
- {
- m_applicationFullPath = value;
- }
- std::string getApplicationFullPath() const
- {
- return m_applicationFullPath;
- }
- void setApplicationName(const std::string &value)
- {
- m_applicationName = value;
- }
- std::string getApplicationName() const
- {
- return m_applicationName;
- }
- virtual void clearOnCancel()
- {}
- EventGetDefaultApplication()
- {}
-};
-
-typedef DPL::SharedPtr<EventGetDefaultApplication>
-EventGetDefaultApplicationPtr;
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_EVENT_GET_DEFAULT_APPLICATION_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file IEventGetInstalledApplications.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_EVENT_GET_INSTALLED_APPLICATIONS_H_
-#define _ABSTRACT_LAYER_EVENT_GET_INSTALLED_APPLICATIONS_H_
-
-#include <string>
-#include <vector>
-#include <map>
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include <commons/EventReceiver.h>
-#include "ApplicationTypes.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-/* This event is sent when list of installed applications is get */
-class EventGetInstalledApplications : public WrtPlugins::Platform::IEvent<
- EventGetInstalledApplications>
-{
- std::vector<std::string> m_applicationFullPaths;
- std::vector<std::string> m_applicationNames;
- std::map<ApplicationType, std::string> m_applicationTypesPath;
- std::map<ApplicationType, std::string> m_applicationTypesName;
-
- public:
- void addApplicationTypeByName(const std::pair<ApplicationType,
- std::string> &value)
- {
- m_applicationTypesName.insert(value);
- }
- const std::map<ApplicationType,
- std::string> &getApplicationTypesByName() const
- {
- return m_applicationTypesName;
- }
- void addApplicationTypeByPath(const std::pair<ApplicationType,
- std::string> &value)
- {
- m_applicationTypesPath.insert(value);
- }
- const std::map<ApplicationType,
- std::string> &getApplicationTypesByPath() const
- {
- return m_applicationTypesPath;
- }
- void addApplicationFullPath(const std::string &value)
- {
- m_applicationFullPaths.push_back(value);
- }
- const std::vector<std::string> &getApplicationFullPaths() const
- {
- return m_applicationFullPaths;
- }
- void addApplicationName(const std::string &value)
- {
- m_applicationNames.push_back(value);
- }
- const std::vector<std::string> &getApplicationNames() const
- {
- return m_applicationNames;
- }
- virtual void clearOnCancel()
- {}
- EventGetInstalledApplications()
- {}
-};
-
-typedef DPL::SharedPtr<EventGetInstalledApplications>
-EventGetInstalledApplicationsPtr;
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_GET_INSTALLED_APPLICATIONS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @file IEventLaunchApplication.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_IEVENT_LAUNCH_APPLICATION_H_
-#define _ABSTRACT_LAYER_IEVENT_LAUNCH_APPLICATION_H_
-
-#include <vector>
-#include <string>
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include <commons/EventReceiver.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-/* this event is sent when application is launched */
-class EventLaunchApplication : public WrtPlugins::Platform::IEvent<
- EventLaunchApplication>
-{
- //Uri type. http://, file://, sms:, mailto: etc
- ApplicationUriType m_applicationUriType;
- // used as param to uriType, for example http address, path to file, phone
- // number, etc
- std::string m_applicationUriParam;
- //optional parameters for file://
- std::vector<std::string> m_applicationParameters;
-
- public:
- void addApplicationParameter(const std::string &value)
- {
- m_applicationParameters.push_back(value);
- }
- std::vector<std::string> getApplicationParameters() const
- {
- return m_applicationParameters;
- }
- void setApplicationUriType(const ApplicationUriType value)
- {
- m_applicationUriType = value;
- }
- ApplicationUriType getApplicationUriType() const
- {
- return m_applicationUriType;
- }
- void setApplicationUriParam(const std::string &value)
- {
- m_applicationUriParam = value;
- }
- std::string getApplicationUriParam() const
- {
- return m_applicationUriParam;
- }
- virtual void clearOnCancel()
- {}
- EventLaunchApplication() : m_applicationUriType(
- APPLICATION_URI_TYPE_UNDEFINED)
- {}
-};
-
-typedef DPL::SharedPtr<EventLaunchApplication> EventLaunchApplicationPtr;
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_LAUNCH_APPLICATION_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file IAppLauncherManager.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#include "IAppLauncherManager.h"
-#include <commons/ThreadPool.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-IAppLauncherManager::IAppLauncherManager() :
- EventRequestReceiverGetDefaultApplication(Platform::ThreadEnum::
- APPLAUNCHER_THREAD),
- EventRequestReceiverGetInstalledApplications(Platform::ThreadEnum::
- APPLAUNCHER_THREAD),
- EventRequestReceiverLaunchApplication(Platform::ThreadEnum::
- APPLAUNCHER_THREAD)
-{}
-
-IAppLauncherManager::~IAppLauncherManager()
-{}
-
-void IAppLauncherManager::getDefaultApplication(
- const EventGetDefaultApplicationPtr &event)
-{
- EventRequestReceiverGetDefaultApplication::PostRequest(event);
-}
-
-void IAppLauncherManager::getInstalledApplications(
- const EventGetInstalledApplicationsPtr &event)
-{
- EventRequestReceiverGetInstalledApplications::PostRequest(event);
-}
-
-void IAppLauncherManager::launchApplication(
- const EventLaunchApplicationPtr &event)
-{
- EventRequestReceiverLaunchApplication::PostRequest(event);
-}
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file IAppLauncherManager.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_IAPP_LAUNCHER_MANAGER_H_
-#define _ABSTRACT_LAYER_IAPP_LAUNCHER_MANAGER_H_
-
-#include <string>
-#include <vector>
-#include <dpl/shared_ptr.h>
-#include "EventGetDefaultApplication.h"
-#include "EventGetInstalledApplications.h"
-#include "EventLaunchApplication.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace AppLauncher {
-typedef Platform::EventRequestReceiver< EventGetDefaultApplication >
-EventRequestReceiverGetDefaultApplication;
-typedef Platform::EventRequestReceiver< EventGetInstalledApplications >
-EventRequestReceiverGetInstalledApplications;
-typedef Platform::EventRequestReceiver< EventLaunchApplication >
-EventRequestReceiverLaunchApplication;
-
-class IAppLauncherManager : public EventRequestReceiverGetDefaultApplication,
- public EventRequestReceiverGetInstalledApplications,
- public EventRequestReceiverLaunchApplication
-{
- public:
- IAppLauncherManager();
- virtual ~IAppLauncherManager();
- virtual void getDefaultApplication(
- const EventGetDefaultApplicationPtr &event);
- virtual void getInstalledApplications(
- const EventGetInstalledApplicationsPtr &event);
- virtual void launchApplication(const EventLaunchApplicationPtr &event);
-
- protected:
- virtual void OnRequestReceived(const EventGetDefaultApplicationPtr &event)
- = 0;
- virtual void OnRequestReceived(
- const EventGetInstalledApplicationsPtr &event) = 0;
- virtual void OnRequestReceived(const EventLaunchApplicationPtr &event) = 0;
-};
-
-typedef DPL::SharedPtr<IAppLauncherManager> IAppLauncherManagerPtr;
-}
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IAPP_LAUNCHER_MANAGER_H_ */
+++ /dev/null
-get_current_path()
-set(SRCS_PLATFORM_API_APPLAUNCHER
- ${CURRENT_PATH}/AppLauncherFactory.cpp
- ${CURRENT_PATH}/IAppLauncherManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DEVICE_ENUMS_H_
-#define WRTPLUGINS_DEVICE_ENUMS_H_
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-enum ClamshellState
-{
- CSS_OPEN,
- CSS_CLOSE
-};
-
-enum KeypadLightState
-{
- KLS_ON,
- KLS_OFF
-};
-} // Device
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DEVICE_ENUMS_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "EventClamshellStateChange.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-EventClamshellStateChange::EventClamshellStateChange() : m_state(CSS_CLOSE)
-{}
-
-EventClamshellStateChange::~EventClamshellStateChange()
-{}
-
-ClamshellState EventClamshellStateChange::getState() const
-{
- return m_state;
-}
-
-void EventClamshellStateChange::setState(ClamshellState state)
-{
- m_state = state;
-}
-} // Device
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_DEVICE_EVENTCLAMSHELLSTATECHANGE_H_
-#define WRTPLUGINS_DEVICE_EVENTCLAMSHELLSTATECHANGE_H_
-
-#include <dpl/shared_ptr.h>
-#include <platform/commons/ListenerEvent.h>
-#include <platform/commons/ListenerEventEmitter.h>
-#include "Enums.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-/**
- * Event emitted when screen orientation changes.
- */
-class EventClamshellStateChange : public Platform::ListenerEvent<
- EventClamshellStateChange>
-{
- public:
- EventClamshellStateChange();
- virtual ~EventClamshellStateChange();
-
- /**
- * Gets clamshell's state.
- * @return State of the clamshell.
- */
- ClamshellState getState() const;
-
- /**
- * Sets clamshell's state.
- * @param state State of the clamshell.
- */
- void setState(ClamshellState state);
-
- protected:
- ClamshellState m_state;
-};
-
-typedef DPL::SharedPtr<EventClamshellStateChange> EventClamshellStateChangePtr;
-typedef Platform::ListenerEventEmitter<EventClamshellStateChange>
-EventClamshellStateChangeEmitter;
-typedef DPL::SharedPtr<EventClamshellStateChangeEmitter>
-EventClamshellStateChangeEmitterPtr;
-} // Device
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DEVICE_EVENTCLAMSHELLSTATECHANGE_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IClamshell.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-IClamshell::~IClamshell()
-{}
-} // Device
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DEVICE_ICLAMSHELL_H_
-#define WRTPLUGINS_DEVICE_ICLAMSHELL_H_
-
-#include <dpl/noncopyable.h>
-#include "EventClamshellStateChange.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-class IClamshell : private DPL::Noncopyable
-{
- public:
- virtual ~IClamshell() = 0;
-
- /**
- * Adds on change state event emitter.
- * @param emitter On change state event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void addOnStateChange(
- const EventClamshellStateChangeEmitterPtr& emitter) = 0;
-
- /**
- * Removes on change state emitter.
- * @param id Id of an event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void removeOnStateChange(
- EventClamshellStateChangeEmitter::IdType id) = 0;
-};
-} // Device
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DEVICE_ICLAMSHELL_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IKeypad.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-IKeypad::~IKeypad()
-{}
-} // Device
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DEVICE_IKEYPAD_H_
-#define WRTPLUGINS_DEVICE_IKEYPAD_H_
-
-#include <dpl/noncopyable.h>
-#include "Enums.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-class IKeypad : private DPL::Noncopyable
-{
- public:
- virtual ~IKeypad();
-
- /**
- * Gets state of keypad's backlight.
- * @return State of keypad's backlight.
- */
- virtual KeypadLightState getLightState() const = 0;
-};
-} // Device
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DEVICE_IKEYPAD_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IManager.h"
-#include <Device/Manager.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-IManager& IManager::getInstance()
-{
- return Platform::Device::Manager::getInstance();
-}
-
-IManager::~IManager()
-{}
-} // Device
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DEVICE_IMANAGER_H_
-#define WRTPLUGINS_DEVICE_IMANAGER_H_
-
-#include <string>
-#include <dpl/noncopyable.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Device {
-class IClamshell;
-class IKeypad;
-
-class IManager : private DPL::Noncopyable
-{
- public:
- static IManager& getInstance();
-
- public:
- virtual ~IManager() = 0;
-
- /**
- * Gets if device is equipped with clamshell.
- * @return True if clamshell is supported, false otherwise.
- */
- virtual bool hasClamshell() const = 0;
-
- /**
- * Gets clamshell interface.
- * @return Clamshell interface.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks Ownership does NOT follow caller.
- */
- virtual IClamshell* getClamshell() const = 0;
-
- /**
- * Gets if device is equipped with keypad.
- * @return True if keypad is present, false otherwise.
- */
- virtual bool hasKeypad() const = 0;
-
- /**
- * Gets keypad interface.
- * @return Keypad interface.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks Ownership does NOT follow caller.
- */
- virtual IKeypad* getKeypad() const = 0;
-
- /**
- * Gets IMEI number.
- * @return IMEI number.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual std::string getImei() const = 0;
-};
-} // Device
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DEVICE_IMANAGER_H_
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_API_DEVICE
- ${CURRENT_PATH}/EventClamshellStateChange.cpp
- ${CURRENT_PATH}/IClamshell.cpp
- ${CURRENT_PATH}/IKeypad.cpp
- ${CURRENT_PATH}/IManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DISPLAY_ENUMS_H_
-#define WRTPLUGINS_DISPLAY_ENUMS_H_
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-enum State
-{
- ST_ON,
- ST_DIM,
- ST_OFF
-};
-
-enum Orientation
-{
- O_PORTRAIT,
- O_LANDSCAPE
-};
-} // Display
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DISPLAY_ENUMS_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "EventChangeOrientation.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-EventChangeOrientation::EventChangeOrientation() : m_orientation(O_PORTRAIT)
-{}
-
-EventChangeOrientation::~EventChangeOrientation()
-{}
-
-Orientation EventChangeOrientation::getOrientation() const
-{
- return m_orientation;
-}
-
-void EventChangeOrientation::setOrientation(Orientation orientation)
-{
- m_orientation = orientation;
-}
-} // Display
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_DISPLAY_EVENTCHANGEORIENTATION_H_
-#define WRTPLUGINS_DISPLAY_EVENTCHANGEORIENTATION_H_
-
-#include <dpl/shared_ptr.h>
-#include <platform/commons/ListenerEvent.h>
-#include <platform/commons/ListenerEventEmitter.h>
-#include "Enums.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-/**
- * Event emitted when screen orientation changes.
- */
-class EventChangeOrientation : public Platform::ListenerEvent<
- EventChangeOrientation>
-{
- public:
- EventChangeOrientation();
- virtual ~EventChangeOrientation();
-
- /**
- * Gets screen's orientation.
- * @return Orientation.
- */
- Orientation getOrientation() const;
-
- /**
- * Sets screen's orientation.
- * @param orientation Orientation.
- */
- void setOrientation(Orientation orientation);
-
- protected:
- Orientation m_orientation;
-};
-
-typedef DPL::SharedPtr<EventChangeOrientation> EventChangeOrientationPtr;
-typedef Platform::ListenerEventEmitter<EventChangeOrientation>
-EventChangeOrientationEmitter;
-typedef DPL::SharedPtr<EventChangeOrientationEmitter>
-EventChangeOrientationEmitterPtr;
-} // Display
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DISPLAY_EVENTCHANGEORIENTATION_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "EventChangeState.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-EventChangeState::EventChangeState() : m_state(ST_OFF)
-{}
-
-EventChangeState::~EventChangeState()
-{}
-
-State EventChangeState::getState() const
-{
- return m_state;
-}
-
-void EventChangeState::setState(State state)
-{
- m_state = state;
-}
-} // Display
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_DISPLAY_EVENTCHANGESTATE_H_
-#define WRTPLUGINS_DISPLAY_EVENTCHANGESTATE_H_
-
-#include <dpl/shared_ptr.h>
-#include <platform/commons/ListenerEvent.h>
-#include <platform/commons/ListenerEventEmitter.h>
-#include "Enums.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-/**
- * Event emitted when screen changes its state.
- */
-class EventChangeState : public Platform::ListenerEvent<EventChangeState>
-{
- public:
- EventChangeState();
- virtual ~EventChangeState();
-
- /**
- * Gets screen's state.
- * @return State of the screen.
- */
- State getState() const;
-
- /**
- * Sets screen's state.
- * @param state State of the screen.
- */
- void setState(State state);
-
- protected:
- State m_state; ///< State of the screen.
-};
-
-typedef DPL::SharedPtr<EventChangeState> EventChangeStatePtr;
-typedef Platform::ListenerEventEmitter<EventChangeState>
-EventChangeStateEmitter;
-typedef DPL::SharedPtr<EventChangeStateEmitter> EventChangeStateEmitterPtr;
-} // Display
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DISPLAY_EVENTCHANGESTATE_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IManager.h"
-#include <Display/Manager.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-IManager& IManager::getInstance()
-{
- return Platform::Display::Manager::getInstance();
-}
-
-IManager::~IManager()
-{}
-} // Display
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DISPLAY_IMANAGER_H_
-#define WRTPLUGINS_DISPLAY_IMANAGER_H_
-
-#include <cstddef>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-class IScreen;
-
-class IManager
-{
- public:
- static IManager& getInstance();
-
- public:
- virtual ~IManager() = 0;
-
- /**
- * Gets interface to specified screen.
- * @param index Index of a screen to get (1-based)
- * @return Screen interface.
- * @throw UnsupportedException If current platform doesn't support it.
- * @throw OutOfRangeException If specified screen doesn't exist.
- * @throw PlatformException If error in platform occurs.
- * @remarks On some platforms passing 0 as screen index may result in
- * returning
- * some global screen interface. Other may return default screen.
- * @remarks Ownership is NOT passed to the caller.
- */
- virtual IScreen* getScreen(std::size_t index) const = 0;
-
- /**
- * Gets number of supported screens.
- * @return Screens count.
- */
- virtual std::size_t getScreensCount() const = 0;
-};
-} // Display
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DISPLAY_IMANAGER_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IScreen.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-IScreen::~IScreen()
-{}
-} // Display
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_DISPLAY_ISCREEN_H_
-#define WRTPLUGINS_DISPLAY_ISCREEN_H_
-
-#include <dpl/shared_ptr.h>
-#include <dpl/noncopyable.h>
-#include <platform/commons/Dimension.h>
-#include "EventChangeOrientation.h"
-#include "EventChangeState.h"
-#include "Enums.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Display {
-class IScreen : private DPL::Noncopyable
-{
- public:
- virtual ~IScreen() = 0;
-
- /**
- * Gets color depth.
- * @return Color depth (in bits per pixel).
- */
- virtual unsigned short getColorDepth() const = 0;
-
- /**
- * Gets screen's real size (in pixels).
- * @return Screen's real size.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks "Real size" means that temporary screen modifications like e.g.
- * changing orientation are not taken into account.
- */
- virtual Platform::Dimension getSize() const = 0;
-
- /**
- * Gets screen's actual size (in pixels).
- * @return Screen's actual size.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks Convenience method that takes into account any temporary screen
- * modifications like e.g. changing orientation.
- */
- virtual Platform::Dimension getActualSize() const = 0;
-
- /**
- * Gets screen's orientation.
- * @return Orientation.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual Orientation getOrientation() const = 0;
-
- /**
- * Gets screen state.
- * @return State of the screen.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual State getState() const = 0;
-
- /**
- * Adds on change size event emitter.
- * @param emitter On change size event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void addOnChangeOrientation(
- const EventChangeOrientationEmitterPtr& emitter) = 0;
-
- /**
- * Removes on change size emitter.
- * @param id Id of an event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void removeOnChangeOrientation(
- EventChangeOrientationEmitter::IdType id) = 0;
-
- /**
- * Adds on change state event emitter.
- * @param emitter On change state event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void addOnChangeState(const EventChangeStateEmitterPtr& emitter) =
- 0;
-
- /**
- * Removes on change state emitter.
- * @param id Id of an event emitter.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual void removeOnChangeState(EventChangeStateEmitter::IdType id) = 0;
-};
-
-typedef DPL::SharedPtr<IScreen> IScreenPtr;
-} // Display
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_DISPLAY_ISCREEN_H_
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_API_DISPLAY
- ${CURRENT_PATH}/EventChangeOrientation.cpp
- ${CURRENT_PATH}/EventChangeState.cpp
- ${CURRENT_PATH}/IManager.cpp
- ${CURRENT_PATH}/IScreen.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _IEVENT_LOAD_FEATURE_
-#define _IEVENT_LOAD_FEATURE_
-
-/*
- * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- */
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-class EventLoadFeature : public WrtPlugins::Platform::IEvent<EventLoadFeature>
-{
- public:
- explicit EventLoadFeature(const std::string &feature) :
- m_success(false),
- m_feature(feature),
- m_object(0)
- {}
-
- ~EventLoadFeature()
- {
- LogDebug(__FUNCTION__);
- }
-
- const std::string getFeature() const
- {
- return m_feature;
- }
-
- const bool isSuccess() const
- {
- return m_success;
- }
-
- void setStatus(bool status)
- {
- m_success = status;
- }
-
- void* getObject() const
- {
- return m_object;
- }
-
- void setObject(void* jsObject)
- {
- m_object = jsObject;
- }
-
- virtual void clearOnCancel()
- {}
-
- private:
- bool m_success;
- std::string m_feature;
- void *m_object;
-};
-
-typedef DPL::SharedPtr<EventLoadFeature> EventLoadFeaturePtr;
-} // namespace Api
-} // namespace WrtPlugins
-
-#endif // _IEVENT_LOAD_FEATURE_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- */
-#include "FeatureManagerFactory.h"
-#include <FeatureLoader/FeatureManager.h>
-
-namespace WrtPlugins {
-namespace Api {
-IFeatureManagerPtr FeatureManagerFactory::createFeatureManager()
-{
- return IFeatureManagerPtr(new WrtPlugins::Platform::FeatureManager());
-}
-} // namespace Api
-} // namespace WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _FEATUREMANAGERFACTORY_H_
-#define _FEATUREMANAGERFACTORY_H_
-
-/*
- * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- */
-
-#include "IFeatureManager.h"
-
-namespace WrtPlugins {
-namespace Api {
-class FeatureManagerFactory :
- private DPL::Noncopyable
-{
- public:
- static FeatureManagerFactory& getInstance()
- {
- static FeatureManagerFactory instance;
- return instance;
- }
-
- IFeatureManagerPtr createFeatureManager();
-
- private:
- FeatureManagerFactory()
- {}
- ~FeatureManagerFactory()
- {}
-};
-} // namespace Api
-} // namespace WrtPlugins
-
-#endif // _FEATUREMANAGERFACTORY_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author: Bartlomiej Grzelewski <b.grzelewski@samsung.com>
- */
-
-#include "IFeatureManager.h"
-#include <commons/ThreadPool.h>
-
-namespace WrtPlugins {
-namespace Api {
-IFeatureManager::IFeatureManager() :
- Platform::EventRequestReceiver<EventLoadFeature>(Platform::ThreadEnum::
- BONDI_THREAD)
-{}
-
-IFeatureManager::~IFeatureManager()
-{}
-
-void IFeatureManager::loadFeature(const EventLoadFeaturePtr &event)
-{
- Platform::EventRequestReceiver<EventLoadFeature>::PostRequest(event);
-}
-} // namespace Api
-} // namespace WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _IFEATUREMANAGER_H_
-#define _IFEATUREMANAGER_H_
-
-#include <dpl/shared_ptr.h>
-#include "EventLoadFeature.h"
-
-namespace WrtPlugins {
-namespace Api {
-class IFeatureManager :
- public Platform::EventRequestReceiver<EventLoadFeature>
-{
- public:
- IFeatureManager();
- virtual ~IFeatureManager();
-
- /**
- * This fuction is used to load API feature whan widget is already started.
- */
-
- virtual void loadFeature(const EventLoadFeaturePtr &event);
-
- protected:
- virtual void OnRequestReceived(const EventLoadFeaturePtr &event) = 0;
-};
-
-typedef DPL::SharedPtr<IFeatureManager> IFeatureManagerPtr;
-} // namespace Api
-} // namespace WrtPlugins
-
-#endif // _IFEATUREMANAGER_H_
+++ /dev/null
-get_current_path()
-set(SRCS_PLATFORM_API_FEATURE_MANAGER
- ${CURRENT_PATH}/IFeatureManager.cpp
- ${CURRENT_PATH}/FeatureManagerFactory.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_CHANGEVIEW_H_
-#define WRT_PLUGINS_IEVENT_CHANGEVIEW_H_
-
-#include <commons/Exception.h>
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventChangeView : public WrtPlugins::Platform::IEvent<IEventChangeView>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IViewProperties m_props;
- IGalleryPtr m_gallery;
-
- public:
- IEventChangeView() : m_result(Commons::ExceptionCodes::None)
- {
- LogDebug("entered");
- }
-
- void setResult(const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- IViewProperties &getProperties()
- {
- return m_props;
- }
- void setProperties(const IViewProperties &props)
- {
- m_props = props;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
-};
-
-typedef DPL::SharedPtr<IEventChangeView> IEventChangeViewPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_CHANGEVIEW_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_CLOSE_H_
-#define WRT_PLUGINS_IEVENT_CLOSE_H_
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventClose : public WrtPlugins::Platform::IEvent<IEventClose>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IGalleryPtr m_gallery;
-
- public:
- void setResult(Commons::ExceptionCodes::Enumeration value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
-
- IEventClose() : m_result(Commons::ExceptionCodes::None)
- {}
-};
-
-typedef DPL::SharedPtr<IEventClose> IEventClosePtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_CLOSE_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_GET_GALLERIES_H_
-#define WRT_PLUGINS_IEVENT_GET_GALLERIES_H_
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventGetGalleries : public WrtPlugins::Platform::IEvent<
- IEventGetGalleries>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IGallerySetPtr m_galleries;
-
- public:
- void setResult(
- const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- IGallerySetPtr getGalleries()
- {
- return m_galleries;
- }
- void setGalleries(const IGallerySetPtr &galleries)
- {
- m_galleries = galleries;
- }
-
- IEventGetGalleries() : m_result(Commons::ExceptionCodes::None),
- m_galleries(NULL)
- {}
-};
-
-typedef DPL::SharedPtr<IEventGetGalleries> IEventGetGalleriesPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_GET_GALLERIES_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_GET_MEDIA_ITEM_BY_ID_H_
-#define WRT_PLUGINS_IEVENT_GET_MEDIA_ITEM_BY_ID_H_
-
-#include <commons/Exception.h>
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventGetMediaItemById : public WrtPlugins::Platform::IEvent<
- IEventGetMediaItemById>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- unsigned long m_id;
- IGalleryPtr m_gallery;
- IMediaItemPtr m_mediaItem;
-
- public:
- void setResult(const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- int getId() const
- {
- return m_id;
- }
- void setId(unsigned long id)
- {
- m_id = id;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
- void setMediaItem(const IMediaItemPtr &mediaItem)
- {
- m_mediaItem = mediaItem;
- }
- IMediaItemPtr getMediaItem() const
- {
- return m_mediaItem;
- }
-
- IEventGetMediaItemById() : m_result(Commons::ExceptionCodes::None),
- m_id(0)
- {}
-};
-
-typedef DPL::SharedPtr<IEventGetMediaItemById> IEventGetMediaItemByIdPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_GET_MEDIA_ITEM_BY_ID_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_GET_MEDIA_ITEMS_H_
-#define WRT_PLUGINS_IEVENT_GET_MEDIA_ITEMS_H_
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventGetMediaItems : public WrtPlugins::Platform::IEvent<
- IEventGetMediaItems>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IGalleryPtr m_gallery;
- IMediaItemsSetPtr m_mediaItems;
-
- public:
- void setResult(
- const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
- IMediaItemsSetPtr getMediaItems() const
- {
- return m_mediaItems;
- }
- void setMediaItems(const IMediaItemsSetPtr &mediaItems)
- {
- m_mediaItems = mediaItems;
- }
-
- IEventGetMediaItems() : m_result(Commons::ExceptionCodes::None)
- {}
-};
-
-typedef DPL::SharedPtr<IEventGetMediaItems> IEventGetMediaItemsPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_GET_MEDIA_ITEMS_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_OPEN_H_
-#define WRT_PLUGINS_IEVENT_OPEN_H_
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventOpen : public WrtPlugins::Platform::IEvent<IEventOpen>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IGalleryPtr m_gallery;
-
- public:
- void setResult(
- const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
-
- IEventOpen() : m_result(Commons::ExceptionCodes::None)
- {}
-};
-
-typedef DPL::SharedPtr<IEventOpen> IEventOpenPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_OPEN_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IEVENT_REFRESH_H_
-#define WRT_PLUGINS_IEVENT_REFRESH_H_
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IEventRefresh : public WrtPlugins::Platform::IEvent<IEventRefresh>
-{
- Commons::ExceptionCodes::Enumeration m_result;
- IGalleryPtr m_gallery;
-
- public:
- void setResult(const Commons::ExceptionCodes::Enumeration &value)
- {
- m_result = value;
- }
- Commons::ExceptionCodes::Enumeration getResult() const
- {
- return m_result;
- }
- void setGallery(const IGalleryPtr &gallery)
- {
- m_gallery = gallery;
- }
- IGalleryPtr getGallery() const
- {
- return m_gallery;
- }
-
- IEventRefresh() : m_result(Commons::ExceptionCodes::None)
- {}
-};
-
-typedef DPL::SharedPtr<IEventRefresh> IEventRefreshPtr;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IEVENT_OPEN_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IGallery.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-IGallery::IGallery()
-{}
-
-IGallery::~IGallery()
-{}
-} // Gallery
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_GALLERY_IGALLERY_H_
-#define WRTPLUGINS_GALLERY_IGALLERY_H_
-
-#include <list>
-#include <dpl/shared_ptr.h>
-#include <commons/Exception.h>
-#include <platform/commons/EventReceiver.h>
-#include "IMediaItem.h"
-#include "IViewProperties.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IGallery
-{
- public:
- virtual ~IGallery() = 0;
-
- virtual unsigned int getNumberOfItems() const = 0;
- virtual std::string getName() const = 0;
- virtual void open() = 0;
- virtual bool isOpen() const = 0;
- virtual void close() = 0;
- virtual void refresh() = 0;
- virtual void changeView(const IViewProperties &props) = 0;
- virtual const IMediaItemsSetPtr getMediaItems() const = 0;
- virtual const IMediaItemPtr getMediaItemById(unsigned long id) const =
- 0;
-
- protected:
- IGallery();
-};
-
-typedef DPL::SharedPtr<IGallery> IGalleryPtr;
-typedef std::list<IGalleryPtr> IGallerySet;
-typedef DPL::SharedPtr<IGallerySet> IGallerySetPtr;
-typedef std::list<IGalleryPtr>::iterator IGallerySetIterator;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_GALLERY_IGALLERY_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file IGalleryRequestManager.cpp
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- */
-
-#include <Gallery/GalleryRequestManager.h>
-#include "IGalleryRequestManager.h"
-
-using namespace WrtPlugins::Platform;
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-void IGalleryRequestManager::getGalleries(const IEventGetGalleriesPtr &event)
-{
- EventRequestReceiver< IEventGetGalleries >::PostRequest(event);
-}
-
-void IGalleryRequestManager::open(const IEventOpenPtr &event)
-{
- EventRequestReceiver< IEventOpen >::PostRequest(event);
-}
-
-void IGalleryRequestManager::refresh(const IEventRefreshPtr &event)
-{
- EventRequestReceiver< IEventRefresh >::PostRequest(event);
-}
-
-void IGalleryRequestManager::close(const IEventClosePtr &event)
-{
- EventRequestReceiver< IEventClose >::PostRequest(event);
-}
-
-void IGalleryRequestManager::changeView(const IEventChangeViewPtr &event)
-{
- EventRequestReceiver< IEventChangeView >::PostRequest(event);
-}
-
-void IGalleryRequestManager::getMediaItems(const IEventGetMediaItemsPtr &event)
-{
- EventRequestReceiver< IEventGetMediaItems >::PostRequest(event);
-}
-
-void IGalleryRequestManager::getMediaItemById(
- const IEventGetMediaItemByIdPtr &event)
-{
- EventRequestReceiver< IEventGetMediaItemById >::PostRequest(event);
-}
-//======== GalleryFactory
-
-IGalleryRequestManagerPtr GalleryFactory::getGalleryManager()
-{
- static IGalleryRequestManagerPtr result(
- new WrtPlugins::Platform::GalleryRequestManager());
- return result;
-}
-
-GalleryFactory& GalleryFactory::getInstance()
-{
- static GalleryFactory theInstance;
- return theInstance;
-}
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file IGalleryRequestManager.h
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- */
-
-#ifndef WRT_PLUGINS_IGALLERY_REQUEST_MANAGER_H_
-#define WRT_PLUGINS_IGALLERY_REQUEST_MANAGER_H_
-
-#include <API/Gallery/IEventGetGalleries.h>
-#include <API/Gallery/IEventOpen.h>
-#include <API/Gallery/IEventRefresh.h>
-#include <API/Gallery/IEventClose.h>
-#include <API/Gallery/IEventChangeView.h>
-#include <API/Gallery/IEventGetMediaItems.h>
-#include <API/Gallery/IEventGetMediaItemById.h>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-typedef Platform::EventRequestReceiver<IEventGetGalleries> ERRGetGalleries;
-typedef Platform::EventRequestReceiver<IEventOpen> ERROpen;
-typedef Platform::EventRequestReceiver<IEventRefresh> ERRRefresh;
-typedef Platform::EventRequestReceiver<IEventClose> ERRClose;
-typedef Platform::EventRequestReceiver<IEventChangeView> ERRChangeView;
-typedef Platform::EventRequestReceiver<IEventGetMediaItems> ERRGetMediaItems;
-typedef Platform::EventRequestReceiver<IEventGetMediaItemById>
-ERRGetMediaItemById;
-
-class IGalleryRequestManager :
- public ERRGetGalleries,
- public ERROpen,
- public ERRRefresh,
- public ERRClose,
- public ERRChangeView,
- public ERRGetMediaItems,
- public ERRGetMediaItemById
-{
- public:
- IGalleryRequestManager() :
- ERRGetGalleries(Platform::ThreadEnum::GALLERY_THREAD),
- ERROpen(Platform::ThreadEnum::GALLERY_THREAD),
- ERRRefresh(Platform::ThreadEnum::GALLERY_THREAD),
- ERRClose(Platform::ThreadEnum::GALLERY_THREAD),
- ERRChangeView(Platform::ThreadEnum::GALLERY_THREAD),
- ERRGetMediaItems(Platform::ThreadEnum::GALLERY_THREAD),
- ERRGetMediaItemById(Platform::ThreadEnum::GALLERY_THREAD)
- {}
-
- virtual ~IGalleryRequestManager()
- {}
-
- virtual void getGalleries(const IEventGetGalleriesPtr &event);
- virtual void open(const IEventOpenPtr &event);
- virtual void refresh(const IEventRefreshPtr &event);
- virtual void close(const IEventClosePtr &event);
- virtual void changeView(const IEventChangeViewPtr &event);
- virtual void getMediaItems(const IEventGetMediaItemsPtr &event);
- virtual void getMediaItemById(const IEventGetMediaItemByIdPtr &event);
-
- protected:
- virtual void OnRequestReceived(const IEventGetGalleriesPtr &event) = 0;
- virtual void OnRequestReceived(const IEventOpenPtr &event) = 0;
- virtual void OnRequestReceived(const IEventRefreshPtr &event) = 0;
- virtual void OnRequestReceived(const IEventClosePtr &event) = 0;
- virtual void OnRequestReceived(const IEventChangeViewPtr &event) = 0;
- virtual void OnRequestReceived(const IEventGetMediaItemsPtr &event) = 0;
- virtual void OnRequestReceived(const IEventGetMediaItemByIdPtr &event) = 0;
-};
-
-typedef DPL::SharedPtr<IGalleryRequestManager> IGalleryRequestManagerPtr;
-
-class GalleryFactory : private DPL::Noncopyable
-{
- protected:
- GalleryFactory()
- {}
-
- public:
- static GalleryFactory& getInstance();
- IGalleryRequestManagerPtr getGalleryManager();
-};
-}
-}
-}
-
-#endif //WRT_PLUGINS_IGALLERY_REQUEST_MANAGER_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_IMEDIA_ITEM_H_
-#define WRT_PLUGINS_IMEDIA_ITEM_H_
-
-#include <string>
-#include <list>
-#include <dpl/shared_ptr.h>
-#include <dpl/log/log.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IMediaItem
-{
- public:
- typedef enum
- {
- AUDIO,
- VIDEO,
- IMAGE,
- UNDEFINED
- } MediaType;
-
- private:
- unsigned long m_id;
- MediaType m_type;
- std::string m_mimeType;
- std::string m_fileName;
- unsigned long m_date;
-
- public:
- IMediaItem() : m_id(0),
- m_type(UNDEFINED),
- m_date(0)
- {}
- virtual ~IMediaItem()
- {}
-
- virtual const std::string &getFileName() const
- {
- return m_fileName;
- }
- virtual unsigned long getId() const
- {
- return m_id;
- }
- virtual const std::string &getMimeType() const
- {
- return m_mimeType;
- }
- virtual MediaType getType() const
- {
- return m_type;
- }
- virtual unsigned long getDate() const
- {
- return m_date;
- }
-
- virtual void setFileName(const std::string &fileName)
- {
- m_fileName = fileName;
- }
- virtual void setId(unsigned long id)
- {
- m_id = id;
- }
- virtual void setMimeType(const std::string &mimeType)
- {
- m_mimeType = mimeType;
- }
- virtual void setType(MediaType type)
- {
- m_type = type;
- }
- virtual void setDate(unsigned long date)
- {
- m_date = date;
- }
-};
-
-typedef DPL::SharedPtr<IMediaItem> IMediaItemPtr;
-typedef std::list<IMediaItemPtr> IMediaItemsSet;
-typedef DPL::SharedPtr<IMediaItemsSet> IMediaItemsSetPtr;
-typedef std::list<IMediaItemPtr>::iterator IMediaItemsSetIterator;
-typedef std::list<IMediaItemPtr>::const_iterator IMediaItemsSetConstIterator;
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRT_PLUGINS_IMEDIA_ITEM_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <commons/Exception.h>
-#include "IViewProperties.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-IViewProperties::SortType IViewProperties::getSortOrder() const
-{
- return m_order;
-}
-
-std::string IViewProperties::getMetaTag() const
-{
- return m_metaTag;
-}
-
-IViewProperties::SortOrder IViewProperties::getPrimarySortOrder() const
-{
- return m_primarySortOrder;
-}
-
-IViewProperties::SortOrder IViewProperties::getSecondarySortOrder() const
-{
- return m_secondarySortOrder;
-}
-
-unsigned long IViewProperties::getStartDate() const
-{
- return m_startDate;
-}
-
-unsigned long IViewProperties::getEndDate() const
-{
- return m_endDate;
-}
-
-void IViewProperties::setSortOrder(IViewProperties::SortType order)
-{
- if (order < ASCENDING || order > DESCENDING) {
- Throw(Commons::InvalidArgumentException);
- }
- m_order = order;
-}
-
-void IViewProperties::setMetaTag(const std::string &metaTag)
-{
- m_metaTag = metaTag;
-}
-
-void IViewProperties::setPrimarySortOrder(
- IViewProperties::SortOrder primarySortOrder)
-{
- if (primarySortOrder < NONE || primarySortOrder > BY_TYPE) {
- Throw(Commons::InvalidArgumentException);
- }
- m_primarySortOrder = primarySortOrder;
-}
-
-void IViewProperties::setSecondarySortOrder(
- IViewProperties::SortOrder secondarySortOrder)
-{
- if (secondarySortOrder < NONE || secondarySortOrder > BY_TYPE) {
- Throw(Commons::InvalidArgumentException);
- }
- m_secondarySortOrder = secondarySortOrder;
-}
-
-void IViewProperties::setStartDate(long startDate)
-{
- m_startDate = startDate;
-}
-
-void IViewProperties::setEndDate(long endDate)
-{
- m_endDate = endDate;
-}
-
-IViewProperties::IViewProperties() :
- m_order(ASCENDING),
- m_primarySortOrder(NONE),
- m_secondarySortOrder(NONE),
- m_startDate(0),
- m_endDate(0)
-{}
-} // Gallery
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_GALLERY_IVIEWPROPERTIES_H_
-#define WRTPLUGINS_GALLERY_IVIEWPROPERTIES_H_
-
-#include <string>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Gallery {
-class IViewProperties
-{
- public:
- typedef enum
- {
- NONE,
- BY_FILENAME,
- BY_FILEDATE,
- BY_TYPE,
- //Not supported:
- // BY_TITLE,
- // BY_AUTHOR,
- // BY_ALBUM,
- BY_DATE
- } SortOrder;
-
- typedef enum
- {
- ASCENDING,
- DESCENDING
- } SortType;
-
- private:
- SortType m_order;
- SortOrder m_primarySortOrder;
- SortOrder m_secondarySortOrder;
- long m_startDate;
- long m_endDate;
- std::string m_metaTag;
-
- public:
- SortType getSortOrder() const;
- std::string getMetaTag() const;
- SortOrder getPrimarySortOrder() const;
- SortOrder getSecondarySortOrder() const;
- unsigned long getStartDate() const;
- unsigned long getEndDate() const;
-
- void setSortOrder(SortType order);
- void setMetaTag(const std::string &metaTag);
- void setPrimarySortOrder(SortOrder primarySortOrder);
- void setSecondarySortOrder(SortOrder secondarySortOrder);
- void setStartDate(long startDate);
- void setEndDate(long endDate);
-
- IViewProperties();
-};
-} // Gallery
-} // Api
-} // WrtPlugins
-
-#endif //WRTPLUGINS_GALLERY_IVIEWPROPERTIES_H_
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_API_GALLERY
- ${CURRENT_PATH}/IGallery.cpp
- ${CURRENT_PATH}/IGalleryRequestManager.cpp
- ${CURRENT_PATH}/IViewProperties.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#ifndef WRTPLUGINS_API_GEOLOCATION_EVENT_GET_CURRENT_LOCATION_H_
-#define WRTPLUGINS_API_GEOLOCATION_EVENT_GET_CURRENT_LOCATION_H_
-
-#include "PositionProperties.h"
-#include "IGeolocation.h"
-
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-class EventGetCurrentPosition : public WrtPlugins::Platform::IEvent<
- EventGetCurrentPosition>
-{
- private:
- PositionProperties m_props;
- IGeolocation::ApiLocationMethod m_method;
-
- public:
- void setTimestamp(std::time_t timestamp)
- {
- m_props.timestamp = timestamp;
- }
- void setLatitude(double latitude)
- {
- m_props.latitude = latitude;
- }
- void setLongitude(double longitude)
- {
- m_props.longitude = longitude;
- }
- void setAltitude(double altitude)
- {
- m_props.altitude = altitude;
- }
- void setAccuracy(double accuracy)
- {
- m_props.accuracy = accuracy;
- }
- void setAltitudeAccuracy(double accuracy)
- {
- m_props.altitudeAccuracy = accuracy;
- }
- void setSpeed(double speed)
- {
- m_props.speed = speed;
- }
- void setDirection(double direction)
- {
- m_props.direction = direction;
- }
- void setAltitudeSpeed(double climb)
- {
- m_props.altitudeSpeed = climb;
- }
- void setMethod(IGeolocation::ApiLocationMethod method)
- {
- m_method = method;
- }
-
- std::time_t getTimestamp() const
- {
- return m_props.timestamp;
- }
- double getLatitude() const
- {
- return m_props.latitude;
- }
- double getLongitude() const
- {
- return m_props.longitude;
- }
- double getAltitude() const
- {
- return m_props.altitude;
- }
- double getAccuracy() const
- {
- return m_props.accuracy;
- }
- double getAltitudeAccuracy() const
- {
- return m_props.altitudeAccuracy;
- }
- double getSpeed() const
- {
- return m_props.speed;
- }
- double getDirection() const
- {
- return m_props.direction;
- }
- double getAltitudeSpeed() const
- {
- return m_props.altitudeSpeed;
- }
- IGeolocation::ApiLocationMethod getMethod() const
- {
- return m_method;
- }
- PositionProperties getPositionProperties() const
- {
- return m_props;
- }
-
- EventGetCurrentPosition()
- {}
-};
-
-typedef DPL::SharedPtr<EventGetCurrentPosition> EventGetCurrentPositionPtr;
-} // Geolocation
-} // Api
-} // WrtPlugins
-
-#endif //WRTPLUGINS_API_GEOLOCATION_EVENT_GET_CURRENT_LOCATION_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#ifndef WRTPLUGINS_API_GEOLOCATION_EVENT_POSITION_CHANGED_H_
-#define WRTPLUGINS_API_GEOLOCATION_EVENT_POSITION_CHANGED_H_
-
-#include "PositionProperties.h"
-#include <commons/IEvent.h>
-#include <dpl/shared_ptr.h>
-#include <platform/commons/ListenerEvent.h>
-#include <platform/commons/ListenerEventEmitter.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-class EventPositionChanged : public Platform::ListenerEvent<
- EventPositionChanged>
-{
- private:
- PositionProperties m_props;
-
- public:
- PositionProperties getPositionProperties() const
- {
- return m_props;
- }
- void setPositionProperties(const PositionProperties &props)
- {
- m_props = props;
- }
-
- EventPositionChanged()
- {}
-};
-
-typedef DPL::SharedPtr<EventPositionChanged> EventPositionChangedPtr;
-typedef Platform::ListenerEventEmitter<EventPositionChanged>
-EventPositionChangedEmitter;
-typedef DPL::SharedPtr<EventPositionChangedEmitter>
-EventPositionChangedEmitterPtr;
-} // Geolocation
-} // Api
-} // WrtPlugins
-
-#endif //WRTPLUGINS_API_GEOLOCATION_EVENT_POSITION_CHANGED_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#include "GeolocationFactory.h"
-#include <Geolocation/Geolocation.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-IGeolocationPtr GeolocationFactory::getLocalizer()
-{
- return IGeolocationPtr(new Platform::Geolocation::Geolocation());
-}
-
-GeolocationFactory& GeolocationFactory::getInstance()
-{
- static GeolocationFactory theInstance;
- return theInstance;
-}
-
-GeolocationFactory::GeolocationFactory()
-{}
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#ifndef WRTPLUGINS_API_GEOLOCATIONFACTORY_H_
-#define WRTPLUGINS_API_GEOLOCATIONFACTORY_H_
-
-#include <dpl/noncopyable.h>
-#include "IGeolocation.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-class GeolocationFactory : DPL::Noncopyable
-{
- public:
- IGeolocationPtr getLocalizer();
-
- static GeolocationFactory& getInstance();
-
- protected:
- GeolocationFactory();
-};
-}
-}
-}
-
-#endif //WRTPLUGINS_API_GEOLOCATIONFACTORY_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#include "IGeolocation.h"
-#include "EventGetCurrentPosition.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-using namespace Platform;
-
-IGeolocation::IGeolocation() :
- EventRequestReceiver<EventGetCurrentPosition>(ThreadEnum::
- GEOLOCATION_THREAD)
-{}
-
-IGeolocation::~IGeolocation()
-{}
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#ifndef WRTPLUGINS_API_IGEOLOCATION_H_
-#define WRTPLUGINS_API_IGEOLOCATION_H_
-
-#include "EventPositionChanged.h"
-
-#include <dpl/shared_ptr.h>
-#include <platform/commons/ThreadPool.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-class EventGetCurrentPosition;
-typedef DPL::SharedPtr<EventGetCurrentPosition> EventGetCurrentPositionPtr;
-
-class IGeolocation :
- public Platform::EventRequestReceiver<EventGetCurrentPosition>
-{
- public:
- typedef enum
- {
- METHOD_GPS,
- METHOD_AGPS,
- METHOD_CPS,
- METHOD_IPS,
- METHOD_WPS,
- METHOD_BEST
- } ApiLocationMethod;
-
- virtual ~IGeolocation();
-
- /**
- * Gets current position
- * @param event @see WrtPlugins::Api::Geolocation::EventGetCurrentPosition.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void getCurrentPosition(const EventGetCurrentPositionPtr& event) =
- 0;
-
- /**
- * Requests location module to receive continuously update of current
- * position if the position is significantly changed
- * @param emitter @see WrtPlugins::Api::Geolocation::EventPositionChanged.
- * @param timeout
- * @param maximumAge
- * @param highAccuracy
- * @return An ID of created subscription
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual long watchPosition(const EventPositionChangedEmitterPtr& emitter,
- long timeout,
- long maximumAge,
- bool highAccuracy) = 0;
-
- /**
- * Stopping periodic location updates started with watchPosition
- * @param id An Id of listener subscription.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void clearWatch(EventPositionChangedEmitter::IdType id) = 0;
-
- /**
- * Choses location method
- * @param method A location method
- * @exception Commons::PlatformException when platform error occurs
- * @remarks does nothing when executed with the same method as currently
- * used
- */
- virtual void changeLocationMethod(ApiLocationMethod method) = 0;
-
- protected:
- IGeolocation();
-
- virtual void OnRequestReceived(const EventGetCurrentPositionPtr& event) = 0;
-};
-
-typedef DPL::SharedPtr<IGeolocation> IGeolocationPtr;
-}
-}
-}
-
-#endif /* WRTPLUGINS_API_IGEOLOCATION_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#ifndef WRTPLUGINS_API_GEOLOCATION_POSITION_PROPERTIES_H_
-#define WRTPLUGINS_API_GEOLOCATION_POSITION_PROPERTIES_H_
-
-#include <ctime>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Geolocation {
-struct PositionProperties
-{
- std::time_t timestamp;
- double latitude;
- double longitude;
- double altitude;
- double accuracy;
- double altitudeAccuracy;
- double speed;
- double direction;
- double altitudeSpeed;
-
- PositionProperties() :
- timestamp(NULL),
- latitude(0.0),
- altitude(0.0),
- accuracy(0.0),
- altitudeAccuracy(0.0),
- speed(0.0),
- direction(0.0),
- altitudeSpeed(0.0)
- {}
-};
-
-typedef DPL::SharedPtr<PositionProperties> PositionPropertiesPtr;
-} // Geolocation
-} // Api
-} // WrtPlugins
-
-#endif //WRTPLUGINS_API_GEOLOCATION_POSITION_PROPERTIES_H_
+++ /dev/null
-get_current_path()
-set(SRCS_PLATFORM_API_GEOLOCATION
- ${CURRENT_PATH}/GeolocationFactory.cpp
- ${CURRENT_PATH}/IGeolocation.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <Memory/Manager.h>
-#include "IManager.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace Memory {
-IManager& IManager::getInstance()
-{
- return Platform::Memory::Manager::getInstance();
-}
-
-IManager::~IManager()
-{}
-} // Memory
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTPLUGINS_MEMORY_IMANAGER_H_
-#define WRTPLUGINS_MEMORY_IMANAGER_H_
-
-#include <dpl/noncopyable.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace Memory {
-class IManager : public DPL::Noncopyable
-{
- public:
- static IManager& getInstance();
-
- public:
- virtual ~IManager() = 0;
-
- /**
- * Gets total memory.
- * @return Total memory.
- * @throw UnsupportedException If not supported by current platform.
- * @throw PlatformException If platform error occurs.
- */
- virtual unsigned long getTotal() const = 0;
-
- /**
- * Gets free (available) memory.
- * @return Free memory.
- * @throw UnsupportedException If not supported by current platform.
- * @throw PlatformException If platform error occurs.
- */
- virtual unsigned long getFree() const = 0;
-};
-} // Memory
-} // Api
-} // WrtPlugins
-
-#endif /* WRTPLUGINS_MEMORY_IMANAGER_H_ */
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_API_MEMORY
- ${CURRENT_PATH}/IManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IDate.h"
-
-namespace WrtPlugins {
-namespace Api {
-namespace System {
-IDate::~IDate()
-{}
-} // System
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_SYSTEM_IDATE_H_
-#define WRTPLUGINS_SYSTEM_IDATE_H_
-
-#include <string>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace System {
-/**
- * Date class.
- * Creating an Date object with default (parameterless) ctor makes object
- * with current date/time values.
- */
-class IDate
-{
- public:
- /**
- * Represents format for date to string conversions.
- */
- typedef std::string Format;
-
- public:
- virtual ~IDate() = 0;
-
- /**
- * Gets date converted to string using default format.
- * @return Date string.
- */
- virtual std::string toString() const = 0;
-
- /**
- * Gets date converted to string using specified format.
- * @param format Format.
- * @return Date string.
- */
- virtual std::string toString(const Format& format) const = 0;
-};
-
-typedef DPL::SharedPtr<IDate> IDatePtr;
-} // System
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_SYSTEM_IDATE_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "IEnvironment.h"
-#include <System/Environment.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace System {
-IEnvironment& IEnvironment::getInstance()
-{
- return Platform::System::Environment::getInstance();
-}
-
-IEnvironment::~IEnvironment()
-{}
-} // System
-} // Api
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTPLUGINS_SYSTEM_IENVIRONMENT_H_
-#define WRTPLUGINS_SYSTEM_IENVIRONMENT_H_
-
-#include <string>
-#include <dpl/noncopyable.h>
-
-namespace WrtPlugins {
-namespace Api {
-namespace System {
-class IEnvironment : private DPL::Noncopyable
-{
- public:
- static IEnvironment& getInstance();
-
- public:
- /**
- * Gets language code for current locale.
- * @return Language code (ISO-639-1).
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks For Linux-based platforms this could be contents of LANG
- * environment variable.
- */
- virtual std::string getLanguage() const = 0;
-
- /**
- * Gets version of the operation system.
- * @return Operating system version.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks On UNIX/Linux-based system this could be versions of kernel.
- */
- virtual std::string getOsVersion() const = 0;
-
- /**
- * Gets version of software.
- * @return Software version.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks On some platform this could be the same as OsVersion.
- */
- virtual std::string getSoftwareVersion() const = 0;
-
- /**
- * Gets name of hardware.
- * @return Hardware name.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- */
- virtual std::string getHardwareName() const = 0;
-
- /**
- * Gets name of the vendor.
- * @return Vendor's name.
- * @throw UnsupportedException If platform doesn't support it.
- * @throw PlatformException If error in platform occurs.
- * @remarks This could be either vendor of kernel, software or device.
- */
- virtual std::string getVendorName() const = 0;
-
- public:
- virtual ~IEnvironment() = 0;
-};
-} // System
-} // Api
-} // WrtPlugins
-
-#endif // WRTPLUGINS_SYSTEM_IENVIRONMENT_H_
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_API_SYSTEM
- ${CURRENT_PATH}/IEnvironment.cpp
- ${CURRENT_PATH}/IDate.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_IEVENT_CLEAR_LOGS_H_
-#define _ABSTRACT_LAYER_IEVENT_CLEAR_LOGS_H_
-
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include "LogEntry.h"
-#include "LogFilter.h"
-
-namespace WrtPlugins {
-namespace Api {
-class IEventClearLog : public WrtPlugins::Platform::IEvent<IEventClearLog>
-{
- bool m_result;
- LogFilterPtr m_filter;
-
- public:
- void setFilter(LogFilterPtr value)
- {
- m_filter = value;
- }
- LogFilterPtr getFilter() const
- {
- return m_filter;
- }
- void setResult(bool value)
- {
- m_result = value;
- }
- bool getResult() const
- {
- return m_result;
- }
- virtual void clearOnCancel()
- {}
- IEventClearLog() : m_result(false)
- {}
- ~IEventClearLog()
- {}
-};
-
-typedef DPL::SharedPtr<IEventClearLog> IEventClearLogPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_CLEAR_LOGS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_IEVENT_DELETE_LOG_ENTRY_H_
-#define _ABSTRACT_LAYER_IEVENT_DELETE_LOG_ENTRY_H_
-
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include "LogEntry.h"
-#include "LogFilter.h"
-
-namespace WrtPlugins {
-namespace Api {
-class IEventDeleteLogEntry : public WrtPlugins::Platform::IEvent<
- IEventDeleteLogEntry>
-{
- bool m_result;
- LogFilterPtr m_filter;
-
- public:
- void setFilter(LogFilterPtr value)
- {
- m_filter = value;
- }
- LogFilterPtr getFilter() const
- {
- return m_filter;
- }
- void setResult(bool value)
- {
- m_result = value;
- }
- bool getResult() const
- {
- return m_result;
- }
- virtual void clearOnCancel()
- {}
- IEventDeleteLogEntry() : m_result(false)
- {}
- ~IEventDeleteLogEntry()
- {}
-};
-
-typedef DPL::SharedPtr<IEventDeleteLogEntry> IEventDeleteLogEntryPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_DELETE_LOG_ENTRY_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_IEVENT_FIND_LOG_ENTRIES_H_
-#define _ABSTRACT_LAYER_IEVENT_FIND_LOG_ENTRIES_H_
-
-#include <vector>
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include "LogEntry.h"
-#include "LogFilter.h"
-
-namespace WrtPlugins {
-namespace Api {
-class IEventFindLogEntries : public WrtPlugins::Platform::IEvent<
- IEventFindLogEntries>
-{
- bool m_result;
- std::vector<Api::LogEntryPtr> m_logs;
- LogFilterPtr m_filter;
- int m_firstCall;
- int m_lastCall;
-
- public:
- void setFirstCall(int value)
- {
- m_firstCall = value;
- }
- int getFirstCall() const
- {
- return m_firstCall;
- }
- void setLastCall(int value)
- {
- m_lastCall = value;
- }
- int getLastCall() const
- {
- return m_lastCall;
- }
- void setFilter(LogFilterPtr value)
- {
- m_filter = value;
- }
- LogFilterPtr getFilter() const
- {
- return m_filter;
- }
- std::vector<Api::LogEntryPtr> getLogs() const
- {
- return m_logs;
- }
- void addLog(Api::LogEntryPtr log)
- {
- m_logs.push_back(log);
- }
- void setResult(bool value)
- {
- m_result = value;
- }
- bool getResult() const
- {
- return m_result;
- }
- virtual void clearOnCancel()
- {}
- IEventFindLogEntries() : m_result(false),
- m_firstCall(0),
- m_lastCall(-1)
- {}
- ~IEventFindLogEntries()
- {}
-};
-
-typedef DPL::SharedPtr<IEventFindLogEntries> IEventFindLogEntriesPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_FIND_LOG_ENTRIES_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef _ABSTRACT_LAYER_IEVENT_GET_NUMBER_OF_LOGS_H_
-#define _ABSTRACT_LAYER_IEVENT_GET_NUMBER_OF_LOGS_H_
-
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-#include "LogEntry.h"
-#include "LogFilter.h"
-
-namespace WrtPlugins {
-namespace Api {
-class IEventGetNumberOfLogs : public WrtPlugins::Platform::IEvent<
- IEventGetNumberOfLogs>
-{
- bool m_result;
- int m_numberOfLogs;
- LogFilterPtr m_filter;
-
- public:
- void setFilter(LogFilterPtr value)
- {
- m_filter = value;
- }
- LogFilterPtr getFilter() const
- {
- return m_filter;
- }
- void setNumberOfLogs(int value)
- {
- m_numberOfLogs = value;
- }
- int getNumberOfLogs() const
- {
- return m_numberOfLogs;
- }
- void setResult(bool value)
- {
- m_result = value;
- }
- bool getResult() const
- {
- return m_result;
- }
- virtual void clearOnCancel()
- {}
- IEventGetNumberOfLogs() : m_result(false),
- m_numberOfLogs(0)
- {}
- ~IEventGetNumberOfLogs()
- {}
-};
-
-typedef DPL::SharedPtr<IEventGetNumberOfLogs> IEventGetNumberOfLogsPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_GET_NUMBER_OF_LOGS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file ILogManager.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#include <commons/ThreadPool.h>
-#include "ILogManager.h"
-
-namespace WrtPlugins {
-namespace Api {
-ILogManager::ILogManager() :
- EventRequestReceiverGetNumberOfLogs(Platform::ThreadEnum::TELEPHONY_THREAD),
- EventRequestReceiverFindLogEntries(Platform::ThreadEnum::TELEPHONY_THREAD),
- EventRequestReceiverDeleteLogEntry(Platform::ThreadEnum::TELEPHONY_THREAD),
- EventRequestReceiverClearLogs(Platform::ThreadEnum::TELEPHONY_THREAD)
-{}
-
-ILogManager::~ILogManager()
-{}
-
-void ILogManager::getNumberOfLogs(const IEventGetNumberOfLogsPtr &event)
-{
- EventRequestReceiverGetNumberOfLogs::PostRequest(event);
-}
-
-void ILogManager::findLogEntries(const IEventFindLogEntriesPtr &event)
-{
- EventRequestReceiverFindLogEntries::PostRequest(event);
-}
-
-void ILogManager::deleteLogEntry(const IEventDeleteLogEntryPtr &event)
-{
- EventRequestReceiverDeleteLogEntry::PostRequest(event);
-}
-
-void ILogManager::clearLogs(const IEventClearLogPtr &event)
-{
- EventRequestReceiverClearLogs::PostRequest(event);
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file ILogManager.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_ILOG_MANAGER_H_
-#define _ABSTRACT_LAYER_ILOG_MANAGER_H_
-
-#include <dpl/shared_ptr.h>
-#include "LogEntry.h"
-#include "IEventClearLogs.h"
-#include "IEventDeleteLogEntry.h"
-#include "IEventFindLogEntries.h"
-#include "IEventGetNumberOfLogs.h"
-
-namespace WrtPlugins {
-namespace Api {
-typedef Platform::EventRequestReceiver< IEventGetNumberOfLogs >
-EventRequestReceiverGetNumberOfLogs;
-typedef Platform::EventRequestReceiver< IEventFindLogEntries >
-EventRequestReceiverFindLogEntries;
-typedef Platform::EventRequestReceiver< IEventDeleteLogEntry >
-EventRequestReceiverDeleteLogEntry;
-typedef Platform::EventRequestReceiver< IEventClearLog >
-EventRequestReceiverClearLogs;
-
-class ILogManager : public EventRequestReceiverGetNumberOfLogs,
- public EventRequestReceiverFindLogEntries,
- public EventRequestReceiverDeleteLogEntry,
- public EventRequestReceiverClearLogs
-{
- public:
- ILogManager();
- virtual ~ILogManager();
- virtual void getNumberOfLogs(const IEventGetNumberOfLogsPtr &event);
- virtual void findLogEntries(const IEventFindLogEntriesPtr &event);
- virtual void deleteLogEntry(const IEventDeleteLogEntryPtr &event);
- virtual void clearLogs(const IEventClearLogPtr &event);
-
- protected:
- virtual void OnRequestReceived(
- const IEventGetNumberOfLogsPtr &event) = 0;
- virtual void OnRequestReceived(const IEventFindLogEntriesPtr &event)
- = 0;
- virtual void OnRequestReceived(const IEventDeleteLogEntryPtr &event)
- = 0;
- virtual void OnRequestReceived(const IEventClearLogPtr &event) = 0;
-};
-
-typedef DPL::SharedPtr<ILogManager> ILogManagerPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_ILOG_MANAGER_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogEntry.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#include "LogEntry.h"
-#include <dpl/log/log.h>
-
-namespace WrtPlugins {
-namespace Api {
-LogEntry::LogEntry() :
- m_id(UNDEFINED_LOG_ENTRY_ID),
- m_startTime(0),
- m_duration(0),
- m_folder(LogEntry::INVALID_FOLDER)
-{}
-
-LogEntry::~LogEntry()
-{}
-
-int LogEntry::getId() const
-{
- return m_id;
-}
-
-void LogEntry::setId(int value)
-{
- m_id = value;
-}
-
-std::string LogEntry::getPhoneNumber() const
-{
- return m_phoneNumber;
-}
-
-void LogEntry::setPhoneNumber(const std::string &value)
-{
- m_phoneNumber = value;
-}
-
-std::time_t LogEntry::getStartTime() const
-{
- return m_startTime;
-}
-
-void LogEntry::setStartTime(std::time_t value)
-{
- m_startTime = value;
-}
-
-int LogEntry::getDuration() const
-{
- return m_duration;
-}
-
-void LogEntry::setDuration(int value)
-{
- m_duration = value;
-}
-
-LogEntry::LogFolder LogEntry::getFolder() const
-{
- return m_folder;
-}
-
-void LogEntry::setFolder(LogFolder value)
-{
- m_folder = value;
-}
-
-std::string LogEntry::getDescription() const
-{
- return m_description;
-}
-
-void LogEntry::setDescription(const std::string &value)
-{
- m_description = value;
-}
-
-void LogEntry::display()
-{
- LogDebug("m_id " << m_id);
- LogDebug("m_duration " << m_duration);
- LogDebug("m_startTime " << m_startTime);
- LogDebug("m_phoneNumber " << m_phoneNumber);
- LogDebug("m_folder " << m_folder);
- LogDebug("m_description " << m_description);
-}
-}
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogEntry.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_CALENDAR_EVENT_H_
-#define _ABSTRACT_LAYER_CALENDAR_EVENT_H_
-
-#include <ctime>
-#include <string>
-#include <dpl/shared_ptr.h>
-
-namespace WrtPlugins {
-namespace Api {
-const int UNDEFINED_LOG_ENTRY_ID = -1;
-
-class LogEntry
-{
- public:
-
- typedef enum
- {
- RECEIVED_CALLS_FOLDER,
- REJECTED_CALLS_FOLDER,
- MISSED_CALLS_FOLDER,
- INITIATED_CALLS_FOLDER,
- INVALID_FOLDER = 10000,
- UNDEFINED_FOLDER /* should be used only to mark a fact filter
- *is not set */
- } LogFolder;
-
- LogEntry();
- virtual ~LogEntry();
-
- int getId() const;
- void setId(int value);
-
- std::string getPhoneNumber() const;
- void setPhoneNumber(const std::string &value);
-
- std::time_t getStartTime() const;
- void setStartTime(std::time_t value);
-
- int getDuration() const;
- void setDuration(int value);
-
- LogFolder getFolder() const;
- void setFolder(LogFolder value);
-
- std::string getDescription() const;
- void setDescription(const std::string &value);
-
- void display();
-
- protected:
- int m_id;
- std::string m_phoneNumber;
- std::time_t m_startTime;
- int m_duration;
- LogFolder m_folder;
- std::string m_description;
-};
-
-typedef DPL::SharedPtr<LogEntry> LogEntryPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_CALENDAR_EVENT_H_ */
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogFilter.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#include <ctime>
-#include <algorithm>
-#include <dpl/log/log.h>
-#include <dpl/shared_ptr.h>
-#include "LogFilter.h"
-
-namespace WrtPlugins {
-namespace Api {
-LogFilter::LogFilter() :
- m_id(LOG_FILTER_UNDEFINED_ID),
- m_phoneNumber(""),
- m_startTimeMin(LOG_FILTER_UNDEFINED_TIME_T_MEMBERS),
- m_startTimeMax(LOG_FILTER_UNDEFINED_TIME_T_MEMBERS),
- m_durationMin(LOG_FILTER_UNDEFINED_DURATION),
- m_durationMax(LOG_FILTER_UNDEFINED_DURATION),
- m_phoneNumberIsSet(false),
- m_descriptionIsSet(false)
-{}
-
-LogFilter::~LogFilter()
-{}
-
-int
-LogFilter::getIdFilter() const
-{
- return m_id;
-}
-
-void
-LogFilter::setIdFilter(int value)
-{
- m_id = value;
-}
-
-std::string
-LogFilter::getPhoneNumberFilter() const
-{
- return m_phoneNumber;
-}
-
-void
-LogFilter::setPhoneNumberFilter(const std::string &value)
-{
- m_phoneNumberIsSet = true;
- m_phoneNumber = value;
-}
-
-time_t
-LogFilter::getStartTimeMinFilter() const
-{
- return m_startTimeMin;
-}
-
-time_t
-LogFilter::getStartTimeMaxFilter() const
-{
- return m_startTimeMax;
-}
-
-void
-LogFilter::setStartTimeMinFilter(time_t value)
-{
- m_startTimeMin = value;
-}
-
-void
-LogFilter::setStartTimeMaxFilter(time_t value)
-{
- m_startTimeMax = value;
-}
-
-void
-LogFilter::setStartTimeFilter(time_t value)
-{
- setStartTimeMinFilter(value);
- setStartTimeMaxFilter(value);
-}
-
-int
-LogFilter::getDurationMinFilter() const
-{
- return m_durationMin;
-}
-
-int
-LogFilter::getDurationMaxFilter() const
-{
- return m_durationMax;
-}
-
-void
-LogFilter::setDurationMinFilter(int value)
-{
- m_durationMin = value;
-}
-
-void
-LogFilter::setDurationMaxFilter(int value)
-{
- m_durationMax = value;
-}
-
-void
-LogFilter::setDurationFilter(int value)
-{
- setDurationMinFilter(value);
- setDurationMaxFilter(value);
-}
-
-std::list<LogEntry::LogFolder>
-LogFilter::getFolderFilter() const
-{
- return m_folder;
-}
-
-void
-LogFilter::addFolderFilter(LogEntry::LogFolder value)
-{
- m_folder.push_back(value);
-}
-
-std::string
-LogFilter::getDescriptionFilter() const
-{
- return m_description;
-}
-void
-LogFilter::setDescriptionFilter(const std::string &value)
-{
- m_description = value;
- m_descriptionIsSet = true;
-}
-
-bool
-LogFilter::getIdIsSet() const
-{
- return m_id != LOG_FILTER_UNDEFINED_ID;
-}
-
-bool
-LogFilter::getPhoneNumberIsSet() const
-{
- return m_phoneNumberIsSet;
-}
-
-bool
-LogFilter::getStartTimeIsSet() const
-{
- return m_startTimeMin != LOG_FILTER_UNDEFINED_TIME_T_MEMBERS;
-}
-
-bool
-LogFilter::getDurationIsSet() const
-{
- return m_durationMin != LOG_FILTER_UNDEFINED_DURATION;
-}
-
-bool
-LogFilter::getFolderIsSet() const
-{
- LogDebug("entered");
- return m_folder.size() != 0;
-}
-
-bool
-LogFilter::getDescriptionIsSet() const
-{
- return m_descriptionIsSet;
-}
-
-bool
-LogFilter::checkIfFolderIsSet(LogEntry::LogFolder folder) const
-{
- LogDebug("entered");
- std::list<LogEntry::LogFolder>::const_iterator result =
- std::find(m_folder.begin(), m_folder.end(), folder);
- return result != m_folder.end();
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogFilter.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_LOG_FILTER_H_
-#define _ABSTRACT_LAYER_LOG_FILTER_H_
-
-#include <ctime>
-#include <list>
-#include <dpl/shared_ptr.h>
-#include "LogEntry.h"
-
-namespace WrtPlugins {
-namespace Api {
-const int LOG_FILTER_UNDEFINED_ID = -1;
-const int LOG_FILTER_UNDEFINED_TIME_T_MEMBERS = -1;
-const int LOG_FILTER_UNDEFINED_DURATION = -1;
-
-class LogFilter
-{
- public:
-
- LogFilter();
- virtual ~LogFilter();
-
- int getIdFilter() const;
- void setIdFilter(int value);
-
- std::string getPhoneNumberFilter() const;
- void setPhoneNumberFilter(const std::string &value);
-
- time_t getStartTimeMinFilter() const;
- time_t getStartTimeMaxFilter() const;
- void setStartTimeMinFilter(time_t value);
- void setStartTimeMaxFilter(time_t value);
- void setStartTimeFilter(time_t value);
-
- int getDurationMinFilter() const;
- int getDurationMaxFilter() const;
- void setDurationMinFilter(int value);
- void setDurationMaxFilter(int value);
- void setDurationFilter(int value);
-
- std::list<LogEntry::LogFolder> getFolderFilter() const;
- void addFolderFilter(LogEntry::LogFolder value);
-
- std::string getDescriptionFilter() const;
- void setDescriptionFilter(const std::string &value);
-
- bool getIdIsSet() const;
- bool getPhoneNumberIsSet() const;
- bool getStartTimeIsSet() const;
- bool getDurationIsSet() const;
- bool getFolderIsSet() const;
- bool checkIfFolderIsSet(LogEntry::LogFolder folder) const;
- bool getDescriptionIsSet() const;
-
- protected:
- int m_id;
- std::string m_phoneNumber;
- time_t m_startTimeMin;
- time_t m_startTimeMax;
- int m_durationMin;
- int m_durationMax;
- std::list<LogEntry::LogFolder> m_folder;
- std::string m_description;
-
- bool m_phoneNumberIsSet;
- bool m_descriptionIsSet;
-};
-
-typedef DPL::SharedPtr<LogFilter> LogFilterPtr;
-}
-}
-
-#endif /* _ABSTRACT_LAYER_IEVENT_FILTER_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "TelephonyFactory.h"
-#include <Telephony/LogManager.h>
-
-namespace WrtPlugins {
-namespace Api {
-ILogManagerPtr TelephonyFactory::createLogManagerObject()
-{
- ILogManagerPtr result(new WrtPlugins::Platform::LogManager());
- return result;
-}
-
-TelephonyFactory& TelephonyFactory::getInstance()
-{
- static TelephonyFactory theInstance;
- return theInstance;
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file TelephonyFactory.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.1
- */
-
-#ifndef _ABSTRACT_LAYER_TELEPHONY_FACTORY_H_
-#define _ABSTRACT_LAYER_TELEPHONY_FACTORY_H_
-
-#include <dpl/shared_ptr.h>
-#include "ILogManager.h"
-
-namespace WrtPlugins {
-namespace Api {
-class TelephonyFactory : private DPL::Noncopyable
-{
- private:
- TelephonyFactory()
- {}
-
- public:
- static TelephonyFactory& getInstance();
- ILogManagerPtr createLogManagerObject();
-};
-}
-}
-
-#endif /* _ABSTRACT_LAYER_TELEPHONY_FACTORY_H_ */
\ No newline at end of file
+++ /dev/null
-get_current_path()
-set(SRCS_PLATFORM_API_TELEPHONY
- ${CURRENT_PATH}/TelephonyFactory.cpp
- ${CURRENT_PATH}/LogFilter.cpp
- ${CURRENT_PATH}/LogEntry.cpp
- ${CURRENT_PATH}/ILogManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Karol Majewski (k.majewski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRTPLUGINSUIIPREFERENCES_H_
-#define WRTPLUGINSUIIPREFERENCES_H_
-
-#include <dpl/event/controller.h>
-#include <commons/ThreadPool.h>
-#include <commons/EventReceiver.h>
-#include "IPreferencesEvents.h"
-
-namespace WrtPlugins {
-namespace Api {
-//============================================================
-class IPreferences : public Platform::EventRequestReceiver< IEventSetWallpaper >,
- public Platform::EventRequestReceiver< IEventSetCallRingtone >,
- public Platform::EventRequestReceiver< IEventSetMessageRingtone >
-{
- protected:
- IPreferences() : Platform::EventRequestReceiver< IEventSetWallpaper >(
- Platform::ThreadEnum::UI_THREAD),
- Platform::EventRequestReceiver< IEventSetCallRingtone >(Platform::
- ThreadEnum
- ::UI_THREAD),
- Platform::EventRequestReceiver< IEventSetMessageRingtone >(Platform::
- ThreadEnum
- ::
- UI_THREAD)
- {}
-
- virtual void OnRequestReceived(
- const DPL::SharedPtr<IEventSetWallpaper> &event) = 0;
- virtual void OnRequestReceived(
- const DPL::SharedPtr<IEventSetCallRingtone> &event) = 0;
- virtual void OnRequestReceived(
- const DPL::SharedPtr<IEventSetMessageRingtone> &event) = 0;
-
- public:
- virtual void setWallpaper(DPL::SharedPtr<IEventSetWallpaper> &event)
- {
- PostRequest(event);
- }
- virtual void setCallRingtone(DPL::SharedPtr<IEventSetCallRingtone> &event)
- {
- PostRequest(event);
- }
- virtual void setMessageRingtone(
- DPL::SharedPtr<IEventSetMessageRingtone> &event)
- {
- PostRequest(event);
- }
-
- virtual ~IPreferences()
- {}
-};
-//============================================================
-} //namespace
-} //namespace
-
-#endif /* WRTPLUGINSUIIPREFERENCES_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Karol Majewski (k.majewski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRTPLUGINSUIIEVENTS_H_
-#define WRTPLUGINSUIIEVENTS_H_
-
-#include <dpl/shared_ptr.h>
-#include <commons/IEvent.h>
-
-namespace WrtPlugins {
-namespace Api {
-//=========================================================================
-class IEventSetWallpaper : public WrtPlugins::Platform::IEvent<
- IEventSetWallpaper>
-{
- public:
- IEventSetWallpaper()
- {}
-
- virtual ~IEventSetWallpaper()
- {}
-};
-typedef DPL::SharedPtr<IEventSetWallpaper> IEventSetWallpaperPtr;
-//=========================================================================
-class IEventSetCallRingtone : public WrtPlugins::Platform::IEvent<
- IEventSetCallRingtone>
-{
- public:
- IEventSetCallRingtone()
- {}
-
- virtual ~IEventSetCallRingtone()
- {}
-};
-typedef DPL::SharedPtr<IEventSetCallRingtone> IEventSetCallRingtonePtr;
-//=========================================================================
-class IEventSetMessageRingtone : public WrtPlugins::Platform::IEvent<
- IEventSetMessageRingtone>
-{
- public:
- IEventSetMessageRingtone()
- {}
-
- virtual ~IEventSetMessageRingtone()
- {}
-};
-typedef DPL::SharedPtr<IEventSetMessageRingtone> IEventSetMessageRingtonePtr;
-//=========================================================================
-}
-}
-
-#endif /* WRTPLUGINSUIIEVENTS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * CameraController.cpp
- *
- * Created on: 2010-06-28
- * Author: kmajewski
- */
-
-#include "UIFactory.h"
-
-namespace WrtPlugins {
-namespace Api {
-UIFactory& UIFactory::getInstance()
-{
- static UIFactory theInstance;
- return theInstance;
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * CameraController.h
- *
- * Created on: 2010-06-28
- * Author: kmajewski
- */
-
-#ifndef WRTPLUGINSUIFACTORY_H_
-#define WRTPLUGINSUIFACTORY_H_
-
-#include <dpl/noncopyable.h>
-
-namespace WrtPlugins {
-namespace Api {
-class UIFactory : private DPL::Noncopyable
-{
- private:
- UIFactory()
- {}
-
- public:
- static UIFactory& getInstance();
-};
-}
-}
-#endif /* WRTPLUGINSUIFACTORY_H_ */
+++ /dev/null
-get_current_path()
-set(SRCS_PLATFORM_API_UI
- ${CURRENT_PATH}/UIFactory.cpp
-
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file AppLauncherManager.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @author Yujie Zeng (yj.zeng@samsung.com)
- * @version 0.1
- */
-
-#include <algorithm>
-#include <vector>
-#include <pcrecpp.h>
-#include <menu_db.h>
-#include <aul.h>
-#include <bundle.h>
-#include <dpl/scoped_free.h>
-#include <dpl/log/log.h>
-#include <commons/StringUtils.h>
-#include <Filesystem/Manager.h>
-#include "AppLauncherManager.h"
-
-using namespace WrtPlugins::Api;
-using namespace WrtPlugins::Api::AppLauncher;
-
-namespace {
-const char* EMPTY_STRING_PATTERN = "^\\s*$";
-const char* EMAIL_PATTERN = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+$";
-//According to RFC1738,any character is possible in http address
-const char* HTTP_ADDRESS_PATTERN = "^(http(s)?://)?\\w+.*$";
-const char* FILE_ADDRESS_PATTERN = "^.*\\..*$";
-
-const char* APPLICATION_ALARM = "org.tizen.clock"; // alarm has been
- // included in clock app
-const char* APPLICATION_BROWSER = "org.tizen.browser";
-const char* APPLICATION_CALCULATOR = "org.tizen.calculator";
-const char* APPLICATION_CALENDAR = "org.tizen.efl-calendar";
-const char* APPLICATION_CAMERA = "org.tizen.camera-app";
-const char* APPLICATION_CONTACTS = "org.tizen.contacts";
-const char* APPLICATION_FILES = "org.tizen.myfile";
-const char* APPLICATION_GAMES = "";
-const char* APPLICATION_MAIL = "org.tizen.email";
-const char* APPLICATION_MEDIAPLAYER = "org.tizen.music-player";
-const char* APPLICATION_MESSAGING = "org.tizen.message";
-const char* APPLICATION_PHONECALL = "org.tizen.dialer";
-const char* APPLICATION_PHONECALL_CALLING = "org.tizen.call";
-const char* APPLICATION_PICTURES = "org.tizen.gallery";
-const char* APPLICATION_PICTURES_IMG_PATH = "org.tizen.image-viewer";
-const char* APPLICATION_PROG_MANAGER = "org.tizen.taskmgr";
-const char* APPLICATION_SETTINGS = "org.tizen.setting";
-const char* APPLICATION_TASKS = "org.tizen.dailybriefing";
-const char* APPLICATION_WIDGET_MANAGER = "org.tizen.wrt-test-ui";
-const char* APPLICATION_WIDGET = "org.tizen.";
-const char* APPLICATION_EMPTY = "";
-
-const char* WIDGET_URI_PREFIX = "widget://";
-
-const int SUCCESS_LAUNCHER = 0;
-const int ERROR_LAUNCHER_INVALID_URI = 1;
-const int ERROR_LAUNCHER_INVALID_PARAMETER = 2;
-const int ERROR_LAUNCHER_EXECUTION_ERROR = 3;
-}
-
-namespace WrtPlugins {
-namespace Platform {
-std::map<Api::AppLauncher::ApplicationType,
- std::string> AppLauncherManager::m_applicationTypesByPath;
-std::map<Api::AppLauncher::ApplicationType,
- std::string> AppLauncherManager::m_applicationTypesByName;
-std::vector<std::string> AppLauncherManager::m_installedApplications;
-std::vector<std::string> AppLauncherManager::m_installedApplicationsNames;
-
-AppLauncherManager::AppLauncherManager()
-{
- LogDebug("entered");
- static bool initialized = initializeApplicationList();
- (void) initialized;
-}
-
-AppLauncherManager::~AppLauncherManager()
-{
- LogDebug("entered");
-}
-
-bool AppLauncherManager::initializeApplicationList()
-{
- //application paths
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_ALARM,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_BROWSER,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CALCULATOR,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CALENDAR,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CAMERA,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CONTACTS,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_FILES,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_GAMES,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MAIL,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MEDIAPLAYER,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MESSAGING,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PHONECALL,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PICTURES,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PROG_MANAGER,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_SETTINGS,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_TASKS,
- APPLICATION_EMPTY));
- m_applicationTypesByPath.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_WIDGET_MANAGER,
- APPLICATION_EMPTY));
- //application names
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_ALARM,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_BROWSER,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CALCULATOR,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CALENDAR,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CAMERA,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_CONTACTS,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_FILES,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_GAMES,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MAIL,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MEDIAPLAYER,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_MESSAGING,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PHONECALL,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PICTURES,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_PROG_MANAGER,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_SETTINGS,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_TASKS,
- APPLICATION_EMPTY));
- m_applicationTypesByName.insert(std::pair<ApplicationType,
- std::string>(
- APPLICATION_TYPE_WIDGET_MANAGER,
- APPLICATION_EMPTY));
-
- bool registered_application = false; // A variable that gets set if the
- // current pkg_name is needed by WAC
- // spec, needless of weather the
- // package is visible or not.
- app_info info = {};
- unsigned int count = record_count(COUNT_MENU, &info);
- LogDebug("number of registered applications: " << count);
-
- DPL::ScopedFree<app_info> infoAll(static_cast<app_info*>(calloc(
- count,
- sizeof(
- app_info))));
- if (infoAll.Get()) {
- if (!record_get(GET_MENU, infoAll.Get())) {
- LogError("error during executing record_get() function");
- return false;
- }
- for (unsigned int i = 0; i < count; i++) {
- LogDebug("pkg_name " << infoAll.Get()[i].pkg_name);
- LogDebug("app_path " << infoAll.Get()[i].app_path);
- LogDebug("app_name " << infoAll.Get()[i].app_name);
- registered_application = false;
- if (infoAll.Get()[i].app_path == NULL ||
- infoAll.Get()[i].app_name == NULL)
- {
- LogDebug("Not Registered.");
- LogDebug("-----");
- continue;
- }
- if (0 ==
- strncmp(APPLICATION_ALARM, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_ALARM] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_ALARM] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_BROWSER, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_BROWSER] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_BROWSER] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_CALCULATOR, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_CALCULATOR] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_CALCULATOR] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_CALENDAR, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_CALENDAR] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_CALENDAR] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_CAMERA, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_CAMERA] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_CAMERA] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_CONTACTS, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_CONTACTS] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_CONTACTS] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_FILES, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_FILES] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_FILES] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_GAMES, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_GAMES] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_GAMES] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_MAIL, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_MAIL] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_MAIL] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_MEDIAPLAYER, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_MEDIAPLAYER] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_MEDIAPLAYER] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_MESSAGING, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_MESSAGING] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_MESSAGING] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_PHONECALL, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_PHONECALL] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_PHONECALL] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_PICTURES, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_PICTURES] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_PICTURES] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_PROG_MANAGER, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_PROG_MANAGER] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_PROG_MANAGER] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_SETTINGS, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_SETTINGS] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_SETTINGS] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_TASKS, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_TASKS] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_TASKS] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (0 ==
- strncmp(APPLICATION_WIDGET_MANAGER, infoAll.Get()[i].pkg_name,
- NAME_LEN))
- {
- m_applicationTypesByPath[APPLICATION_TYPE_WIDGET_MANAGER] =
- infoAll.Get()[i].app_path;
- m_applicationTypesByName[APPLICATION_TYPE_WIDGET_MANAGER] =
- infoAll.Get()[i].app_name;
- registered_application = true;
- }
- if (infoAll.Get()[i].visible == 0 && registered_application ==
- false)
- {
- LogDebug("Not Registered.");
- LogDebug("-----");
- continue;
- }
- m_installedApplications.push_back(infoAll.Get()[i].app_path);
- m_installedApplicationsNames.push_back(infoAll.Get()[i].app_name);
- LogDebug("Registered.");
- LogDebug("-----");
- }
- }
- return true;
-}
-
-ApplicationType AppLauncherManager::getRegisteredApplicationType(
- const std::string &name) const
-{
- if (!name.empty()) {
- std::map<ApplicationType, std::string>::const_iterator it;
- for (it = m_applicationTypesByPath.begin();
- it != m_applicationTypesByPath.end();
- ++it)
- {
- if (it->second == name) {
- return it->first;
- }
- }
- }
- return APPLICATION_TYPE_UNDEFINED;
-}
-
-bool AppLauncherManager::isRegisteredApplication(const std::string &name) const
-{
- if (name.empty()) {
- return false;
- }
- std::vector<std::string>::const_iterator pos =
- find(m_installedApplications.begin(),
- m_installedApplications.end(), name);
- return pos != m_installedApplications.end();
-}
-
-bool AppLauncherManager::validateHttpAddress(const std::string &value) const
-{
- if (!pcrecpp::RE(HTTP_ADDRESS_PATTERN).FullMatch(value)) {
- LogDebug("not valid paterrn of http address");
- return false;
- }
- return true;
-}
-
-bool AppLauncherManager::isFilePath(const std::string &value) const
-{
- if (!pcrecpp::RE(FILE_ADDRESS_PATTERN).FullMatch(value)) {
- return false;
- }
- return true;
-}
-
-bool AppLauncherManager::validateEmailAddress(const std::string &value) const
-{
- if (!pcrecpp::RE(EMAIL_PATTERN).FullMatch(value)) {
- LogDebug("not valid paterrn of email address");
- return false;
- }
- return true;
-}
-
-std::string AppLauncherManager::getRealPath(const std::string &path) const
-{
- Try
- {
- Api::Filesystem::IPathPtr currentPath = Api::Filesystem::IPath::create(
- path);
- return currentPath->getFullPath();
- }
- Catch(Commons::Exception)
- {
- LogError("invalid path");
- }
- return std::string();
-}
-
-std::string AppLauncherManager::getPathFromApplicationName(
- const std::string &applicationName) const
-{
- if (0 == applicationName.find(WIDGET_URI_PREFIX) && std::string::npos !=
- applicationName.find("?"))
- {
- //uri format is: widget://{widgetId}?wname={WidgetName}
- LogDebug("found widget:// URI");
- std::string uri = applicationName;
- uri.erase(0, strlen(WIDGET_URI_PREFIX)); //remove widget://part
- std::string widgetId = uri.substr(0, uri.find("?"));
- uri.erase(0, widgetId.size() + 7); //remove widget id and "?wname="
- // string, so uri contains only
- // widget name now
- std::string packageName = APPLICATION_WIDGET + widgetId;
- LogDebug(
- "Widget id: " << widgetId << ", widget name: " << uri <<
- ", package: " << packageName);
- app_info info = { 0, };
- strncpy(info.pkg_name, packageName.c_str(), NAME_LEN);
- if (record_get(GET_ONE_RECORD_BY_PKG_NAME, &info)) {
- if (info.app_path && info.app_name && uri == info.app_name) {
- return std::string(info.app_path);
- }
- }
- }
- for (size_t i = 0; i < m_installedApplicationsNames.size(); ++i) {
- if (m_installedApplicationsNames[i] == applicationName) {
- return m_installedApplications[i];
- }
- }
- return std::string();
-}
-
-std::string AppLauncherManager::getPathFromPackageName(
- const std::string &packageName) const
-{
- app_info info = { 0, };
- strncpy(info.pkg_name, packageName.c_str(), NAME_LEN);
- if (record_get(GET_ONE_RECORD_BY_PKG_NAME, &info)) {
- LogDebug("pkg_name " << info.pkg_name);
- LogDebug("app_path " << info.app_path);
- LogDebug("app_name " << info.app_name);
- if (info.app_path) {
- return std::string(info.app_path);
- }
- }
- return std::string();
-}
-
-std::string AppLauncherManager::getPackageNameFromPath(const std::string &path)
-const
-{
- app_info info = { 0, };
- strncpy(info.app_path, path.c_str(), PATH_LEN);
- if (record_get(GET_ONE_RECORD_BY_APP_PATH, &info)) {
- LogDebug("pkg_name " << info.pkg_name);
- LogDebug("app_path " << info.app_path);
- LogDebug("app_name " << info.app_name);
- if (info.app_path) {
- return std::string(info.pkg_name);
- }
- }
- return std::string();
-}
-
-int AppLauncherManager::launchApplicationFileInternal(
- const std::string &uriParameter,
- const std::vector<std::string> &applicationParams)
-{
- LogDebug("entered with uriParameter: '" << uriParameter << "'");
- ApplicationType appType = getRegisteredApplicationType(uriParameter);
- if (!isRegisteredApplication(uriParameter)) {
- LogDebug("Its not registered application");
- return ERROR_LAUNCHER_INVALID_URI;
- }
- //try to launch as package using aul
- std::string packageName = getPackageNameFromPath(uriParameter);
- if (!packageName.empty()) {
- LogDebug("executing as package, package name " << packageName);
- //check parameters for empty or extra spaces
- std::vector<std::string> params;
- std::vector<std::string>::const_iterator it;
- for (it = applicationParams.begin();
- it != applicationParams.end();
- ++it)
- {
- std::string param(Commons::String::trim(*it));
- if (param.empty()) {
- continue;
- }
- params.push_back(param);
- }
- bundle *kb = NULL;
- if (params.size() > 0) {
- if (appType == APPLICATION_TYPE_PHONECALL) {
- //phone number is provided.
- //replace package to make a call, not run application with this
- // functionality
-
- packageName = APPLICATION_PHONECALL_CALLING;
- kb = bundle_create();
- if (!kb) {
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "launch-type", "MO") < 0) { // "MO" : normal
- // call,
- // "EMERGENCY" :
- // emergency call
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "number", params.front().c_str()) < 0) {
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- LogDebug("running with number: " << params.front());
- } else if (appType == APPLICATION_TYPE_BROWSER) {
- if (!validateHttpAddress(params.front())) {
- return ERROR_LAUNCHER_INVALID_PARAMETER;
- }
- kb = bundle_create();
- if (!kb) {
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "url", params.front().c_str()) < 0) {
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- LogDebug("running with url: " << params.front().c_str());
- } else if (appType == APPLICATION_TYPE_MEDIAPLAYER) {
- LogDebug("opening file: " << getRealPath(params.front()).c_str());
- int result = aul_open_file(getRealPath(params.front()).c_str());
- if (result < 0) {
- LogError("Cannot open file, launch application only");
- } else {
- return SUCCESS_LAUNCHER;
- }
- } else if (appType == APPLICATION_TYPE_FILES) {
- struct stat sb;
- if (stat(getRealPath(params.front()).c_str(), &sb) == -1) {
- LogError(
- "The selected path does not exist: " <<
- getRealPath(params.front()).c_str());
- } else {
- if (!S_ISDIR(sb.st_mode)) {
- LogDebug("opening file: " << getRealPath(
- params.front()).c_str());
- int result = aul_open_file(getRealPath(
- params.front()).c_str());
- if (result < 0) {
- LogError(
- "Cannot open file, launch application only");
- } else {
- return SUCCESS_LAUNCHER;
- }
- } else {
- kb = bundle_create();
- if (!kb) {
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "path",
- getRealPath(params.front()).c_str()) <
- 0)
- {
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- LogDebug("running with folder path: " <<
- getRealPath(params.front()).c_str());
- }
- }
- } else if (appType == APPLICATION_TYPE_PICTURES) {
- //open photo with image path
- //replace package to show only one picture with given image path
- packageName = APPLICATION_PICTURES_IMG_PATH;
- kb = bundle_create();
- if (!kb) {
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "View Mode", "SINGLE") < 0) {
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- if (bundle_add(kb, "Path",
- getRealPath(params.front()).c_str()) < 0)
- {
- bundle_free(kb);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- LogDebug("running with img file path: " <<
- getRealPath(params.front()).c_str());
- }
- //TODO: add more parameters when needed
- }
- int result = aul_launch_app(packageName.c_str(), kb);
- if (kb) {
- bundle_free(kb);
- }
- if (result > 0) {
- return SUCCESS_LAUNCHER;
- }
- LogError("aul_launch_app result " << result);
- return ERROR_LAUNCHER_EXECUTION_ERROR;
- }
- return ERROR_LAUNCHER_EXECUTION_ERROR;
-}
-
-int AppLauncherManager::launchApplicationInternal(
- const ApplicationUriType uriType,
- const std::string &uriParameter,
- const std::vector<std::string> &applicationParams)
-{
- LogDebug(
- "entered with uriType: " << uriType << ", uriParameter: " <<
- uriParameter);
- if (APPLICATION_URI_TYPE_HTTP == uriType) {
- std::string application =
- m_applicationTypesByPath[APPLICATION_TYPE_BROWSER];
- std::vector<std::string> params;
- if (Commons::String::startsWith(uriParameter, "http://")) {
- params.push_back(uriParameter);
- } else if (!pcrecpp::RE(EMPTY_STRING_PATTERN).FullMatch(uriParameter))
- {
- params.push_back("http://" + uriParameter);
- }
- return launchApplicationFileInternal(application, params);
- } else if (APPLICATION_URI_TYPE_HTTPS == uriType) {
- std::string application =
- m_applicationTypesByPath[APPLICATION_TYPE_BROWSER];
- std::vector<std::string> params;
- if (Commons::String::startsWith(uriParameter, "https://")) {
- params.push_back(uriParameter);
- } else if (!pcrecpp::RE(EMPTY_STRING_PATTERN).FullMatch(uriParameter))
- {
- params.push_back("https://" + uriParameter);
- }
- return launchApplicationFileInternal(application, params);
- } else if (APPLICATION_URI_TYPE_TEL == uriType) {
- std::string application =
- m_applicationTypesByPath[APPLICATION_TYPE_PHONECALL];
- std::vector<std::string> params;
- params.push_back(uriParameter);
- return launchApplicationFileInternal(application, params);
- } else if (APPLICATION_URI_TYPE_MAILTO == uriType) {
- std::string application =
- m_applicationTypesByPath[APPLICATION_TYPE_MAIL];
- std::vector<std::string> params;
- params.push_back(uriParameter);
- return launchApplicationFileInternal(application, params);
- } else if (APPLICATION_URI_TYPE_SMS == uriType) {
- std::string application =
- m_applicationTypesByPath[APPLICATION_TYPE_MESSAGING];
- std::vector<std::string> params;
- params.push_back(uriParameter);
- return launchApplicationFileInternal(application, params);
- } else if (APPLICATION_URI_TYPE_FILE == uriType) {
- return launchApplicationFileInternal(uriParameter, applicationParams);
- } else if (APPLICATION_URI_TYPE_APPLICATION_BY_NAME == uriType) {
- std::string application = getPathFromApplicationName(uriParameter);
- return launchApplicationFileInternal(application, applicationParams);
- } else {
- return ERROR_LAUNCHER_INVALID_URI;
- }
- return SUCCESS_LAUNCHER;
-}
-
-std::string AppLauncherManager::getDefaultApplicationByMimeInternal(
- const std::string &mime) const
-{
- LogDebug("entered with mime: " << mime);
- const int bufferSize = 1024;
- char buffer[bufferSize] = { 0 };
- int result = aul_get_defapp_from_mime(mime.c_str(), buffer, bufferSize - 1);
- if (AUL_R_OK == result) {
- LogDebug("returning default application");
- return std::string(buffer);
- } else {
- LogError("aul_get_defapp_from_mime failed, error code " << result);
- Throw(Commons::PlatformException);
- }
- return std::string();
-}
-
-void AppLauncherManager::OnRequestReceived(
- const EventGetDefaultApplicationPtr &event)
-{
- LogDebug("entered");
- Try
- {
- std::string result = getDefaultApplicationByMimeInternal(event->getMime());
- event->setApplicationFullPath(result);
- event->setExceptionCode(Commons::ExceptionCodes::None);
- }
- Catch(Commons::PlatformException)
- {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
-}
-
-void AppLauncherManager::OnRequestReceived(
- const EventGetInstalledApplicationsPtr &event)
-{
- LogDebug("entered");
- std::vector<std::string>::const_iterator it1;
- for (it1 = m_installedApplications.begin();
- it1 != m_installedApplications.end();
- ++it1)
- {
- event->addApplicationFullPath(*it1);
- }
- for (it1 = m_installedApplicationsNames.begin();
- it1 != m_installedApplicationsNames.end();
- ++it1)
- {
- event->addApplicationName(*it1);
- }
- std::map<ApplicationType, std::string>::const_iterator it2;
- for (it2 = m_applicationTypesByPath.begin();
- it2 != m_applicationTypesByPath.end();
- ++it2)
- {
- event->addApplicationTypeByPath(*it2);
- }
- for (it2 = m_applicationTypesByName.begin();
- it2 != m_applicationTypesByName.end();
- ++it2)
- {
- event->addApplicationTypeByName(*it2);
- }
- event->setExceptionCode(Commons::ExceptionCodes::None);
-}
-
-void AppLauncherManager::OnRequestReceived(
- const EventLaunchApplicationPtr &event)
-{
- LogDebug("entered");
- ApplicationUriType uriType = event->getApplicationUriType();
- std::string uriParam = event->getApplicationUriParam();
- std::vector<std::string> parameters = event->getApplicationParameters();
- int result = launchApplicationInternal(uriType, uriParam, parameters);
- if (result == SUCCESS_LAUNCHER) {
- event->setExceptionCode(Commons::ExceptionCodes::None);
- } else if (result == ERROR_LAUNCHER_INVALID_PARAMETER ||
- result == ERROR_LAUNCHER_INVALID_URI)
- {
- event->setExceptionCode(
- Commons::ExceptionCodes::InvalidArgumentException);
- } else {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file AppLauncherManager.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @author Yujie Zeng (yj.zeng@samsung.com)
- * @version 0.1
- */
-
-#ifndef _SLP20__APPLAUNCHER_MANAGER_H_
-#define _SLP20__APPLAUNCHER_MANAGER_H_
-
-#include <dpl/shared_ptr.h>
-#include <string>
-#include <vector>
-#include <API/AppLauncher/IAppLauncherManager.h>
-#include <API/AppLauncher/EventGetDefaultApplication.h>
-#include <API/AppLauncher/EventGetInstalledApplications.h>
-#include <API/AppLauncher/EventLaunchApplication.h>
-#include <API/AppLauncher/ApplicationTypes.h>
-
-namespace WrtPlugins {
-namespace Platform {
-class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager
-{
- public:
- AppLauncherManager();
- virtual ~AppLauncherManager();
-
- protected:
- virtual void OnRequestReceived(
- const Api::AppLauncher::EventGetDefaultApplicationPtr &event);
- virtual void OnRequestReceived(
- const Api::AppLauncher::EventGetInstalledApplicationsPtr &event);
- virtual void OnRequestReceived(
- const Api::AppLauncher::EventLaunchApplicationPtr &event);
- virtual bool isRegisteredApplication(const std::string &name) const;
- virtual Api::AppLauncher::ApplicationType getRegisteredApplicationType(
- const std::string &name) const;
- virtual std::string getRealPath(const std::string &path) const;
- virtual bool validateHttpAddress(const std::string &value) const;
- virtual bool validateEmailAddress(const std::string &value) const;
- virtual bool isFilePath(const std::string &value) const;
-
- private:
- bool initializeApplicationList();
- std::string getPathFromApplicationName(const std::string &applicationName)
- const;
- std::string getPathFromPackageName(const std::string &packageName) const;
- std::string getPackageNameFromPath(const std::string &path) const;
- std::string getDefaultApplicationByMimeInternal(const std::string &mime)
- const;
- int launchApplicationInternal(
- const Api::AppLauncher::ApplicationUriType uriType,
- const std::string &uriParameter,
- const std::vector<std::string> &applicationParams);
- int launchApplicationFileInternal(
- const std::string &uriParameter,
- const std::vector<std::string> &
- applicationParam);
- static std::map<Api::AppLauncher::ApplicationType,
- std::string> m_applicationTypesByPath;
- static std::map<Api::AppLauncher::ApplicationType,
- std::string> m_applicationTypesByName;
- static std::vector<std::string> m_installedApplications;
- static std::vector<std::string> m_installedApplicationsNames;
-};
-
-typedef DPL::SharedPtr<AppLauncherManager> AppLauncherManagerPtr;
-}
-}
-
-#endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */
+++ /dev/null
-get_current_path()
-
-pkg_search_module(glib REQUIRED glib-2.0)
-pkg_search_module(aul REQUIRED aul)
-pkg_search_module(pcre REQUIRED libpcrecpp)
-pkg_search_module(dmi REQUIRED desktop-manager-internal)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_APPLAUNCHER
- ${glib_INCLUDE_DIRS}
- ${pcre_INCLUDE_DIRS}
- ${aul_INCLUDE_DIRS}
- ${dmi_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_APPLAUNCHER
- ${glib_LIBRARIES}
- ${pcre_LIBRARIES}
- ${aul_LIBRARIES}
- ${dmi_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_APPLAUNCHER
- ${CURRENT_PATH}/../../API/Filesystem/IManager.cpp
- ${CURRENT_PATH}/../../API/Filesystem/IPath.cpp
- ${CURRENT_PATH}/../../API/Filesystem/INode.cpp
- ${CURRENT_PATH}/../../API/Filesystem/IStream.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventCopy.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventFind.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventResolve.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventMove.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventRemove.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventOpen.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventListNodes.cpp
- ${CURRENT_PATH}/../../API/Filesystem/EventReadText.cpp
- ${CURRENT_PATH}/../../API/Filesystem/NodeFilter.cpp
- ${CURRENT_PATH}/../../API/Filesystem/PathUtils.cpp
- ${CURRENT_PATH}/../Filesystem/System.cpp
- ${CURRENT_PATH}/../Filesystem/Manager.cpp
- ${CURRENT_PATH}/../Filesystem/Utils.cpp
- ${CURRENT_PATH}/../Filesystem/Path.cpp
- ${CURRENT_PATH}/../Filesystem/Node.cpp
- ${CURRENT_PATH}/../Filesystem/Stream.cpp
- ${CURRENT_PATH}/../Filesystem/NodeFilterMatcher.cpp
- ${CURRENT_PATH}/AppLauncherManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#include "Camera.h"
-#include <pthread.h>
-#include <dpl/assert.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/noncopyable.h>
-#include <Commons/Exception.h>
-#include <Commons/TypeTraits.h>
-
-namespace WrtDeviceApis {
-namespace Camera {
-template<typename EventPtr>
-class CameraPrivateData
-{
- public:
- Camera* camera;
- EventPtr event;
-};
-
-enum EventTypeId
-{
- BeginRecordingType,
- TakePictureType,
- CreatePreviewType
-};
-
-class OpaquePrivateData
-{
- public:
- EventTypeId eventTypeId;
- void* cameraPrivateData;
-};
-
-//GetEventTypeId
-template<typename T>
-EventTypeId getEventTypeId(const T& event)
-{
- Assert(0);
-}
-
-template<>
-EventTypeId getEventTypeId<Api::EventBeginRecordingSharedPtr>(
- const Api::EventBeginRecordingSharedPtr& /*event*/)
-{
- return BeginRecordingType;
-}
-
-template<>
-EventTypeId getEventTypeId<Api::EventTakePictureSharedPtr>(
- const Api::EventTakePictureSharedPtr& /*event*/)
-{
- return TakePictureType;
-}
-
-template<>
-EventTypeId getEventTypeId<Api::EventGetPreviewNodeSharedPtr>(
- const Api::EventGetPreviewNodeSharedPtr& /*event*/)
-{
- return CreatePreviewType;
-}
-
-template<typename EventPtr>
-OpaquePrivateData* createPrivateOpaqueData(Camera* camera,
- const EventPtr& event)
-{
- //create private opaque data
- OpaquePrivateData* opaqueData = new OpaquePrivateData;
-
- CameraPrivateData<EventPtr>* privateData = new CameraPrivateData<EventPtr>;
- privateData->camera = camera;
- privateData->event = event;
-
- opaqueData->eventTypeId = getEventTypeId(event);
- opaqueData->cameraPrivateData = privateData;
-
- return opaqueData;
-}
-
-template<typename EventPtr>
-CameraPrivateData<EventPtr>* getPrivateData(void* data)
-{
- OpaquePrivateData* opaqueData = static_cast<OpaquePrivateData*>(data);
-
- CameraPrivateData<EventPtr>* privateData =
- static_cast<CameraPrivateData<EventPtr> *>
- (opaqueData->cameraPrivateData);
-
- return privateData;
-}
-
-template<typename EventPtr>
-void deletePrivateData(void* data)
-{
- OpaquePrivateData* opaqueData = static_cast<OpaquePrivateData*>(data);
-
- CameraPrivateData<EventPtr>* privateData =
- static_cast<CameraPrivateData<EventPtr> *>
- (opaqueData->cameraPrivateData);
-
- delete privateData;
- delete opaqueData;
-}
-
-template<typename EventType, typename EventArg>
-EventType createEvent(const EventArg& arg1)
-{
- return EventType(arg1);
-}
-
-template<typename EventType>
-class BaseCallbackHandler : private DPL::Noncopyable
-{
- public:
- explicit BaseCallbackHandler(void* data) :
- m_camera(NULL)
- {
- Assert(data);
- CameraPrivateData<EventType>* privateData =
- getPrivateData<EventType>(data);
- m_camera = privateData->camera;
- m_event = privateData->event;
-
- deletePrivateData<EventType>(data);
- }
-
- virtual void handleErrorCallback(int error)
- {
- LogError("Error: " << error);
- m_event->setExceptionCode(Commons::ExceptionCodes::UnknownException);
- this->post();
- }
-
- virtual void handleSuccessCallback(void* data)
- {
- setPrivate(data);
- this->post();
- }
-
- virtual void post() = 0;
-
- virtual ~BaseCallbackHandler(){ }
-
- protected:
- virtual void setPrivate(void* /*data*/) {}
-
- protected:
- Camera* m_camera;
- EventType m_event;
-};
-
-template<typename EventType>
-class CallbackHandler : public BaseCallbackHandler<EventType>
-{
- static_assert(WrtDeviceApis::Commons::AlwaysFalse<EventType>::value,
- "Error, no specialization found for given type");
-
- public:
- explicit CallbackHandler(void* data) :
- BaseCallbackHandler<EventType>(data)
- {}
-
- //virtual void post(){ }
-};
-
-template<>
-class CallbackHandler<Api::EventBeginRecordingSharedPtr>:
- public BaseCallbackHandler<Api::EventBeginRecordingSharedPtr>
-{
- public:
- explicit CallbackHandler(void* data) :
- BaseCallbackHandler(data)
- {}
-
- virtual void post()
- {
- this->m_camera->setRecordingState(Camera::COMPLETED);
- this->m_camera->
- DPL::Event::ControllerEventHandler<JobDoneVideoRecordingEvent>::
- PostEvent(
- createEvent<JobDoneVideoRecordingEvent,
- Api::EventBeginRecordingSharedPtr>(this->m_event));
- }
-
- virtual void handleSuccessCallback(void* data)
- {
- this->m_camera->setRecordingState(Camera::COMPLETED);
- BaseCallbackHandler<Api::EventBeginRecordingSharedPtr>::
- handleSuccessCallback(data);
- }
-};
-
-template<>
-class CallbackHandler<Api::EventTakePictureSharedPtr>:
- public BaseCallbackHandler<Api::EventTakePictureSharedPtr>
-{
- public:
- explicit CallbackHandler(void* data) :
- BaseCallbackHandler(data)
- {}
-
- virtual void post()
- {
- this->m_camera->
- DPL::Event::ControllerEventHandler<JobDoneTakePictureEvent>::
- PostEvent(
- createEvent<JobDoneTakePictureEvent,
- Api::EventTakePictureSharedPtr>(this->m_event));
- }
-
- virtual void setPrivate(void* data)
- {
- m_event->getCaptureOptionsRef()->setFileName(static_cast<char*>(data));
- }
-};
-
-template<>
-class CallbackHandler<Api::EventGetPreviewNodeSharedPtr>:
- public BaseCallbackHandler<Api::EventGetPreviewNodeSharedPtr>
-{
- public:
- explicit CallbackHandler(void* data) :
- BaseCallbackHandler(data)
- {}
-
- virtual void post()
- {
- this->m_camera->
- DPL::Event::ControllerEventHandler<JobDoneCreatePreviewEvent>::
- PostEvent(
- createEvent<JobDoneCreatePreviewEvent,
- Api::EventGetPreviewNodeSharedPtr>(this->m_event));
- }
-
- virtual void setPrivate(void* data)
- {
- LogDebug("Enter");
- m_event->setPreviewNode(data);
- }
-};
-
-Camera::Camera(const Commons::IWrtCameraPtr& wrtCamera) :
- m_wrtCamera(wrtCamera),
- m_stateRecordingVideo(Camera::IDLE)
-{
- CameraJobDoneController::Touch();
-}
-
-Camera::~Camera()
-{
- LogDebug("enter");
-
- CameraJobDoneController::SwitchToThread(NULL);
-}
-
-void Camera::OnRequestReceived(
- const Api::EventTakePictureSharedPtr & event)
-{
- LogDebug("enter");
-
- event->switchToManualAnswer();
-
- m_wrtCamera->captureImage(event->getCaptureOptionsRef()->getFileName(),
- checkHighResolutionRequired(event),
- camCaptureImageSuccessCallback,
- camCaptureImageErrorCallback,
- setPendingOperation,
- createPrivateOpaqueData(this, event));
-
- LogDebug("leaving");
-}
-
-void Camera::OnRequestReceived(
- const Api::EventBeginRecordingSharedPtr & event)
-{
- LogDebug("enter");
-
- if (m_stateRecordingVideo != Camera::IDLE) {
- event->setExceptionCode(Commons::ExceptionCodes::AlreadyInUseException);
- return;
- }
- m_stateRecordingVideo = Camera::PROCESSING;
-
- //from now on we will have to call answer manually
- event->switchToManualAnswer();
-
- m_wrtCamera->startVideoCapture(event->getCaptureOptionsRef()->getFileName(),
- checkHighResolutionRequired(event),
- camCaptureVideoSuccessCallback,
- camCaptureVideoErrorCallback,
- setPendingOperation,
- createPrivateOpaqueData(this, event));
-
- LogDebug("leaving");
-}
-
-void Camera::OnRequestReceived(
- const Api::EventEndRecordingSharedPtr & event)
-{
- LogDebug("end request");
- if (m_stateRecordingVideo == Camera::PROCESSING) {
- m_wrtCamera->stopVideoCapture();
- } else {
- LogDebug("stopVideo has been called but no recording is in progress");
- event->setExceptionCode(Commons::ExceptionCodes::UnknownException);
- }
-}
-
-void Camera::OnRequestReceived(
- const Api::EventGetPreviewNodeSharedPtr & event)
-{
- LogDebug("enter");
-
- event->switchToManualAnswer();
-
- LogDebug("start createPreview");
-
- m_wrtCamera->createPreviewNode(camPreviewSuccessCallback,
- camPreviewErrorCallback,
- setPendingOperation,
- createPrivateOpaqueData(this, event));
- LogDebug("leaving");
-}
-
-void Camera::camCaptureImageSuccessCallback(
- const char* filename, void* data)
-{
- LogDebug("*Picture* Captured. !!!");
-
- CallbackHandler<Api::EventTakePictureSharedPtr> handler(data);
- handler.handleSuccessCallback(const_cast<char*>(filename));
-}
-
-void Camera::camCaptureVideoSuccessCallback(const char* filename, void* data)
-{
- LogDebug("*Video* Captured. !!!");
-
- CallbackHandler<Api::EventBeginRecordingSharedPtr> handler(data);
- handler.handleSuccessCallback(const_cast<char*>(filename));
-}
-
-void Camera::camPreviewSuccessCallback(
- Commons::IWrtCamera::CameraPreviewNode node, void* data)
-{
- LogDebug("enter");
-
- CallbackHandler<Api::EventGetPreviewNodeSharedPtr> handler(data);
- handler.handleSuccessCallback(node);
-}
-
-void Camera::camPreviewErrorCallback(int errorCode, void* data)
-{
- LogDebug("enter");
-
- CallbackHandler<Api::EventGetPreviewNodeSharedPtr> handler(data);
- handler.handleErrorCallback(errorCode);
-}
-
-void Camera::camCaptureImageErrorCallback(int errorCode, void* data)
-{
- LogDebug("enter");
-
- CallbackHandler<Api::EventTakePictureSharedPtr> handler(data);
- handler.handleErrorCallback(errorCode);
-}
-
-void Camera::camCaptureVideoErrorCallback(int errorCode, void* data)
-{
- LogDebug("enter");
-
- CallbackHandler<Api::EventBeginRecordingSharedPtr> handler(data);
- handler.handleErrorCallback(errorCode);
-}
-
-void Camera::OnEventReceived(const JobDoneVideoRecordingEvent &event)
-{
- LogDebug("enter");
- if (m_stateRecordingVideo == COMPLETED && event.GetArg0()) {
- EventRequestReceiver<Api::EventBeginRecording>::
- ManualAnswer(event.GetArg0());
- //event.Reset();
- }
- m_stateRecordingVideo = Camera::IDLE;
-}
-
-void Camera::OnEventReceived(const JobDoneCreatePreviewEvent &event)
-{
- OnJobDoneReceived(event.GetArg0());
-}
-
-void Camera::OnEventReceived(const JobDoneTakePictureEvent &event)
-{
- OnJobDoneReceived(event.GetArg0());
-}
-
-void Camera::OnCancelEvent(
- const Api::EventBeginRecordingSharedPtr& event)
-{
- LogDebug(__FUNCTION__);
-
- if (Camera::PROCESSING == m_stateRecordingVideo) {
- if (event->checkPendingOperation()) {
- m_wrtCamera->cancelAsyncOperation(event->getPendingOperation());
- }
- setRecordingState(Camera::IDLE);
- } else {
- LogError("Cancel invoked, but the state is wrong");
- }
-}
-
-void Camera::OnCancelEvent(const Api::EventTakePictureSharedPtr& event)
-{
- cancelEvent(event);
-}
-
-void Camera::OnCancelEvent(
- const Api::EventGetPreviewNodeSharedPtr& event)
-{
- cancelEvent(event);
-}
-
-void Camera::setRecordingState(CameraState state)
-{
- m_stateRecordingVideo = state;
-}
-
-void Camera::setPendingOperation(
- Commons::IWrtCamera::CameraPendingOperation pendingOperation, void* data)
-{
- LogDebug("Set pending operation callback invoked");
-
- Assert(data);
- OpaquePrivateData* opaqueData = static_cast<OpaquePrivateData*>(data);
- Assert(opaqueData->cameraPrivateData);
-
- switch (opaqueData->eventTypeId) {
- case BeginRecordingType:
- {
- static_cast<CameraPrivateData<Api::EventBeginRecordingSharedPtr>* >(
- opaqueData->cameraPrivateData)
- ->event->setPendingOperation(pendingOperation);
- break;
- }
- case CreatePreviewType:
- {
- static_cast<CameraPrivateData<Api::EventGetPreviewNodeSharedPtr>* >(
- opaqueData->cameraPrivateData)
- ->event->setPendingOperation(pendingOperation);
- break;
- }
- case TakePictureType:
- {
- static_cast<CameraPrivateData<Api::EventGetPreviewNodeSharedPtr>* >(
- opaqueData->cameraPrivateData)
- ->event->setPendingOperation(pendingOperation);
- break;
- }
- default:
- Assert(0);
- }
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Grzegorz Krawczyk(g.krawczyk@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_CAMERA_H_
-#define WRT_PLUGINS_CAMERA_H_
-
-#include <string>
-#include <dpl/log/log.h>
-#include <dpl/generic_event.h>
-#include <dpl/event/controller.h>
-#include <dpl/type_list.h>
-#include <dpl/shared_ptr.h>
-#include <API/Camera/ICamera.h>
-#include <API/Camera/ICaptureOptions.h>
-#include <API/Camera/EventTakePicture.h>
-#include <API/Camera/EventBeginRecording.h>
-#include <API/Camera/EventEndRecording.h>
-#include <API/Camera/EventGetPreviewNode.h>
-#include <Commons/Dimension.h>
-#include <Commons/WrtWrapper/IWrtCamera.h>
-
-namespace WrtDeviceApis {
-namespace Camera {
-DECLARE_GENERIC_EVENT_1(JobDoneTakePictureEvent,
- Camera::Api::EventTakePictureSharedPtr)
-DECLARE_GENERIC_EVENT_1(JobDoneVideoRecordingEvent,
- Camera::Api::EventBeginRecordingSharedPtr)
-DECLARE_GENERIC_EVENT_1(JobDoneCreatePreviewEvent,
- Camera::Api::EventGetPreviewNodeSharedPtr)
-
-typedef DPL::TypeListDecl<JobDoneTakePictureEvent,
- JobDoneVideoRecordingEvent,
- JobDoneCreatePreviewEvent
- >::Type JobDoneEvents;
-
-typedef DPL::Event::Controller<JobDoneEvents> CameraJobDoneController;
-
-class Camera : public Api::ICamera,
- public CameraJobDoneController
-{
- public:
- enum CameraState {
- IDLE,
- PROCESSING,
- COMPLETED
- };
-
- public:
- explicit Camera(const Commons::IWrtCameraPtr& wrtCamera);
-
- virtual ~Camera();
-
- virtual void OnRequestReceived(
- const Api::EventTakePictureSharedPtr &event);
- virtual void OnRequestReceived(
- const Api::EventBeginRecordingSharedPtr &event);
- virtual void OnRequestReceived(
- const Api::EventEndRecordingSharedPtr &event);
- virtual void OnRequestReceived(
- const Api::EventGetPreviewNodeSharedPtr &event);
-
- virtual void OnEventReceived(const JobDoneVideoRecordingEvent &event);
- virtual void OnEventReceived(const JobDoneCreatePreviewEvent &event);
- virtual void OnEventReceived(const JobDoneTakePictureEvent &event);
-
- void OnCancelEvent(const Api::EventBeginRecordingSharedPtr& event);
- void OnCancelEvent(const Api::EventTakePictureSharedPtr& event);
- void OnCancelEvent(const Api::EventGetPreviewNodeSharedPtr& event);
-
- void setRecordingState(CameraState state);
-
- private:
- static void camCaptureImageSuccessCallback(const char* filename,
- void* data);
- static void camCaptureVideoSuccessCallback(const char* filename,
- void* data);
- static void camPreviewSuccessCallback(
- Commons::IWrtCamera::CameraPreviewNode node, void* data);
-
- static void camCaptureImageErrorCallback(int errorCode, void* data);
- static void camCaptureVideoErrorCallback(int errorCode, void* data);
- static void camPreviewErrorCallback(int errorCode, void* data);
-
- template<class EventType>
- bool checkHighResolutionRequired(const EventType& event) const
- {
- return event->getCaptureOptionsRef()->getImageResolution()
- == Api::ICaptureOptions::IMAGE_RESOLUTION_HIGH;
- }
-
- template<typename EventData>
- void OnJobDoneReceived(DPL::SharedPtr<EventData> event)
- {
- LogDebug("enter");
- if (event) {
- EventRequestReceiver<EventData>::ManualAnswer(event);
- }
- LogDebug("post");
- }
-
- template<typename EventType>
- void cancelEvent(const EventType& event)
- {
- LogDebug(__FUNCTION__);
-
- if (event->checkPendingOperation()) {
- m_wrtCamera->cancelAsyncOperation(event->getPendingOperation());
- }
- }
-
- static void setPendingOperation(
- Commons::IWrtCamera::CameraPendingOperation pendingOperation,
- void* data);
-
- private:
- Commons::IWrtCameraPtr m_wrtCamera;
-
- CameraState m_stateRecordingVideo;
-};
-}
-}
-#endif /* WRTPLUGINSCAMERA_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
- * @version 0.1
- * @brief
- */
-#include <dpl/foreach.h>
-#include "CameraManager.h"
-#include <Commons/Exception.h>
-#include <API/Camera/EventGetCameras.h>
-#include <API/Camera/ICamera.h>
-#include "Camera.h"
-
-namespace WrtDeviceApis {
-namespace Camera {
-void CameraManager::OnRequestReceived(
- const Api::EventGetCamerasPtr &event)
-{
- LogDebug(__FUNCTION__);
- try {
- if (m_cameras.empty()) {
- DPL::Mutex::ScopedLock lock(&m_accessMutex);
-
- if (m_cameras.empty()) {
- Commons::IWrtCameraManager::WrtCamerasPtr cameras;
- cameras = event->
- getConfiguration()->
- getWrtWrapper()->
- getCameraManagerInterface()->
- getCameras();
-
- FOREACH(it, *cameras)
- {
- Api::ICameraSharedPtr icamera(new Camera(*it));
- m_cameras.push_back(icamera);
- }
- }
- }
- event->setCamerasRef(m_cameras, 0);
- LogDebug("Nr of cameras: " << m_cameras.size());
- } catch (const Commons::Exception &exc) {
- LogError("Exception has occurred: " << std::hex << exc.getCode());
- event->setExceptionCode(exc.getCode());
- }
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRT_PLUGINS_CAMERA_MANAGER_H_
-#define WRT_PLUGINS_CAMERA_MANAGER_H_
-
-#include <dpl/mutex.h>
-
-#include <API/Camera/ICameraManager.h>
-#include <API/Camera/EventGetCameras.h>
-
-namespace WrtDeviceApis {
-namespace Camera {
-class CameraManager : public Api::ICameraManager
-{
- protected:
- virtual void OnRequestReceived(
- const Api::EventGetCamerasPtr &event);
-
- private:
- DPL::Mutex m_accessMutex;
-};
-}
-}
-#endif /* */
+++ /dev/null
-get_current_path()
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_CAMERA
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_CAMERA
- ${CURRENT_PATH}/Camera.cpp
- ${CURRENT_PATH}/CameraManager.cpp
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_CAMERA
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Manager.h"
-#include <commons/Exception.h>
-
-namespace {
-const bool CLAMSHELL_SUPPORTED = false;
-const bool KEYPAD_SUPPORTED = false;
-} // anonymous
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Device {
-Manager& Manager::getInstance()
-{
- static Manager instance;
- return instance;
-}
-
-Manager::~Manager()
-{}
-
-bool Manager::hasClamshell() const
-{
- return CLAMSHELL_SUPPORTED;
-}
-
-Api::Device::IClamshell* Manager::getClamshell() const
-{
- ThrowMsg(Commons::UnsupportedException,
- "Device is not equipped with clamshell.");
-}
-
-bool Manager::hasKeypad() const
-{
- return KEYPAD_SUPPORTED;
-}
-
-Api::Device::IKeypad* Manager::getKeypad() const
-{
- ThrowMsg(Commons::UnsupportedException,
- "Device is not equipped with keypad.");
-}
-
-std::string Manager::getImei() const
-{
- Try {
- return m_imei.getString();
- }
- Catch(Commons::ConversionException) {
- ReThrow(Commons::PlatformException);
- }
-}
-
-Manager::Manager() : m_imei(VCONFKEY_TELEPHONY_IMEI)
-{}
-} // Device
-} // Platform
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTDEVICEAPIS_DEVICE_MANAGER_H_
-#define WRTDEVICEAPIS_DEVICE_MANAGER_H_
-
-#include <API/Device/IManager.h>
-#include <VConf/Key.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Device {
-class Manager : public Api::Device::IManager
-{
- public:
- static Manager& getInstance();
-
- public:
- virtual ~Manager();
-
- /**
- * @see WrtPlugins::Api::Device::IManager::hasClamshell()
- */
- bool hasClamshell() const;
-
- /**
- * @see WrtPlugins::Api::Device::IManager::getClamshell()
- */
-
- Api::Device::IClamshell* getClamshell() const;
-
- /**
- * @see WrtPlugins::Api::Device::IManager::hasKeypad()
- */
- bool hasKeypad() const;
-
- /**
- * @see WrtPlugins::Api::Device::IManager::getKeypad()
- */
- Api::Device::IKeypad* getKeypad() const;
-
- /**
- * @see WrtPlugins::Api::Device::IManager::getImei()
- */
- std::string getImei() const;
-
- protected:
- Manager();
-
- private:
- VConf::Key m_imei;
-};
-} // Device
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_DEVICE_MANAGER_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(devman REQUIRED devman)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_DEVICE
- ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF}
- ${devman_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_DEVICE
- ${LIBS_PLATFORM_IMPLEMENTATION_VCONF}
- ${devman_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_DEVICE
- ${CURRENT_PATH}/Manager.cpp
- ${SRCS_PLATFORM_IMPLEMENTATION_VCONF}
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Manager.h"
-#include <commons/Exception.h>
-#include "Screen.h"
-
-namespace {
-const std::size_t NUMBER_OF_AVAILABLE_SCREENS = 1;
-const std::size_t INDEX_OF_DEFAULT_SCREEN = 1;
-} // anonymous
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Display {
-Manager& Manager::getInstance()
-{
- static Manager instance;
- return instance;
-}
-
-Api::Display::IScreen* Manager::getScreen(std::size_t index) const
-{
- if (index == 0) {
- index = INDEX_OF_DEFAULT_SCREEN;
- }
-
- if (index > NUMBER_OF_AVAILABLE_SCREENS) {
- ThrowMsg(Commons::OutOfRangeException, "Screen is not available.");
- }
-
- Screens::iterator it = m_screens.find(index);
- if (it == m_screens.end()) {
- Api::Display::IScreen* screen = new Screen(index);
- m_screens.insert(Screens::value_type(index, screen));
- return screen;
- }
- return it->second;
-}
-
-std::size_t Manager::getScreensCount() const
-{
- return NUMBER_OF_AVAILABLE_SCREENS;
-}
-
-Manager::~Manager()
-{
- Screens::iterator it = m_screens.begin();
- for (; it != m_screens.end(); ++it) {
- delete it->second;
- }
-}
-
-Manager::Manager()
-{}
-} // Display
-} // Platform
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTDEVICEAPIS_DISPLAY_MANAGER_H_
-#define WRTDEVICEAPIS_DISPLAY_MANAGER_H_
-
-#include <map>
-#include <API/Display/IManager.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Display {
-class Manager : public Api::Display::IManager
-{
- public:
- static Manager& getInstance();
-
- public:
- ~Manager();
-
- /**
- * @see WrtPlugins::Api::Display::IManager::getScreen()
- */
- Api::Display::IScreen* getScreen(std::size_t index) const;
-
- /**
- * @see WrtPlugins::Api::Display::IManager::getScreensCount()
- */
- std::size_t getScreensCount() const;
-
- protected:
- typedef std::map<std::size_t, Api::Display::IScreen*> Screens;
-
- protected:
- Manager();
-
- protected:
- mutable Screens m_screens; ///< Available screen interfaces.
-};
-} // Display
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_DISPLAY_MANAGER_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Screen.h"
-#include <stdio.h>
-#include <limits.h>
-#include <algorithm>
-#include <commons/Exception.h>
-#include <API/Display/EventChangeState.h>
-
-// TODO: attach to platform event informing about changed size!
-
-namespace {
-const char* COMMAND_XDPYINFO = "xdpyinfo";
-const char* PATTERN_COLOR_DEPTH = "depth of root window:\\s+(\\d+)\\s+planes";
-const char* PATTERN_SIZE = "dimensions:\\s+(\\d+)x(\\d+)";
-} // anonymous
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Display {
-unsigned short Screen::getColorDepth() const
-{
- unsigned short colorDepth = 0;
- if (!getXDpyProperty(PATTERN_COLOR_DEPTH, &colorDepth)) {
- ThrowMsg(Commons::PlatformException, "Could not read color depth.");
- }
- return colorDepth;
-}
-
-Dimension Screen::getSize() const
-{
- unsigned int width = 0, height = 0;
- if (!getXDpyProperty(PATTERN_SIZE, &width, &height)) {
- ThrowMsg(Commons::PlatformException, "Could not read size.");
- }
- return Dimension(width, height);
-}
-
-Dimension Screen::getActualSize() const
-{
- unsigned int width = 0, height = 0;
- if (!getXDpyProperty(PATTERN_SIZE, &width, &height)) {
- ThrowMsg(Commons::PlatformException, "Could not read size.");
- }
- if (getOrientation() == Api::Display::O_LANDSCAPE) {
- std::swap(width, height);
- }
- return Dimension(width, height);
-}
-
-Api::Display::Orientation Screen::getOrientation() const
-{
- appcore_rm rot = APPCORE_RM_UNKNOWN;
- if (appcore_get_rotation_state(&rot) != 0) {
- ThrowMsg(Commons::PlatformException, "Could not get orientation.");
- }
- switch (rot) {
- case APPCORE_RM_LANDSCAPE_NORMAL:
- case APPCORE_RM_LANDSCAPE_REVERSE:
- return Api::Display::O_LANDSCAPE;
- default:
- return Api::Display::O_PORTRAIT;
- }
-}
-
-Api::Display::State Screen::getState() const
-{
- Try {
- int state = m_powerState.getInt();
- switch (state) {
- case VCONFKEY_PM_STATE_NORMAL:
- return Api::Display::ST_ON;
- case VCONFKEY_PM_STATE_LCDDIM:
- return Api::Display::ST_DIM;
- default:
- return Api::Display::ST_OFF;
- }
- }
- Catch(Commons::ConversionException) {
- ReThrowMsg(Commons::PlatformException,
- "Could not get device's power state.");
- }
-}
-
-void Screen::addOnChangeOrientation(
- const Api::Display::EventChangeOrientationEmitterPtr& emitter)
-{
- m_onChangeOrientation.attach(emitter);
- ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock();
- if (m_onChangeOrientation.size() == 1) {
- if (appcore_set_rotation_cb(onChangeOrientation, this) != 0) {
- ThrowMsg(Commons::PlatformException,
- "Could not attach to platform event.");
- }
- }
-}
-
-void Screen::removeOnChangeOrientation(
- Api::Display::EventChangeOrientationEmitter::IdType id)
-{
- m_onChangeOrientation.detach(id);
- ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock();
- if (m_onChangeOrientation.size() == 0) {
- if (appcore_unset_rotation_cb() != 0) {
- ThrowMsg(Commons::PlatformException,
- "Could not detach from platform event.");
- }
- }
-}
-
-void Screen::addOnChangeState(
- const Api::Display::EventChangeStateEmitterPtr& emitter)
-{
- m_onChangeState.attach(emitter);
- ChangeStateEmitters::LockType lock = m_onChangeState.getLock();
- if (m_onChangeState.size() == 1) {
- m_powerState.attachCallback(onChangeState, this);
- }
-}
-
-void Screen::removeOnChangeState(
- Api::Display::EventChangeStateEmitter::IdType id)
-{
- m_onChangeState.detach(id);
- ChangeStateEmitters::LockType lock = m_onChangeState.getLock();
- if (m_onChangeState.size() == 0) {
- m_powerState.detachCallback();
- }
-}
-
-Screen::Screen(std::size_t index) :
- m_index(index),
- m_powerState(VCONFKEY_PM_STATE)
-{}
-
-bool Screen::getXDpyProperty(const char* pattern,
- const pcrecpp::Arg& arg1,
- const pcrecpp::Arg& arg2)
-{
- FILE* pipe = popen(COMMAND_XDPYINFO, "r");
- if (pipe == NULL) {
- ThrowMsg(Commons::PlatformException,
- "Could not initialize pipe to xdpyinfo.");
- }
-
- bool matched = false;
- pcrecpp::RE re(pattern);
- char line[LINE_MAX] = { 0 };
- while (fgets(line, LINE_MAX, pipe)) {
- if (re.PartialMatch(line, arg1, arg2)) {
- matched = true;
- break;
- }
- }
- pclose(pipe);
-
- return matched;
-}
-
-void Screen::onChangeState(const VConf::Node* /*node*/,
- void* data)
-{
- Screen* this_ = static_cast<Screen*>(data);
- Api::Display::EventChangeStatePtr event(new Api::Display::EventChangeState());
- Try {
- event->setState(this_->getState());
- }
- Catch(Commons::PlatformException) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- this_->m_onChangeState.emit(event);
-}
-
-int Screen::onChangeOrientation(appcore_rm rot,
- void* data)
-{
- Screen* this_ = static_cast<Screen*>(data);
- Api::Display::EventChangeOrientationPtr event(
- new Api::Display::EventChangeOrientation());
- Try {
- event->setOrientation(this_->getOrientation());
- }
- Catch(Commons::PlatformException) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- this_->m_onChangeOrientation.emit(event);
- //TODO check returned value
- return 0;
-}
-} // Display
-} // Platform
-} // WrtPlugins
-
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTDEVICEAPIS_DISPLAY_SCREEN_H_
-#define WRTDEVICEAPIS_DISPLAY_SCREEN_H_
-
-#include <cstddef>
-#include <pcrecpp.h>
-#include <appcore-common.h>
-#include <platform/commons/Emitters.h>
-#include <API/Display/IScreen.h>
-#include <VConf/Key.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Display {
-class Manager;
-
-class Screen : public Api::Display::IScreen
-{
- friend class Manager;
-
- public:
- /**
- * @see WrtPlugins::Api::Display::IScreen::getColorDepth()
- */
- unsigned short getColorDepth() const;
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::getSize()
- */
- Dimension getSize() const;
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::getActualSize()
- */
- Dimension getActualSize() const;
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::getOrientation()
- */
- Api::Display::Orientation getOrientation() const;
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::getState()
- */
- Api::Display::State getState() const;
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::addOnChangeOrientation()
- */
- void addOnChangeOrientation(
- const Api::Display::EventChangeOrientationEmitterPtr& emitter);
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::removeOnChangeOrientation()
- */
- void removeOnChangeOrientation(
- Api::Display::EventChangeOrientationEmitter::IdType id);
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::addOnChangeState()
- */
- void addOnChangeState(
- const Api::Display::EventChangeStateEmitterPtr& emitter);
-
- /**
- * @see WrtPlugins::Api::Display::IScreen::removeOnChangeState()
- */
- void removeOnChangeState(Api::Display::EventChangeStateEmitter::IdType id);
-
- protected:
- typedef Emitters<Api::Display::EventChangeOrientationEmitter>
- ChangeOrientationEmitters;
- typedef Emitters<Api::Display::EventChangeStateEmitter> ChangeStateEmitters;
-
- protected:
- /**
- * Gets data matching specified pattern from output of xdpyinfo program.
- * @param pattern Pattern to search for.
- * @return Zero or positive value on success, -1 on failure.
- */
- static bool getXDpyProperty(const char* pattern,
- const pcrecpp::Arg& arg1 = pcrecpp::RE::no_arg,
- const pcrecpp::Arg& arg2 = pcrecpp::RE::no_arg);
-
- /**
- * Callback run when device's power state changes.
- * @param node Node object (unused).
- * @param data User data.
- */
- static void onChangeState(const VConf::Node* node,
- void* data);
-
- /**
- * Callback run when device's orientation changes.
- * @param rot Rotation mode.
- * @param data User data.
- * @return Error code (?) - not specified in documentation.
- */
- static int onChangeOrientation(appcore_rm rot,
- void* data);
-
- protected:
- explicit Screen(std::size_t index);
-
- protected:
- std::size_t m_index; ///< Index of the screen.
- ChangeOrientationEmitters m_onChangeOrientation; ///< Change orientation
- // emitters.
- ChangeStateEmitters m_onChangeState; ///< Change state emitters.
- VConf::Key m_powerState; ///< Key for power manager state.
-};
-} // Display
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_DISPLAY_SCREEN_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(pcrecpp REQUIRED libpcrecpp)
-pkg_search_module(appcore REQUIRED appcore-common)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_DISPLAY
- ${pcrecpp_INCLUDE_DIRS}
- ${appcore_INCLUDE_DIRS}
- ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_DISPLAY
- ${pcrecpp_LIBRARIES}
- ${appcore_LIBRARIES}
- ${LIBS_PLATFORM_IMPLEMENTATION_VCONF}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_DISPLAY
- ${CURRENT_PATH}/Manager.cpp
- ${CURRENT_PATH}/Screen.cpp
- ${SRCS_PLATFORM_IMPLEMENTATION_VCONF}
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Bartlomiej Grzelewski
- */
-
-#include <dpl/log/log.h>
-#include <commons/JSCallbackManager.h>
-#include <vector>
-#include "FeatureManager.h"
-
-using namespace WrtPlugins::Api;
-
-namespace WrtPlugins {
-namespace Platform {
-//static void wrtPlatformCallback(int widgetHandler, JSObjectRef object, void*
-// userParam)
-//{
-// FeatureManager::platformCallback(widgetHandler,
-// static_cast<void*>(object), userParam);
-//}
-
-void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event)
-{
- //TODO commented
- //EventWrapper *eventWrapper = new EventWrapper(this, event);
- LogDebug("Call for dynamic feature: " << event->getFeature().c_str());
- JSCallbackManagerPtr jsCallbackManager =
- DPL::StaticPointerCast<JSCallbackManager,
- Platform::IEventPrivateData>(
- event->getPrivateData());
- /* TODO uncomment - this function _will_ be available in new wrt-engine API
- **/
- LogError("*** CRITICAL wrt_dynamic_feature_request is disable!");
- // wrt_dynamic_feature_request(jsCallbackManager->getContext(),
- // event->getFeature().c_str(), wrtPlatformCallback, eventWrapper);
-}
-
-void FeatureManager::platformCallback(int,
- void* object,
- void* userParam)
-{
- if (object == NULL) {
- LogError("Request has been rejected.");
- } else {
- LogDebug("Request has been approved.");
- }
- EventWrapper *eventWrapper = static_cast<EventWrapper*>(userParam);
- eventWrapper->m_event->setObject(object);
- eventWrapper->m_event->setStatus((object == 0) ? false : true);
- eventWrapper->m_featureManager->Platform::EventRequestReceiver<
- EventLoadFeature>::ManualAnswer(eventWrapper->m_event);
- delete eventWrapper;
-}
-} // namespace Platform
-} // namespace WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef _SLP20_FEATUREMANAGER_H_
-#define _SLP20_FEATUREMANAGER_H_
-
-/*
- * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
- */
-
-#include "API/FeatureLoader/IFeatureManager.h"
-
-namespace WrtPlugins {
-namespace Platform {
-class FeatureManager :
- public Api::IFeatureManager
-{
- public:
- FeatureManager()
- {}
- virtual ~FeatureManager()
- {}
- static void platformCallback(int,
- void* object,
- void* userParam);
-
- protected:
- virtual void OnRequestReceived(const Api::EventLoadFeaturePtr &event);
-
- private:
- struct EventWrapper
- {
- EventWrapper(FeatureManager *featureManager,
- const Api::EventLoadFeaturePtr &event) :
- m_featureManager(featureManager),
- m_event(event)
- {}
-
- ~EventWrapper()
- {}
-
- FeatureManager *m_featureManager;
- Api::EventLoadFeaturePtr m_event;
- };
-};
-} // namespace Platform
-} // namespace WrtPlugins
-
-#endif // _SLP20_FEATUREMANAGER_H_
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_IMPLEMENTATION_FEATURE_MANAGER
- ${CURRENT_PATH}/FeatureManager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file Gallery.cpp
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- */
-
-#include <algorithm>
-#include <commons/Exception.h>
-#include <API/Filesystem/INode.h>
-#include <API/Filesystem/Enums.h>
-#include "Gallery.h"
-
-using namespace std;
-using namespace DPL;
-using namespace WrtPlugins::Api::Gallery;
-using namespace WrtPlugins::Api::Filesystem;
-
-namespace WrtPlugins {
-namespace Platform {
-using namespace Filesystem;
-
-namespace {
-//Map file extension to IMediaItem type
-map<string, IMediaItem::MediaType> &createExtToTypeMap()
-{
- static map<string, IMediaItem::MediaType> retMap;
- retMap["jpg"] = IMediaItem::IMAGE;
- retMap["jpeg"] = IMediaItem::IMAGE;
- retMap["gif"] = IMediaItem::IMAGE;
- retMap["bmp"] = IMediaItem::IMAGE;
- retMap["png"] = IMediaItem::IMAGE;
- retMap["wav"] = IMediaItem::AUDIO;
- retMap["mp3"] = IMediaItem::AUDIO;
- retMap["wmv"] = IMediaItem::VIDEO;
- retMap["3gp"] = IMediaItem::VIDEO;
- return retMap;
-}
-
-//Map file extension to MIME type
-map<string, string> &createExtToMimeMap()
-{
- static map<string, string> retMap;
- retMap["jpg"] = "image/jpeg";
- retMap["jpeg"] = "image/jpeg";
- retMap["gif"] = "image/gif";
- retMap["bmp"] = "image/bmp";
- retMap["png"] = "image/png";
- retMap["wav"] = "audio/wav";
- retMap["mp3"] = "audio/mpeg3";
- retMap["wmv"] = "video/x - ms - wmv";
- retMap["3gp"] = "video/3gpp";
- return retMap;
-}
-
-bool compareByFilename(const IMediaItemPtr &lpm,
- const IMediaItemPtr &rpm)
-{
- return lpm->getFileName().compare(rpm->getFileName()) < 0;
-}
-
-bool compareByFileDate(const IMediaItemPtr &lpm,
- const IMediaItemPtr &rpm)
-{
- return lpm->getDate() < rpm->getDate();
-}
-
-bool compareByType(const IMediaItemPtr &lpm,
- const IMediaItemPtr &rpm)
-{
- return lpm->getType() < rpm->getType();
-}
-
-class SearchIdObj
-{
- unsigned long m_id;
-
- public:
- SearchIdObj(unsigned long id) : m_id(id)
- {}
- bool operator ()(const IMediaItemPtr &elem)
- {
- return elem->getId() == m_id;
- }
-};
-} //private namespace
-
-map<string,
- IMediaItem::MediaType> &Gallery::m_extensionToType = createExtToTypeMap();
-map<string, string> &Gallery::m_extensionToMime = createExtToMimeMap();
-
-unsigned int Gallery::getNumberOfItems() const
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- //if gallery is opened m_view always stores an object
- return m_view->size();
-}
-
-std::string Gallery::getName() const
-{
- LogDebug("Gallery name: " << m_name);
- return m_name;
-}
-
-void Gallery::open()
-{
- if (m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- m_mediaItems.clear();
- m_lastId = 0;
- Path path("/");
- SharedPtr<INode> node(Node::resolve(path));
- node->setPermissions(PERM_READ);
- searchFiles(node);
- //Destroy previous view and store new one
- m_view = IMediaItemsSetPtr(new IMediaItemsSet(m_mediaItems));
- m_opened = true;
- LogDebug("Gallery contains " << m_mediaItems.size() << " items");
-}
-
-void Gallery::searchFiles(const SharedPtr<INode> &node)
-{
- if (Api::Filesystem::NT_FILE == node->getType()) {
- string fileName = node->getPath().getName();
- size_t dotPos = fileName.find_last_of(".");
- if (dotPos == string::npos) {
- //Not supported file
- return;
- }
- string fileExt = fileName.substr(dotPos + 1);
- //Check if file has supported type
- map<string, string>::iterator it = m_extensionToMime.find(fileExt);
- if (it != m_extensionToMime.end()) {
- IMediaItemPtr mediaItem(new IMediaItem());
- mediaItem->setId(getFreeId());
- mediaItem->setFileName(fileName);
- mediaItem->setType(m_extensionToType[fileExt]);
- mediaItem->setMimeType(m_extensionToMime[fileExt]);
- mediaItem->setDate(node->getCreated());
- m_mediaItems.push_back(mediaItem);
- }
- return;
- }
-
- //else get recurrent on NT_DIRECTORY
- NodeList nodes = node->getChildNodes();
- NodeList::iterator it = nodes.begin(), end = nodes.end();
- while (it != end) {
- //Warning: '*it' element will be deleted after out of scope (next
- // iteration)
- (*it)->setPermissions(PERM_READ);
- searchFiles(SharedPtr<INode>(*it));
- ++it;
- }
-}
-
-unsigned long Gallery::getFreeId()
-{
- return ++m_lastId;
-}
-
-bool Gallery::isOpen() const
-{
- return m_opened;
-}
-
-void Gallery::close()
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- m_mediaItems.clear();
- m_view.Reset();
- m_lastId = 0;
- m_opened = false;
-}
-
-void Gallery::refresh()
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- m_mediaItems.clear();
- m_view->clear();
- m_lastId = 0;
- Path path("/");
- SharedPtr<Node> node(Node::resolve(path));
- node->setPermissions(PERM_READ);
- searchFiles(DynamicPointerCast<INode>(node));
- changeView(m_viewProperties);
- LogDebug("Gallery contains " << m_mediaItems.size() << " items");
-}
-
-void Gallery::changeView(const IViewProperties &props)
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- m_viewProperties = props;
- m_view->clear();
-
- //Copy elements within date period to view struct
- for (IMediaItemsSetIterator it = m_mediaItems.begin(),
- end = m_mediaItems.end();
- it != end; ++it)
- {
- if ((m_viewProperties.getStartDate() <= (*it)->getDate()) &&
- ((*it)->getDate() <= m_viewProperties.getEndDate()))
- {
- m_view->push_back(*it);
- }
- }
-
- //sort elements
- IViewProperties::SortOrder sortOrder[] = {
- m_viewProperties.getSecondarySortOrder(),
- m_viewProperties.getPrimarySortOrder()
- };
- for (size_t i = 0; i < (sizeof(sortOrder) / sizeof(sortOrder[0])); ++i) {
- switch (sortOrder[i]) {
- case IViewProperties::BY_FILEDATE:
- m_view->sort(compareByFileDate);
- break;
- case IViewProperties::BY_FILENAME:
- m_view->sort(compareByFilename);
- break;
- case IViewProperties::BY_TYPE:
- m_view->sort(compareByType);
- break;
- default:
- break;
- }
- }
-
- //reverse order if necessary
- if (IViewProperties::DESCENDING == m_viewProperties.getSortOrder()) {
- m_view->reverse();
- }
- LogDebug("View contains " << m_view->size() << " items");
-}
-
-const IMediaItemsSetPtr Gallery::getMediaItems() const
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- LogError("View contains " << m_view->size() << " entries");
- return m_view;
-}
-
-const IMediaItemPtr Gallery::getMediaItemById(unsigned long id) const
-{
- if (!m_opened) {
- Throw(Commons::PlatformWrongStateException);
- }
- SearchIdObj searchObj(id);
- IMediaItemsSetConstIterator elem = find_if(
- m_mediaItems.begin(), m_mediaItems.end(), searchObj);
- if (elem == m_mediaItems.end()) {
- Throw(Commons::InvalidArgumentException);
- }
- return *elem;
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_
-#define WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_
-
-#include <dpl/shared_ptr.h>
-#include <string>
-#include <map>
-#include <platform/commons/EventReceiver.h>
-#include <API/Gallery/IGallery.h>
-#include <API/Gallery/IMediaItem.h>
-#include <Filesystem/Path.h>
-#include <Filesystem/Node.h>
-
-namespace WrtPlugins {
-namespace Platform {
-class Gallery : public Api::Gallery::IGallery
-{
- /*
- * Gallery name
- */
- std::string m_name;
- /*
- * Stores state of the gallery
- */
- bool m_opened;
- /*
- * Last ID field is used to give for an MediaItem unique ID
- */
- unsigned long m_lastId;
- /*
- * Set of all media items found on device
- */
- Api::Gallery::IMediaItemsSet m_mediaItems;
- /*
- * Set of media items selected by changeView method
- */
- Api::Gallery::IMediaItemsSetPtr m_view;
- /*
- * Properties to manage view of media items
- */
- Api::Gallery::IViewProperties m_viewProperties;
-
- /*
- * Map to convert from file extension to media type
- */
- static std::map<std::string,
- Api::Gallery::IMediaItem::MediaType> &m_extensionToType;
- /*
- * Map to convert from file extension to MIME type
- */
- static std::map<std::string,
- std::string> &m_extensionToMime;
-
- /*
- * Recurrent search files trough whole tree exposed by file manager
- * \param node - node to start from
- * \exception - Filesystem related
- */
- void searchFiles(const DPL::SharedPtr<Api::Filesystem::INode> &node);
- /*
- * Gets free ID
- */
- unsigned long getFreeId();
-
- public:
- /*
- * Constructor of the gallery
- * \param name - the gallery name
- */
- Gallery(const std::string &name) :
- IGallery(),
- m_name(name),
- m_opened(false),
- m_lastId(0)
- {}
- /*
- * Destructor of the gallery
- */
- virtual ~Gallery()
- {}
-
- /*
- * Gets number of media items selected by current view
- * \exception Commons::PlatformWrongStateException when gallery not open
- * \return number of media items
- */
- virtual unsigned int getNumberOfItems() const;
- /*
- * Gets name of the gallery
- * \return name of the gallery
- */
- virtual std::string getName() const;
- /*
- * Opens the gallery
- * \exception Commons::PlatformWrongStateException when gallery is already
- * open
- */
- virtual void open();
- /* Gets the current state of the gallery
- * \return true if the gallery is open
- */
- virtual bool isOpen() const;
- /*
- * Closes the gallery
- * \exception Commons::PlatformWrongStateException when gallery is not open
- */
- virtual void close();
- /*
- * Refreshes files in the gallery
- * \exception Commons::PlatformWrongStateException when gallery is not open
- */
- virtual void refresh();
- /*
- * Changes current view with given properties
- * \param props - view properties
- * \exception Commons::PlatformWrongStateException when gallery is not open
- */
- virtual void changeView(const Api::Gallery::IViewProperties &props);
- /*
- * Gets media items selected by current view
- * \return set of media items
- * \exception Commons::PlatformWrongStateException when gallery is not open
- */
- virtual const Api::Gallery::IMediaItemsSetPtr getMediaItems() const;
- /*
- * Gets specified media item
- * \param id of wanted item
- * \return an media item
- * \exception Commons::PlatformWrongStateException when gallery is not open
- */
- virtual const Api::Gallery::IMediaItemPtr getMediaItemById(unsigned long id)
- const;
-};
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file GalleryRequestManager.cpp
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- */
-
-#include <commons/Exception.h>
-#include <API/Gallery/IGallery.h>
-#include "GalleryRequestManager.h"
-#include "Gallery.h"
-
-using namespace WrtPlugins::Commons;
-using namespace WrtPlugins::Api::Gallery;
-
-namespace WrtPlugins {
-namespace Platform {
-void GalleryRequestManager::OnRequestReceived(
- const IEventGetGalleriesPtr &event)
-{
- IGallerySetPtr galleries(new IGallerySet());
- galleries->push_back(IGalleryPtr(new Gallery("Device")));
- event->setGalleries(galleries);
- event->setResult(ExceptionCodes::None);
-}
-
-void GalleryRequestManager::OnRequestReceived(const IEventOpenPtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- gallery->open();
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-
-void GalleryRequestManager::OnRequestReceived(const IEventRefreshPtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- gallery->refresh();
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-
-void GalleryRequestManager::OnRequestReceived(const IEventClosePtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- gallery->close();
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-
-void GalleryRequestManager::OnRequestReceived(const IEventChangeViewPtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- gallery->changeView(event->getProperties());
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-
-void GalleryRequestManager::OnRequestReceived(
- const IEventGetMediaItemsPtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- IMediaItemsSetPtr mediaItems(gallery->getMediaItems());
- event->setMediaItems(mediaItems);
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-
-void GalleryRequestManager::OnRequestReceived(
- const IEventGetMediaItemByIdPtr &event)
-{
- Try
- {
- IGalleryPtr gallery(event->getGallery());
- IMediaItemPtr mediaItem(gallery->getMediaItemById(event->getId()));
- event->setMediaItem(mediaItem);
- event->setResult(ExceptionCodes::None);
- }
- Catch(Exception)
- {
- LogError("Gallery exception message: " <<
- _rethrown_exception.GetMessage() <<
- " Code: " << _rethrown_exception.getCode());
- event->setResult(_rethrown_exception.getCode());
- }
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file GalleryRequestManager.h
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- */
-
-#ifndef WRT_PLUGINS_GALLERYREQUESTMANAGER_H_
-#define WRT_PLUGINS_GALLERYREQUESTMANAGER_H_
-
-#include <API/Gallery/IGalleryRequestManager.h>
-
-namespace WrtPlugins {
-namespace Platform {
-class GalleryRequestManager : public Api::Gallery::IGalleryRequestManager
-{
- public:
-
- protected:
- virtual void OnRequestReceived(
- const Api::Gallery::IEventGetGalleriesPtr &event);
- virtual void OnRequestReceived(const Api::Gallery::IEventOpenPtr &event);
- virtual void OnRequestReceived(const Api::Gallery::IEventRefreshPtr &event);
- virtual void OnRequestReceived(const Api::Gallery::IEventClosePtr &event);
- virtual void OnRequestReceived(
- const Api::Gallery::IEventChangeViewPtr &event);
- virtual void OnRequestReceived(
- const Api::Gallery::IEventGetMediaItemsPtr &event);
- virtual void OnRequestReceived(
- const Api::Gallery::IEventGetMediaItemByIdPtr &event);
-};
-}
-}
-
-#endif //WRT_PLUGINS_GALLERYREQUESTMANAGER_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(libpcrecpp REQUIRED libpcrecpp)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_GALLERY
- ${CURRENT_PATH}/Gallery.cpp
- ${CURRENT_PATH}/GalleryRequestManager.cpp
- PARENT_SCOPE
-)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_GALLERY
- ${libpcrecpp_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_GALLERY
- ${libpcrecpp_LIBRARIES}
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- */
-
-#include "Geolocation.h"
-#include <cassert>
-#include <API/Geolocation/EventGetCurrentPosition.h>
-#include <commons/Exception.h>
-
-using namespace WrtPlugins::Api::Geolocation;
-using namespace DPL;
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Geolocation {
-namespace {
-static void positionChangedCallback(LocationObject *obj,
- guint type,
- gpointer data,
- gpointer accuracy,
- Geolocation* this_)
-{
- if (this_) {
- this_->positionHasChanged(obj, type, data, accuracy);
- } else {
- LogError("Callback private data is NULL.");
- }
-}
-} //private namespace
-
-Geolocation::Geolocation() :
- m_location(NULL),
- m_currentLocationMethod(METHOD_GPS),
- m_initialized(false)
-{
- LogDebug("Enter");
-}
-
-Geolocation::~Geolocation()
-{
- LogDebug("Enter");
- stop();
-}
-
-void Geolocation::getCurrentPosition(const EventGetCurrentPositionPtr& event)
-{
- initialize();
- EventRequestReceiver<EventGetCurrentPosition>::PostRequest(event);
-}
-
-void Geolocation::OnRequestReceived(const EventGetCurrentPositionPtr& event)
-{
- LogDebug("Entered");
- gint ret;
- LocationPosition* pos = NULL;
- LocationAccuracy* acc = NULL;
- ret = location_get_position(m_location, &pos, &acc);
- if (LOCATION_ERROR_NONE != ret) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) {
- location_position_free(pos);
- location_accuracy_free(acc);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- event->setTimestamp(static_cast<std::time_t>(pos->timestamp));
- event->setLatitude(static_cast<double>(pos->latitude));
- event->setLongitude(static_cast<double>(pos->longitude));
- event->setAltitude(static_cast<double>(pos->altitude));
- event->setAccuracy(static_cast<double>(acc->horizontal_accuracy));
- event->setAltitudeAccuracy(static_cast<double>(acc->vertical_accuracy));
- location_position_free(pos);
- location_accuracy_free(acc);
-
- LocationVelocity* velocity = NULL;
- ret = location_get_velocity(m_location, &velocity, &acc);
- if (LOCATION_ERROR_NONE != ret) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) {
- location_velocity_free(velocity);
- location_accuracy_free(acc);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- event->setSpeed(static_cast<double>(velocity->speed));
- event->setDirection(static_cast<double>(velocity->direction));
- event->setAltitudeSpeed(static_cast<double>(velocity->climb));
- event->setMethod(m_currentLocationMethod);
- location_velocity_free(velocity);
- location_accuracy_free(acc);
-}
-
-long Geolocation::watchPosition(const EventPositionChangedEmitterPtr& emitter,
- long timeout,
- long maximumAge,
- bool highAccuracy)
-{
- initialize();
- m_positionEmitters.attach(emitter);
- return static_cast<long>(emitter->getId());
-}
-
-void Geolocation::clearWatch(EventPositionChangedEmitter::IdType id)
-{
- m_positionEmitters.detach(id);
-}
-
-void Geolocation::positionHasChanged(LocationObject *obj,
- guint type,
- gpointer data,
- gpointer accuracy)
-{
- LogDebug("Enter");
- if (POSITION_UPDATED != type) {
- //nothing to do
- return;
- }
-
- //convert data from platform to API form
- LocationPosition *pos = static_cast<LocationPosition*>(data);
- LocationAccuracy *acc = static_cast<LocationAccuracy*>(accuracy);
- LocationVelocity* velocity = NULL;
-
- EventPositionChangedPtr event(new EventPositionChanged());
- PositionProperties props;
- props.altitude = static_cast<double>(pos->altitude);
- props.latitude = static_cast<double>(pos->latitude);
- props.longitude = static_cast<double>(pos->longitude);
- props.timestamp = static_cast<std::time_t>(pos->timestamp);
- props.accuracy = static_cast<double>(acc->horizontal_accuracy);
- props.altitudeAccuracy = static_cast<double>(acc->vertical_accuracy);
-
- gint ret = location_get_velocity(m_location, &velocity, &acc);
- if (LOCATION_ERROR_NONE != ret) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) {
- location_velocity_free(velocity);
- location_accuracy_free(acc);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- props.speed = static_cast<double>(velocity->speed);
- props.direction = static_cast<double>(velocity->direction);
- props.altitudeSpeed = static_cast<double>(velocity->climb);
- location_velocity_free(velocity);
- location_accuracy_free(acc);
-
- event->setPositionProperties(props);
- m_positionEmitters.emit(event);
-}
-
-void Geolocation::changeLocationMethod(ApiLocationMethod method)
-{
- LogDebug("Enter");
- if (method != m_currentLocationMethod) {
- m_currentLocationMethod = method;
- if (m_location) {
- restart();
- }
- }
-}
-
-void Geolocation::initialize()
-{
- LogDebug("ENTER");
- if (!m_initialized) {
- DPL::Mutex::ScopedLock lock(&m_initializationMutex);
- if (!m_initialized) {
- if (LOCATION_ERROR_NONE != location_init()) {
- ThrowMsg(Commons::PlatformException,
- "Couldn't init location module.");
- }
- m_initialized = true;
- start();
- }
- }
-}
-
-void Geolocation::restart()
-{
- stop();
- start();
-}
-
-void Geolocation::start()
-{
- LogDebug("ENTER");
- assert(m_initialized && "Geolocation has not been initialized.");
- if (m_location) {
- return;
- }
-
- //may return NULL
- m_location = location_new(convertMethodToPlatform(m_currentLocationMethod));
-
- if (NULL == m_location) {
- ThrowMsg(Commons::PlatformException,
- "Couldn't create new location object.");
- }
-
- if (LOCATION_ERROR_NONE != location_start(m_location)) {
- location_free(m_location);
- m_location = NULL;
- ThrowMsg(Commons::PlatformException, "Couldn't start localizing.");
- }
- m_signalId = g_signal_connect(m_location, "service-updated",
- G_CALLBACK(positionChangedCallback), this);
-}
-
-void Geolocation::stop()
-{
- LogDebug("ENTER");
- if (!m_initialized || !m_location) {
- return;
- }
-
- g_signal_handler_disconnect(m_location, m_signalId);
- if (LOCATION_ERROR_NONE != location_stop(m_location)) {
- ThrowMsg(Commons::PlatformException, "Couldn't stop location object.");
- }
- if (LOCATION_ERROR_NONE != location_free(m_location)) {
- ThrowMsg(Commons::PlatformException, "Couldn't free location module.");
- }
- m_location = NULL;
-}
-
-LocationMethod Geolocation::convertMethodToPlatform(ApiLocationMethod method)
-const
-{
- switch (method) {
- case METHOD_GPS:
- return LOCATION_METHOD_GPS;
- case METHOD_AGPS:
- return LOCATION_METHOD_HYBRID;
- case METHOD_CPS:
- return LOCATION_METHOD_CPS;
- case METHOD_IPS:
- return LOCATION_METHOD_IPS;
- case METHOD_WPS:
- return LOCATION_METHOD_WPS;
- case METHOD_BEST:
- return LOCATION_METHOD_HYBRID;
- }
- LogError("Unknown location method");
- return LOCATION_METHOD_HYBRID;
-}
-}
-}
-}
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * @author Wojciech Bielawski (w.bielawski@samsung.com)
- * @version 0.1
- * @brief
- */
-
-#ifndef WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_
-#define WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_
-
-#include <map>
-#include <API/Geolocation/IGeolocation.h>
-#include <API/Geolocation/GeolocationFactory.h>
-#include <API/Geolocation/EventPositionChanged.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/noncopyable.h>
-#include <location/location.h>
-#include <platform/commons/Emitters.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Geolocation {
-class Geolocation : public Api::Geolocation::IGeolocation
-{
- LocationObject *m_location;
- gulong m_signalId;
- Api::Geolocation::IGeolocation::ApiLocationMethod m_currentLocationMethod;
-
- friend class WrtPlugins::Api::Geolocation::GeolocationFactory;
-
- public:
- virtual ~Geolocation();
-
- /**
- * @See: IGelocation::getCurrentPosition
- */
- virtual void getCurrentPosition(
- const Api::Geolocation::EventGetCurrentPositionPtr& event);
-
- /**
- * @See: IGelocation::watchPosition
- */
- virtual long watchPosition(
- const Api::Geolocation::EventPositionChangedEmitterPtr& emitter,
- long timeout,
- long maximumAge,
- bool highAccuracy);
-
- /**
- * @See: IGelocation::clearWatch
- */
- virtual void clearWatch(
- Api::Geolocation::EventPositionChangedEmitter::IdType id);
-
- /**
- * @See: IGelocation::changeLocationMethod
- */
- virtual void changeLocationMethod(ApiLocationMethod method);
-
- /**
- * Method to run from platform's callback function
- */
- void positionHasChanged(LocationObject *obj,
- guint type,
- gpointer data,
- gpointer accuracy);
-
- protected:
- Geolocation();
- virtual void OnRequestReceived(
- const Api::Geolocation::EventGetCurrentPositionPtr& event);
-
- private:
- typedef Emitters<Api::Geolocation::EventPositionChangedEmitter>
- PositionChangedEmitters;
-
- void initialize();
- void start();
- void stop();
- void restart();
- LocationMethod convertMethodToPlatform(ApiLocationMethod method) const;
-
- PositionChangedEmitters m_positionEmitters;
- DPL::Mutex m_initializationMutex;
- bool m_initialized;
-};
-}
-}
-}
-
-#endif /* WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_ */
+++ /dev/null
-get_current_path()
-
-pkg_search_module(location REQUIRED location)
-pkg_search_module(glib REQUIRED glib-2.0)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_GEOLOCATION
- ${location_INCLUDE_DIRS}
- ${glib_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_GEOLOCATION
- ${location_LIBRARIES}
- ${glib_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_GEOLOCATION
- ${CURRENT_PATH}/Geolocation.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <fstream>
-#include <cassert>
-#include <pcrecpp.h>
-#include <commons/Exception.h>
-#include "Manager.h"
-
-namespace {
-const char* MEMINFO_FILE = "/proc/meminfo";
-const char* MEMORY_TOTAL_PATTERN = "^MemTotal:\\s+(\\d+)\\s*kB$";
-const char* MEMORY_FREE_PATTERN = "^MemFree:\\s+(\\d+)\\s*kB$";
-}
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Memory {
-Manager& Manager::getInstance()
-{
- static Manager instance;
- return instance;
-}
-
-unsigned long Manager::getTotal() const
-{
- return getMeminfoValue(MEMORY_TOTAL_PATTERN);
-}
-
-unsigned long Manager::getFree() const
-{
- return getMeminfoValue(MEMORY_FREE_PATTERN);
-}
-
-Manager::Manager()
-{}
-
-unsigned long Manager::getMeminfoValue(const char* pattern) const
-{
- assert(pattern && "Pattern not set.");
-
- std::ifstream file(MEMINFO_FILE);
- if (!file) {
- ThrowMsg(Commons::PlatformException, "Memory info file not found.");
- }
-
- unsigned long result = 0;
- bool matched = false;
- std::string line;
- while ((std::getline(file, line).rdstate() &
- (std::ifstream::failbit | std::ifstream::eofbit)) == 0)
- {
- if (pcrecpp::RE(pattern).FullMatch(line, &result)) {
- matched = true;
- break;
- }
- }
- file.close();
-
- if (!matched) {
- ThrowMsg(Commons::UnsupportedException, "Total memory data not found.");
- }
-
- return result;
-}
-} // Memory
-} // Platform
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef WRTDEVICEAPIS_MEMORY_MANAGER_H_
-#define WRTDEVICEAPIS_MEMORY_MANAGER_H_
-
-#include <API/Memory/IManager.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace Memory {
-class Manager : public Api::Memory::IManager
-{
- public:
- static Manager& getInstance();
-
- public:
- unsigned long getTotal() const;
- unsigned long getFree() const;
-
- private:
- Manager();
-
- /**
- * Reads value from meminfo file looking it up using specified regex
- * pattern.
- * Function matches each (whole!) line against specified pattern.
- * @param pattern Perl-like regular expresion used to search through
- * meminfo.
- * @return Found value.
- * @throw PlatformException If could not find meminfo file.
- * @throw UnsupportedException If pattern didn't match any line in meminfo
- * file.
- */
- unsigned long getMeminfoValue(const char* pattern) const;
-};
-} // Memory
-} // Platform
-} // WrtPlugins
-
-#endif /* WRTDEVICEAPIS_MEMORY_MANAGER_H_ */
+++ /dev/null
-get_current_path()
-
-pkg_search_module(pcrecpp REQUIRED libpcrecpp)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_MEMORY
- ${pcrecpp_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_MEMORY
- ${pcrecpp_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_MEMORY
- ${CURRENT_PATH}/Manager.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Date.h"
-#include <cstddef>
-#include <commons/Exception.h>
-
-namespace {
-const std::size_t MAX_BUFFER_SIZE = 80;
-} // anonymous
-
-namespace WrtPlugins {
-namespace Platform {
-namespace System {
-Api::System::IDate::Format Date::m_defualtFormat = "%c";
-
-Date::Date()
-{
- m_timestamp = time(NULL);
-}
-
-std::string Date::toString() const
-{
- return toString(m_defualtFormat);
-}
-
-std::string Date::toString(const Format& format) const
-{
- if (format.empty()) {
- ThrowMsg(Commons::PlatformException, "Format is not set.");
- }
-
- char buffer[MAX_BUFFER_SIZE] = { 0 };
- struct tm* tm = std::localtime(&m_timestamp);
- if (std::strftime(buffer, MAX_BUFFER_SIZE, format.c_str(), tm) == 0) {
- ThrowMsg(Commons::PlatformException, "Could not get date string.");
- }
-
- return buffer;
-}
-} // System
-} // Platform
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTDEVICEAPIS_SYSTEM_DATE_H_
-#define WRTDEVICEAPIS_SYSTEM_DATE_H_
-
-#include <ctime>
-#include <API/System/IDate.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace System {
-class Date : public Api::System::IDate
-{
- public:
- Date();
-
- /**
- * @see WrtPlugins::Api::System::IDate::toString()
- */
- std::string toString() const;
-
- /**
- * @see WrtPlugins::Api::System::IDate::toString()
- */
- std::string toString(const Format& format) const;
-
- protected:
- static Format m_defualtFormat; ///< Default format for to string conversion.
-
- protected:
- std::time_t m_timestamp; ///< Timestamp, number of seconds since UNIX epoch.
-};
-} // System
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_SYSTEM_DATE_H_
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "Environment.h"
-#include <stdlib.h>
-#include <sys/utsname.h>
-#include <stdio.h>
-#include <limits.h>
-extern "C" {
- #include <iniparser.h>
-}
-#include <pcrecpp.h>
-#include <sstream>
-#include <commons/Exception.h>
-
-namespace {
-const char* VARIABLE_LANGUAGE_NAME = "LANG";
-const char* VENDOR_NAME = "Samsung";
-const char* FILE_INFO_INI = "/etc/info.ini";
-const char* FILE_CPUINFO = "/proc/cpuinfo";
-const char* PATTERN_CPUINFO_HARDWARE = "^Hardware\\s*:\\s+(\\w+)\\s*$";
-} // anonymous
-
-namespace WrtPlugins {
-namespace Platform {
-namespace System {
-// TODO: Most of those values (if not any) doesn't have to be recalculated every
-// time someone request them. Optimalization could be introduced to do it
-// only once, e.g. on first request.
-
-Environment& Environment::getInstance()
-{
- static Environment instance;
- return instance;
-}
-
-std::string Environment::getLanguage() const
-{
- return getVariable(VARIABLE_LANGUAGE_NAME);
-}
-
-std::string Environment::getOsVersion() const
-{
- struct utsname buf;
- if (uname(&buf) != 0) {
- ThrowMsg(Commons::PlatformException, "Could not get uname data.");
- }
- return buf.sysname;
-}
-
-std::string Environment::getSoftwareVersion() const
-{
- dictionary* dict = iniparser_load(FILE_INFO_INI);
- if (dict == NULL) {
- ThrowMsg(Commons::PlatformException, "Could not get SW version.");
- }
- char* major =
- iniparser_getstring(dict, ("Version:Major"), const_cast<char*>(""));
-
- const char* minor =
- iniparser_getstring(dict, "Version:Minor", const_cast<char*>(""));
-
- std::stringstream ss;
- ss << major;
- if ((*major != '\0') && (*minor != '\0')) {
- ss << "-";
- }
- ss << minor;
- iniparser_freedict(dict);
-
- return ss.str();
-}
-
-std::string Environment::getHardwareName() const
-{
- FILE* file = fopen(FILE_CPUINFO, "r");
- if (file == NULL) {
- ThrowMsg(Commons::UnsupportedException, "Could not open cpuinfo file.");
- }
-
- std::string result;
- char line[LINE_MAX] = { 0 };
- pcrecpp::RE re(PATTERN_CPUINFO_HARDWARE);
- while (fgets(line, LINE_MAX, file) && !re.FullMatch(line, &result)) {}
- fclose(file);
-
- if (result.empty()) {
- ThrowMsg(Commons::UnsupportedException, "Hardware name not found.");
- }
-
- return result;
-}
-
-std::string Environment::getVendorName() const
-{
- return VENDOR_NAME;
-}
-
-std::string Environment::getVariable(const char* name)
-{
- char* value = getenv(name);
- if (value == NULL) {
- std::stringstream ss;
- ss << "Could not read variable " << name << ".";
- ThrowMsg(Commons::PlatformException, ss.str());
- }
- return value;
-}
-
-Environment::Environment()
-{}
-} // System
-} // Platform
-} // WrtPlugins
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- */
-
-#ifndef WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_
-#define WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_
-
-#include <API/System/IEnvironment.h>
-
-namespace WrtPlugins {
-namespace Platform {
-namespace System {
-class Environment : public Api::System::IEnvironment
-{
- public:
- static Environment& getInstance();
-
- public:
- /**
- * @see WrtPlugins::Api::System::IEnvironment::getLanguage()
- */
- std::string getLanguage() const;
-
- /**
- * @see WrtPlugins::Api::System::IEnvironment::getOsVersion()
- */
- std::string getOsVersion() const;
-
- /**
- * @see WrtPlugins::Api::System::IEnvironment::getSoftwareVersion()
- */
- std::string getSoftwareVersion() const;
-
- /**
- * @see WrtPlugins::Api::System::IEnvironment::getHardwareName()
- */
- std::string getHardwareName() const;
-
- /**
- * @see WrtPlugins::Api::System::IEnvironment::getVendorName()
- */
- std::string getVendorName() const;
-
- protected:
- /**
- * Gets value of specified environment variable.
- * @param name Name of the variable.
- * @return Value of the variable.
- * @throw PlatformException If specified variable doesn't exist.
- */
- static std::string getVariable(const char* name);
-
- protected:
- Environment();
-};
-} // System
-} // Platform
-} // WrtPlugins
-
-#endif // WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(iniparser REQUIRED iniparser)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_SYSTEM
- ${iniparser_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_SYSTEM
- ${iniparser_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_SYSTEM
- ${CURRENT_PATH}/Environment.cpp
- ${CURRENT_PATH}/Date.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogEntryWrapper.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.2
- */
-
-#include <string>
-#include <dpl/log/log.h>
-#include <pcrecpp.h>
-#include "LogEntryWrapper.h"
-#include "commons/Exception.h"
-
-using namespace WrtPlugins::Api;
-
-namespace WrtPlugins {
-namespace Platform {
-LogEntryWrapper::LogEntryWrapper(CTSvalue *log) :
- m_logEntry(new LogEntry())
-{
- LogDebug("entered");
- convertPlatformStructToAbstractStruct(log);
-}
-
-LogEntryWrapper::~LogEntryWrapper()
-{
- LogDebug("entered");
-}
-
-bool LogEntryWrapper::matchFilters(const LogFilterPtr &filter)
-{
- LogDebug("entered");
- if (!m_logEntry) {
- Throw(WrtPlugins::Commons::NullPointerException);
- }
- if (!filter) {
- return true;
- }
- if (filter->getIdIsSet() && filter->getIdFilter() != m_logEntry->getId()) {
- return false;
- }
- if (filter->getStartTimeIsSet() &&
- (filter->getStartTimeMinFilter() > m_logEntry->getStartTime() ||
- filter->getStartTimeMaxFilter() < m_logEntry->getStartTime()))
- {
- return false;
- }
- if (filter->getDurationIsSet() &&
- (filter->getDurationMinFilter() > m_logEntry->getDuration() ||
- filter->getDurationMaxFilter() < m_logEntry->getDuration()))
- {
- return false;
- }
- if (filter->getPhoneNumberIsSet() &&
- !pcrecpp::RE(filter->getPhoneNumberFilter()).FullMatch(m_logEntry->
- getPhoneNumber()))
- {
- return false;
- }
- if (filter->getDescriptionIsSet() &&
- !pcrecpp::RE(filter->getDescriptionFilter()).FullMatch(m_logEntry->
- getDescription()))
- {
- return false;
- }
- if (filter->getFolderIsSet() &&
- !filter->checkIfFolderIsSet(m_logEntry->getFolder()))
- {
- return false;
- } else if (m_logEntry->getFolder() == LogEntry::INVALID_FOLDER) {
- return false;
- }
- return true;
-}
-
-bool LogEntryWrapper::convertPlatformStructToAbstractStruct(CTSvalue *log)
-{
- LogDebug("entered");
- if (!m_logEntry) {
- return false;
- }
- if (!log) {
- return true;
- }
- const char *charVal =
- contacts_svc_value_get_str(log, CTS_LIST_PLOG_NUMBER_STR);
- if (charVal) {
- LogDebug("phone number " << charVal);
- m_logEntry->setPhoneNumber(charVal);
- }
- charVal = contacts_svc_value_get_str(log, CTS_LIST_PLOG_SHORTMSG_STR);
- if (charVal) {
- m_logEntry->setDescription(charVal);
- }
- m_logEntry->setDuration(
- contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT));
- LogDebug("id " <<
- contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT));
- m_logEntry->setStartTime(
- contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TIME_INT));
- m_logEntry->setId(
- contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT));
- LogDebug("id " << contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT));
- switch (contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TYPE_INT)) {
- case CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
- case CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
- case CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
- case CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
- m_logEntry->setFolder(LogEntry::MISSED_CALLS_FOLDER);
- break;
- case CTS_PLOG_TYPE_VIDEO_INCOMMING:
- case CTS_PLOG_TYPE_VOICE_INCOMMING:
- m_logEntry->setFolder(LogEntry::RECEIVED_CALLS_FOLDER);
- break;
- case CTS_PLOG_TYPE_VIDEO_OUTGOING:
- case CTS_PLOG_TYPE_VOICE_OUTGOING:
- m_logEntry->setFolder(LogEntry::INITIATED_CALLS_FOLDER);
- break;
- default:
- LogDebug("Invalid folder");
- m_logEntry->setFolder(LogEntry::INVALID_FOLDER);
- break;
- }
- return true;
-}
-
-Api::LogEntryPtr LogEntryWrapper::getAbstractCall() const
-{
- return m_logEntry;
-}
-}
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogEntryWrapper.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.2
- */
-
-#ifndef _SLP20_LOG_ENTRY_WRAPPER_H_
-#define _SLP20_LOG_ENTRY_WRAPPER_H_
-
-#include <dpl/shared_ptr.h>
-#include <contacts-svc.h>
-#include <API/Telephony/LogEntry.h>
-#include <API/Telephony/LogFilter.h>
-
-namespace WrtPlugins {
-namespace Platform {
-class LogEntryWrapper
-{
- public:
- explicit LogEntryWrapper(CTSvalue *log);
- virtual ~LogEntryWrapper();
- bool matchFilters(const Api::LogFilterPtr &filter);
- Api::LogEntryPtr getAbstractCall() const;
-
- private:
- Api::LogEntryPtr m_logEntry;
- bool convertPlatformStructToAbstractStruct(CTSvalue *log);
-};
-
-typedef DPL::SharedPtr<LogEntryWrapper> LogEntryWrapperPtr;
-}
-}
-
-#endif /* _SLP20_EVENT_WRAPPER_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogManager.cpp
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.2
- */
-
-#include <dpl/log/log.h>
-#include <contacts-svc.h>
-#include <vector>
-#include "LogManager.h"
-#include "LogEntryWrapper.h"
-
-using namespace WrtPlugins::Api;
-
-namespace WrtPlugins {
-namespace Platform {
-int LogManager::m_instanceCount = 0;
-
-LogManager::LogManager()
-{
- DPL::Mutex::ScopedLock mx(&m_constructorMutex);
- if (m_instanceCount == 0) {
- LogDebug("opening calllog DB");
- if (CTS_SUCCESS != contacts_svc_connect()) {
- LogError("database not opened");
- }
- }
- m_instanceCount++;
-}
-
-LogManager::~LogManager()
-{
- LogDebug("entered");
- DPL::Mutex::ScopedLock mx(&m_constructorMutex);
- m_instanceCount--;
- if (m_instanceCount == 0) {
- LogDebug("closing calllog DB");
- contacts_svc_disconnect();
- }
-}
-
-void LogManager::OnRequestReceived(const Api::IEventGetNumberOfLogsPtr &event)
-{
- LogDebug("entered");
- Try
- {
- int result = getNumberOfLogsInternal(event->getFilter());
- event->setNumberOfLogs(result);
- }
- Catch(Commons::Exception)
- {
- LogError("Error during searching logs");
- return;
- }
- event->setResult(true);
-}
-
-void LogManager::OnRequestReceived(const Api::IEventFindLogEntriesPtr &event)
-{
- LogDebug("entered");
- Try
- {
- std::vector<LogEntryPtr> result = findLogEntriesInternal(
- event->getFilter(), event->getFirstCall(), event->getLastCall());
- std::vector<LogEntryPtr>::const_iterator it;
- for (it = result.begin(); it != result.end(); it++) {
- event->addLog(*it);
- }
- }
- Catch(Commons::Exception)
- {
- LogError("Error during searching logs");
- return;
- }
- event->setResult(true);
-}
-
-void LogManager::OnRequestReceived(const Api::IEventDeleteLogEntryPtr &event)
-{
- LogDebug("entered");
- Try
- {
- if (!event->getFilter() || !event->getFilter()->getIdIsSet()) {
- return;
- }
- deleteLogEntryInternal(event->getFilter()->getIdFilter());
- }
- Catch(Commons::Exception)
- {
- LogError("Error during deleting log");
- return;
- }
- event->setResult(true);
-}
-
-void LogManager::OnRequestReceived(const Api::IEventClearLogPtr &event)
-{
- LogDebug("entered");
- Try
- {
- clearLogInternal(event->getFilter());
- }
- Catch(Commons::Exception)
- {
- LogError("Error during deleting logs");
- return;
- }
- event->setResult(true);
-}
-
-int LogManager::getNumberOfLogsInternal(const LogFilterPtr &filter)
-{
- LogDebug("entered");
- if (!filter) {
- LogWarning("filter is NULL");
- return 0;
- }
- int result = 0;
- CTSiter *iter = NULL;
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *log = contacts_svc_iter_get_info(iter);
- if (NULL == log) {
- LogError("funtion returned NULL value");
- continue;
- }
- LogEntryWrapperPtr wrapper(new LogEntryWrapper(log));
- if (wrapper->matchFilters(filter)) {
- result++;
- }
- contacts_svc_value_free(log);
- }
- contacts_svc_iter_remove(iter);
- return result;
-}
-
-std::vector<Api::LogEntryPtr> LogManager::findLogEntriesInternal(
- const LogFilterPtr &filter,
- const int minIndex,
- const int maxIndex)
-{
- LogDebug("entered");
- std::vector<LogEntryPtr> result;
- CTSiter *iter = NULL;
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *log = contacts_svc_iter_get_info(iter);
- if (NULL == log) {
- LogError("funtion returned NULL value");
- continue;
- }
- LogEntryWrapperPtr wrapper(new LogEntryWrapper(log));
- if (wrapper->matchFilters(filter)) {
- result.push_back(wrapper->getAbstractCall());
- }
- contacts_svc_value_free(log);
- }
- contacts_svc_iter_remove(iter);
- return result;
-}
-
-void LogManager::deleteLogEntryInternal(int id) const
-{
- LogDebug("entered");
- if (CTS_SUCCESS != contacts_svc_delete_phonelog(CTS_PLOG_DEL_BY_ID, id)) {
- ThrowMsg(Commons::PlatformException, "Cannot delete log");
- }
- return;
-}
-
-void LogManager::clearLogInternal(const LogFilterPtr &filter)
-{
- LogDebug("entered");
- CTSiter *iter = NULL;
- contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter);
- while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
- CTSvalue *log = contacts_svc_iter_get_info(iter);
- if (NULL == log) {
- LogError("funtion returned NULL value");
- continue;
- }
- LogEntryWrapperPtr wrapper(new LogEntryWrapper(log));
- if (wrapper->matchFilters(filter)) {
- deleteLogEntryInternal(wrapper->getAbstractCall()->getId());
- }
- contacts_svc_value_free(log);
- }
- contacts_svc_iter_remove(iter);
- return;
-}
-}
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * @file LogManager.h
- * @author Lukasz Marek (l.marek@samsung.com)
- * @version 0.2
- */
-
-#ifndef _SLP20__LOG_MANAGER_H_
-#define _SLP20__LOG_MANAGER_H_
-
-#include <vector>
-#include <dpl/mutex.h>
-#include <dpl/shared_ptr.h>
-#include <API/Telephony/ILogManager.h>
-#include <API/Telephony/LogEntry.h>
-#include <API/Telephony/LogFilter.h>
-#include <API/Telephony/IEventGetNumberOfLogs.h>
-#include <API/Telephony/IEventFindLogEntries.h>
-#include <API/Telephony/IEventDeleteLogEntry.h>
-#include <API/Telephony/IEventClearLogs.h>
-
-namespace WrtPlugins {
-namespace Platform {
-class LogManager : public Api::ILogManager
-{
- public:
- LogManager();
- virtual ~LogManager();
-
- protected:
- virtual void OnRequestReceived(
- const Api::IEventGetNumberOfLogsPtr &event);
- virtual void OnRequestReceived(
- const Api::IEventFindLogEntriesPtr &event);
- virtual void OnRequestReceived(
- const Api::IEventDeleteLogEntryPtr &event);
- virtual void OnRequestReceived(
- const Api::IEventClearLogPtr &event);
- int getNumberOfLogsInternal(
- const Api::LogFilterPtr &filter);
- std::vector<Api::LogEntryPtr> findLogEntriesInternal(
- const Api::LogFilterPtr &filter,
- const int minIndex = -1,
- const int maxIndex = -1);
- void deleteLogEntryInternal(int id) const;
- void clearLogInternal(
- const Api::LogFilterPtr &filter);
- static int m_instanceCount;
- DPL::Mutex m_constructorMutex;
-};
-
-typedef DPL::SharedPtr<LogManager> LogManagerPtr;
-}
-}
-
-#endif /* _SLP20__LOG_MANAGER_H_ */
+++ /dev/null
-get_current_path()
-
-pkg_search_module(contacts-service REQUIRED contacts-service)
-pkg_search_module(glib REQUIRED glib-2.0)
-pkg_search_module(libpcrecpp REQUIRED libpcrecpp)
-
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_TELEPHONY
- ${contacts-service_INCLUDE_DIRS}
- ${glib_INCLUDE_DIRS}
- ${libpcrecpp_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_TELEPHONY
- ${contacts-service_LIBRARIES}
- ${glib_LIBRARIES}
- ${libpcrecpp_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_TELEPHONY
- ${CURRENT_PATH}/LogManager.cpp
- ${CURRENT_PATH}/LogEntryWrapper.cpp
- PARENT_SCOPE
-)
+++ /dev/null
-get_current_path()
-
-set(SRCS_PLATFORM_IMPLEMENTATION_UI
-# ${CURRENT_PATH}/Camera.cpp
- PARENT_SCOPE
-)
)
SET_TARGET_PROPERTIES(${TARGET_PLUGINS_INSTALLER} PROPERTIES
- LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both -Wl"
+ LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both"
BUILD_WITH_INSTALL_RPATH ON
INSTALL_RPATH_USE_LINK_PATH ON
)
)
SET_TARGET_PROPERTIES(${TARGET_POPUP_WRT} PROPERTIES
- LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both -Wl"
+ LINK_FLAGS "-Wl,--as-needed -Wl,--hash-style=both"
BUILD_WITH_INSTALL_RPATH ON
INSTALL_RPATH_USE_LINK_PATH ON
)