Changeset 117378 in webkit
- Timestamp:
- May 16, 2012 7:09:16 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r117327 r117378 1 2012-05-16 Kihong Kwon <kihong.kwon@samsung.com> 2 3 [EFL] Support for Battery Status API on the WebKit-Efl 4 https://bugs.webkit.org/show_bug.cgi?id=83254 5 6 Reviewed by Chang Shu. 7 8 Add dependency check for e_ukit package which is in the e_dbus library. 9 10 * Source/cmake/FindEFL.cmake: 11 1 12 2012-05-16 Varun Jain <varunjain@google.com> 2 13 -
trunk/Source/WebKit/ChangeLog
r117046 r117378 1 2012-05-16 Kihong Kwon <kihong.kwon@samsung.com> 2 3 [EFL] Support for Battery Status API on the WebKit-Efl 4 https://bugs.webkit.org/show_bug.cgi?id=83254 5 6 Reviewed by Chang Shu. 7 8 Add e_ukit library and include directory to get battery status of device. 9 10 * PlatformEfl.cmake: 11 1 12 2012-05-15 Tomasz Morawski <t.morawski@samsung.com> 2 13 -
trunk/Source/WebKit/PlatformEfl.cmake
r117046 r117378 20 20 ${EFLDEPS_INCLUDE_DIRS} 21 21 ${EVAS_INCLUDE_DIRS} 22 ${EUKIT_INCLUDE_DIRS} 22 23 ${LIBXML2_INCLUDE_DIR} 23 24 ${LIBXSLT_INCLUDE_DIR} … … 125 126 ${ECORE_X_LIBRARIES} 126 127 ${EFLDEPS_LIBRARIES} 128 ${EUKIT_LIBRARIES} 127 129 ${FREETYPE_LIBRARIES} 128 130 ${LIBXML2_LIBRARIES} -
trunk/Source/WebKit/efl/ChangeLog
r117285 r117378 1 2012-05-16 Kihong Kwon <kihong.kwon@samsung.com> 2 3 [EFL] Support for Battery Status API on the WebKit-Efl 4 https://bugs.webkit.org/show_bug.cgi?id=83254 5 6 Reviewed by Chang Shu. 7 8 The set of e_dbus libraries, e_ukit library in particular, enables to support all types of battery status events (e.g., charging, chargingTime, dischargingTime, level). 9 10 * WebCoreSupport/BatteryClientEfl.cpp: 11 (WebCore::BatteryClientEfl::BatteryClientEfl): 12 (WebCore::BatteryClientEfl::startUpdating): 13 (WebCore::BatteryClientEfl::stopUpdating): 14 (WebCore::BatteryClientEfl::setBatteryStatus): 15 (WebCore): 16 (WebCore::BatteryClientEfl::timerFired): 17 (WebCore::BatteryClientEfl::getBatteryStatus): 18 (WebCore::BatteryClientEfl::setBatteryClient): 19 * WebCoreSupport/BatteryClientEfl.h: 20 (WebCore::BatteryClientEfl::batteryStatus): 21 (BatteryClientEfl): 22 1 23 2012-05-16 Thiago Marcos P. Santos <thiago.santos@intel.com> 2 24 -
trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp
r110991 r117378 24 24 25 25 #include "BatteryController.h" 26 #include "EventNames.h" 27 #include <limits> 26 28 27 29 namespace WebCore { … … 29 31 BatteryClientEfl::BatteryClientEfl() 30 32 : m_controller(0) 33 , m_timer(this, &BatteryClientEfl::timerFired) 34 , m_batteryStatusRefreshInterval(1.0) 31 35 { 32 36 } … … 39 43 void BatteryClientEfl::startUpdating() 40 44 { 41 // FIXME: Need to implement for getting battery status to the efl port. 45 if (m_timer.isActive()) 46 return; 47 48 if (!e_dbus_init()) 49 return; 50 51 if (!e_ukit_init()) { 52 e_dbus_shutdown(); 53 return; 54 } 55 56 m_timer.startRepeating(m_batteryStatusRefreshInterval); 42 57 } 43 58 44 59 void BatteryClientEfl::stopUpdating() 45 60 { 46 // FIXME: Need to implement for getting battery status to the efl port 61 m_timer.stop(); 62 e_ukit_shutdown(); 63 e_dbus_shutdown(); 47 64 } 48 65 … … 54 71 void BatteryClientEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus) 55 72 { 56 m_controller->didChangeBatteryStatus(eventType, batteryStatus); 73 m_batteryStatus = batteryStatus; 74 m_controller->didChangeBatteryStatus(eventType, m_batteryStatus); 75 } 76 77 void BatteryClientEfl::timerFired(Timer<BatteryClientEfl>* timer) 78 { 79 ASSERT_UNUSED(timer, timer == &m_timer); 80 E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); 81 if (edbusConnection) 82 e_upower_get_all_devices(edbusConnection, getBatteryStatus, static_cast<void*>(this)); 83 } 84 85 void BatteryClientEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError) 86 { 87 E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData); 88 if (!eukitDeviceNames || !eukitDeviceNames->strings || dbus_error_is_set(dBusError)) { 89 dbus_error_free(dBusError); 90 return; 91 } 92 93 E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); 94 Eina_List* list; 95 void* deviceName; 96 EINA_LIST_FOREACH(eukitDeviceNames->strings, list, deviceName) 97 e_upower_get_all_properties(edbusConnection, static_cast<char*>(deviceName), setBatteryClient, data); 98 } 99 100 void BatteryClientEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError) 101 { 102 E_Ukit_Get_All_Properties_Return* eukitPropertyNames = static_cast<E_Ukit_Get_All_Properties_Return*>(replyData); 103 104 if (!eukitPropertyNames || dbus_error_is_set(dBusError)) { 105 dbus_error_free(dBusError); 106 return; 107 } 108 109 if (!eukitPropertyNames->properties) 110 return; 111 112 E_Ukit_Property* property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Type")); 113 if (!property || property->val.u != E_UPOWER_SOURCE_BATTERY) 114 return; 115 116 BatteryClientEfl* client = static_cast<BatteryClientEfl*>(data); 117 BatteryStatus* clientBatteryStatus = client->batteryStatus(); 118 bool charging = false; 119 bool chargingChanged = false; 120 static unsigned chargingState = 0; 121 122 property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "State")); 123 if (!property) 124 return; 125 if (!clientBatteryStatus || chargingState != property->val.u) { 126 chargingChanged = true; 127 chargingState = property->val.u; 128 (chargingState == E_UPOWER_STATE_FULL || chargingState == E_UPOWER_STATE_CHARGING) ? charging = true : charging = false; 129 } else 130 charging = clientBatteryStatus->charging(); 131 132 bool chargingTimeChanged = false; 133 bool dischargingTimeChanged = false; 134 double chargingTime = std::numeric_limits<double>::infinity(); 135 double dischargingTime = std::numeric_limits<double>::infinity(); 136 137 if (charging) { 138 if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != std::numeric_limits<double>::infinity()) 139 dischargingTimeChanged = true; 140 dischargingTime = std::numeric_limits<double>::infinity(); 141 property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToFull")); 142 if (!property) 143 return; 144 if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != property->val.x) 145 chargingTimeChanged = true; 146 chargingTime = property->val.x; 147 } else { 148 if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != std::numeric_limits<double>::infinity()) 149 chargingTimeChanged = true; 150 chargingTime = std::numeric_limits<double>::infinity(); 151 property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToEmpty")); 152 if (!property) 153 return; 154 if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != property->val.x) 155 dischargingTimeChanged = true; 156 dischargingTime = property->val.x; 157 } 158 159 double level = 0; 160 bool levelChanged = false; 161 162 property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Percentage")); 163 if (!property) 164 return; 165 if (!clientBatteryStatus || clientBatteryStatus->level() != property->val.d) 166 levelChanged = true; 167 level = property->val.d; 168 169 WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(charging, chargingTime, dischargingTime, level); 170 if (chargingChanged) 171 client->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus); 172 if (chargingTimeChanged) 173 client->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus); 174 if (dischargingTimeChanged) 175 client->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus); 176 if (levelChanged) 177 client->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus); 57 178 } 58 179 -
trunk/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h
r110991 r117378 24 24 25 25 #include "BatteryClient.h" 26 #include "BatteryStatus.h" 27 #include "Timer.h" 28 #include <E_Ukit.h> 26 29 #include <wtf/text/AtomicString.h> 27 30 … … 42 45 43 46 void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>); 47 BatteryStatus* batteryStatus() { return m_batteryStatus.get(); } 44 48 45 49 private: 50 void timerFired(Timer<BatteryClientEfl>*); 51 static void getBatteryStatus(void* data, void* replyData, DBusError*); 52 static void setBatteryClient(void* data, void* replyData, DBusError*); 53 46 54 BatteryController* m_controller; 55 Timer<BatteryClientEfl> m_timer; 56 RefPtr<BatteryStatus> m_batteryStatus; 57 const double m_batteryStatusRefreshInterval; 47 58 }; 48 59 -
trunk/Source/cmake/FindEFL.cmake
r107747 r117378 10 10 ecore-file>=1.0.0 11 11 ecore-evas>=1.0.999.59763 12 edje>=1.0.0) 12 edje>=1.0.0 13 eukit>=1.1.0) 13 14 PKG_CHECK_MODULES (EINA REQUIRED eina>=1.0.0) 14 15 PKG_CHECK_MODULES (ECORE_X ecore-x>=1.0.0) 15 16 PKG_CHECK_MODULES (EVAS REQUIRED evas>=1.0.0) 17 PKG_CHECK_MODULES (EUKIT REQUIRED eukit>=1.1.0) 16 18 17 19 FIND_PROGRAM (EDJE_CC_EXECUTABLE edje_cc) -
trunk/Tools/ChangeLog
r117298 r117378 1 2012-05-16 Kihong Kwon <kihong.kwon@samsung.com> 2 3 [EFL] Support for Battery Status API on the WebKit-Efl 4 https://bugs.webkit.org/show_bug.cgi?id=83254 5 6 Reviewed by Chang Shu. 7 8 Add e_dbus libraries to jhbuild's modules list. 9 10 * efl/jhbuild.modules: 11 1 12 2012-05-16 Christophe Dumez <christophe.dumez@intel.com> 2 13 -
trunk/Tools/efl/jhbuild.modules
r116776 r117378 14 14 <dep package="libsoup"/> 15 15 <dep package="edje"/> 16 <dep package="e_dbus"/> 16 17 </dependencies> 17 18 </metamodule> … … 208 209 </autotools> 209 210 211 <autotools id="e_dbus"> 212 <branch module="e_dbus" 213 repo="enlightenment.org" 214 revision="68629"/> 215 <dependencies> 216 <dep package="ecore"/> 217 <dep package="eina"/> 218 </dependencies> 219 </autotools> 220 210 221 </moduleset>
Note: See TracChangeset
for help on using the changeset viewer.