Ubuntu Platform API
1.0.0
A library helping with tight integration into the Ubuntu platform
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
gps.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2013 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
17
* Authored by: Thomas Voß <thomas.voss@canonical.com>
18
*/
19
#ifndef UBUNTU_HARDWARE_GPS_H_
20
#define UBUNTU_HARDWARE_GPS_H_
21
22
#include <
ubuntu/visibility.h
>
23
24
#include <stdint.h>
25
#include <stddef.h>
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
30
37
#define U_HARDWARE_GPS_MAX_SVS 32
38
43
enum
44
{
46
U_HARDWARE_GPS_STATUS_NONE
= 0,
48
U_HARDWARE_GPS_STATUS_SESSION_BEGIN
= 1,
50
U_HARDWARE_GPS_STATUS_SESSION_END
= 2,
52
U_HARDWARE_GPS_STATUS_ENGINE_ON
= 3,
54
U_HARDWARE_GPS_STATUS_ENGINE_OFF
= 4
55
};
56
64
#define U_HARDWARE_GPS_CAPABILITY_SCHEDULING 0x0000001
65
66
#define U_HARDWARE_GPS_CAPABILITY_MSB 0x0000002
67
68
#define U_HARDWARE_GPS_CAPABILITY_MSA 0x0000004
69
70
#define U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT 0x0000008
71
72
#define U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010
73
78
typedef
uint32_t
UHardwareGpsNiNotifyFlags
;
80
#define U_HARDWARE_GPS_NI_NEED_NOTIFY 0x0001
81
82
#define U_HARDWARE_GPS_NI_NEED_VERIFY 0x0002
83
84
#define U_HARDWARE_GPS_NI_PRIVACY_OVERRIDE 0x0004
85
91
typedef
int
UHardwareGpsUserResponseType
;
92
93
enum
94
{
95
U_HARDWARE_GPS_NI_RESPONSE_ACCEPT
= 1,
96
U_HARDWARE_GPS_NI_RESPONSE_DENY
= 2,
97
U_HARDWARE_GPS_NI_RESPONSE_NORESP
= 3
98
};
99
100
enum
101
{
102
U_HARDWARE_GPS_NI_TYPE_VOICE
= 1,
103
U_HARDWARE_GPS_NI_TYPE_UMTS_SUPL
= 2,
104
U_HARDWARE_GPS_NI_TYPE_UMTS_CTRL_PLANE
= 3
105
};
106
111
#define U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN 256
112
#define U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN 2048
113
118
typedef
int
UHardwareGpsNiEncodingType
;
119
124
enum
125
{
126
U_HARDWARE_GPS_ENC_NONE
= 0,
127
U_HARDWARE_GPS_ENC_SUPL_GSM_DEFAULT
= 1,
128
U_HARDWARE_GPS_ENC_SUPL_UTF8
= 2,
129
U_HARDWARE_GPS_ENC_SUPL_UCS2
= 3,
130
U_HARDWARE_GPS_ENC_UNKNOWN
= -1
131
};
132
137
enum
138
{
139
U_HARDWARE_GPS_AGPS_TYPE_SUPL
= 1,
140
U_HARDWARE_GPS_AGPS_TYPE_C2K
= 2
141
};
142
147
enum
148
{
150
U_HARDWARE_GPS_POSITION_MODE_STANDALONE
= 0,
152
U_HARDWARE_GPS_POSITION_MODE_MS_BASED
= 1,
154
U_HARDWARE_GPS_POSITION_MODE_MS_ASSISTED
= 2
155
};
156
161
enum
162
{
164
U_HARDWARE_GPS_POSITION_RECURRENCE_PERIODIC
= 0,
166
U_HARDWARE_GPS_POSITION_RECURRENCE_SINGLE
= 1
167
};
168
169
enum
170
{
172
U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN
= 1,
174
U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN
= 2,
176
U_HARDWARE_GPS_AGPS_DATA_CONNECTED
= 3,
178
U_HARDWARE_GPS_AGPS_DATA_CONN_DONE
= 4,
180
U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED
= 5
181
};
182
184
#define U_HARDWARE_GPS_LOCATION_HAS_LAT_LONG 0x0001
185
186
#define U_HARDWARE_GPS_LOCATION_HAS_ALTITUDE 0x0002
187
188
#define U_HARDWARE_GPS_LOCATION_HAS_SPEED 0x0004
189
190
#define U_HARDWARE_GPS_LOCATION_HAS_BEARING 0x0008
191
192
#define U_HARDWARE_GPS_LOCATION_HAS_ACCURACY 0x0010
193
194
typedef
struct
UHardwareGps_*
UHardwareGps
;
195
200
typedef
struct
201
{
203
size_t
size
;
205
uint16_t
flags
;
207
double
latitude
;
209
double
longitude
;
212
double
altitude
;
214
float
speed
;
216
float
bearing
;
218
float
accuracy
;
220
int64_t
timestamp
;
221
}
UHardwareGpsLocation
;
222
227
typedef
struct
{
229
size_t
size
;
231
int
prn
;
233
float
snr
;
235
float
elevation
;
237
float
azimuth
;
238
}
UHardwareGpsSvInfo
;
239
244
typedef
struct
{
246
size_t
size
;
247
249
int
num_svs
;
250
252
UHardwareGpsSvInfo
sv_list[
U_HARDWARE_GPS_MAX_SVS
];
253
257
uint32_t
ephemeris_mask
;
258
262
uint32_t
almanac_mask
;
263
268
uint32_t
used_in_fix_mask
;
269
}
UHardwareGpsSvStatus
;
270
275
typedef
struct
{
277
size_t
size
;
278
279
uint16_t
type
;
280
uint16_t
status
;
281
uint32_t
ipaddr
;
282
}
UHardwareGpsAGpsStatus
;
283
288
typedef
struct
{
290
size_t
size
;
291
296
int
notification_id
;
297
302
uint32_t
ni_type
;
303
307
UHardwareGpsNiNotifyFlags
notify_flags
;
308
313
int
timeout
;
314
318
UHardwareGpsUserResponseType
default_response
;
319
323
char
requestor_id[
U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN
];
324
328
char
text[
U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN
];
329
333
UHardwareGpsNiEncodingType
requestor_id_encoding
;
334
338
UHardwareGpsNiEncodingType
text_encoding
;
339
345
char
extras[
U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN
];
346
347
}
UHardwareGpsNiNotification
;
348
349
typedef
void (*
UHardwareGpsLocationCallback
)(
UHardwareGpsLocation
*location,
void
*context);
350
typedef
void (*
UHardwareGpsStatusCallback
)(uint16_t status,
void
*context);
351
typedef
void (*
UHardwareGpsSvStatusCallback
)(
UHardwareGpsSvStatus
*sv_info,
void
*context);
352
typedef
void (*
UHardwareGpsNmeaCallback
)(int64_t timestamp,
const
char
*nmea,
int
length,
void
*context);
353
typedef
void (*
UHardwareGpsSetCapabilities
)(uint32_t capabilities,
void
*context);
354
typedef
void (*
UHardwareGpsRequestUtcTime
)(
void
*context);
355
359
typedef
void (*
UHardwareGpsXtraDownloadRequest
)(
void
*context);
360
363
typedef
void (*
UHardwareGpsAGpsStatusCallback
)(
UHardwareGpsAGpsStatus
*status,
void
*context);
364
367
typedef
void (*
UHardwareGpsNiNotifyCallback
)(
UHardwareGpsNiNotification
*notification,
void
*context);
368
369
/*
370
Callback for AGPS RIL (Radio Interface Library) set id
371
*/
372
typedef
void (*
UHardwareGpsAGpsRilRequestSetId
)(uint32_t flags,
void
*context);
373
typedef
void (*
UHardwareGpsAGpsRilRequestRefLoc
)(uint32_t flags,
void
*context);
374
375
typedef
struct
376
{
377
378
UHardwareGpsLocationCallback
location_cb
;
379
UHardwareGpsStatusCallback
status_cb
;
380
UHardwareGpsSvStatusCallback
sv_status_cb
;
381
UHardwareGpsNmeaCallback
nmea_cb
;
382
UHardwareGpsSetCapabilities
set_capabilities_cb
;
383
UHardwareGpsRequestUtcTime
request_utc_time_cb
;
384
385
UHardwareGpsXtraDownloadRequest
xtra_download_request_cb
;
386
387
UHardwareGpsAGpsStatusCallback
agps_status_cb
;
388
389
UHardwareGpsNiNotifyCallback
gps_ni_notify_cb
;
390
391
UHardwareGpsAGpsRilRequestSetId
request_setid_cb
;
392
UHardwareGpsAGpsRilRequestRefLoc
request_refloc_cb
;
393
394
void
*
context
;
395
}
UHardwareGpsParams
;
396
397
/*
398
You must create only one instance per process/application.
399
*/
400
UBUNTU_DLL_PUBLIC
UHardwareGps
401
u_hardware_gps_new
(
UHardwareGpsParams
*params);
402
403
UBUNTU_DLL_PUBLIC
void
404
u_hardware_gps_delete
(UHardwareGps handle);
405
406
UBUNTU_DLL_PUBLIC
bool
407
u_hardware_gps_start
(UHardwareGps
self
);
408
409
UBUNTU_DLL_PUBLIC
bool
410
u_hardware_gps_stop
(UHardwareGps
self
);
411
412
/*
413
\param time NTP time, in milliseconds since Jan 1st 1970.
414
\param time_reference time from the internal clock at the moment that NTP time was taken.
415
\param uncertainty possible deviation in the time supplied (uncertainty) in milliseconds.
416
*/
417
UBUNTU_DLL_PUBLIC
void
418
u_hardware_gps_inject_time
(
419
UHardwareGps
self
,
420
int64_t time,
421
int64_t time_reference,
422
int
uncertainty);
423
424
UBUNTU_DLL_PUBLIC
void
425
u_hardware_gps_inject_location
(
426
UHardwareGps
self
,
427
double
latitude,
428
double
longitude,
429
float
accuracy);
430
431
UBUNTU_DLL_PUBLIC
void
432
u_hardware_gps_delete_aiding_data
(
433
UHardwareGps
self
,
434
uint16_t flags);
435
436
/*
437
\param mode One of the U_HARDWARE_GPS_POSITION_MODE_* values
438
\param recurrence One of the U_HARDWARE_GPS_POSITION_RECURRENCE_* values
439
\param min_interval represents the time between fixes in milliseconds.
440
\param preferred_accuracy The requested fix accuracy in meters. Can be zero.
441
\param preferred_time The requested time to first fix in milliseconds. Can be zero.
442
*/
443
UBUNTU_DLL_PUBLIC
bool
444
u_hardware_gps_set_position_mode
(
445
UHardwareGps
self
,
446
uint32_t mode,
447
uint32_t recurrence,
448
uint32_t min_interval,
449
uint32_t preferred_accuracy,
450
uint32_t preferred_time);
451
452
UBUNTU_DLL_PUBLIC
void
453
u_hardware_gps_inject_xtra_data
(
454
UHardwareGps
self
,
455
char
* data,
456
int
length);
457
458
#ifdef __cplusplus
459
}
460
#endif
461
462
#endif // UBUNTU_HARDWARE_GPS_H_
include
ubuntu
hardware
gps.h
Generated on Tue Oct 15 2013 02:50:25 for Ubuntu Platform API by
1.8.4