navit  0.5.6
About: NavIt is a car navigation system with GPS tracking and a routing engine.
  Fossies Dox: navit-0.5.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

traffic_dummy.c File Reference

A dummy traffic plugin. More...

#include <string.h>
#include <time.h>
#include "glib_slice.h"
#include "config.h"
#include "coord.h"
#include "item.h"
#include "xmlconfig.h"
#include "traffic.h"
#include "plugin.h"
#include "debug.h"
Include dependency graph for traffic_dummy.c:

Go to the source code of this file.

Data Structures

struct  traffic_priv
 Stores information about the plugin instance. More...


struct traffic_message ** traffic_dummy_get_messages (struct traffic_priv *this_)
 Returns a dummy traffic report. More...
static struct traffic_privtraffic_dummy_new (struct navit *nav, struct traffic_methods *meth, struct attr **attrs, struct callback_list *cbl)
 Registers a new dummy traffic plugin. More...
void module_MODULE_init (void)
 Initializes the traffic plugin. More...


static struct traffic_methods traffic_dummy_meth
 The methods implemented by this plugin. More...

Detailed Description

A dummy traffic plugin.

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

This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.

You should have received a copy of the GNU 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.

This is a dummy plugin to test the traffic framework.

Definition in file traffic_dummy.c.

Function Documentation

◆ module_MODULE_init()

void module_MODULE_init ( void  )

Initializes the traffic plugin.

register vehicle_gypsy

This function is called once on startup.

Definition at line 187 of file traffic_dummy.c.

References dbg, lvl_debug, and traffic_dummy_new().

◆ traffic_dummy_get_messages()

struct traffic_message ** traffic_dummy_get_messages ( struct traffic_priv this_)

Returns a dummy traffic report.

This method will report two messages when first called: The messages indicate queuing traffic on the A9 Munich–Nuremberg between Neufahrn and Allershausen, and slow traffic on the A96 Lindau–Munich between Gräfelfing and München-Laim.

The 10th call will report an update message for the A9 (with a recent timestamp but otherwise the same data) and a cancellation message for the A96.

They mimic TMC messages in that coordinates are approximate, TMC identifiers are supplied for the locations and extra data fields which can be inferred from the TMC location table are filled. The timestamps indicate a message that has just been received for the first time, i.e. its “first received” and “last updated” timestamps match and are recent. Expiration is after 20 seconds for messages in the first feed and 10 seconds for messages in the first feed (far below the lowest expiration timespan permitted in TMC).

All other calls to this method will return NULL, indicating that there are no messages to report.

A NULL-terminated pointer array. Each element points to one struct traffic_message. NULL is returned (rather than an empty pointer array) if there are no messages to report.

Definition at line 75 of file traffic_dummy.c.

References traffic_location::at, event_class_congestion, event_congestion_queue, event_congestion_slow_traffic, traffic_location::from, g_new0, location_dir_one, location_fuzziness_low_res, location_ramps_none, NULL, traffic_priv::reports_requested, time(), traffic_location::to, traffic_location_new(), traffic_message_new_cancellation(), traffic_message_new_single_event(), traffic_point_new(), and traffic_location::via.

◆ traffic_dummy_new()

static struct traffic_priv* traffic_dummy_new ( struct navit nav,
struct traffic_methods meth,
struct attr **  attrs,
struct callback_list cbl 

Registers a new dummy traffic plugin.

navThe navit instance
methReceives the traffic methods
attrsThe attributes for the map
A pointer to a traffic_priv structure for the plugin instance

Definition at line 170 of file traffic_dummy.c.

References dbg, g_new0, lvl_debug, and traffic_dummy_meth.

Referenced by module_MODULE_init().

Variable Documentation

◆ traffic_dummy_meth

struct traffic_methods traffic_dummy_meth
Initial value:
= {
#define NULL
Definition: explodename.c:34
struct traffic_message ** traffic_dummy_get_messages(struct traffic_priv *this_)
Returns a dummy traffic report.
Definition: traffic_dummy.c:75

The methods implemented by this plugin.

Definition at line 75 of file traffic_dummy.c.

Referenced by traffic_dummy_new().