libretro.api.location

Geographic location service interface types.

Allows cores to access the host device’s geographic location.

Module Attributes

retro_location_set_interval_t

Set the desired update rate for the location service.

retro_location_start_t

Start listening to the host device's location service.

retro_location_stop_t

Stop listening to the host device's location service.

retro_location_get_position_t

Return the device's most recent geographic position.

retro_location_lifetime_status_t

Notify the core that the location service has been initialized or deinitialized.

Classes

retro_location_callback

Corresponds to retro_location_callback in libretro.h.

class retro_location_callback[source]

Bases: Structure

Corresponds to retro_location_callback in libretro.h.

A set of callbacks for managing location services.

>>> from libretro.api import retro_location_callback
>>> loc = retro_location_callback()
>>> loc.start is None
True
start

Starts the location service. Set by the frontend.

stop

Stops the location service. Set by the frontend.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
get_position

Returns the device’s current geographic coordinates. Set by the frontend.

set_interval

Sets the location update interval. Set by the frontend.

initialized

Called when the location service is initialized. Set by the core. Optional.

deinitialized

Called when the location service is deinitialized. Set by the core. Optional.

__deepcopy__(_)[source]

Return a deep copy of this object. Intended for use with copy.deepcopy().

>>> import copy
>>> from libretro.api import retro_location_callback
>>> copy.deepcopy(retro_location_callback()).start is None
True
retro_location_get_position_t

Return the device’s most recent geographic position.

Registered by the frontend and called by the core. Each output parameter is set to 0.0 if no change has occurred since the last call.

Parameters:
  • lat – Pointer to a c_double that receives the latitude, in degrees.

  • lon – Pointer to a c_double that receives the longitude, in degrees.

  • horiz_accuracy – Pointer to a c_double that receives the horizontal accuracy.

  • vert_accuracy – Pointer to a c_double that receives the vertical accuracy.

Returns:

True on success.

Corresponds to retro_location_get_position_t in libretro.h.

retro_location_lifetime_status_t

Notify the core that the location service has been initialized or deinitialized.

Registered by the core and called by the frontend when the location service starts or stops.

Corresponds to retro_location_lifetime_status_t in libretro.h.

retro_location_set_interval_t

Set the desired update rate for the location service.

Registered by the frontend and called by the core to hint how often it would like new location updates. Some platforms may honor only one of the two parameters.

Parameters:
  • interval_ms – Desired period between updates, in milliseconds.

  • interval_distance – Desired distance between updates, in meters.

Corresponds to retro_location_set_interval_t in libretro.h.

retro_location_start_t

Start listening to the host device’s location service.

Registered by the frontend and called by the core.

Returns:

True if location services were successfully started, False if they are unavailable or the frontend lacks permission.

Corresponds to retro_location_start_t in libretro.h.

retro_location_stop_t

Stop listening to the host device’s location service.

Registered by the frontend and called by the core.

Corresponds to retro_location_stop_t in libretro.h.