4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 static void startup(), cleanup();
27 void (*tet_startup) () = startup;
28 void (*tet_cleanup) () = cleanup;
30 static void utc_location_init();
31 static void utc_location_new();
32 static void utc_location_start();
33 static void utc_get_method();
34 static void utc_get_devname();
35 static void utc_location_get_nmea();
36 static void utc_location_svc_disabled();
37 static void utc_location_free();
40 struct tet_testlist tet_testlist[] = {
41 {utc_location_init,1},
43 {utc_location_start,1},
46 {utc_location_get_nmea,1},
47 {utc_location_svc_disabled,1},
48 {utc_location_free,1},
52 static GMainLoop *loop = NULL;
57 exit_loop (gpointer data)
59 g_main_loop_quit (loop);
67 tet_printf("\n TC startup");
72 tet_printf("\n TC End");
78 ret = location_init();
79 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
80 else tet_result(TET_FAIL);
86 loc = location_new(LOCATION_METHOD_GPS);
87 if (loc) tet_result(TET_PASS);
88 else tet_result(TET_FAIL);
94 ret = location_start(loc);
95 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
96 else tet_result(TET_FAIL);
102 LocationMethod method;
103 g_object_get(loc, "method", &method, NULL);
104 if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
105 else tet_result(TET_FAIL);
111 char* devname = NULL;
112 g_object_get(loc, "dev-name", &devname, NULL);
114 tet_result(TET_PASS);
116 } else tet_result(TET_FAIL);
120 _get_nmea (GObject *self,
125 g_object_get(loc, "nmea", &nmea_data, NULL);
127 tet_result(TET_PASS);
129 } else tet_result(TET_FAIL);
130 g_main_loop_quit (loop);
134 utc_location_get_nmea()
136 loop = g_main_loop_new (NULL, TRUE);
137 g_signal_connect (loc, "service-updated", G_CALLBACK(_get_nmea), loc);
138 g_timeout_add_seconds(60, exit_loop, NULL);
139 g_main_loop_run (loop);
143 _cb_disabled (GObject *self,
147 if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
148 else tet_result(TET_FAIL);
149 g_main_loop_quit (loop);
160 utc_location_svc_disabled()
162 g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc);
163 g_timeout_add_seconds(1, _stop_location, NULL);
164 g_timeout_add_seconds(60, exit_loop, NULL);
165 g_main_loop_run (loop);
172 ret = location_free(loc);
173 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
174 else tet_result(TET_FAIL);