forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
location_driver.h
144 lines (123 loc) · 4.02 KB
/
location_driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LOCATION_DRIVER__H
#define __LOCATION_DRIVER__H
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
enum rarch_location_ctl_state
{
RARCH_LOCATION_CTL_NONE = 0,
RARCH_LOCATION_CTL_DESTROY,
RARCH_LOCATION_CTL_DEINIT,
RARCH_LOCATION_CTL_SET_OWN_DRIVER,
RARCH_LOCATION_CTL_UNSET_OWN_DRIVER,
RARCH_LOCATION_CTL_OWNS_DRIVER,
RARCH_LOCATION_CTL_SET_ACTIVE,
RARCH_LOCATION_CTL_UNSET_ACTIVE,
RARCH_LOCATION_CTL_IS_ACTIVE
};
typedef struct location_driver
{
void *(*init)(void);
void (*free)(void *data);
bool (*start)(void *data);
void (*stop)(void *data);
bool (*get_position)(void *data, double *lat, double *lon,
double *horiz_accuracy, double *vert_accuracy);
void (*set_interval)(void *data, unsigned interval_msecs,
unsigned interval_distance);
const char *ident;
} location_driver_t;
extern location_driver_t location_corelocation;
extern location_driver_t location_android;
extern location_driver_t location_null;
/**
* driver_location_start:
*
* Starts location driver interface..
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool driver_location_start(void);
/**
* driver_location_stop:
*
* Stops location driver interface..
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
*
* Returns: true (1) if successful, otherwise false (0).
**/
void driver_location_stop(void);
/**
* driver_location_get_position:
* @lat : Latitude of current position.
* @lon : Longitude of current position.
* @horiz_accuracy : Horizontal accuracy.
* @vert_accuracy : Vertical accuracy.
*
* Gets current positioning information from
* location driver interface.
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
*
* Returns: bool (1) if successful, otherwise false (0).
**/
bool driver_location_get_position(double *lat, double *lon,
double *horiz_accuracy, double *vert_accuracy);
/**
* driver_location_set_interval:
* @interval_msecs : Interval time in milliseconds.
* @interval_distance : Distance at which to update.
*
* Sets interval update time for location driver interface.
* Used by RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE.
**/
void driver_location_set_interval(unsigned interval_msecs,
unsigned interval_distance);
/**
* config_get_location_driver_options:
*
* Get an enumerated list of all location driver names,
* separated by '|'.
*
* Returns: string listing of all location driver names,
* separated by '|'.
**/
const char* config_get_location_driver_options(void);
/**
* location_driver_find_handle:
* @index : index of driver to get handle to.
*
* Returns: handle to location driver at index. Can be NULL
* if nothing found.
**/
const void *location_driver_find_handle(int index);
/**
* location_driver_find_ident:
* @index : index of driver to get handle to.
*
* Returns: Human-readable identifier of location driver at index. Can be NULL
* if nothing found.
**/
const char *location_driver_find_ident(int index);
void find_location_driver(void);
void init_location(void);
bool location_driver_ctl(enum rarch_location_ctl_state state, void *data);
RETRO_END_DECLS
#endif