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_satellite();
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_satellite,1},
47 {utc_location_svc_disabled,1},
48 {utc_location_free,1},
54 static GMainLoop *loop = NULL;
59 exit_loop (gpointer data)
61 g_main_loop_quit (loop);
68 tet_printf("\n TC startup");
73 tet_printf("\n TC End");
79 ret = location_init();
80 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
81 else tet_result(TET_FAIL);
87 loc = location_new(LOCATION_METHOD_GPS);
88 if(loc) tet_result(TET_PASS);
89 else tet_result(TET_FAIL);
95 ret = location_start(loc);
96 if(ret == LOCATION_ERROR_NONE) tet_result(TET_PASS);
97 else tet_result(TET_FAIL);
103 LocationMethod method;
104 g_object_get(loc, "method", &method, NULL);
105 if (LOCATION_METHOD_HYBRID <= method && method<= LOCATION_METHOD_WPS) tet_result(TET_PASS);
106 else tet_result(TET_FAIL);
112 char* devname = NULL;
113 g_object_get(loc, "dev-name", &devname, NULL);
115 tet_result(TET_PASS);
117 } else tet_result(TET_FAIL);
121 _get_satellite (GObject *self,
125 LocationSatellite *sat = NULL;
126 g_object_get (loc, "satellite", &sat, NULL);
128 tet_result(TET_PASS);
129 location_satellite_free (sat);
130 } else tet_result(TET_FAIL);
131 g_main_loop_quit (loop);
135 utc_location_get_satellite()
137 loop = g_main_loop_new (NULL, TRUE);
138 g_signal_connect (loc, "service-enabled", G_CALLBACK(_get_satellite), loc);
139 g_timeout_add_seconds(60, exit_loop, NULL);
140 g_main_loop_run (loop);
144 _cb_disabled (GObject *self,
148 if( LOCATION_STATUS_NO_FIX <= _status && _status <= LOCATION_STATUS_3D_FIX) tet_result(TET_PASS);
149 else tet_result(TET_FAIL);
150 g_main_loop_quit (loop);
161 utc_location_svc_disabled()
163 g_signal_connect (loc, "service-disabled", G_CALLBACK(_cb_disabled), loc);
164 g_timeout_add_seconds(1, _stop_location, NULL);
165 g_timeout_add_seconds(60, exit_loop, NULL);
166 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);