navit  0.5.3-trunk
vehicle_android.c File Reference
#include <config.h>
#include <string.h>
#include <glib.h>
#include <math.h>
#include <time.h>
#include "debug.h"
#include "callback.h"
#include "plugin.h"
#include "coord.h"
#include "item.h"
#include "android.h"
#include "vehicle.h"

Data Structures

struct  vehicle_priv
 

Functions

static void vehicle_android_destroy (struct vehicle_priv *priv)
 Free the android_vehicle. More...
 
static int vehicle_android_position_attr_get (struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
 Retrieves a vehicle attribute. More...
 
static void vehicle_android_position_callback (struct vehicle_priv *v, jobject location)
 Called when a new position has been reported. More...
 
static void vehicle_android_status_callback (struct vehicle_priv *v, int sats_in_view, int sats_used)
 Called when a new GPS status has been reported. More...
 
static void vehicle_android_fix_callback (struct vehicle_priv *v, int fix_type)
 Called when a change in GPS fix status has been reported. More...
 
static int vehicle_android_init (struct vehicle_priv *ret)
 Initializes an Android vehicle. More...
 
static struct vehicle_privvehicle_android_new_android (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)
 Create android_vehicle. More...
 
void plugin_init (void)
 register vehicle_android More...
 

Variables

struct vehicle_methods vehicle_android_methods
 

Function Documentation

◆ plugin_init()

void plugin_init ( void  )

register vehicle_android

The plugin entry point.

Returns
nothing

References dbg, lvl_debug, and vehicle_android_new_android().

◆ vehicle_android_destroy()

static void vehicle_android_destroy ( struct vehicle_priv priv)
static

Free the android_vehicle.

Parameters
privvehicle_priv structure for the vehicle
Returns
nothing

References dbg, and lvl_debug.

◆ vehicle_android_fix_callback()

static void vehicle_android_fix_callback ( struct vehicle_priv v,
int  fix_type 
)
static

Called when a change in GPS fix status has been reported.

This function is called by

NavitLocationListener

upon receiving a new

android.location.GPS_FIX_CHANGE

broadcast.

Parameters
vThe
struct_vehicle_priv
for the vehicle
fix_typeThe fix type (1 = valid, 0 = invalid)

References attr_position_valid_extrapolated_time, attr_position_valid_valid, callback_list_call_attr_0, vehicle_priv::cbl, vehicle_priv::fix_type, and vehicle_priv::valid.

Referenced by vehicle_android_new_android().

◆ vehicle_android_init()

◆ vehicle_android_new_android()

◆ vehicle_android_position_attr_get()

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

Retrieves a vehicle attribute.

Parameters
privvehicle_priv structure for the vehicle
typeThe attribute type to retrieve
attrPoints to an attr structure that will receive the attribute data
Returns
True for success, false for failure

◆ vehicle_android_position_callback()

static void vehicle_android_position_callback ( struct vehicle_priv v,
jobject  location 
)
static

◆ vehicle_android_status_callback()

static void vehicle_android_status_callback ( struct vehicle_priv v,
int  sats_in_view,
int  sats_used 
)
static

Called when a new GPS status has been reported.

This function is called by

NavitLocationListener

upon receiving a new

GpsStatus

.

Note that

sats_used

should not be used to determine whether the vehicle's position is valid: some devices report non-zero numbers even when they do not have a fix. Position validity should be determined in

static void vehicle_android_fix_callback(struct vehicle_priv *v, int fix_type)
Called when a change in GPS fix status has been reported.
Definition: vehicle_android.c:198

(an invalid fix type means we have lost the fix) and

static void vehicle_android_position_callback(struct vehicle_priv *v, jobject location)
Called when a new position has been reported.
Definition: vehicle_android.c:143

(receiving a position means we have a fix).

Parameters
vThe
struct_vehicle_priv
for the vehicle
sats_in_viewThe number of satellites in view
sats_usedThe number of satellites currently used to determine the position

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

Referenced by vehicle_android_new_android().

Variable Documentation

◆ vehicle_android_methods

struct vehicle_methods vehicle_android_methods
Initial value:
= {
}
static int vehicle_android_position_attr_get(struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
Retrieves a vehicle attribute.
Definition: vehicle_android.c:86
static void vehicle_android_destroy(struct vehicle_priv *priv)
Free the android_vehicle.
Definition: vehicle_android.c:73

Referenced by vehicle_android_new_android().