static void ewkGeolocationPositionChangedCallback(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
{
+ if(!timestamp)
+ return;
+
WKRetainPtr<WKGeolocationPositionRef> position(AdoptWK, WKGeolocationPositionCreate(timestamp, latitude, longitude, 0.0f));
WKGeolocationManagerProviderDidChangePosition(static_cast<WKGeolocationManagerRef>(user_data), position.get());
}
void ewkGeolocationDeleteGeolocation(Ewk_Geolocation* ewkGeolocation)
{
+ if (ewkGeolocation->started)
+ ewkGeolocationStopLocationManager(ewkGeolocation);
+
delete ewkGeolocation;
}
bool ewkGeolocationStartLocationManager(WKGeolocationManagerRef geolocationManager, Ewk_Geolocation* ewkGeolocation)
{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ewkGeolocation, false);
+
location_error_e ret = static_cast<location_error_e>(location_manager_create(LOCATIONS_METHOD_HYBRID, &ewkGeolocation->locationManager));
if (ret != LOCATIONS_ERROR_NONE)
return false;
void ewkGeolocationStopLocationManager(Ewk_Geolocation* ewkGeolocation)
{
+ EINA_SAFETY_ON_NULL_RETURN(ewkGeolocation);
+
if (!ewkGeolocation->started)
return;
ret = static_cast<location_error_e>(location_manager_destroy(ewkGeolocation->locationManager));
if (ret != LOCATIONS_ERROR_NONE)
return;
+
+ ewkGeolocation->started = false;
}
#endif