navit  0.5.3-trunk
Vehicle GeoClue

The Vehicle to gain position data from GeoClue. @Author jkoan. More...

Data Structures

struct  vehicle_priv
 

Macros

#define DEFAULT_RETRY_INTERVAL   10
 
#define MIN_RETRY_INTERVAL   1
 
#define plugin_init   plugin_module_cat(module_,_init)
 register vehicle_gypsy More...
 

Functions

static void vehicle_geoclue_destroy (struct vehicle_priv *priv)
 Free the geoclue_vehicle. More...
 
static void print_location (GClueSimple *simple, GParamSpec *pspec, gpointer user_data)
 
static void on_client_active_notify (GClueClient *client, GParamSpec *pspec, gpointer user_data)
 
static void on_simple_ready (GObject *source_object, GAsyncResult *res, gpointer user_data)
 
static int vehicle_geoclue_position_attr_get (struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
 Provide the outside with information. More...
 
static struct vehicle_privvehicle_geoclue_new (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)
 Create geoclue_vehicle. More...
 
void plugin_init (void)
 register vehicle_geoclue More...
 
static void vehicle_gypsy_fixstatus_changed (GypsyDevice *device, gint fixstatus, gpointer userdata)
 When the fixstatus has changed, this function get called. More...
 
static void vehicle_gypsy_position_changed (GypsyPosition *position, GypsyPositionFields fields_set, int timestamp, double latitude, double longitude, double altitude, gpointer userdata)
 When the position has changed, this function get called. More...
 
static void vehicle_gypsy_satellite_changed (GypsySatellite *satellite, GPtrArray *satellites, gpointer userdata)
 Everytime any Sat-Details are changed, this function get called. More...
 
static void vehicle_gypsy_course_changed (GypsyCourse *course, GypsyCourseFields fields, int timestamp, double speed, double direction, double climb, gpointer userdata)
 When the course or speed has changed, this function get called. More...
 
static gboolean vehicle_gypsy_try_open (gpointer *data)
 Attempt to open the gypsy device. More...
 
static void vehicle_gypsy_open (struct vehicle_priv *priv)
 Open a connection to gypsy. Will re-try the connection if it fails. More...
 
static void vehicle_gypsy_close (struct vehicle_priv *priv)
 Stop retry timer; Free alloced memory. More...
 
static void vehicle_gypsy_destroy (struct vehicle_priv *priv)
 Free the gypsy_vehicle. More...
 
static int vehicle_gypsy_position_attr_get (struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
 Provide the outside with information. More...
 
static struct vehicle_privvehicle_gypsy_new_gypsy (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)
 Create gypsy_vehicle. More...
 

Variables

GClueLocation * vehicle_priv::location
 
char * vehicle_priv::bla
 
int vehicle_priv::accuracy
 
char * vehicle_priv::time_str
 
GClueSimple * vehicle_priv::simple
 
GClueClient * client = NULL
 
struct vehicle_methods vehicle_geoclue_methods
 
GypsyControl * vehicle_priv::control
 
GypsyPosition * vehicle_priv::position
 
GypsyDevice * vehicle_priv::device
 
GypsyCourse * vehicle_priv::course
 
GypsySatellite * vehicle_priv::satellite
 
char * vehicle_priv::path
 
guint vehicle_priv::retry_timer
 
int vehicle_priv::have_cords
 
static struct vehicle_privvehicle_last
 
struct vehicle_methods vehicle_gypsy_methods
 

Detailed Description

The Vehicle to gain position data from GeoClue. @Author jkoan.

The Vehicle to gain position data from gypsy. gypsy uses dbus signals @Author Tim Niemeyer reddo.nosp@m.g@ma.nosp@m.sters.nosp@m.word.nosp@m..de

Date
2020
2008-2009

Macro Definition Documentation

◆ DEFAULT_RETRY_INTERVAL

#define DEFAULT_RETRY_INTERVAL   10

◆ MIN_RETRY_INTERVAL

#define MIN_RETRY_INTERVAL   1

◆ plugin_init

void plugin_init (   void)    plugin_module_cat(module_,_init)

register vehicle_gypsy

Returns
nothing

Function Documentation

◆ on_client_active_notify()

static void on_client_active_notify ( GClueClient *  client,
GParamSpec *  pspec,
gpointer  user_data 
)
static

References client.

Referenced by on_simple_ready().

◆ on_simple_ready()

static void on_simple_ready ( GObject *  source_object,
GAsyncResult *  res,
gpointer  user_data 
)
static

◆ plugin_init()

void plugin_init ( void  )

register vehicle_geoclue

The plugin entry point.

register vehicle_gypsy

Returns
nothing

References dbg, lvl_error, and vehicle_geoclue_new().

◆ print_location()

◆ vehicle_geoclue_destroy()

static void vehicle_geoclue_destroy ( struct vehicle_priv priv)
static

Free the geoclue_vehicle.

Parameters
priv
Returns
nothing

References client, and vehicle_priv::simple.

◆ vehicle_geoclue_new()

static struct vehicle_priv* vehicle_geoclue_new ( struct vehicle_methods meth,
struct callback_list cbl,
struct attr **  attrs 
)
static

Create geoclue_vehicle.

Parameters
meth[out]Methodes supported by geoclue Plugin
cbl[in]Callback List reference
attrsConfiguration attributes
Returns
vehicle_priv The newly created Vehicle priv

References cbl, vehicle_priv::cbl, dbg, lvl_debug, on_simple_ready(), and vehicle_geoclue_methods.

Referenced by plugin_init().

◆ vehicle_geoclue_position_attr_get()

static int vehicle_geoclue_position_attr_get ( struct vehicle_priv priv,
enum attr_type  type,
struct attr attr 
)
static

Provide the outside with information.

Parameters
priv
typeTODO: What can this be?
attr
Returns
true/false

◆ vehicle_gypsy_close()

static void vehicle_gypsy_close ( struct vehicle_priv priv)
static

Stop retry timer; Free alloced memory.

Parameters
priv
Returns
nothing

References vehicle_priv::control, vehicle_priv::course, vehicle_priv::device, vehicle_priv::path, vehicle_priv::position, vehicle_priv::retry_timer, and vehicle_priv::satellite.

Referenced by vehicle_gypsy_destroy().

◆ vehicle_gypsy_course_changed()

static void vehicle_gypsy_course_changed ( GypsyCourse *  course,
GypsyCourseFields  fields,
int  timestamp,
double  speed,
double  direction,
double  climb,
gpointer  userdata 
)
static

When the course or speed has changed, this function get called.

Only speed and direction are used!

If we get any new information, we have to call the global callback.

Parameters
courseThe GypsyCourse
fieldsBitmask indicating what field was set
timestampthe time since Unix Epoch
speed
direction
climb
userdata
Returns
nothing

References callback_list_call_attr_0, vehicle_priv::cb, vehicle_priv::cbl, vehicle_priv::direction, vehicle_priv::speed, and vehicle_last.

Referenced by vehicle_gypsy_try_open().

◆ vehicle_gypsy_destroy()

static void vehicle_gypsy_destroy ( struct vehicle_priv priv)
static

Free the gypsy_vehicle.

Parameters
priv
Returns
nothing

References vehicle_priv::source, and vehicle_gypsy_close().

◆ vehicle_gypsy_fixstatus_changed()

static void vehicle_gypsy_fixstatus_changed ( GypsyDevice *  device,
gint  fixstatus,
gpointer  userdata 
)
static

When the fixstatus has changed, this function get called.

fixstatus can be one of this: GYPSY_DEVICE_FIX_STATUS_INVALID = 0 GYPSY_DEVICE_FIX_STATUS_NONE = 1 GYPSY_DEVICE_FIX_STATUS_2D = 2 GYPSY_DEVICE_FIX_STATUS_3D = 3

Anytime this functions get called, we have to call the global callback.

Parameters
deviceThe GypsyDevice
fixstatusThe fisstatus 0, 1, 2 or 3
userdata
Returns
nothing

References callback_list_call_attr_0, vehicle_priv::cbl, vehicle_priv::fix_type, and vehicle_last.

Referenced by vehicle_gypsy_try_open().

◆ vehicle_gypsy_new_gypsy()

◆ vehicle_gypsy_open()

static void vehicle_gypsy_open ( struct vehicle_priv priv)
static

Open a connection to gypsy. Will re-try the connection if it fails.

Parameters
priv
Returns
nothing

References vehicle_priv::retry_interval, vehicle_priv::retry_timer, and vehicle_gypsy_try_open().

Referenced by vehicle_gypsy_new_gypsy().

◆ vehicle_gypsy_position_attr_get()

static int vehicle_gypsy_position_attr_get ( struct vehicle_priv priv,
enum attr_type  type,
struct attr attr 
)
static

Provide the outside with information.

Parameters
priv
typeTODO: What can this be?
attr
Returns
true/false

◆ vehicle_gypsy_position_changed()

static void vehicle_gypsy_position_changed ( GypsyPosition *  position,
GypsyPositionFields  fields_set,
int  timestamp,
double  latitude,
double  longitude,
double  altitude,
gpointer  userdata 
)
static

When the position has changed, this function get called.

The fields_set can hold: GYPSY_POSITION_FIELDS_NONE = 1 << 0, GYPSY_POSITION_FIELDS_LATITUDE = 1 << 1, GYPSY_POSITION_FIELDS_LONGITUDE = 1 << 2, GYPSY_POSITION_FIELDS_ALTITUDE = 1 << 3

If we get any new information, we have to call the global callback.

Parameters
positionThe GypsyPosition
fields_setBitmask indicating what field was set
timestampthe time since Unix Epoch
latitude
longitude
altitude
userdata
Returns
nothing

References vehicle_priv::altitude, callback_list_call_attr_0, vehicle_priv::cb, vehicle_priv::cbl, vehicle_priv::fix_time, vehicle_priv::geo, vehicle_priv::have_cords, vehicle_priv::height, coord_geo::lat, coord_geo::lng, and vehicle_last.

Referenced by vehicle_gypsy_try_open().

◆ vehicle_gypsy_satellite_changed()

static void vehicle_gypsy_satellite_changed ( GypsySatellite *  satellite,
GPtrArray *  satellites,
gpointer  userdata 
)
static

Everytime any Sat-Details are changed, this function get called.

Going through all Sats, counting those wich are in use.

Anytime this functions get called, we have to call the global callback.

Parameters
satelliteThe GypsySatellite
satellitesAn GPtrArray wich hold information of all sats
userdata
Returns
nothing

References callback_list_call_attr_0, vehicle_priv::cbl, vehicle_priv::satellites, vehicle_priv::sats, vehicle_priv::sats_used, and vehicle_last.

Referenced by vehicle_gypsy_try_open().

◆ vehicle_gypsy_try_open()

static gboolean vehicle_gypsy_try_open ( gpointer *  data)
static

Attempt to open the gypsy device.

Tells gypsy wich functions to call when anything occours.

Parameters
data
Returns
TRUE to try again; FALSE if retry not required

References vehicle_priv::control, vehicle_priv::course, data, dbg, vehicle_priv::device, lvl_debug, vehicle_priv::path, vehicle_priv::position, vehicle_priv::satellite, vehicle_priv::source, vehicle_gypsy_course_changed(), vehicle_gypsy_fixstatus_changed(), vehicle_gypsy_position_changed(), vehicle_gypsy_satellite_changed(), and vehicle_last.

Referenced by vehicle_gypsy_open().

Variable Documentation

◆ accuracy

int vehicle_priv::accuracy

Referenced by print_location().

◆ bla

char* vehicle_priv::bla

◆ client

GClueClient* client = NULL

◆ control

GypsyControl* vehicle_priv::control

◆ course

GypsyCourse* vehicle_priv::course

◆ device

GypsyDevice* vehicle_priv::device

◆ have_cords

int vehicle_priv::have_cords

◆ location

GClueLocation* vehicle_priv::location

Referenced by print_location().

◆ path

char* vehicle_priv::path

◆ position

GypsyPosition* vehicle_priv::position

◆ retry_timer

guint vehicle_priv::retry_timer

◆ satellite

GypsySatellite* vehicle_priv::satellite

◆ simple

GClueSimple* vehicle_priv::simple

◆ time_str

char* vehicle_priv::time_str

Referenced by print_location().

◆ vehicle_geoclue_methods

struct vehicle_methods vehicle_geoclue_methods
Initial value:
= {
.position_attr_get = vehicle_geoclue_position_attr_get,
}
static int vehicle_geoclue_position_attr_get(struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
Provide the outside with information.
Definition: vehicle_geoclue.c:162
static void vehicle_geoclue_destroy(struct vehicle_priv *priv)
Free the geoclue_vehicle.
Definition: vehicle_geoclue.c:63

Referenced by vehicle_geoclue_new().

◆ vehicle_gypsy_methods

struct vehicle_methods vehicle_gypsy_methods
Initial value:
= {
}
static int vehicle_gypsy_position_attr_get(struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
Provide the outside with information.
Definition: vehicle_gypsy.c:348
static void vehicle_gypsy_destroy(struct vehicle_priv *priv)
Free the gypsy_vehicle.
Definition: vehicle_gypsy.c:333

Referenced by vehicle_gypsy_new_gypsy().

◆ vehicle_last