RetroArch/location/location_driver.h

145 lines
4.0 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - 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
2015-01-12 18:53:10 +00:00
#include <stdint.h>
#include <stddef.h>
2016-06-03 03:38:40 +00:00
2015-01-12 18:53:10 +00:00
#include <boolean.h>
2016-06-03 03:38:40 +00:00
#include <retro_common_api.h>
2015-01-12 18:53:10 +00:00
2016-06-03 03:38:40 +00:00
RETRO_BEGIN_DECLS
2015-12-05 14:40:29 +00:00
enum rarch_location_ctl_state
{
RARCH_LOCATION_CTL_NONE = 0,
RARCH_LOCATION_CTL_DESTROY,
2015-12-05 22:03:05 +00:00
RARCH_LOCATION_CTL_DEINIT,
2015-12-05 14:40:29 +00:00
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;
2015-01-12 20:16:17 +00:00
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);
2015-12-05 14:40:29 +00:00
bool location_driver_ctl(enum rarch_location_ctl_state state, void *data);
2016-06-03 03:38:40 +00:00
RETRO_END_DECLS
#endif