navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
Vehicle File

The Vehicle to gain position data from a file, pipe, serial interface or a socket. More...

Data Structures

struct  gps_sat
 
struct  vehicle_priv
 

Enumerations

enum  file_type {
  file_type_pipe = 1, file_type_device, file_type_file, file_type_socket,
  file_type_serial, file_type_pipe = 1, file_type_device, file_type_file,
  file_type_socket
}
 

Functions

static void vehicle_file_disable_watch (struct vehicle_priv *priv)
 Disable watch. More...
 
static void vehicle_file_enable_watch (struct vehicle_priv *priv)
 Enable watch. More...
 
static int vehicle_file_parse (struct vehicle_priv *priv, char *buffer)
 Parse the buffer. More...
 
static int vehicle_file_open (struct vehicle_priv *priv)
 Callback of the plugin. More...
 
static void vehicle_file_close (struct vehicle_priv *priv)
 Close dialogue with the GPS. More...
 
static int vehicle_file_enable_watch_timer (struct vehicle_priv *priv)
 Enable watch timer to get GPS data. More...
 
static void vehicle_file_fix_timeout_cb (struct vehicle_priv *priv)
 This is a callback function, called when the fix timeout is done. Set the position to invalid. More...
 
static void vehicle_file_restart_fix_timeout (struct vehicle_priv *priv)
 Cancel previous fix timeout event and add a new one. More...
 
static void vehicle_file_io (struct vehicle_priv *priv)
 Function to get data from GPS. More...
 
static void vehicle_file_destroy (struct vehicle_priv *priv)
 Function called to uninitialize the plugin. More...
 
