blob: 67a16e8b0c513c540c2295d3f3198aed18693e4b [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (C) 2016 The Android Open Source Project
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#ifndef ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H
17#define ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H
18
19#ifdef __LINUX_OS__
20//#include <hardware/gps.h>
21#include "gps.h"
22
23/****************************************************************************
24 * This file contains legacy structs that are deprecated/retired from gps.h *
25 ****************************************************************************/
26
27__BEGIN_DECLS
28
29/**
30 * Legacy GPS callback structure.
31 * Deprecated, to be removed in the next Android release.
32 * Use GpsCallbacks instead.
33 */
34typedef struct {
35 /** set to sizeof(GpsCallbacks_v1) */
36 size_t size;
37 gps_location_callback location_cb;
38 gps_status_callback status_cb;
39 gps_sv_status_callback sv_status_cb;
40 gps_nmea_callback nmea_cb;
41 gps_set_capabilities set_capabilities_cb;
42 gps_acquire_wakelock acquire_wakelock_cb;
43 gps_release_wakelock release_wakelock_cb;
44 gps_create_thread create_thread_cb;
45 gps_request_utc_time request_utc_time_cb;
46} GpsCallbacks_v1;
47
48#pragma pack(push,4)
49// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit
50// environments the size of this legacy definition does not collide with _v2. Implementations should
51// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old
52// implementation is still in use.
53
54/**
55 * Legacy struct to represent the status of AGPS.
56 */
57typedef struct {
58 /** set to sizeof(AGpsStatus_v1) */
59 size_t size;
60 AGpsType type;
61 AGpsStatusValue status;
62} AGpsStatus_v1;
63
64#pragma pack(pop)
65
66/**
67 * Legacy struct to represent the status of AGPS augmented with a IPv4 address
68 * field.
69 */
70typedef struct {
71 /** set to sizeof(AGpsStatus_v2) */
72 size_t size;
73 AGpsType type;
74 AGpsStatusValue status;
75
76 /*-------------------- New fields in _v2 --------------------*/
77
78 uint32_t ipaddr;
79} AGpsStatus_v2;
80
81/**
82 * Legacy extended interface for AGPS support.
83 * See AGpsInterface_v2 for more information.
84 */
85typedef struct {
86 /** set to sizeof(AGpsInterface_v1) */
87 size_t size;
88 void (*init)( AGpsCallbacks* callbacks );
89 int (*data_conn_open)( const char* apn );
90 int (*data_conn_closed)();
91 int (*data_conn_failed)();
92 int (*set_server)( AGpsType type, const char* hostname, int port );
93} AGpsInterface_v1;
94
95__END_DECLS
96
97#endif
98#endif /* ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H */