| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Holger Hans Peter Freyther | 2 * Copyright (C) 2008 Holger Hans Peter Freyther |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 setError(PositionError::POSITION_UNAVAILABLE, "Position could not be det
ermined."); | 172 setError(PositionError::POSITION_UNAVAILABLE, "Position could not be det
ermined."); |
| 173 return; | 173 return; |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 } | 177 } |
| 178 | 178 |
| 179 void GeolocationServiceGtk::updatePosition() | 179 void GeolocationServiceGtk::updatePosition() |
| 180 { | 180 { |
| 181 m_lastError = 0; | 181 m_lastError = 0; |
| 182 m_lastPosition = Geoposition::create(m_latitude, m_longitude, m_altitude, | 182 |
| 183 m_accuracy, m_altitudeAccuracy, 0.0, | 183 RefPtr<Coordinates> coordinates = Coordinates::create(m_latitude, m_longitud
e, |
| 184 0.0, m_timestamp*1000.0); | 184 m_altitude, m_accuracy
, |
| 185 m_altitudeAccuracy, 0.
0, 0.0); |
| 186 m_lastPosition = Geoposition::create(coordinates.release(), m_timestamp * 10
00.0); |
| 185 positionChanged(); | 187 positionChanged(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 void GeolocationServiceGtk::position_changed(GeocluePosition*, GeocluePositionFi
elds fields, int timestamp, double latitude, double longitude, double altitude,
GeoclueAccuracy* accuracy, GeolocationServiceGtk* that) | 190 void GeolocationServiceGtk::position_changed(GeocluePosition*, GeocluePositionFi
elds fields, int timestamp, double latitude, double longitude, double altitude,
GeoclueAccuracy* accuracy, GeolocationServiceGtk* that) |
| 189 { | 191 { |
| 190 if (!(fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION
_FIELDS_LONGITUDE)) { | 192 if (!(fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION
_FIELDS_LONGITUDE)) { |
| 191 that->setError(PositionError::POSITION_UNAVAILABLE, "Position could not
be determined."); | 193 that->setError(PositionError::POSITION_UNAVAILABLE, "Position could not
be determined."); |
| 192 return; | 194 return; |
| 193 } | 195 } |
| 194 | 196 |
| 195 that->m_timestamp = timestamp; | 197 that->m_timestamp = timestamp; |
| 196 that->m_latitude = latitude; | 198 that->m_latitude = latitude; |
| 197 that->m_longitude = longitude; | 199 that->m_longitude = longitude; |
| 198 that->m_altitude = altitude; | 200 that->m_altitude = altitude; |
| 199 | 201 |
| 200 GeoclueAccuracyLevel level; | 202 GeoclueAccuracyLevel level; |
| 201 geoclue_accuracy_get_details(accuracy, &level, &that->m_accuracy, &that->m_a
ltitudeAccuracy); | 203 geoclue_accuracy_get_details(accuracy, &level, &that->m_accuracy, &that->m_a
ltitudeAccuracy); |
| 202 that->updatePosition(); | 204 that->updatePosition(); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void GeolocationServiceGtk::setError(PositionError::ErrorCode errorCode, const c
har* message) | 207 void GeolocationServiceGtk::setError(PositionError::ErrorCode errorCode, const c
har* message) |
| 206 { | 208 { |
| 207 m_lastPosition = 0; | 209 m_lastPosition = 0; |
| 208 m_lastError = PositionError::create(errorCode, String::fromUTF8(message)); | 210 m_lastError = PositionError::create(errorCode, String::fromUTF8(message)); |
| 209 } | 211 } |
| 210 | 212 |
| 211 } | 213 } |
| OLD | NEW |