static void _state_change_cb(location_service_state_e state, void *user_data)
{
- fprintf(stderr, "--------------------------state change: %d---------\n", state);
+ fprintf(stderr, "--------> ServiceState Change : %s\n", state ? "ENABLED" : "DISABLED");
location_manager_h lm = (location_manager_h) user_data;
if (state == LOCATIONS_SERVICE_ENABLED) {
int ret;
if (ret != LOCATIONS_ERROR_NONE)
fprintf(stderr, " Fail: location_manager_get_accuracy ---> %d \n", ret);
else
- fprintf(stderr, "Level: %d, horizontal: %f, vertical %f\n", level, horizontal, vertical);
+ fprintf(stderr, " Level: %d, horizontal: %f, vertical %f\n", level, horizontal, vertical);
#if 0
char *nmea;
ret = gps_status_get_nmea(lm, &nmea);
void _position_updated_cb(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
{
- fprintf(stderr, "-------------------------- position updated --------------------------\n");
fprintf(stderr, "[%ld] lat: %f, lng: %f, alt: %f\n", timestamp, latitude, longitude, altitude);
- location_manager_h lm = (location_manager_h) user_data;
- location_accuracy_level_e level;
- double horizontal;
- double vertical;
- int ret = location_manager_get_accuracy(lm, &level, &horizontal, &vertical);
- if (ret != LOCATIONS_ERROR_NONE)
- fprintf(stderr, " Fail: location_manager_get_accuracy ---> %d \n", ret);
- else
- fprintf(stderr, "Level: %d, horizontal: %f, vertical %f\n", level, horizontal, vertical);
-
repeat_count++;
if (repeat_count > 9)
void _velocity_updated_cb(double speed, double direction, double climb, time_t timestamp, void *user_data)
{
- fprintf(stderr, "-------------------------- velocity updated --------------------------\n");
fprintf(stderr, "[%ld] speed[%f] direction[%f] climb[%f]\n", timestamp, speed, direction, climb);
}
void _location_cb(int error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double climb, double direction, void *user_data)
{
fprintf(stderr, "error[%d]\n", error);
- fprintf(stderr, "location_cb: lat[%f] lon[%f] alt[%f]\n", latitude, longitude, altitude);
- fprintf(stderr, "speed[%f] climb[%f] direction[%f]\n", speed, climb, direction);
+ fprintf(stderr, "-- SingleLocation\n[%ld] lat: %f, lon: %f, alt:%f\n", timestamp, latitude, longitude, altitude);
+ fprintf(stderr, " speed[%f] climb[%f] direction[%f]\n", speed, climb, direction);
test_timer = g_timeout_add_seconds(1, wait_test, NULL);
}
void _location_changed_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data)
{
- fprintf(stderr, "-------------------------- location changed --------------------------\n");
- fprintf(stderr, "[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal_accuracy);
+ fprintf(stderr, "[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], hor_acc[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal_accuracy);
repeat_count++;
void _location_batch_cb(int num_of_location, void *user_data)
{
- fprintf(stderr, "-------------------------- location batch --------------------------\n");
+ fprintf(stderr, "-------------------------- location batch \n");
fprintf(stderr, "num_of_location: [%d]\n", num_of_location);
location_manager_h manager = user_data;
void _satellite_updated_cb(int num_of_active, int num_of_inview, time_t timestamp, void *user_data)
{
-/* fprintf(stderr, "-------------------------- satellite updated --------------------------\n"); */
fprintf(stderr, "--- active[%d] inview[%d] timestamp[%ld]\n", num_of_active, num_of_inview, timestamp);
repeat_count++;
static void print_location_status()
{
- fprintf(stderr, "==== LOCATION Setting state =====\n");
+ fprintf(stderr, "\n\nSETTING --> ");
bool is_enabled = FALSE;
location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_enabled);
- fprintf(stderr, "hybrid: %d, ", is_enabled);
+ fprintf(stderr, "Hybrid[%s], ", is_enabled ? "ON" : "Off");
location_manager_is_enabled_method(LOCATIONS_METHOD_GPS, &is_enabled);
- fprintf(stderr, "gps: %d, ", is_enabled);
+ fprintf(stderr, "Gps[%s], ", is_enabled ? "ON" : "Off");
location_manager_is_enabled_method(LOCATIONS_METHOD_WPS, &is_enabled);
- fprintf(stderr, "wps: %d \n", is_enabled);
+ fprintf(stderr, "Wps[%s]\n", is_enabled ? "ON" : "Off");
}
static int enable_method(location_method_e method, bool enable)
static void print_menu()
{
fprintf(stderr, "============= LOCATION TEST =============\n");
- fprintf(stderr, "[1] Get location: LOCATIONS_METHOD_HYBRID\n");
- fprintf(stderr, "[2] Get location: LOCATIONS_METHOD_GPS\n");
- fprintf(stderr, "[3] Get location: LOCATIONS_METHOD_WPS\n");
- fprintf(stderr, "[4] Single location: LOCATIONS_METHOD_HYBRID\n");
- fprintf(stderr, "[5] Single location: LOCATIONS_METHOD_GPS\n");
- fprintf(stderr, "[6] Single location: LOCATIONS_METHOD_WPS\n\n");
- fprintf(stderr, "[11] Change update interval: LOCATIONS_METHOD_HYBRID\n");
- fprintf(stderr, "[12] Change update interval: LOCATIONS_METHOD_GPS\n\n");
- fprintf(stderr, "[21] Distance based location update: LOCATIONS_METHOD_HYBRID\n");
- fprintf(stderr, "[22] Distance based location update: LOCATIONS_METHOD_GPS\n");
- fprintf(stderr, "[23] Distance based location update: LOCATIONS_METHOD_WPS\n\n");
- fprintf(stderr, "[31] Location batch update: LOCATIONS_METHOD_GPS\n\n");
- fprintf(stderr, "[41] Turn on/off mock test: LOCATIONS_METHOD_MOCK\n");
- fprintf(stderr, "[42] Set & Clear location: LOCATIONS_METHOD_HYBRID\n\n");
- fprintf(stderr, "[51] Turn on/off method: LOCATIONS_METHOD_HYBRID\n");
- fprintf(stderr, "[52] Turn on/off method: LOCATIONS_METHOD_GPS\n");
- fprintf(stderr, "[53] Turn on/off method: LOCATIONS_METHOD_WPS\n\n");
+ fprintf(stderr, "[1] LocationUpdate (HYBRID)\n");
+ fprintf(stderr, "[2] LocationUpdate (GPS)\n");
+ fprintf(stderr, "[3] LocationUpdate (WPS)\n");
+ fprintf(stderr, "[4] LocationUpdate (PASSIVE)\n");
+ fprintf(stderr, "[5] LocationUpdate (FUSED)\n\n");
+ fprintf(stderr, "[6] SingleLocation (HYBRID)\n");
+ fprintf(stderr, "[7] SingleLocation (GPS)\n");
+ fprintf(stderr, "[8] SingleLocation (WPS)\n\n");
+ fprintf(stderr, "[11] Change Interval (HYBRID)\n");
+ fprintf(stderr, "[12] Change Interval (GPS)\n\n");
+ fprintf(stderr, "[21] DistanceBased Update (HYBRID)\n");
+ fprintf(stderr, "[22] DistanceBased Update (GPS)\n");
+ fprintf(stderr, "[23] DistanceBased Update (WPS)\n\n");
+ fprintf(stderr, "[31] LocationBatch update (GPS)\n\n");
+ fprintf(stderr, "[41] Turn on/off mock test (MOCK)\n");
+ fprintf(stderr, "[42] Set & Clear location (HYBRID)\n\n");
+ fprintf(stderr, "[51] Turn on/off method (HYBRID)\n");
+ fprintf(stderr, "[52] Turn on/off method (GPS)\n");
+ fprintf(stderr, "[53] Turn on/off method (WPS)\n\n");
fprintf(stderr, "[61] Boundary Test\n\n");
fprintf(stderr, "[0] Exit!!!\n\n");
fprintf(stderr, "Select menu: ");
switch (menu) {
case 1:
case 2:
- case 3: {
+ case 3:
+ case 4:
+ case 5: {
basic = 1;
int method = menu - 1;
}
break;
}
- case 4:
- case 5:
- case 6: {
+ case 6:
+ case 7:
+ case 8: {
int timeout = 60;
- fprintf(stderr, "\n Input timeout ==> ");
+ fprintf(stderr, "\n Input single timeout ==> ");
ret = scanf_safety("%d", &timeout);
- int method = menu - 4;
+ int method = menu - 6;
ret = location_manager_create(method, &manager);
ret = location_manager_request_single_location(manager, timeout, _location_cb, manager);
fprintf(stderr, "request single_location (method: %d): %d\n", method, ret);