e4aacf4d5fc7eb450489a0ebbde37d891dc73a4c
[platform/core/api/location-manager.git] / test / location_test.c
1 /*
2  * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <glib.h>
21 #include <locations.h>
22 #include <location_bounds.h>
23 #include <location_batch.h>
24
25 static location_manager_h manager;
26 static GMainLoop *g_mainloop = NULL;
27 static int menu;
28
29 static int repeat_count;
30 static void location_cleanup();
31 static int location_test();
32
33 static gboolean exit_program(gpointer data)
34 {
35         g_main_loop_quit(g_mainloop);
36
37         return FALSE;
38 }
39
40 static gboolean wait_test()
41 {
42         location_cleanup();
43         location_test();
44
45         return FALSE;
46 }
47
48 #if 0
49 void zone_event_cb(location_boundary_state_e state, double latitude, double longitude, double altitude, time_t timestamp,
50                    void *user_data)
51 {
52         if (state == LOCATIONS_BOUNDARY_IN) {
53                 printf("Entering zone\n");
54         } else {                /* state == LOCATIONS_BOUNDARY_OUT */
55                 printf("Leaving zone\n");
56         }
57
58         printf("Latitude: %lf, longitude: %lf, altitude: %lf\n", latitude, longitude, altitude);
59
60         printf("Time: %s\n", ctime(&timestamp));
61 }
62
63 static bool last_satellites_foreach_cb(unsigned int azimuth, unsigned int elevation, unsigned int prn, int snr, bool is_in_use,
64                                        void *user_data)
65 {
66         printf("[Last Satellite information]    azimuth : %d, elevation: %d, prn: %d, snr: %d, used: %d\n", azimuth, elevation,
67                prn, snr, is_in_use);
68         return true;
69 }
70
71 static bool __poly_coords_cb(location_coords_s coords, void *user_data)
72 {
73         printf("location_bounds_foreach_rect_coords(latitude: %lf, longitude: %lf) \n", coords.latitude, coords.longitude);
74         return TRUE;
75 }
76
77 static bool __location_bounds_cb(location_bounds_h bounds, void *user_data)
78 {
79         if (bounds == NULL)
80                 printf("bounds ==NULL\n");
81         else {
82                 location_bounds_type_e type;
83                 location_bounds_get_type(bounds, &type);
84                 if (type == LOCATION_BOUNDS_CIRCLE) {
85                         location_coords_s center;
86                         double radius;
87                         location_bounds_get_circle_coords(bounds, &center, &radius);
88                         printf("location_bounds_get_circle_coords(center: %lf, %lf, radius: %lf) \n", center.latitude,
89                                center.longitude, radius);
90
91                 } else if (type == LOCATION_BOUNDS_RECT) {
92                         location_coords_s left_top;
93                         location_coords_s right_bottom;
94                         location_bounds_get_rect_coords(bounds, &left_top, &right_bottom);
95                         printf("location_bounds_get_rect_coords(left_top: %lf, %lf - right_bottom: %lf, %lf) \n",
96                                left_top.latitude, left_top.longitude, right_bottom.latitude, right_bottom.longitude);
97                 } else if (type == LOCATION_BOUNDS_POLYGON) {
98                         location_bounds_foreach_polygon_coords(bounds, __poly_coords_cb, NULL);
99                 }
100         }
101         return TRUE;
102 }
103
104 void location_bounds_test()
105 {
106         int ret;
107         location_coords_s center;
108         center.latitude = 37.258;
109         center.longitude = 127.056;
110         double radius = 30;
111         location_bounds_h bounds_circle;
112         ret = location_bounds_create_circle(center, radius, &bounds_circle);
113         if (ret != LOCATION_BOUNDS_ERROR_NONE) {
114                 printf("location_bounds_create_circle() failed\n");
115         } else
116                 printf("Bounds(circle) has been created successfully.\n");
117
118         ret = location_manager_add_boundary(manager, bounds_circle);
119         if (ret != LOCATIONS_ERROR_NONE) {
120                 printf("Setting boundary failed\n");
121         } else
122                 printf("Boundary set\n");
123
124         location_coords_s center2;
125         double radius2;
126         ret = location_bounds_get_circle_coords(bounds_circle, &center2, &radius2);
127         if (ret != LOCATIONS_ERROR_NONE) {
128                 printf("location_bounds_get_circle_coords() failed\n");
129         } else
130                 printf("location_bounds_get_circle_coords(center: %lf, %lf, radius: %lf) \n", center2.latitude,
131                        center2.longitude, radius2);
132
133         /*Add the rect bounds */
134         location_coords_s left_top;
135         left_top.latitude = 30;
136         left_top.longitude = 30;
137
138         location_coords_s right_bottom;
139         right_bottom.latitude = 10;
140         right_bottom.longitude = 50;
141
142         location_bounds_h bounds_rect;
143         ret = location_bounds_create_rect(left_top, right_bottom, &bounds_rect);
144         if (ret != LOCATION_BOUNDS_ERROR_NONE) {
145                 printf("location_bounds_create_rect() failed\n");
146         } else
147                 printf("Bounds(rect) has been created successfully.\n");
148
149         ret = location_manager_add_boundary(manager, bounds_rect);
150         if (ret != LOCATIONS_ERROR_NONE) {
151                 printf("Setting boundary failed\n");
152         } else
153                 printf("Boundary set\n");
154
155         location_coords_s left_top2;
156         location_coords_s right_bottom2;
157
158         ret = location_bounds_get_rect_coords(bounds_rect, &left_top2, &right_bottom2);
159         if (ret != LOCATIONS_ERROR_NONE) {
160                 printf("location_bounds_get_rect_coords() failed\n");
161         } else
162                 printf("location_bounds_get_rect_coords(left_top: %lf, %lf - right_bottom: %lf, %lf) \n", left_top2.latitude,
163                        left_top2.longitude, right_bottom2.latitude, right_bottom2.longitude);
164
165         /*Add the polygon bounds */
166
167         int poly_size = 3;
168         location_coords_s coord_list[poly_size];
169
170         coord_list[0].latitude = 10;
171         coord_list[0].longitude = 10;
172         coord_list[1].latitude = 20;
173         coord_list[1].longitude = 20;
174         coord_list[2].latitude = 30;
175         coord_list[2].longitude = 30;
176
177         location_bounds_h bounds_poly;
178         ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
179         if (ret != LOCATION_BOUNDS_ERROR_NONE) {
180                 printf("location_bounds_create_polygon() failed\n");
181         } else
182                 printf("Bounds(polygon) has been created successfully.\n");
183
184         ret = location_manager_add_boundary(manager, bounds_poly);
185         if (ret != LOCATIONS_ERROR_NONE) {
186                 printf("Setting boundary failed\n");
187         } else
188                 printf("Boundary set\n");
189
190         ret = location_bounds_foreach_polygon_coords(bounds_poly, __poly_coords_cb, NULL);
191         if (ret != LOCATIONS_ERROR_NONE) {
192                 printf("location_bounds_get_rect_coords() failed\n");
193         }
194
195         location_coords_s test_coords;
196         test_coords.latitude = 12;
197         test_coords.longitude = 12;
198
199         if (location_bounds_contains_coordinates(bounds_poly, test_coords))
200                 printf("location_bounds_contains_coordinates() retrun TRUE \n");
201         else
202                 printf("location_bounds_contains_coordinates() retrun FALSE \n");
203
204         /*print current bounds */
205         ret = location_manager_foreach_boundary(manager, __location_bounds_cb, (void *)manager);
206         if (ret != LOCATIONS_ERROR_NONE) {
207                 printf("location_manager_foreach_boundary() failed\n");
208         }
209
210 }
211
212 void location_get_last_information_test()
213 {
214         int ret;
215         double altitude, latitude, longitude;
216         double climb, direction, speed;
217         double horizontal, vertical;
218         location_accuracy_level_e level;
219         time_t timestamp;
220         int num_of_inview, num_of_active;
221
222         ret = location_manager_get_last_position(manager, &altitude, &latitude, &longitude, &timestamp);
223         if (ret != LOCATIONS_ERROR_NONE) {
224                 printf(" Fail: location_manager_get_last_position ---> %d \n", ret);
225         } else {
226                 printf("[%ld] alt: %g, lat: %g, long: %g\n", timestamp, altitude, latitude, longitude);
227         }
228
229         ret = location_manager_get_last_velocity(manager, &climb, &direction, &speed, &timestamp);
230         if (ret != LOCATIONS_ERROR_NONE) {
231                 printf(" Fail: location_manager_get_last_velocity ---> %d \n", ret);
232         } else {
233                 printf("climb: %f, direction: %f, speed: %f\n", climb, direction, speed);
234         }
235
236         ret = location_manager_get_last_accuracy(manager, &level, &horizontal, &vertical);
237         if (ret != LOCATIONS_ERROR_NONE) {
238                 printf(" Fail: location_manager_get_last_accuracy ---> %d \n", ret);
239         } else {
240                 printf("Level: %d, horizontal: %g, vertical: %g\n", level, horizontal, vertical);
241         }
242
243         ret = gps_status_get_last_satellite(manager, &num_of_active, &num_of_inview, &timestamp);
244         if (ret != LOCATIONS_ERROR_NONE) {
245                 printf(" Fail: gps_status_get_last_satellite_count_in_view ---> %d \n", ret);
246         } else {
247                 printf("[%ld] Satellite number of active: %d, in view: %d\n", timestamp, num_of_active, num_of_inview);
248         }
249
250         ret = gps_status_foreach_last_satellites_in_view(manager, last_satellites_foreach_cb, NULL);
251         if (ret != LOCATIONS_ERROR_NONE) {
252                 printf(" Fail: gps_status_foreach_last_satellites_in_view ---> %d \n", ret);
253         }
254 }
255 #endif
256
257 static void _state_change_cb(location_service_state_e state, void *user_data)
258 {
259         fprintf(stderr, "--------------------------state change: %d---------\n", state);
260         location_manager_h lm = (location_manager_h) user_data;
261         if (state == LOCATIONS_SERVICE_ENABLED) {
262                 int ret;
263                 double altitude;
264                 double latitude;
265                 double longitude;
266                 time_t timestamp;
267                 ret = location_manager_get_position(lm, &altitude, &latitude, &longitude, &timestamp);
268                 if (ret != LOCATIONS_ERROR_NONE) {
269                         printf(" Fail: location_manager_get_position ---> %d \n", ret);
270                 } else {
271                         printf("[%ld] alt: %g, lat %g, long %g\n", timestamp, altitude, latitude, longitude);
272                 }
273
274                 location_accuracy_level_e level;
275                 double horizontal;
276                 double vertical;
277                 ret = location_manager_get_accuracy(lm, &level, &horizontal, &vertical);
278                 if (ret != LOCATIONS_ERROR_NONE) {
279                         printf(" Fail: location_manager_get_accuracy ---> %d \n", ret);
280                 } else {
281                         printf("Level: %d, horizontal: %g, vertical %g\n", level, horizontal, vertical);
282                 }
283 #if 0
284                 char *nmea;
285                 ret = gps_status_get_nmea(lm, &nmea);
286                 if (ret != LOCATIONS_ERROR_NONE) {
287                         printf(" Fail: gps_status_get_nmea ---> %d \n", ret);
288                 } else {
289                         printf("NMEA: %s\n", nmea);
290                         free(nmea);
291                 }
292 #endif
293         }
294
295 }
296
297 void _position_updated_cb(double latitude, double longitude, double altitude, time_t timestamp, void *user_data)
298 {
299         fprintf(stderr, "-------------------------- position updated --------------------------\n");
300         printf("[%ld] lat[%f] lon[%f] alt[%f]\n", timestamp, latitude, longitude, altitude);
301
302         repeat_count++;
303
304         if (repeat_count > 2) {
305                 g_timeout_add_seconds(1, wait_test, NULL);
306         }
307 }
308
309 void _velocity_updated_cb(double speed, double direction, double climb, time_t timestamp, void *user_data)
310 {
311         fprintf(stderr, "-------------------------- velocity updated --------------------------\n");
312         printf("[%ld] speed[%f] direction[%f] climb[%f]\n", timestamp, speed, direction, climb);
313 }
314
315 void _location_cb(int error, double latitude, double longitude, double altitude, time_t timestamp, double speed, double climb, double direction, void *user_data)
316 {
317         printf("error[%d]\n", error);
318         printf("location_cb: lat[%f] lon[%f] alt[%f]\n", latitude, longitude, altitude);
319         printf("speed[%f] climb[%f] direction[%f]\n", speed, climb, direction);
320
321         g_timeout_add_seconds(1, wait_test, NULL);
322 }
323
324 void _location_changed_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal_accuracy, time_t timestamp, void *user_data)
325 {
326         fprintf(stderr, "-------------------------- location changed --------------------------\n");
327         printf("[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal_accuracy);
328
329         repeat_count++;
330
331         if (repeat_count > 2) {
332                 g_timeout_add_seconds(1, wait_test, NULL);
333         }
334 }
335
336 bool _get_location_cb(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, time_t timestamp, void *user_data)
337 {
338         fprintf(stderr, "-------------------------- batch: get location --------------------------\n");
339         printf("[%ld] lat[%f] lon[%f] alt[%f] speed[%lf] direction[%lf], horizontal_accuracy[%lf]\n", timestamp, latitude, longitude, altitude, speed, direction, horizontal);
340         return TRUE;
341 }
342
343 void _location_batch_cb(int num_of_location, void *user_data)
344 {
345         fprintf(stderr, "-------------------------- location batch --------------------------\n");
346         printf("num_of_location: [%d]\n", num_of_location);
347
348         location_manager_h manager = user_data;
349
350         if (num_of_location > 0) {
351                 location_manager_foreach_location_batch(manager, _get_location_cb, user_data);
352         }
353         repeat_count++;
354
355         if (repeat_count > 1) {
356                 g_timeout_add_seconds(1, wait_test, NULL);
357         }
358 }
359
360 static void __setting_cb(location_method_e method, bool enable, void *user_data)
361 {
362         printf("method[%d], enable[%d]\n", method, enable);
363 }
364
365 static void print_location_status()
366 {
367         printf("==== LOCATION STATUS ======\n");
368         bool is_enabled = FALSE;
369         location_manager_is_enabled_method(LOCATIONS_METHOD_HYBRID, &is_enabled);
370         printf("hybrid: %d, ", is_enabled);
371
372         location_manager_is_enabled_method(LOCATIONS_METHOD_GPS, &is_enabled);
373         printf("gps: %d, ", is_enabled);
374
375         location_manager_is_enabled_method(LOCATIONS_METHOD_WPS, &is_enabled);
376         printf("wps: %d\n", is_enabled);
377 }
378
379 static int enable_method(location_method_e method, bool enable)
380 {
381         int ret = 0;
382         printf("==== LOCATION STATUS ======\n");
383
384         location_manager_set_setting_changed_cb(LOCATIONS_METHOD_HYBRID, __setting_cb, NULL);
385         location_manager_set_setting_changed_cb(LOCATIONS_METHOD_GPS, __setting_cb, NULL);
386         location_manager_set_setting_changed_cb(LOCATIONS_METHOD_WPS, __setting_cb, NULL);
387
388         ret = location_manager_enable_method(method, enable);
389         printf("method[%d]: %d\n", method, enable);
390         return ret;
391 }
392
393 static void print_menu()
394 {
395         printf("==== LOCATION TEST ======\n");
396         printf("[1] Get location: LOCATIONS_METHOD_HYBRID\n");
397         printf("[2] Get location: LOCATIONS_METHOD_GPS\n");
398         printf("[3] Get location: LOCATIONS_METHOD_WPS\n");
399         printf("[4] Single location: LOCATIONS_METHOD_HYBRID\n");
400         printf("[5] Single location: LOCATIONS_METHOD_GPS\n");
401         printf("[6] Single location: LOCATIONS_METHOD_WPS\n\n");
402         printf("[11] Change update interval: LOCATIONS_METHOD_HYBRID\n");
403         printf("[12] Change update interval: LOCATIONS_METHOD_GPS\n\n");
404         printf("[21] Distance based location update: LOCATIONS_METHOD_HYBRID\n");
405         printf("[22] Distance based location update: LOCATIONS_METHOD_GPS\n");
406         printf("[23] Distance based location update: LOCATIONS_METHOD_WPS\n\n");
407         printf("[31] Location batch update: LOCATIONS_METHOD_GPS\n\n");
408         printf("[41] Turn on/off method: LOCATIONS_METHOD_HYBRID\n");
409         printf("[42] Turn on/off method: LOCATIONS_METHOD_GPS\n");
410         printf("[43] Turn on/off method: LOCATIONS_METHOD_WPS\n\n");
411         printf("[51] Boundary Test\n\n");
412         printf("[0] Exit!!!\n\n");
413         printf("Select menu: ");
414
415         if (scanf("%d", &menu) < 0) {
416                 printf("Can't read menu !!!\n");
417         }
418 }
419
420 static int location_test()
421 {
422         int ret = LOCATIONS_ERROR_NONE;
423         int basic = 0;
424         int interval = 1;
425
426         print_location_status();
427         print_menu();
428
429         switch (menu) {
430                 case 1:
431                         basic = 1;
432                         ret = location_manager_create(LOCATIONS_METHOD_HYBRID, &manager);
433                         printf("LOCATIONS_METHOD_HYBRID create: %d\n", ret);
434                         ret = location_manager_start(manager);
435                         printf("start: %d\n", ret);
436                         break;
437                 case 2:
438                         basic = 1;
439                         ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
440                         printf("LOCATIONS_METHOD_GPS create: %d\n", ret);
441                         ret = location_manager_start(manager);
442                         printf("start: %d\n", ret);
443                         break;
444                 case 3:
445                         basic = 1;
446                         ret = location_manager_create(LOCATIONS_METHOD_WPS, &manager);
447                         ret = location_manager_start(manager);
448                         printf("start: %d\n", ret);
449                         break;
450                 case 4:
451                 case 5:
452                 case 6: {
453                         int timeout = 30;
454
455                         printf("\n      Input timeout ==> ");
456                         ret = scanf("%d", &timeout);
457
458                         int method = menu - 4;
459                         ret = location_manager_create(method, &manager);
460                         ret = location_manager_request_single_location(manager, timeout, _location_cb, manager);
461                         printf("request single_location (method: %d): %d\n", method, ret);
462                         break;
463                         }
464                 case 11:
465                 case 12:
466                 case 13: {
467                         repeat_count = 0;
468                         int interval = 1;
469
470                         printf("\n      Input position interval ==> ");
471                         ret = scanf("%d", &interval);
472
473                         int method = menu - 4;
474                         ret = location_manager_create(method, &manager);
475                         printf("location_manager_create (method: %d): %d\n", method, ret);
476
477                         ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager);
478                         printf("set position changed callback: %d\n", ret);
479
480                         /*
481                         ret = location_manager_set_velocity_updated_cb(manager, _velocity_updated_cb, interval*2, (void *)manager);
482                         printf("set velocity changed callback: %d\n", ret);
483                         */
484
485                         ret = location_manager_set_location_changed_cb(manager, _location_changed_cb, interval * 2, (void *)manager);
486                         printf("set location changed callback: %d\n", ret);
487
488                         ret = location_manager_start(manager);
489                         repeat_count = 0;
490                         break;
491                         }
492                 case 21:
493                 case 22:
494                 case 23: {
495                         repeat_count = 0;
496                         int interval = 1;
497                         int method = menu - 21;
498
499                         printf("\n      Input position interval ==> ");
500                         ret = scanf("%d", &interval);
501
502                         ret = location_manager_create(method, &manager);
503                         printf("location_manager_create (method : %d)", method);
504
505                         /*ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager); */
506                         /*printf("set position changed callback: %d\n", ret); */
507
508                         ret = location_manager_set_distance_based_location_changed_cb(manager, _location_changed_cb, interval, 30, (void *)manager);
509                         printf("set location changed callback: %d\n", ret);
510
511                         ret = location_manager_start(manager);
512                         break;
513                         }
514                 case 31: {
515                         repeat_count = 0;
516                         int interval = 1;
517                         printf("\n      Input batch interval ==> ");
518                         ret = scanf("%d", &interval);
519
520                         int period = 60;
521                         printf("        Input batch period ==> ");
522                         ret = scanf("%d", &period);
523
524
525                         ret = location_manager_create(LOCATIONS_METHOD_GPS, &manager);
526                         printf("location_manager_create (method : %d)\n", LOCATIONS_METHOD_GPS);
527
528                         ret = location_manager_set_location_batch_cb(manager, _location_batch_cb, interval, period, (void *)manager);
529                         printf("set location batch callback: %d\n", ret);
530
531                         ret = location_manager_start_batch(manager);
532                         break;
533                         }
534                 case 41:
535                 case 42:
536                 case 43: {
537                         int method = menu - 41;
538                         int onoff = 1;
539
540                         printf("\n      Input ON: 1 or OFF: 0 ==> ");
541                         ret = scanf("%d", &onoff);
542
543                         ret = enable_method(method, onoff);
544                         printf("Enabling method[%d]: %d\n", method, ret);
545                         break;
546                         }
547
548                 case 51: {
549                         location_bounds_h hPolyLocationBound = NULL;
550                         bool bIsContained = false;
551                         int nPolySize = 3;
552                         location_coords_s location_coord_list[nPolySize];
553                         location_coord_list[0].latitude = 10;
554                         location_coord_list[0].longitude = 10;
555                         location_coord_list[1].latitude = 20;
556                         location_coord_list[1].longitude = 20;
557                         location_coord_list[2].latitude = 30;
558                         location_coord_list[2].longitude = 10;
559
560                         //Checking coordinates in location boundary
561                         location_coords_s testLocationCoordinates;
562                         testLocationCoordinates.latitude = 20;
563                         testLocationCoordinates.longitude = 12;
564                         location_bound_error_e nRet = location_bounds_create_polygon(location_coord_list, nPolySize, &hPolyLocationBound);
565
566                         printf("location_bounds_create_polygon= %d\n", nRet);
567
568                         bIsContained = location_bounds_contains_coordinates(hPolyLocationBound, testLocationCoordinates);// Target API
569                         printf("bIsContained : %d\n", bIsContained);
570
571                         location_bounds_destroy(hPolyLocationBound);
572                         break;
573                         }
574                 case 0:
575                         g_timeout_add_seconds(0.1, exit_program, NULL);
576                         return 0;
577                 default:
578                         printf("Exit!!! Input: %d\n", menu);
579                         g_timeout_add_seconds(0.1, exit_program, NULL);
580                         return 0;
581         }
582
583         if (ret != LOCATIONS_ERROR_NONE) {
584                 printf("Test Failed!!! [%d]\n", ret);
585                 g_timeout_add_seconds(0.1, exit_program, NULL);
586                 return 0;
587         }
588
589         if (menu < 40) {
590                 ret = location_manager_set_service_state_changed_cb(manager, _state_change_cb, (void *)manager);
591                 printf("set state changed callback: %d\n", ret);
592
593                 if (basic) {
594                         ret = location_manager_set_position_updated_cb(manager, _position_updated_cb, interval, (void *)manager);
595                         printf("set position changed callback: %d\n", ret);
596                 }
597         }
598         else {
599                 g_timeout_add_seconds(0.1, wait_test, NULL);
600         }
601
602         return 0;
603 }
604
605 static void location_cleanup()
606 {
607         int ret = 0;
608         if (manager != NULL) {
609                 ret = location_manager_stop(manager);
610                 printf("stop: %d\n", ret);
611
612                 ret = location_manager_unset_service_state_changed_cb(manager);
613                 printf("unset: %d\n", ret);
614
615                 ret = location_manager_unset_position_updated_cb(manager);
616                 printf("unset: %d\n", ret);
617
618                 ret = location_manager_destroy(manager);
619                 printf("destroy: %d\n", ret);
620                 manager = NULL;
621         }
622         location_manager_unset_setting_changed_cb(LOCATIONS_METHOD_GPS);
623         location_manager_unset_setting_changed_cb(LOCATIONS_METHOD_WPS);
624 }
625
626 int main(int argc, char **argv)
627 {
628         g_mainloop = g_main_loop_new(NULL, 0);
629         location_test();
630         g_main_loop_run(g_mainloop);
631         location_cleanup();
632         return 0;
633 }