navit
0.5.3-trunk
|
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"
Data Structures | |
struct | traffic_priv |
Stores information about the plugin instance. More... | |
Functions | |
struct traffic_message ** | traffic_dummy_get_messages (struct traffic_priv *this_) |
Returns a dummy traffic report. More... | |
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. More... | |
void | plugin_init (void) |
Initializes the traffic plugin. More... | |
Variables | |
static struct traffic_methods | traffic_dummy_meth |
The methods implemented by this plugin. More... | |
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.
void plugin_init | ( | void | ) |
Initializes the traffic plugin.
The plugin entry point.
This function is called once on startup.
References dbg, lvl_debug, and traffic_dummy_new().
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.
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. References traffic_location::at, event_class_congestion, event_congestion_queue, event_congestion_slow_traffic, traffic_location::from, location_dir_one, location_fuzziness_low_res, location_ramps_none, traffic_priv::reports_requested, traffic_location::to, traffic_location_new(), traffic_message_new_cancellation(), traffic_message_new_single_event(), traffic_point_new(), and traffic_location::via.
|
static |
Registers a new dummy traffic plugin.
nav | The navit instance |
meth | Receives the traffic methods |
attrs | The attributes for the map |
cbl |
traffic_priv
structure for the plugin instance References dbg, lvl_debug, and traffic_dummy_meth.
Referenced by plugin_init().
|
static |
The methods implemented by this plugin.
Referenced by traffic_dummy_new().