2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef WRTPLUGINS_API_SYSTEMINFO_EVENT_WATCH_SYSTEMINFO_H_
19 #define WRTPLUGINS_API_SYSTEMINFO_EVENT_WATCH_SYSTEMINFO_H_
23 #include <dpl/shared_ptr.h>
24 #include <dpl/noncopyable.h>
25 #include <Commons/IEvent.h>
26 #include <JavaScriptCore/JavaScript.h>
27 #include <CommonsJavaScript/JSCallbackManager.h>
28 #include "ISysteminfo.h"
31 namespace Systeminfo {
32 class EventWatchSysteminfo;
34 struct BatteryPropertyValue {
39 struct CpuPropertyValue {
43 struct StoragePropertyValue {
44 unsigned long long capacity;
45 unsigned long long availableCapacity;
49 struct PropertyValue {
50 BatteryPropertyValue batterInfo;
51 CpuPropertyValue cpuInfo;
52 StoragePropertyValue storageInfo[2];
55 class EventWatchSysteminfo : public WrtDeviceApis::Commons::IEvent<EventWatchSysteminfo>
58 static DPL::Atomic m_uniqId;
60 BasePropertyPtr m_BaseProperty;
61 WatchOption m_WatchOption;
64 Ecore_Timer *m_initTimer;
71 PropertyValue m_propertyValue;
75 EventWatchSysteminfo();
76 ~EventWatchSysteminfo();
78 void setWatchOption(const WatchOption& watchoption);
79 WatchOption getWatchOption();
80 WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr getCallbackManager();
81 BasePropertyPtr getBasePropertyPtr();
82 void setSysteminfoPtr(void* SysteminfoPtr);
83 void setBasePropertyPtr(const BasePropertyPtr& baseProperty);
84 const char * getProperty() const;
85 const int getWatchType() const;
86 void getWatchValue(int cnt = 1);
89 void processGetValue();
96 typedef DPL::SharedPtr<EventWatchSysteminfo> EventWatchSysteminfoPtr;