static int vehicle_file_position_attr_get (struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
 Function called to get attribute. More...
 
static int vehicle_file_sat_attr_get (void *priv_data, enum attr_type type, struct attr *attr)
 Function called to get satellite attribute. More...
 
static struct vehicle_privvehicle_file_new_file (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs)
 Function called to initialize the plugin. More...
 
void plugin_init (void)
 Initialisation of vehicle_file plugin. More...
 

Variables

static int buffer_size = 1024
 
int gps_sat::prn
 
int gps_sat::elevation
 
int gps_sat::azimuth
 
int gps_sat::snr
 
char * vehicle_priv::source
 
struct callback_listvehicle_priv::cbl
 
int vehicle_priv::fd
 
struct callbackvehicle_priv::cb
 
struct callbackvehicle_priv::cbt
 
struct callbackvehicle_priv::cb_fix_timeout
 
char * vehicle_priv::buffer
 
int vehicle_priv::buffer_pos
 
char * vehicle_priv::nmea_data
 
char * vehicle_priv::nmea_data_buf
 
struct coord_geo vehicle_priv::geo
 
double vehicle_priv::speed
 
double vehicle_priv::direction
 
double vehicle_priv::height
 
double vehicle_priv::hdop
 
double vehicle_priv::vdop
 
char vehicle_priv::fixtime [20]
 
int vehicle_priv::fixyear
 
int vehicle_priv::fixmonth
 
int vehicle_priv::fixday
 
int vehicle_priv::status
 
int vehicle_priv::sats_used
 
int vehicle_priv::sats_visible
 
int vehicle_priv::sats_signal
 
int vehicle_priv::time
 
int vehicle_priv::on_eof
 
enum file_type vehicle_priv::file_type
 
FILE * vehicle_priv::file
 
struct event_watchvehicle_priv::watch
 
struct event_timeoutvehicle_priv::ev_fix_timeout
 
speed_t vehicle_priv::baudrate
 
struct attr ** vehicle_priv::attrs
 
char vehicle_priv::fixiso8601 [128]
 
int vehicle_priv::checksum_ignore
 
int vehicle_priv::magnetic_direction
 
int vehicle_priv::current_count
 
struct gps_sat vehicle_priv::current [24]
 
int vehicle_priv::next_count
 
struct gps_sat vehicle_priv::next [24]
 
struct item vehicle_priv::sat_item
 
int vehicle_priv::valid
 
char * vehicle_priv::statefile
 
int vehicle_priv::process_statefile
 
static struct item_methods vehicle_file_sat_methods
 
static struct vehicle_methods vehicle_file_methods
 

Detailed Description

The Vehicle to gain position data from a file, pipe, serial interface or a socket.

Enumeration Type Documentation

enum file_type
Enumerator
file_type_pipe 
file_type_device 
file_type_file 
file_type_socket 
file_type_serial 
file_type_pipe 
file_type_device 
file_type_file 
file_type_socket 

Function Documentation

void plugin_init ( void  )

Initialisation of vehicle_file plugin.

The plugin entry point.

References dbg, lvl_debug, and vehicle_file_new_file().

static void vehicle_file_close ( struct vehicle_priv priv)
static

Close dialogue with the GPS.

Parameters
privPointer on the private data of the plugin

References callback_destroy(), dbg, vehicle_priv::fd, vehicle_priv::file, vehicle_priv::file_type, file_type_serial, lvl_debug, and vehicle_file_disable_watch().

Referenced by vehicle_file_destroy(), and vehicle_file_io().

static void vehicle_file_destroy ( struct vehicle_priv priv)
static

Function called to uninitialize the plugin.

Parameters
privPointer on the private data of the plugin
Remarks
private data is freed by this function (g_free)

References attr::attrs, vehicle_priv::buffer, callback_destroy(), vehicle_priv::cb, vehicle_priv::cbt, file::f, file_create(), file_data_write(), file_destroy(), file_fsync(), vehicle_priv::nmea_data, attr::num, vehicle_priv::source, vehicle_priv::statefile, attr::u, and vehicle_file_close().

static void vehicle_file_disable_watch ( struct vehicle_priv priv)
static

Disable watch.

Parameters
privPointer on the private data of the plugin

_WIN32

References dbg, event_remove_timeout(), event_remove_watch(), vehicle_priv::file_type, file_type_serial, lvl_debug, and vehicle_priv::watch.

Referenced by vehicle_file_close(), vehicle_file_io(), and vehicle_file_parse().

static void vehicle_file_enable_watch ( struct vehicle_priv priv)
static
static int vehicle_file_enable_watch_timer ( struct vehicle_priv priv)
static

Enable watch timer to get GPS data.

Parameters
privPointer on the private data of the plugin
Returns
Always 0

References dbg, FALSE, lvl_debug, and vehicle_file_enable_watch().

Referenced by vehicle_file_new_file().

static void vehicle_file_fix_timeout_cb ( struct vehicle_priv priv)
static

This is a callback function, called when the fix timeout is done. Set the position to invalid.

Parameters
privPointer on the private data of the plugin

References attr_position_valid_invalid, callback_list_call_attr_0, vehicle_priv::cbl, vehicle_priv::ev_fix_timeout, and vehicle_priv::valid.

Referenced by vehicle_file_new_file().

static int vehicle_file_open ( struct vehicle_priv priv)
static

Callback of the plugin.

Parameters
privPointer on the private data of the plugin
Returns
Always 1 Open dialogue with the GPS
Parameters
privPointer on the private data of the plugin
Returns
1 if ok, 0 if error

_WIN32

_WIN32

References vehicle_priv::baudrate, callback_cast, callback_new_1, dbg, vehicle_priv::fd, vehicle_priv::file, file_is_reg(), vehicle_priv::file_type, file_type_device, file_type_file, file_type_pipe, file_type_serial, file_type_socket, lvl_error, lvl_info, lvl_warning, name, p, and vehicle_priv::source.

Referenced by vehicle_file_io(), and vehicle_file_new_file().

static int vehicle_file_position_attr_get ( struct vehicle_priv priv,
enum attr_type  type,
struct attr attr 
)
static
static void vehicle_file_restart_fix_timeout ( struct vehicle_priv priv)
static

Cancel previous fix timeout event and add a new one.

Parameters
privPointer on the private data of the plugin

References vehicle_priv::cb_fix_timeout, vehicle_priv::ev_fix_timeout, event_add_timeout(), and event_remove_timeout().

Referenced by vehicle_file_parse().

static int vehicle_file_sat_attr_get ( void *  priv_data,
enum attr_type  type,
struct attr attr 
)
static

Function called to get satellite attribute.

Parameters
privPointer on the private data of the plugin
typeAttribute type called
attrStructure to return the attribute value
Returns
1 if ok, 0 for unknown attribute

References gps_sat::azimuth, vehicle_priv::current, vehicle_priv::current_count, gps_sat::elevation, item::id_lo, attr::num, gps_sat::prn, vehicle_priv::sat_item, gps_sat::snr, type, attr::type, and attr::u.

Variable Documentation

speed_t vehicle_priv::baudrate
int vehicle_priv::buffer_pos
int buffer_size = 1024
static
int vehicle_priv::checksum_ignore
FILE* vehicle_priv::file
struct gps_sat vehicle_priv::next
int vehicle_priv::next_count
char * vehicle_priv::nmea_data_buf
int vehicle_priv::process_statefile
char* vehicle_priv::statefile
double vehicle_priv::vdop
struct vehicle_methods vehicle_file_methods
static
Initial value:
= {
}
static int vehicle_file_position_attr_get(struct vehicle_priv *priv, enum attr_type type, struct attr *attr)
Function called to get attribute.
Definition: vehicle_file.c:848
static void vehicle_file_destroy(struct vehicle_priv *priv)
Function called to uninitialize the plugin.
Definition: vehicle_file.c:810

Referenced by vehicle_file_new_file().

struct item_methods vehicle_file_sat_methods
static
Initial value:
= {
NULL,
NULL,
NULL,
}
static int vehicle_file_sat_attr_get(void *priv_data, enum attr_type type, struct attr *attr)
Function called to get satellite attribute.
Definition: vehicle_file.c:926

Referenced by vehicle_file_new_file().