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