configure_and_install_pkg(wrt-plugins-commons-javascript.pc)
configure_and_install_pkg(wrt-plugins-commons.pc)
configure_and_install_pkg(wrt-plugins-filesystem.pc)
-configure_and_install_pkg(wrt-plugins-cpu.pc)
configure_and_install_pkg(wrt-plugins-widget-interface-dao.pc)
configure_and_install_pkg(wrt-plugins-widgetdb.pc)
configure_and_install_pkg(wrt-plugins-plugin-manager.pc)
BuildRequires: pkgconfig(dpl-wrt-dao-rw)
BuildRequires: pkgconfig(dpl-db-efl)
BuildRequires: pkgconfig(libpcrecpp)
-BuildRequires: pkgconfig(mm-sound)
-BuildRequires: pkgconfig(mm-player)
BuildRequires: pkgconfig(icu-i18n)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(cert-svc-vcore)
+++ /dev/null
-prefix=/usr
-project_name=@CMAKE_PROJECT_NAME@
-exec_prefix=${prefix}
-libdir=${prefix}/lib
-includedir=${prefix}/include/${project_name}
-
-Name: WebRuntime DeviceApis Cpu module
-Description: WebRuntime Cpu module
-Version: @CMAKE_PROJECT_VERSION@
-Requires: dpl-efl wrt-plugins-commons
-Libs: -L${libdir} -lwrt-plugins-cpu
-Cflags: -I${includedir}/Cpu
+++ /dev/null
-prefix=/usr
-project_name=@CMAKE_PROJECT_NAME@
-exec_prefix=${prefix}
-libdir=${prefix}/lib
-includedir=${prefix}/include/${project_name}
-
-Name: WebRuntime DeviceApis MMPlayer module
-Description: WebRuntime MMPlayer module
-Version: @CMAKE_PROJECT_VERSION@
-Requires: dpl-efl wrt-plugins-commons
-Libs: -L${libdir} -lwrt-plugins-mmplayer
-Cflags: -I${includedir}/MMPlayer
case ThreadEnum::CONTACT_THREAD:
thandle = getThreadHandleCreateIfNotExists(ThreadEnum::CONTACT_THREAD);
break;
- case ThreadEnum::MMPLAYER_THREAD:
- thandle = getThreadHandleCreateIfNotExists(ThreadEnum::MMPLAYER_THREAD);
- break;
case ThreadEnum::BONDI_THREAD:
thandle = getThreadHandleCreateIfNotExists(ThreadEnum::BONDI_THREAD);
break;
APPCONFIG_THREAD,
GALLERY_THREAD,
CONTACT_THREAD,
- MMPLAYER_THREAD,
BONDI_THREAD,
GEOLOCATION_THREAD,
DEVICESTATUS_THREAD,
# limitations under the License.
#
include_config_file(Filesystem)
-include_config_file(Cpu)
include_config_file(Widget)
include_config_file(LocalStorage)
include_config_file(WidgetDB)
+++ /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 <Cpu/Manager.h>
-#include "IManager.h"
-
-namespace WrtDeviceApis {
-namespace Cpu {
-namespace Api {
-
-IManager& IManager::getInstance()
-{
- return Manager::getInstance();
-}
-
-IManager::~IManager()
-{
-}
-
-} // Cpu
-} // Api
-} // WrtDeviceApis
+++ /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_CPU_IMANAGER_H_
-#define WRTDEVICEAPIS_CPU_IMANAGER_H_
-
-#include <cstddef>
-#include <dpl/noncopyable.h>
-#include <Cpu/IUnit.h>
-
-namespace WrtDeviceApis {
-namespace Cpu {
-namespace Api {
-
-class IManager : private DPL::Noncopyable
-{
- public:
- static IManager& getInstance();
-
- public:
- virtual ~IManager() = 0;
-
- /**
- * Gets interface to CPU.
- * @param index Index of CPU to get (1-based).
- * @return Interface to CPU.
- * @throw PlatformException If platform error occurs.
- * @throw OutOfRangeException If index is greater than available CPUs.
- * @remarks On some platforms passing 0 as index may return unit object
- * that gives avarage data for all CPUs. If such interface is
- * not supported then NULL is returned.
- * @remarks Ownership is NOT passed to the caller.
- */
- virtual IUnit* getUnit(std::size_t index) const = 0;
-
- /**
- * Gets number of available CPUs.
- * @return Number of CPUs.
- */
- virtual std::size_t getUnitsCount() const = 0;
-};
-
-} // Api
-} // Cpu
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_CPU_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 "IUnit.h"
-
-namespace WrtDeviceApis {
-namespace Cpu {
-namespace Api {
-
-IUnit::~IUnit()
-{
-}
-
-} // Cpu
-} // Api
-} // WrtDeviceApis
+++ /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_CPU_IUNIT_H_
-#define WRTDEVICEAPIS_CPU_IUNIT_H_
-
-#include <dpl/shared_ptr.h>
-
-namespace WrtDeviceApis {
-namespace Cpu {
-namespace Api {
-
-class IUnit
-{
- public:
- virtual ~IUnit() = 0;
-
- /**
- * Gets processor utilization percent.
- * @return CPU utilization percent.
- */
- virtual unsigned int getUtilizationPercent() const = 0;
-};
-
-typedef DPL::SharedPtr<IUnit> IUnitPtr;
-
-} // Api
-} // Cpu
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_CPU_IUNIT_H_
+++ /dev/null
-get_current_path()
-
-set(API_CPU_PATH
- ${CURRENT_PATH}
- PARENT_SCOPE
-)
-
-set(SRCS_API_CPU
- ${CURRENT_PATH}/IManager.cpp
- ${CURRENT_PATH}/IUnit.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 WRTDEVICEAPIS_MMPLAYER_EVENT_GET_VOLUME_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_GET_VOLUME_H_
-
-#include <vector>
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventGetVolume : public Commons::IEvent<EventGetVolume>
-{
- private:
- /**
- * The volume is stored as a value in rage 0-10
- */
- int m_volume;
-
- public:
- /**
- * Getters and setters
- */
- int getVolume() const
- {
- return m_volume;
- }
- void setVolume(int volume)
- {
- m_volume = volume;
- }
-
- EventGetVolume()
- {
- }
-};
-
-typedef DPL::SharedPtr<EventGetVolume> EventGetVolumePtr;
-
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_GET_VOLUME_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 WRTDEVICEAPIS_MMPLAYER_EVENT_ISPLAYING_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_ISPLAYING_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventIsPlaying : public Commons::IEvent<EventIsPlaying>
-{
- private:
- IMMPlayerPtr m_player;
- bool m_isPlaying;
-
- public:
- /**
- * Getters and setters
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
- void setIsPlaying(bool isPlaying)
- {
- m_isPlaying = isPlaying;
- }
- bool getIsPlaying() const
- {
- return m_isPlaying;
- }
-
- explicit EventIsPlaying(const IMMPlayerPtr &player) :
- m_player(player),
- m_isPlaying(false)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventIsPlaying> EventIsPlayingPtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_ISPLAYING_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.
- */
-#ifndef WRTDEVICEAPIS_MMPLAYER_EVENT_ON_STATE_CHANGE_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_ON_STATE_CHANGE_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/ListenerEvent.h>
-#include <Commons/ListenerEventEmitter.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventOnStateChange : public Commons::ListenerEvent<EventOnStateChange>
-{
- public:
- typedef enum
- {
- BEGIN,
- OPENED,
- STOPPED,
- PLAYING,
- COMPLETED,
- PAUSED,
- RESUMED
- } PlayerStates;
- private:
- PlayerStates m_playerState;
-
- public:
- EventOnStateChange() : m_playerState(BEGIN)
- {
- }
- explicit EventOnStateChange(const PlayerStates state) : m_playerState(state)
- {
- }
- virtual ~EventOnStateChange()
- {
- }
-
- /**
- * Getters and setters
- */
- void setPlayerState(const PlayerStates state)
- {
- m_playerState = state;
- }
- PlayerStates getPlayerState() const
- {
- return m_playerState;
- }
-};
-
-typedef DPL::SharedPtr<EventOnStateChange> EventOnStateChangePtr;
-typedef Commons::ListenerEventEmitter<EventOnStateChange>
- EventOnStateChangeEmitter;
-typedef DPL::SharedPtr<EventOnStateChangeEmitter> EventOnStateChangeEmitterPtr;
-} //MMPlayer
-} //Api
-} //WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_ON_STATE_CHANGE_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 WRTDEVICEAPIS_MMPLAYER_EVENT_OPEN_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_OPEN_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventOpen : public Commons::IEvent<EventOpen>
-{
- private:
- IMMPlayerPtr m_player;
- std::string m_filename;
-
- public:
- /**
- * Getters
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
- std::string getFilename() const
- {
- return m_filename;
- }
-
- EventOpen(const IMMPlayerPtr &player,
- const std::string &filename) :
- m_player(player),
- m_filename(filename)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventOpen> EventOpenPtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_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 WRTDEVICEAPIS_MMPLAYER_EVENT_PAUSE_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_PAUSE_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventPause : public Commons::IEvent<EventPause>
-{
- private:
- IMMPlayerPtr m_player;
-
- public:
- /**
- * Getter
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
-
- explicit EventPause(const IMMPlayerPtr &player) : m_player(player)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventPause> EventPausePtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_PAUSE_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 WRTDEVICEAPIS_MMPLAYER_EVENT_PLAY_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_PLAY_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventPlay : public Commons::IEvent<EventPlay>
-{
- private:
- IMMPlayerPtr m_player;
- unsigned int m_repeatTimes;
-
- public:
- /**
- * Getters
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
- unsigned int getRepeatTimes() const
- {
- return m_repeatTimes;
- }
-
- explicit EventPlay(const IMMPlayerPtr &player,
- unsigned int repeatTimes) :
- m_player(player),
- m_repeatTimes(repeatTimes)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventPlay> EventPlayPtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_PLAY_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 WRTDEVICEAPIS_MMPLAYER_EVENT_RESUME_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_RESUME_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventResume : public Commons::IEvent<EventResume>
-{
- private:
- IMMPlayerPtr m_player;
-
- public:
- /**
- * Getter
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
-
- explicit EventResume(const IMMPlayerPtr &player) : m_player(player)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventResume> EventResumePtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_RESUME_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 WRTDEVICEAPIS_MMPLAYER_EVENT_SET_WINDOW_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_SET_WINDOW_H_
-
-#include <dpl/shared_ptr.h>
-#include <MMPlayer/IMMPlayer.h>
-#include <Commons/IEvent.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventSetWindow : public Commons::IEvent<EventSetWindow>
-{
- private:
- IMMPlayerPtr m_player;
- int m_posX;
- int m_posY;
- int m_width;
- int m_height;
-
- public:
- /**
- * Getter
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
-
- EventSetWindow(const IMMPlayerPtr &player,
- int posX,
- int posY,
- int width,
- int height) :
- m_player(player),
- m_posX(posX),
- m_posY(posY),
- m_width(width),
- m_height(height)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventSetWindow> EventSetWindowPtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_SET_WINDOW_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 WRTDEVICEAPIS_MMPLAYER_EVENT_STOP_H_
-#define WRTDEVICEAPIS_MMPLAYER_EVENT_STOP_H_
-
-#include <dpl/shared_ptr.h>
-#include <Commons/IEvent.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class EventStop : public Commons::IEvent<EventStop>
-{
- private:
- IMMPlayerPtr m_player;
-
- public:
- /**
- * Getter
- */
- IMMPlayerPtr getPlayer() const
- {
- return m_player;
- }
-
- explicit EventStop(const IMMPlayerPtr &player) : m_player(player)
- {
- }
-};
-
-typedef DPL::SharedPtr<EventStop> EventStopPtr;
-} // MMPlayer
-} // Api
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_MMPLAYER_EVENT_STOP_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.
- */
-#ifndef WRTDEVICEAPIS_MMPLAYER_IMMPlayer_H_
-#define WRTDEVICEAPIS_MMPLAYER_IMMPlayer_H_
-
-#include <dpl/noncopyable.h>
-#include <dpl/shared_ptr.h>
-#include <MMPlayer/EventOnStateChange.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class IMMPlayer : DPL::Noncopyable
-{
- public:
- virtual ~IMMPlayer()
- {
- }
-
- /**
- * Sets on player state change event emitter.
- * @param emitter On player state change event emitter.
- * @throw PlatformException If platform error occurs.
- */
- virtual void setEmitter(const EventOnStateChangeEmitterPtr& emitter) = 0;
-
- /**
- * Gets on player state change event emitter.
- * @throw PlatformException If platform error occurs.
- */
- virtual EventOnStateChangeEmitterPtr getEmitter() = 0;
-
- /**
- * Removes on state change event emitter.
- */
- virtual void clearEmitter() = 0;
-
- /**
- * Gets how many times opened file will be played since now
- */
- virtual unsigned int getRepeatTimes() const = 0;
-
- /**
- * Sets how many times opened file should be played
- */
- virtual void setRepeatTimes(unsigned int count) = 0;
-
- protected:
- IMMPlayer()
- {
- }
-};
-
-typedef DPL::SharedPtr<IMMPlayer> IMMPlayerPtr;
-}
-}
-}
-
-#endif // WRTDEVICEAPIS_MMPLAYER_IMMPlayer_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 <MMPlayer/Manager.h>
-#include <Commons/ThreadPool.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-using namespace Commons;
-
-IManager& IManager::getInstance()
-{
- static Manager instance;
- return instance;
-}
-
-IManager::IManager() :
- EventRequestReceiver<EventOpen>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventPlay>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventPause>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventResume>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventStop>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventIsPlaying>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventSetWindow>(ThreadEnum::MMPLAYER_THREAD),
- EventRequestReceiver<EventGetVolume>(ThreadEnum::MMPLAYER_THREAD)
-{
-}
-
-IManager::~IManager()
-{
-}
-
-}
-}
-}
+++ /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_MMPLAYER_IMANAGER_H_
-#define WRTDEVICEAPIS_MMPLAYER_IMANAGER_H_
-
-#include <dpl/noncopyable.h>
-#include <MMPlayer/EventOpen.h>
-#include <MMPlayer/EventPlay.h>
-#include <MMPlayer/EventPause.h>
-#include <MMPlayer/EventResume.h>
-#include <MMPlayer/EventStop.h>
-#include <MMPlayer/EventIsPlaying.h>
-#include <MMPlayer/EventSetWindow.h>
-#include <MMPlayer/EventGetVolume.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class IManager :
- public Commons::EventRequestReceiver<EventOpen>,
- public Commons::EventRequestReceiver<EventPlay>,
- public Commons::EventRequestReceiver<EventPause>,
- public Commons::EventRequestReceiver<EventResume>,
- public Commons::EventRequestReceiver<EventStop>,
- public Commons::EventRequestReceiver<EventIsPlaying>,
- public Commons::EventRequestReceiver<EventSetWindow>,
- public Commons::EventRequestReceiver<EventGetVolume>
-{
- public:
- static IManager &getInstance();
- virtual ~IManager();
-
- /**
- * Opens a file
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventOpen.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void openFile(const EventOpenPtr& event) = 0;
- /**
- * Plays current file. If file is already playing player starts from the beginning
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventPlay.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void play(const EventPlayPtr& event) = 0;
- /**
- * Pauses current playing file. If no file is currently playing noting happens
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventPause.
- * @exception Commons::PlatformException when platform error occurs
- * @exception Commons::InvalidArgumentException when fileName is empty
- */
- virtual void pause(const EventPausePtr& event) = 0;
- /**
- * Resumes after pause. If file is not paused nothing happens
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventResume.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void resume(const EventResumePtr& event) = 0;
- /**
- * Stops current playing file. If file is not playing nothing happens
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventStop.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void stop(const EventStopPtr& event) = 0;
- /**
- * Sets window for video files
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventSetWindow.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void setWindow(const EventSetWindowPtr& event) = 0;
- /**
- * Returns current playing state
- * @param event @see WrtDeviceApis::Api::MMPlayer::EventIsPlaying.
- * @return True if player is in playing state
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void isPlaying(const EventIsPlayingPtr& event) = 0;
- /**
- * Returns current playing state
- * @param [out] event @see WrtDeviceApis::Api::MMPlayer::EventIsPlaying.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void getVolume(const EventGetVolumePtr& event) = 0;
-
- protected:
- IManager();
-
- virtual void OnRequestReceived(const EventOpenPtr& event) = 0;
- virtual void OnRequestReceived(const EventPlayPtr& event) = 0;
- virtual void OnRequestReceived(const EventPausePtr& event) = 0;
- virtual void OnRequestReceived(const EventResumePtr& event) = 0;
- virtual void OnRequestReceived(const EventStopPtr& event) = 0;
- virtual void OnRequestReceived(const EventIsPlayingPtr& event) = 0;
- virtual void OnRequestReceived(const EventSetWindowPtr& event) = 0;
- virtual void OnRequestReceived(const EventGetVolumePtr& event) = 0;
-};
-}
-}
-}
-
-#endif // WRTDEVICEAPIS_MMPLAYER_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 "MMPlayerFactory.h"
-#include "IMMPlayer.h"
-#include <MMPlayer/MMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-IMMPlayerPtr MMPlayerFactory::getNewPlayer()
-{
- return IMMPlayerPtr(new MMPlayer());
-}
-
-MMPlayerFactory& MMPlayerFactory::getInstance()
-{
- static MMPlayerFactory theInstance;
- return theInstance;
-}
-
-MMPlayerFactory::MMPlayerFactory()
-{
-}
-
-}
-}
-}
+++ /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_MMPLAYER_MMPLAYERFACTORY_H_
-#define WRTDEVICEAPIS_MMPLAYER_MMPLAYERFACTORY_H_
-
-#include <dpl/noncopyable.h>
-#include <MMPlayer/IMMPlayer.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-namespace Api {
-
-class MMPlayerFactory : DPL::Noncopyable
-{
- public:
- IMMPlayerPtr getNewPlayer();
- static MMPlayerFactory& getInstance();
-
- protected:
- MMPlayerFactory();
-};
-
-}
-}
-}
-
-#endif // WRTDEVICEAPIS_MMPLAYER_MMPLAYERFACTORY_H_
+++ /dev/null
-get_current_path()
-
-set(API_MMPLAYER_PATH
- ${CURRENT_PATH}
- PARENT_SCOPE
-)
-
-set(SRCS_API_MMPLAYER
- ${CURRENT_PATH}/MMPlayerFactory.cpp
- ${CURRENT_PATH}/IManager.cpp
- PARENT_SCOPE
-)
#
set(TARGET_MODULE_FILESYSTEM "wrt-plugins-filesystem")
-set(TARGET_MODULE_CAMERA "wrt-plugins-camera")
-set(TARGET_MODULE_CALENDAR "wrt-plugins-calendar")
-set(TARGET_MODULE_MESSAGING "wrt-plugins-messaging")
-set(TARGET_MODULE_HAPTICS "wrt-plugins-haptics")
-set(TARGET_MODULE_CONTACT "wrt-plugins-contact")
-set(TARGET_MODULE_CPU "wrt-plugins-cpu")
-set(TARGET_MODULE_ACCELEROMETER "wrt-plugins-accelerometer")
set(TARGET_MODULE_WIDGET "wrt-plugins-widget")
-set(TARGET_MODULE_TASK "wrt-plugins-task")
-set(TARGET_MODULE_ORIENTATION "wrt-plugins-orientation")
-set(TARGET_MODULE_RADIO "wrt-plugins-radio")
-set(TARGET_MODULE_POWER "wrt-plugins-power")
-set(TARGET_MODULE_PROFILE "wrt-plugins-profile")
-set(TARGET_MODULE_SYSTEMINFO "wrt-plugins-systeminfo")
set(TARGET_MODULE_LOCALSTORAGE "wrt-plugins-localstorage")
set(TARGET_MODULE_WIDGET_INTERFACE_DAO "wrt-plugins-widget-interface-dao")
set(TARGET_MODULE_STORAGEEVENT "wrt-plugins-storageevent")
set(TARGET_MODULE_PLUGIN_MANAGER "wrt-plugins-plugin-manager")
add_subdirectory(Filesystem)
-add_subdirectory(Cpu)
add_subdirectory(Widget)
add_subdirectory(LocalStorage)
add_subdirectory(WidgetInterfaceDAO)
+++ /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.
-#
-macro(install_header_file HEADER_FILE)
- INSTALL(FILES ${API_CPU_PATH}/${HEADER_FILE}
- DESTINATION ${DESTINATION_HEADER_PREFIX}/Cpu)
-endmacro()
-
-set(TARGET_NAME ${TARGET_MODULE_CPU})
-
-include_directories(
- ${INCLUDES_PLATFORM_IMPLEMENTATION_CPU}
-)
-
-set(SRCS
- ${SRCS_API_CPU}
- ${SRCS_PLATFORM_IMPLEMENTATION_CPU}
-)
-
-add_library(${TARGET_NAME} SHARED ${SRCS})
-target_link_libraries(${TARGET_NAME}
- ${LIBS_COMMONS}
- ${TARGET_COMMONS}
- ${LIBS_PLATFORM_IMPLEMENTATION_CPU}
-)
-set_target_properties(${TARGET_NAME} PROPERTIES
- SOVERSION ${CMAKE_PROJECT_API_VERSION}
- VERSION ${CMAKE_PROJECT_VERSION}
-)
-
-INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION
- ${DESTINATION_LIB_PREFIX})
-
-install_header_file(IManager.h)
-install_header_file(IUnit.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.
-#
-macro(install_header_file HEADER_FILE)
- INSTALL(FILES ${API_MMPLAYER_PATH}/${HEADER_FILE}
- DESTINATION ${DESTINATION_HEADER_PREFIX}/MMPlayer)
-endmacro()
-
-set(TARGET_NAME ${TARGET_MODULE_MMPLAYER})
-
-include_directories(
- ${INCLUDES_PLATFORM_IMPLEMENTATION_MMPLAYER}
-)
-
-set(SRCS
- ${SRCS_API_MMPLAYER}
- ${SRCS_PLATFORM_IMPLEMENTATION_MMPLAYER}
-)
-
-add_library(${TARGET_NAME} SHARED ${SRCS})
-target_link_libraries(${TARGET_NAME}
- ${LIBS_COMMONS}
- ${TARGET_COMMONS}
- ${LIBS_PLATFORM_IMPLEMENTATION_MMPLAYER}
-)
-set_target_properties(${TARGET_NAME} PROPERTIES
- SOVERSION ${CMAKE_PROJECT_API_VERSION}
- VERSION ${CMAKE_PROJECT_VERSION}
-)
-
-INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION
- ${DESTINATION_LIB_PREFIX})
-
-install_header_file(EventGetVolume.h)
-install_header_file(EventIsPlaying.h)
-install_header_file(EventOnStateChange.h)
-install_header_file(EventOpen.h)
-install_header_file(EventPause.h)
-install_header_file(EventPlay.h)
-install_header_file(EventResume.h)
-install_header_file(EventSetWindow.h)
-install_header_file(EventStop.h)
-install_header_file(IManager.h)
-install_header_file(IMMPlayer.h)
-install_header_file(MMPlayerFactory.h)
################################################################################
include_config_file(Filesystem)
-include_config_file(Cpu)
include_config_file(Widget)
include_config_file(LocalStorage)
include_config_file(WidgetInterfaceDAO)
add_subdirectory(WidgetInterfaceDAO)
include_config_file(WidgetDB)
include_config_file(PluginManager)
-#DEPRACATED MODULES
-#include_config_file(Networking)
-#include_config_file(Geolocation)
-#include_config_file(FeatureLoader)
-#include_config_file(Camera-Webkit)
-##include_config_file(Telephony)
-#include_config_file(Display)
-#include_config_file(Gallery)
-##include_config_file(AppLauncher)
-#include_config_file(Device)
-#include_config_file(Memory)
-#include_config_file(PhoneBook)
-#include_config_file(UI)
-#include_config_file(System)
+++ /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 std::size_t NUMBER_OF_AVAILABLE_CPUS = 1;
-}
-
-namespace WrtDeviceApis {
-namespace Cpu {
-
-Manager& Manager::getInstance()
-{
- static Manager instance;
- return instance;
-}
-
-Api::IUnit* Manager::getUnit(std::size_t index) const
-{
- if (index > NUMBER_OF_AVAILABLE_CPUS) {
- Throw(Commons::OutOfRangeException);
- }
-
- Units::const_iterator it = m_units.find(index);
- if (it != m_units.end()) {
- return it->second;
- }
- return (m_units[index] = new Unit(index));
-}
-
-std::size_t Manager::getUnitsCount() const
-{
- return NUMBER_OF_AVAILABLE_CPUS;
-}
-
-Manager::Manager()
-{
-}
-
-} // Cpu
-} // WrtDeviceApis
+++ /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_CPU_MANAGER_H_
-#define WRTDEVICEAPIS_CPU_MANAGER_H_
-
-#include <cstddef>
-#include <map>
-#include <Cpu/IManager.h>
-#include "Unit.h"
-
-namespace WrtDeviceApis {
-namespace Cpu {
-
-class Manager : public Api::IManager
-{
- public:
- static Manager& getInstance();
-
- public:
- Api::IUnit* getUnit(std::size_t index) const;
- std::size_t getUnitsCount() const;
-
- private:
- typedef std::map<std::size_t, Api::IUnit*> Units;
-
- private:
- Manager();
-
- private:
- mutable Units m_units;
-};
-
-} // Cpu
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_CPU_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 <unistd.h>
-#include <stdio.h>
-#include <fstream>
-#include <sstream>
-#include <pcrecpp.h>
-#include <Commons/Exception.h>
-#include "Unit.h"
-
-namespace {
-const unsigned int GET_STATS_TIMEOUT = 1; // in seconds
-const char* STAT_FILE = "/proc/stat";
-const char* CPU_PATTERN_PREFIX = "^cpu";
-const char* CPU_PATTERN_POSTFIX = "\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)";
-}
-
-namespace WrtDeviceApis {
-namespace Cpu {
-
-Unit::Unit(std::size_t index) : m_index(index)
-{
- std::ostringstream oss(CPU_PATTERN_PREFIX);
- if (m_index > 0) {
- oss << m_index - 1;
- }
- oss << CPU_PATTERN_POSTFIX;
- m_utilizationPattern = oss.str();
-}
-
-unsigned int Unit::getUtilizationPercent() const
-{
- UtilizationStats usage0 = getUtilization();
- sleep(GET_STATS_TIMEOUT);
- UtilizationStats usage1 = getUtilization();
-
- unsigned sum0 = usage0.m_user + usage0.m_nice + usage0.m_system +
- usage0.m_idle;
- unsigned sum1 = usage1.m_user + usage1.m_nice + usage1.m_system +
- usage1.m_idle;
-
- unsigned percent =
- (100 -
- ((usage1.m_idle -
- usage0.m_idle) / (double) (sum1 - sum0)) * 100);
-
- return percent;
-}
-
-Unit::UtilizationStats Unit::getUtilization() const
-{
- std::ifstream file(STAT_FILE);
- if (!file) {
- ThrowMsg(Commons::UnsupportedException,
- "Could not open statistics file.");
- }
-
- UtilizationStats result;
- memset(&result, 0, sizeof(UtilizationStats));
- bool matched = false;
- std::string line;
- while (!file.eof() && !!std::getline(file, line)) {
- if (pcrecpp::RE(m_utilizationPattern.c_str()).FullMatch(
- line,
- &result.m_user,
- &result.m_nice,
- &result.m_system,
- &result.m_idle))
- {
- matched = true;
- break;
- }
- }
- file.close();
-
- if (!matched) {
- ThrowMsg(Commons::UnsupportedException, "Total memory data not found.");
- }
-
- return result;
-}
-
-} // Cpu
-} // WrtDeviceApis
+++ /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_CPU_UNIT_H_
-#define WRTDEVICEAPIS_CPU_UNIT_H_
-
-#include <string>
-#include <Cpu/IUnit.h>
-
-namespace WrtDeviceApis {
-namespace Cpu {
-
-class Manager;
-
-class Unit : public Api::IUnit
-{
- friend class Manager;
-
- public:
- unsigned int getUtilizationPercent() const;
-
- private:
- /**
- * Stores processor utilization statistics.
- */
- struct UtilizationStats
- {
- unsigned int m_user;
- unsigned int m_nice;
- unsigned int m_system;
- unsigned int m_idle;
- };
-
- private:
- explicit Unit(std::size_t index);
-
- /**
- * Gets processor utilization statistics.
- * @return Processor utilization statistics.
- * @throw UnsupportedException If data could not be retrieved.
- */
- UtilizationStats getUtilization() const;
-
- private:
- std::size_t m_index; ///< Index of CPU interface to represent.
-
- /**
- * Regex pattern used to get processor utilization statistics from
- * stat file.
- */
- std::string m_utilizationPattern;
-};
-
-} // Cpu
-} // WrtDeviceApis
-
-#endif // WRTDEVICEAPIS_CPU_UNIT_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(pcrecpp REQUIRED libpcrecpp)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_CPU
- ${pcrecpp_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_CPU
- ${pcrecpp_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_CPU
- ${CURRENT_PATH}/Manager.cpp
- ${CURRENT_PATH}/Unit.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 "MMPlayer.h"
-#include <mmf/mm.h>
-#include <mm_player.h>
-#include <dpl/log/log.h>
-#include <Commons/Exception.h>
-
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-
-using namespace Api;
-
-MMPlayer::MMPlayer() :
- Commons::EventListener<EventOnEOS>(Commons::ThreadEnum::NULL_THREAD),
- m_player(0),
- m_currentState(STATE_UNDEFINED),
- m_repeatTimes(0)
-{
- Try {
- init();
- } Catch(Commons::Exception) {
- LogError("Unknown exception while constructing MMPlayer");
- }
-}
-
-MMPlayer::~MMPlayer()
-{
- LogInfo("Enter");
- finalize();
-}
-
-MMHandleType MMPlayer::getHandler() const
-{
- return m_player;
-}
-
-void MMPlayer::setEmitter(const EventOnStateChangeEmitterPtr& emitter)
-{
- LogDebug("Enter");
- DPL::Mutex::ScopedLock lock(&m_emitterMtx);
- m_onStateChangeEmitter = emitter;
-}
-
-EventOnStateChangeEmitterPtr MMPlayer::getEmitter()
-{
- DPL::Mutex::ScopedLock lock(&m_emitterMtx);
- return m_onStateChangeEmitter;
-}
-
-void MMPlayer::clearEmitter()
-{
- LogDebug("Enter");
- DPL::Mutex::ScopedLock lock(&m_emitterMtx);
- m_onStateChangeEmitter.Reset();
-}
-
-int MMPlayer::onStateChange(int message,
- void *param,
- void* data)
-{
- LogInfo("Enter");
- static DPL::Mutex playerMtx;
- MMPlayer *this_ = static_cast<MMPlayer*>(data);
- if (this_) {
- EventOnStateChangePtr event(new EventOnStateChange());
- { //Separated block to avoid deadlock when this_->m_emitterMtx will be locked
- DPL::Mutex::ScopedLock lock(&playerMtx);
- switch (message) {
- case MM_MESSAGE_ERROR:
- {
- MMMessageParamType* type =
- static_cast<MMMessageParamType*>(param);
- if (type && (MM_MSG_UNION_CODE == type->union_type)) {
- LogError(
- "Error from platform, code: " << std::hex <<
- type->code);
- }
- event->setPlayerState(EventOnStateChange::BEGIN);
- break;
- }
-
- case MM_MESSAGE_BEGIN_OF_STREAM:
- LogInfo("Begin of stream");
- event->setPlayerState(EventOnStateChange::PLAYING);
- break;
-
- case MM_MESSAGE_END_OF_STREAM:
- LogInfo("End of stream");
- event->setPlayerState(EventOnStateChange::COMPLETED);
-
- // mm_player_stop should be executed outside the callback
- {
- EventOnEOSPtr eventEOS(new EventOnEOS());
- if (this_->m_onEOSEmitter) {
- this_->m_onEOSEmitter->emit(eventEOS);
- } else {
- LogError("EOS emitter not set");
- }
- }
- break;
-
- case MM_MESSAGE_STATE_INTERRUPTED:
- // since platform reports always param->union_type == 0, only what can be done is to use field code
- // and pray it won't be changed right before demo
- {
- MMMessageParamType* type =
- static_cast<MMMessageParamType*>(param);
- LogInfo("Player callback message: " << std::hex << message);
- if (type && (MM_MSG_UNION_CODE == type->union_type)) {
- LogError("Code: " << std::hex << type->code);
- if (MM_PLAYER_STATE_PAUSED == type->code) {
- LogInfo("Sending pause event");
- event->setPlayerState(EventOnStateChange::PAUSED);
- } else {
- return 0;
- }
- }
- }
- break;
-
- default:
- LogInfo("Player callback message: " << std::hex << message);
- MMMessageParamType* type =
- static_cast<MMMessageParamType*>(param);
- if (type && (MM_MSG_UNION_CODE == type->union_type)) {
- LogInfo("Code: " << type->code);
- }
- return 0;
- }
- }
-
- DPL::Mutex::ScopedLock lock(&this_->m_emitterMtx);
- if (this_->m_onStateChangeEmitter) {
- this_->m_onStateChangeEmitter->emit(event);
- }
- return 0;
- }
- return -1;
-}
-
-void MMPlayer::init()
-{
- LogDebug("Enter");
- int err = mm_player_create(&m_player);
- if (MM_ERROR_NONE != err || !m_player) {
- LogError("Can't create player");
- Throw(Commons::PlatformException);
- }
-
- err = mm_player_set_message_callback(m_player,
- MMPlayer::onStateChange,
- this);
- if (MM_ERROR_NONE != err) {
- LogDebug("Can't set player's callback. Error code: " << std::hex << err);
- mm_player_destroy(m_player);
- ThrowMsg(Commons::PlatformException, "Can't set player's callback.");
- }
- //Set emmiter for EOS event
- m_onEOSEmitter.Reset(new EventOnEOSEmitter());
- m_onEOSEmitter->setListener(this);
-}
-
-void MMPlayer::finalize()
-{
- LogDebug("Enter");
- //if the music is playing, stop music.
- if (MM_PLAYER_STATE_PLAYING == getState()) {
- LogInfo("Sending stop request");
- int err = mm_player_stop(m_player);
- if (MM_ERROR_NONE != err) {
- LogError("Can't stop player. Error code: " << std::hex << err);
- }
- }
-
- int err = mm_player_set_message_callback(m_player, NULL, NULL);
- if (MM_ERROR_NONE != err) {
- LogDebug("Can't set player's callback. Error code: " << std::hex << err);
- }
- err = mm_player_destroy(m_player);
- if (MM_ERROR_NONE != err) {
- LogError(
- "There were some problems during player destruction. Error code: "
- << std::hex << err);
- }
-}
-
-MMPlayerStateType MMPlayer::getState() const
-{
- MMPlayerStateType state;
- int err = mm_player_get_state(m_player, &state);
- if (MM_ERROR_NONE != err) {
- LogError("Can't get player status. Error code: " << std::hex << err);
- ThrowMsg(Commons::PlatformException, "Can't get player status.");
- }
- LogInfo("Current player state: " << static_cast<int>(state));
- return state;
-}
-
-void MMPlayer::onAnswerReceived(const EventOnEOSPtr& /*event*/)
-{
- LogInfo("Enter");
- int err = mm_player_stop(m_player);
- if (MM_ERROR_NONE != err) {
- LogError("Can't stop player. Error code: " << std::hex << err);
- }
- LogInfo("Repeat " << m_repeatTimes << " more time" <<
- ((m_repeatTimes == 1) ? "" : "s"));
- if (m_repeatTimes > 0) {
- --m_repeatTimes;
- int err = mm_player_start(m_player);
- if (MM_ERROR_NONE != err) {
- LogError("Can't start play. Error code: " << std::hex << err);
- }
- }
-}
-
-unsigned int MMPlayer::getRepeatTimes() const
-{
- return m_repeatTimes;
-}
-
-void MMPlayer::setRepeatTimes(unsigned int count)
-{
- m_repeatTimes = count;
-}
-
-}
-}
+++ /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_MMPLAYER_MMPLAYER_H_
-#define WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_
-
-#include <mmf/mm.h>
-#include <mm_player.h>
-#include <dpl/shared_ptr.h>
-#include <dpl/mutex.h>
-#include <MMPlayer/IMMPlayer.h>
-#include <MMPlayer/MMPlayerFactory.h>
-#include <MMPlayer/EventOnStateChange.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-/**
- * Event to send from callback when end of stream will be reported -> mm_player_stop should be executed
- */
-class EventOnEOS : public Commons::ListenerEvent<EventOnEOS>
-{
-};
-
-typedef DPL::SharedPtr<EventOnEOS> EventOnEOSPtr;
-typedef Commons::ListenerEventEmitter<EventOnEOS> EventOnEOSEmitter;
-typedef DPL::SharedPtr<EventOnEOSEmitter> EventOnEOSEmitterPtr;
-
-class MMPlayer :
- public Api::IMMPlayer,
- public Commons::EventListener<EventOnEOS>
-{
- friend class Api::MMPlayerFactory;
-
- public:
- typedef enum
- {
- STATE_OPENED,
- STATE_STOPPED,
- STATE_PLAYING,
- STATE_PAUSED,
- STATE_COMPLETED,
- STATE_UNDEFINED
- } MMPLAYER_STATES;
-
- private:
- MMHandleType m_player;
- MMPLAYER_STATES m_currentState;
- unsigned int m_repeatTimes;
-
- /**
- * MMPlayer constructor
- * \exception Commons::PlatformException when platform error occurs
- */
- explicit MMPlayer();
-
- public:
- /**
- * MMPlayer destructor
- */
- virtual ~MMPlayer();
-
- /**
- * Gets handler to platform player type
- */
- virtual MMHandleType getHandler() const;
-
- /**
- * @See Api::MMPlayer::IMMPlayer::setEmitter
- */
- virtual void setEmitter(
- const Api::EventOnStateChangeEmitterPtr& emitter);
- /**
- * @See Api::MMPlayer::IMMPlayer::getEmitter
- */
- Api::EventOnStateChangeEmitterPtr getEmitter();
- /**
- * @See Api::MMPlayer::IMMPlayer::clearEmitter
- */
- virtual void clearEmitter();
-
- /**
- * Gets player state
- */
- virtual MMPlayerStateType getState() const;
-
- /**
- * Used to recieve EventOnEOS
- */
- virtual void onAnswerReceived(const EventOnEOSPtr& event);
-
- virtual unsigned int getRepeatTimes() const;
-
- virtual void setRepeatTimes(unsigned int count);
-
- private:
- /**
- * Callback method called by platform when player state changes.
- * @param message Platform message
- * @param param Platform parameter
- * @param data User data.
- */
- static int onStateChange(int message,
- void* param,
- void* data);
-
- /**
- * Initialize player
- * @throw Commons::PlatformException when platform error occures
- */
- void init();
- /**
- * Finalize player
- */
- void finalize();
-
- DPL::Mutex m_emitterMtx;
- Api::EventOnStateChangeEmitterPtr m_onStateChangeEmitter;
- EventOnEOSEmitterPtr m_onEOSEmitter;
-};
-
-typedef DPL::SharedPtr<MMPlayer> MMPlayerPtr;
-
-}
-}
-
-#endif // WRTDEVICEAPIS_MMPLAYER_MMPLAYER_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 "Manager.h"
-#include <mmf/mm.h>
-#include <mm_sound.h>
-#include <mm_player.h>
-#include <WidgetDB/WidgetDBMgr.h>
-#include <Commons/WrtAccess/WrtAccess.h>
-#include <MMPlayer/EventOnStateChange.h>
-#include "MMPlayer.h"
-
-using namespace std;
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-
-using namespace Api;
-
-Manager::Manager()
-{
-}
-
-Manager::~Manager()
-{
-}
-
-void Manager::openFile(const EventOpenPtr& event)
-{
- EventRequestReceiver<EventOpen>::PostRequest(event);
-}
-
-void Manager::play(const EventPlayPtr& event)
-{
- EventRequestReceiver<EventPlay>::PostRequest(event);
-}
-
-void Manager::pause(const EventPausePtr& event)
-{
- EventRequestReceiver<EventPause>::PostRequest(event);
-}
-
-void Manager::resume(const EventResumePtr& event)
-{
- EventRequestReceiver<EventResume>::PostRequest(event);
-}
-
-void Manager::stop(const EventStopPtr& event)
-{
- EventRequestReceiver<EventStop>::PostRequest(event);
-}
-
-void Manager::setWindow(const EventSetWindowPtr& event)
-{
- EventRequestReceiver<EventSetWindow>::PostRequest(event);
-}
-
-void Manager::isPlaying(const EventIsPlayingPtr& event)
-{
- EventRequestReceiver<EventIsPlaying>::PostRequest(event);
-}
-
-void Manager::getVolume(const EventGetVolumePtr& event)
-{
- EventRequestReceiver<EventGetVolume>::PostRequest(event);
-}
-
-void Manager::OnRequestReceived(const EventOpenPtr& event)
-{
- LogDebug("Entered");
-
- string fullName = event->getFilename();
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
-
- int err;
- if (MM_PLAYER_STATE_NULL != player->getState()) {
- err = mm_player_unrealize(player->getHandler());
- if (MM_ERROR_NONE != err) {
- LogError("Can't unrealize player. Error code: " << std::hex << err);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- }
-
- if (!fullName.length()) {
- event->setExceptionCode(
- Commons::ExceptionCodes::InvalidArgumentException);
- return;
- }
-
- //Check if current installation path should be added
- if ((fullName[0] != '/') && (fullName.find("://") == string::npos)) {
- try {
- using namespace WrtDeviceApis::Commons;
- std::string installationPath;
- int widgetId = WrtAccessSingleton::Instance().getWidgetId();
-
- WidgetDB::Api::IWidgetDBPtr widgetDB =
- WidgetDB::Api::getWidgetDB(widgetId);
- installationPath = widgetDB->getConfigValue(
- WidgetDB::Api::ConfigAttribute::INSTALL_PATH);
-
- LogInfo("Config attribute: " << installationPath);
- fullName.insert(0, installationPath);
- } catch (const Commons::Exception &ex) {
- LogError("Obtaining config info failed");
- event->setExceptionCode(ex.getCode());
- return;
- }
- }
-
- LogDebug("Opening file: " << fullName);
- char *errorBuffer = NULL;
- err = mm_player_set_attribute(
- player->getHandler(), &errorBuffer, "profile_uri",
- fullName.c_str(), fullName.length(), NULL);
- if (MM_ERROR_NONE != err) {
- LogError(
- "Setting attribute error. Code: " << std::hex << err <<
- ". Message: " << errorBuffer);
- free(errorBuffer);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
-
- err = mm_player_realize(player->getHandler());
- if (MM_ERROR_NONE != err) {
- LogError("Can't realize player. Error code:" << std::hex << err);
- if (static_cast<int>(MM_ERROR_PLAYER_INVALID_URI) == err) {
- LogDebug("x");
- event->setExceptionCode(
- Commons::ExceptionCodes::InvalidArgumentException);
- } else {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- return;
- }
-
- if (player->getEmitter()) {
- EventOnStateChangePtr eventStateChanged(new EventOnStateChange(
- EventOnStateChange::OPENED));
- player->getEmitter()->emit(eventStateChanged);
- }
-}
-
-void Manager::OnRequestReceived(const EventPlayPtr& event)
-{
- LogDebug("Entered");
-
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
-
- //Check if player currently plays media
- if (MM_PLAYER_STATE_PLAYING == player->getState() || 0 ==
- event->getRepeatTimes()) {
- LogDebug("already playing");
- return;
- }
- player->setRepeatTimes(event->getRepeatTimes() - 1);
-
- int err = mm_player_start(player->getHandler());
- if (MM_ERROR_NONE != err) {
- LogError("Can't start play. Error code: " << std::hex << err);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- //Event onStateChange will be emitted trough platform callback
-}
-
-void Manager::OnRequestReceived(const EventPausePtr& event)
-{
- LogDebug("Entered");
-
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- if (MM_PLAYER_STATE_PLAYING != player->getState()) {
- return;
- }
-
- int err = mm_player_pause(player->getHandler());
- if (MM_ERROR_NONE != err) {
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- if (player->getEmitter()) {
- EventOnStateChangePtr eventStateChanged(new EventOnStateChange(
- EventOnStateChange::PAUSED));
- player->getEmitter()->emit(eventStateChanged);
- }
-}
-
-void Manager::OnRequestReceived(const EventResumePtr& event)
-{
- LogDebug("Entered");
-
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- if (MM_PLAYER_STATE_PAUSED != player->getState()) {
- return;
- }
-
- int err = mm_player_resume(player->getHandler());
- if (MM_ERROR_NONE != err) {
- LogError("Can't resume player. Error code: " << std::hex << err);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
- if (player->getEmitter()) {
- EventOnStateChangePtr eventStateChanged(new EventOnStateChange(
- EventOnStateChange::RESUMED));
- player->getEmitter()->emit(eventStateChanged);
- }
-}
-
-void Manager::OnRequestReceived(const EventStopPtr& event)
-{
- LogDebug("Entered");
-
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- if (MM_PLAYER_STATE_PLAYING != player->getState() &&
- MM_PLAYER_STATE_PAUSED != player->getState()) {
- return;
- }
-
- int err = mm_player_stop(player->getHandler());
- if (MM_ERROR_NONE != err) {
- LogError("Can't stop player. Error code: " << std::hex << err);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- }
-
- if (player->getEmitter()) {
- EventOnStateChangePtr eventStateChanged(new EventOnStateChange(
- EventOnStateChange::STOPPED));
- player->getEmitter()->emit(eventStateChanged);
- }
-}
-
-void Manager::OnRequestReceived(const EventSetWindowPtr& /*event*/)
-{
- LogDebug("Entered");
- LogError("Not implemented");
- //TODO: set display parameter, when xID will be available
-}
-
-void Manager::OnRequestReceived(const EventIsPlayingPtr& event)
-{
- LogDebug("Entered");
-
- MMPlayerPtr player = DPL::DynamicPointerCast<MMPlayer>(event->getPlayer());
- Try
- {
- if (!player) {
- LogError("MMPlayerPtr cast error");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- event->setIsPlaying(MM_PLAYER_STATE_PLAYING == player->getState());
- }
- Catch(Commons::PlatformException)
- {
- LogError("Can't get player status.");
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
-}
-
-void Manager::OnRequestReceived(const EventGetVolumePtr& event)
-{
- LogDebug("Entered");
- unsigned int volume = 0;
- int steps = 0;
-
- int err = mm_sound_volume_get_step(VOLUME_TYPE_MEDIA, &steps);
- if (MM_ERROR_NONE != err) {
- LogError(
- "Can't get volume steps count. Error code: " << std::hex <<
- err);
- event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
- return;
- }
- LogInfo("Volume steps count: " << steps);
- try
- {
- err = mm_sound_volume_get_value(VOLUME_TYPE_MEDIA, &volume);
- if (MM_ERROR_NONE != err) {
- LogError(
- "Can't get player's volume. Error code: " << std::hex <<
- err);
- Throw(Commons::UnknownException);
- }
- LogInfo("Platform player's volume: " << volume);
- if (steps > 1) {
- event->setVolume((10.0 * volume) / (steps - 1));
- } else {
- LogError("no steps defined");
- event->setVolume(0);
- }
- }
- catch (const Commons::UnknownException &ex)
- {
- LogError("Can't scale the volume");
- 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.
- */
-#ifndef WRTDEVICEAPIS_MMPLAYER_MANAGER_H_
-#define WRTDEVICEAPIS_MMPLAYER_MANAGER_H_
-
-#include <MMPlayer/IManager.h>
-
-namespace WrtDeviceApis {
-namespace MMPlayer {
-
-class Manager : public Api::IManager
-{
- public:
- Manager();
- virtual ~Manager();
-
- /**
- * Opens a file
- * @param event @see WrtDeviceApis::Api::EventOpen.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void openFile(const Api::EventOpenPtr& event);
- /**
- * Plays current file. If file is already playing player starts from the beginning
- * @param event @see WrtDeviceApis::Api::EventPlay.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void play(const Api::EventPlayPtr& event);
- /**
- * Pauses current playing file. If no file is currently playing noting happens
- * @param event @see WrtDeviceApis::Api::EventPause.
- * @exception Commons::PlatformException when platform error occurs
- * @exception Commons::InvalidArgumentException when fileName is empty
- */
- virtual void pause(const Api::EventPausePtr& event);
- /**
- * Resumes after pause. If file is not paused nothing happens
- * @param event @see WrtDeviceApis::Api::EventResume.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void resume(const Api::EventResumePtr& event);
- /**
- * Stops current playing file. If file is not playing nothing happens
- * @param event @see WrtDeviceApis::Api::EventStop.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void stop(const Api::EventStopPtr& event);
- /**
- * Sets window for video files
- * @param event @see WrtDeviceApis::Api::EventSetWindow.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void setWindow(const Api::EventSetWindowPtr& event);
- /**
- * Returns current playing state
- * @param event @see WrtDeviceApis::Api::EventIsPlaying.
- * @return True if player is in playing state
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void isPlaying(const Api::EventIsPlayingPtr& event);
- /**
- * Returns current playing state
- * @param [out] event @see WrtDeviceApis::Api::EventIsPlaying.
- * @exception Commons::PlatformException when platform error occurs
- */
- virtual void getVolume(const Api::EventGetVolumePtr& event);
-
- protected:
- virtual void OnRequestReceived(const Api::EventOpenPtr& event);
- virtual void OnRequestReceived(const Api::EventPlayPtr& event);
- virtual void OnRequestReceived(const Api::EventPausePtr& event);
- virtual void OnRequestReceived(const Api::EventResumePtr& event);
- virtual void OnRequestReceived(const Api::EventStopPtr& event);
- virtual void OnRequestReceived(const Api::EventSetWindowPtr& event);
- virtual void OnRequestReceived(const Api::EventIsPlayingPtr& event);
- virtual void OnRequestReceived(const Api::EventGetVolumePtr& event);
-};
-
-}
-}
-
-#endif // WRTDEVICEAPIS_MMPLAYER_MANAGER_H_
+++ /dev/null
-get_current_path()
-
-pkg_search_module(mmsound REQUIRED mm-sound)
-pkg_search_module(mmplayer REQUIRED mm-player)
-pkg_search_module(libpcrecpp REQUIRED libpcrecpp)
-
-set(INCLUDES_PLATFORM_IMPLEMENTATION_MMPLAYER
- ${mmplayer_INCLUDE_DIRS}
- ${mmsound_INCLUDE_DIRS}
- ${libpcrecpp_INCLUDE_DIRS}
- PARENT_SCOPE
-)
-
-set(LIBS_PLATFORM_IMPLEMENTATION_MMPLAYER
- ${mmplayer_LIBRARIES}
- ${mmsound_LIBRARIES}
- ${libpcrecpp_LIBRARIES}
- PARENT_SCOPE
-)
-
-set(SRCS_PLATFORM_IMPLEMENTATION_MMPLAYER
- ${CURRENT_PATH}/Manager.cpp
- ${CURRENT_PATH}/MMPlayer.cpp
- PARENT_SCOPE
-)
{
return Handle.Get();
}
-
-bool PluginModel::operator< (const PluginModel& obj) const
-{
- return obj.Handle.Get() < Handle.Get();
-}
public:
PluginModel(const WrtDB::DbPluginHandle& handle);
- bool operator< (const PluginModel& obj) const;
-
private:
WrtDB::DbPluginHandle getHandle() const;
};
}
}
-
-void WindowPropertySupport::setBundleToNavigatorProperty(const char* bundle)
-{
- LogInfo("set window.navigator.__bundle: " << bundle);
-
- if(bundle)
- {
- m_bundle = bundle;
-
- JSStringRef bundleString = JSStringCreateWithUTF8CString(bundle);
-
- setPropertyToNavigator(BUNDLE_PROPERTY_NAME,
- JSValueMakeString(m_context, bundleString));
-
- JSStringRelease(bundleString);
- }
-}
-
void WindowPropertySupport::setThemeToNavigatorProperty(const char* theme)
{
LogInfo("set window.navigator.__theme: " << theme);
void setScaleToNavigatorProperty(const double scale);
void setBundleToWindowProperty(const char* bundle);
- void setBundleToNavigatorProperty(const char* bundle);
void setThemeToNavigatorProperty(const char* theme);
explicit WindowPropertySupport(JSGlobalContextRef m_context);
#include <string>
#include <dpl/wrt-dao-ro/feature_dao_read_only.h>
-//#include <plugin_model.h>
using namespace WrtDB;