1 /** @file vehicle_null.c
2 * @brief null uses dbus signals
4 * Navit, a modular navigation system.
5 * Copyright (C) 2005-2008 Navit Team
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
21 * @Author Tim Niemeyer <reddog@mastersword.de>
38 struct callback_list *cbl;
54 * @brief Free the null_vehicle
60 vehicle_null_destroy(struct vehicle_priv *priv)
67 * @brief Provide the outside with information
70 * @param type TODO: What can this be?
75 vehicle_null_position_attr_get(struct vehicle_priv *priv,
76 enum attr_type type, struct attr *attr)
78 dbg(1,"enter %s\n",attr_to_name(type));
81 case attr_position_fix_type:
82 attr->u.num = priv->fix_type;
85 case attr_position_height:
86 attr->u.numd = &priv->height;
88 case attr_position_speed:
89 attr->u.numd = &priv->speed;
91 case attr_position_direction:
92 attr->u.numd = &priv->direction;
94 case attr_position_radius:
95 attr->u.numd = &priv->radius;
99 case attr_position_qual:
100 attr->u.num = priv->sats;
102 case attr_position_sats_used:
103 attr->u.num = priv->sats_used;
106 case attr_position_coord_geo:
107 attr->u.coord_geo = &priv->geo;
108 if (!priv->have_coords)
111 case attr_position_time_iso8601:
112 attr->u.str=priv->fixiso8601;
123 vehicle_null_set_attr(struct vehicle_priv *priv, struct attr *attr)
125 switch (attr->type) {
126 case attr_position_speed:
127 priv->speed=*attr->u.numd;
129 case attr_position_direction:
130 priv->direction=*attr->u.numd;
132 case attr_position_coord_geo:
133 priv->geo=*attr->u.coord_geo;
138 callback_list_call_attr_0(priv->cbl, attr->type);
143 struct vehicle_methods vehicle_null_methods = {
144 vehicle_null_destroy,
145 vehicle_null_position_attr_get,
146 vehicle_null_set_attr,
150 * @brief Create null_vehicle
155 * @returns vehicle_priv
157 static struct vehicle_priv *
158 vehicle_null_new_null(struct vehicle_methods *meth,
159 struct callback_list *cbl,
162 struct vehicle_priv *ret;
165 ret = g_new0(struct vehicle_priv, 1);
167 *meth = vehicle_null_methods;
173 * @brief register vehicle_null
181 plugin_register_vehicle_type("null", vehicle_null_new_null);