navit  0.5.3-trunk
navigation.h File Reference

Go to the source code of this file.

Macros

#define FEET_PER_METER   3.2808399
 
#define FEET_PER_MILE   5280
 
#define KILOMETERS_TO_MILES   0.62137119 /* Kilometers to miles */
 
#define METERS_TO_MILES   (KILOMETERS_TO_MILES/1000.0) /* Meters to miles */
 
#define MPS_TO_KPH   3.6
 

Enumerations

enum  nav_status {
  status_invalid = -2 , status_no_route = -1 , status_no_destination = 0 , status_position_wait = 1 ,
  status_calculating = 2 , status_recalculating = 3 , status_routing = 4
}
 

Functions

char * nav_status_to_text (int status)
 Converts navigation status to human-readable text. More...
 
int navigation_get_attr (struct navigation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 
int navigation_set_attr (struct navigation *this_, struct attr *attr)
 
struct navigationnavigation_new (struct attr *parent, struct attr **attrs)
 
int navigation_set_announce (struct navigation *this_, enum item_type type, int *level)
 
void navigation_destroy (struct navigation *this_)
 
int navigation_register_callback (struct navigation *this_, enum attr_type type, struct callback *cb)
 Registers a new callback function. More...
 
void navigation_unregister_callback (struct navigation *this_, enum attr_type type, struct callback *cb)
 Unregisters a callback function. More...
 
struct mapnavigation_get_map (struct navigation *this_)
 
void navigation_set_route (struct navigation *this_, struct route *route)
 
void navigation_init (void)
 

Macro Definition Documentation

◆ FEET_PER_METER

#define FEET_PER_METER   3.2808399

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation.

This program 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 Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

◆ FEET_PER_MILE

#define FEET_PER_MILE   5280

◆ KILOMETERS_TO_MILES

#define KILOMETERS_TO_MILES   0.62137119 /* Kilometers to miles */

◆ METERS_TO_MILES

#define METERS_TO_MILES   (KILOMETERS_TO_MILES/1000.0) /* Meters to miles */

◆ MPS_TO_KPH

#define MPS_TO_KPH   3.6

Enumeration Type Documentation

◆ nav_status

enum nav_status

Values for the

nav_status
Definition: navigation.h:45

attribute

Enumerator
status_invalid 

Status is unknown. The

nav_status

attribute will never return this value but code that listens to changes to this attribute may use this value as a placeholder until the first actual status has been obtained.

status_no_route 

No route was found

status_no_destination 

No destination set, not routing

status_position_wait 

Destination is set but current position is unknown

status_calculating 

A new route is being calculated and turn instructions are being generated

status_recalculating 

The existing route is being recalculated, along with its turn instructions. Note that as the vehicle follows a route, status will flip between

status_routing

and

status_recalculating

with every position update.

status_routing 

A route with turn instructions has been calculated and the user is being guided along it

Function Documentation

◆ nav_status_to_text()

char* nav_status_to_text ( int  status)

Converts navigation status to human-readable text.

Parameters
Thestatus. This must be one of the values for .
Returns
A string which corresponds to the constant value. The caller is responsible for calling
g_free()
when the result is no longer needed.

References status_calculating, status_invalid, status_no_destination, status_no_route, status_position_wait, status_recalculating, and status_routing.

Referenced by attr_to_text_ext(), and osd_navigation_status_draw_do().

◆ navigation_destroy()

◆ navigation_get_attr()

◆ navigation_get_map()

◆ navigation_init()

void navigation_init ( void  )

Referenced by main_real().

◆ navigation_new()

◆ navigation_register_callback()

int navigation_register_callback ( struct navigation this_,
enum attr_type  type,
struct callback cb 
)

Registers a new callback function.

Callback functions are called whenever the attribute for which they are registered changes. It is possible to register callbacks for

attr_any

, which will fire on any change.

The

Definition: navigation.c:161

object has three callback lists. They differ by the arguments which are passed to the callback function and are selected based on the attribute type:

  • Callbacks for the
    navigation_speech
    attribute are added to the
    callback_speech
    list.
  • Callbacks for the
    navigation_long
    attribute are added to the
    Definition: callback.c:27
    list.
  • Callbacks for any other attribute, including
    attr_any
    , are added to the list stored in the
    Definition: callback.c:37
    attribute. This functionality is inherited from
    Definition: xmlconfig.h:122
    .
Parameters
this_The navigation object.
typeThe attribute type
cbThe callback function
Returns
true on success, false on failure

References navigation::callback, attr::callback_list, callback_list_add(), navigation::callback_speech, navigation_get_attr(), type, and attr::u.

Referenced by navit_init(), navit_window_roadbook_new(), osd_navigation_status_init(), and traffic_traff_android_init().

◆ navigation_set_announce()

int navigation_set_announce ( struct navigation this_,
enum item_type  type,
int *  level 
)

◆ navigation_set_attr()

int navigation_set_attr ( struct navigation this_,
struct attr attr 
)

◆ navigation_set_route()

◆ navigation_unregister_callback()

void navigation_unregister_callback ( struct navigation this_,
enum attr_type  type,
struct callback cb 
)

Unregisters a callback function.

This function removes a previously registered callback function from the callback list to which it was added. See the documentation on navigation_register_callback(struct navigation *, enum attr_type, struct callback *) for details on callback lists.

Parameters
this_The navigation object.
typeThe attribute type
cbThe callback function

References navigation::callback, attr::callback_list, callback_list_remove(), navigation::callback_speech, navigation_get_attr(), type, and attr::u.

Referenced by navit_window_roadbook_destroy().