summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2017-11-26 22:17:14 +0100
committermvglasow <michael -at- vonglasow.com>2017-11-26 22:17:14 +0100
commit6e96e7f385980f4ad6d87841c6897967501468e5 (patch)
tree4631dcea02d629c0ee68b76d920539b501ec91cc
parentdfbf46e7b371f9cd398b6ca9c884abbe8de57c81 (diff)
parent7030908f604d268cf38baee920fe66e98da8ec72 (diff)
downloadnavit-6e96e7f385980f4ad6d87841c6897967501468e5.tar.gz
Merge branch 'trunk' into doc
-rw-r--r--CHANGELOG.md110
-rw-r--r--ChangeLog4
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java21
-rw-r--r--navit/vehicle/file/vehicle_file.c320
-rw-r--r--navit/vehicle/wince/vehicle_wince.c104
5 files changed, 387 insertions, 172 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..bd2cdf1c1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,110 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+
+Changes and documentation about Navit can be found in the wiki at:
+ http://wiki.navit-project.org
+A timeline of opened and closed issue tickets can be found at our trac instance:
+ http://trac.navit-project.org
+
+Navit follows the semantic versioning:
+* `x.y.Z` (patch): only bug fixes or refactoring, no changes in functionality
+* `x.Y.z` (minor): added or changed functionality but can be used as a drop-in
+ replacement for the previous version (all data formats and interfaces are still
+ supported); minor UI changes (such as moving individual menu items) are also
+ allowed
+* X.y.z (major): at least one of the following:
+ * Major new functionality (such as Augmented Reality, inertial navigation or
+ support for live traffic services): de-facto standard for end-user apps
+ * New user interface (such as moving from the old pulldown menu UI to the Internal
+ GUI): this is definitely the UI equivalent of a breaking API change
+ * Dropped support for a data format or interface: also a breaking change and
+ usually tends to occur along with larger changes which would warrant a new major
+ version anyway
+
+## [Unreleased]
+
+The list of changes that happened between the release 0.5.0 and the creation of
+this changelog is too long to fit there so only a subset has been put here.
+
+For the full list of changes, see [Github full commit list](https://github.com/navit-gps/navit/compare/v0.5.0...HEAD)
+
+
+### Added
+- core: Allow zipcode or town seamless search (#211)
+- core: Add feature poly_reservoir (#251)
+- core: Add grass, grassland, wetland and sand (#247)
+- core: Add poly_basin (#248)
+- gui_internal: Add auto zoom toggle to gui_internal (#237)
+- gui_internal: Add network info menu in gui/internal for Linux (#228)
+- graphics: RaspberryPI hardware accelerated graphics support (#208)
+- graphics: Add Qt5 support
+- graphics: add multiple icons
+- gtk: Add menu entry to toggle vehicle tracking (#362)
+- espeak: Add speech module using espeak on QMultimedia. (#233)
+- contrib/sailfish: Add rules to build sailfish package (#221)
+- contrib/sailfish: Add autozoom switch to sailfosh config (#238)
+- contrib/sailfish: Add desktop icons in sizes required by Sailfish OS. (#220)
+- install: Allow unusual building (#215)
+- doc: Improved follow vehicle toggle doc function for GTK (#363)
+- doc: Added download links for PlayStore and F-Droid in the README
+- ci: Added automatic publishing to Playstore Beta
+
+### Changed
+
+- core: Removed autotools lefotover (#204)
+- core: sunrise near poles simplification (#206)
+- core: keep active vehicle profile when deactivating vehicle (#217)
+- core: Hide impossible keys at the internal keyboard instead of highlighting the possible ones (leftover from PR5) (#210)
+- core: Reduce POST_SHIFT to avoid int overflow
+- core: Remove dependency on OpenSSL
+- port/android: ask permissions on sdk >= 23
+- i18n: Update of about all the translations available for the software
+- ci: Updated the CI builds and tests
+- ci: update zlib to 1.2.11
+- doc: Added some usage images to the README.md
+
+### Fixed
+- port/android:moved Taiwan into its own map download entry #348
+- maptool:Remove option -5 (MD5 checksum) from maptool
+- gtk: fixed missing imperial units in the GTK ui (#359)
+- core: Remove binfile map encryption support
+- core: Fix iPhone build broken by plugin refactoring
+- core: Fix Car layout issues with wood and water (#240)
+- core: TRAC-1246: Draw background color even if text label is empty. (#234)
+- core: TRAC-981: Add Align-Attr to osd type Odometer (#230)
+- core: navigation_analyze_roundabout : central_angle may lead to division by 0 (#218)
+- core: Fix POI toggle bug with Car-dark layout (#223)
+- core: TRAC-1347 Add 'Follow' and 'Active' to vehicle_demo to remove the corresponding error messages (Unsupported Attribute) (#229)
+- gui_internal: Rename new option to hide_impossible_next_keys
+- gui_internal: Don't crash if LANG environment not set (#232)
+- xml:Change colors for wetland in Car and Car-dark (#257)
+- port/android: Fix "invalid DT_NEEDED" warnings on API 23+, fixes #1348 (#205)
+- port/android: Fix apk signing and bump sdk to 25 - nougat (#209)
+- port/android: Fix #1345 crash on Android
+- port/android: TRAC-1071 'Toggle POIs' button also toggle POI labels (#226)
+- ci: Tomtom:Switching to mirrored toolchain
+
+### Removed
+
+## [0.5.0] - 2015-12-31
+
+This release was done before the adoption of this changelog format. Click
+[here](https://github.com/navit-gps/navit/compare/v0.5.0-rc.2...v0.5.0)
+to view the corresponding changes.
+
+## [0.5.0-rc2] - 2015-09-02
+
+This release was done before the adoption of this changelog format. Click
+[here](https://github.com/navit-gps/navit/compare/v0.5.0-rc.1...v0.5.0-rc.2)
+to view the corresponding changes.
+
+## [0.5.0-rc1] - 2015-08-08
+
+This release was done before the adoption of this changelog format. Click
+[here](https://github.com/navit-gps/navit/compare/v0.5.0-beta.1...v0.5.0-rc.1)
+to view the corresponding changes.
+
+[Unreleased]: https://github.com/navit-gps/navit/compare/v0.5.0...HEAD
+[0.5.0]: https://github.com/navit-gps/navit/compare/v0.5.0-rc.2...v0.5.0
+[0.5.0-rc.2]: https://github.com/navit-gps/navit/compare/v0.5.0-rc.1...v0.5.0-rc.2
+[0.5.0-rc.1]: https://github.com/navit-gps/navit/compare/v0.5.0-beta.1...v0.5.0-rc.1
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 411115f00..000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,4 +0,0 @@
-Changes and documentation about Navit can be found in the wiki at:
- http://wiki.navit-project.org
-A timeline of opened and closed issue tickets can be found at our trac instance:
- http://trac.navit-project.org
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
index d3b970e98..7505e7ff7 100644
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ b/navit/android/src/org/navitproject/navit/Navit.java
@@ -80,6 +80,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import android.support.v4.app.NotificationCompat;
public class Navit extends Activity
@@ -119,6 +120,7 @@ public class Navit extends Activity
public static final String NAVIT_PREFS = "NavitPrefs";
Boolean isFullscreen = false;
private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
+ public static NotificationManager nm;
/**
@@ -292,13 +294,17 @@ public class Navit extends Activity
// NOTIFICATION
// Setup the status bar notification
// This notification is removed in the exit() function
- NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
- Notification NavitNotification = new Notification(R.drawable.ic_notify, getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
+ nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
- //FIXME : needs a fix for sdk 23
- //NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
- //NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT; // Ensure that the notification appears in Ongoing
- nm.notify(R.string.app_name, NavitNotification); // Set the notification
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
+ builder.setContentIntent(appIntent);
+ builder.setAutoCancel(false).setOngoing(true);
+ builder.setContentTitle(getString(R.string.app_name));
+ builder.setContentText(getString(R.string.notification_event_default));
+ builder.setSmallIcon(R.drawable.ic_notify);
+ Notification NavitNotification = builder.build();
+ nm.notify(R.string.app_name, NavitNotification);// Show the notification
// Status and navigation bar sizes
// These are platform defaults and do not change with rotation, but we have to figure out which ones apply
@@ -906,8 +912,7 @@ public class Navit extends Activity
public void exit()
{
-// NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-// nm.cancel(R.string.app_name);
+ nm.cancelAll();
NavitVehicle.removeListener();
NavitDestroy();
}
diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c
index 10bce942b..affa05d24 100644
--- a/navit/vehicle/file/vehicle_file.c
+++ b/navit/vehicle/file/vehicle_file.c
@@ -84,7 +84,7 @@ struct vehicle_priv {
char *source;
struct callback_list *cbl;
int fd;
- struct callback *cb,*cbt;
+ struct callback *cb,*cbt,*cb_fix_timeout;
char *buffer;
int buffer_pos;
char *nmea_data;
@@ -114,6 +114,7 @@ struct vehicle_priv {
enum file_type file_type;
FILE *file;
struct event_watch *watch;
+ struct event_timeout *ev_fix_timeout;
speed_t baudrate;
struct attr ** attrs;
char fixiso8601[128];
@@ -129,16 +130,13 @@ struct vehicle_priv {
int process_statefile;
};
-//***************************************************************************
-/** @fn static int vehicle_win32_serial_track(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: Callback of the plugin
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-* @return always 1
-*****************************************************************************
-**/
+/**
+* @brief Callback of the plugin
+*
+* @param priv Pointer on the private data of the plugin
+*
+* @return Always 1
+*/
#ifdef _WIN32
static int vehicle_win32_serial_track(struct vehicle_priv *priv)
{
@@ -207,17 +205,13 @@ static int vehicle_win32_serial_track(struct vehicle_priv *priv)
}
#endif
-//***************************************************************************
-/** @fn static int vehicle_file_open(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: open dialogue with the GPS
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-* @return 1 if ok
-* 0 if error
-*****************************************************************************
-**/
+/**
+* @brief Open dialogue with the GPS
+*
+* @param priv Pointer on the private data of the plugin
+*
+* @return 1 if ok, 0 if error
+*/
static int
vehicle_file_open(struct vehicle_priv *priv)
{
@@ -318,14 +312,11 @@ vehicle_file_open(struct vehicle_priv *priv)
return(priv->fd != -1);
}
-//***************************************************************************
-/** @fn static void vehicle_file_close(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: close dialogue with the GPS
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-**/
+/**
+* @brief Close dialogue with the GPS
+*
+* @param priv Pointer on the private data of the plugin
+*/
static void
vehicle_file_close(struct vehicle_priv *priv)
{
@@ -356,16 +347,13 @@ vehicle_file_close(struct vehicle_priv *priv)
}
}
-//***************************************************************************
-/** @fn static int vehicle_file_enable_watch_timer(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: Enable watch timer to get GPS data
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-* @return always 0
-*****************************************************************************
-**/
+/**
+* @brief Enable watch timer to get GPS data
+*
+* @param priv Pointer on the private data of the plugin
+*
+* @return Always 0
+*/
static int
vehicle_file_enable_watch_timer(struct vehicle_priv *priv)
{
@@ -376,19 +364,44 @@ vehicle_file_enable_watch_timer(struct vehicle_priv *priv)
}
-//***************************************************************************
-/** @fn static int vehicle_file_parse( struct vehicle_priv *priv,
-* char *buffer)
-*****************************************************************************
-* @b Description: Parse the buffer
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-* @param buffer : data buffer (null terminated)
-*****************************************************************************
-* @return 1 if The GPRMC Sentence is found
-* 0 if not found
-*****************************************************************************
-**/
+/**
+* @brief This is a callback function, called when the fix timeout
+* is done. Set the position to invalid.
+*
+* @param priv Pointer on the private data of the plugin
+*/
+static void
+vehicle_file_fix_timeout_cb(struct vehicle_priv *priv)
+{
+ priv->valid = attr_position_valid_invalid;
+ priv->ev_fix_timeout = NULL;
+ callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
+}
+
+
+/**
+* @brief Cancel previous fix timeout event and add a new one
+*
+* @param priv Pointer on the private data of the plugin
+*/
+static void
+vehicle_file_restart_fix_timeout(struct vehicle_priv *priv)
+{
+ if (priv->ev_fix_timeout != NULL)
+ event_remove_timeout(priv->ev_fix_timeout);
+ priv->ev_fix_timeout = event_add_timeout(10000, 0, priv->cb_fix_timeout);
+}
+
+
+/**
+* @brief Parse the buffer
+*
+* @param priv Pointer on the private data of the plugin
+* @param buffer Data buffer (null terminated)
+*
+* @return 1 if new coords were received (fixtime changed) or changed to invalid,
+* 0 if not found
+*/
static int
vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
{
@@ -458,7 +471,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7],
HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14]
*/
- if (*item[2] && *item[3] && *item[4] && *item[5]) {
+ if (*item[2] && *item[3] && *item[4] && *item[5] && *item[6] > 0) {
lat = g_ascii_strtod(item[2], NULL);
priv->geo.lat = floor(lat / 100);
lat -= priv->geo.lat * 100;
@@ -474,20 +487,31 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
if (!g_ascii_strcasecmp(item[5],"W"))
priv->geo.lng=-priv->geo.lng;
- priv->valid=attr_position_valid_valid;
+
+ if (priv->valid == attr_position_valid_invalid)
+ ret = 1;
+ priv->valid = attr_position_valid_valid;
+ vehicle_file_restart_fix_timeout(priv);
+
+ if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) {
+ ret = 1;
+ strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
+ }
dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
- } else
+ } else {
+ if (priv->valid == attr_position_valid_valid)
+ ret = 1;
priv->valid=attr_position_valid_invalid;
+ }
+
if (*item[6])
sscanf(item[6], "%d", &priv->status);
if (*item[7])
sscanf(item[7], "%d", &priv->sats_used);
if (*item[8])
sscanf(item[8], "%lf", &priv->hdop);
- if (*item[1])
- strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
if (*item[9])
sscanf(item[9], "%lf", &priv->height);
@@ -537,8 +561,40 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
&priv->fixmonth,
&priv->fixyear);
priv->fixyear += 2000;
+
+ lat = g_ascii_strtod(item[3], NULL);
+ priv->geo.lat = floor(lat / 100);
+ lat -= priv->geo.lat * 100;
+ priv->geo.lat += lat / 60;
+
+ if (!g_ascii_strcasecmp(item[4],"S"))
+ priv->geo.lat=-priv->geo.lat;
+
+ lng = g_ascii_strtod(item[5], NULL);
+ priv->geo.lng = floor(lng / 100);
+ lng -= priv->geo.lng * 100;
+ priv->geo.lng += lng / 60;
+
+ if (!g_ascii_strcasecmp(item[6],"W"))
+ priv->geo.lng=-priv->geo.lng;
+
+ if (priv->valid == attr_position_valid_invalid)
+ ret = 1;
+ priv->valid=attr_position_valid_valid;
+ vehicle_file_restart_fix_timeout(priv);
+
+ if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) {
+ ret = 1;
+ strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
+ }
+
+ dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
+
+ } else {
+ if (priv->valid == attr_position_valid_valid)
+ ret = 1;
+ priv->valid=attr_position_valid_invalid;
}
- ret = 1;
}
if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) {
/*
@@ -610,16 +666,11 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
return ret;
}
-//***************************************************************************
-/** @fn static void vehicle_file_io(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: function to get data from GPS
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-* @remarks
-*****************************************************************************
-**/
+/**
+* @brief Function to get data from GPS
+*
+* @param priv Pointer on the private data of the plugin
+*/
static void
vehicle_file_io(struct vehicle_priv *priv)
{
@@ -685,14 +736,11 @@ vehicle_file_io(struct vehicle_priv *priv)
callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
}
-//***************************************************************************
-/** @fn static void vehicle_file_enable_watch(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: Enable watch
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-**/
+/**
+* @brief Enable watch
+*
+* @param priv Pointer on the private data of the plugin
+*/
static void
vehicle_file_enable_watch(struct vehicle_priv *priv)
{
@@ -713,14 +761,11 @@ vehicle_file_enable_watch(struct vehicle_priv *priv)
}
}
-//***************************************************************************
-/** @fn static void vehicle_file_disable_watch(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: Disable watch
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
-**/
+/**
+* @brief Disable watch
+*
+* @param priv Pointer on the private data of the plugin
+*/
static void
vehicle_file_disable_watch(struct vehicle_priv *priv)
{
@@ -742,16 +787,13 @@ vehicle_file_disable_watch(struct vehicle_priv *priv)
}
}
-//***************************************************************************
-/** @fn static void vehicle_priv vehicle_file_destroy(struct vehicle_priv *priv)
-*****************************************************************************
-* @b Description: Function called to uninitialize the plugin
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-*****************************************************************************
+/**
+* @brief Function called to uninitialize the plugin
+*
+* @param priv Pointer on the private data of the plugin
+*
* @remarks private data is freed by this function (g_free)
-*****************************************************************************
-**/
+*/
static void
vehicle_file_destroy(struct vehicle_priv *priv)
{
@@ -781,21 +823,15 @@ vehicle_file_destroy(struct vehicle_priv *priv)
g_free(priv);
}
-//***************************************************************************
-/** @fn static int vehicle_file_position_attr_get(struct vehicle_priv *priv,
-* enum attr_type type,
-* struct attr *attr)
-*****************************************************************************
-* @b Description: Function called to get attribute
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-* @param type : attribute type called
-* @param attr : structure to return the attribute value
-*****************************************************************************
-* @return 1 if ok
-* 0 for unkown or invalid attribute
-*****************************************************************************
-**/
+/**
+* @brief Function called to get attribute
+*
+* @param priv Pointer on the private data of the plugin
+* @param type Attribute type called
+* @param attr Structure to return the attribute value
+*
+* @return 1 if ok, 0 for unkown or invalid attribute
+*/
static int
vehicle_file_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
@@ -865,21 +901,15 @@ vehicle_file_position_attr_get(struct vehicle_priv *priv,
return 1;
}
-//***************************************************************************
-/** @fn static int vehicle_file_sat_attr_get(struct vehicle_priv *priv,
-* enum attr_type type,
-* struct attr *attr)
-*****************************************************************************
-* @b Description: Function called to get satellite attribute
-*****************************************************************************
-* @param priv : pointer on the private data of the plugin
-* @param type : attribute type called
-* @param attr : structure to return the attribute value
-*****************************************************************************
-* @return 1 if ok
-* 0 for unkown attribute
-*****************************************************************************
-**/
+/**
+* @brief Function called to get satellite attribute
+*
+* @param priv Pointer on the private data of the plugin
+* @param type Attribute type called
+* @param attr Structure to return the attribute value
+*
+* @return 1 if ok, 0 for unkown attribute
+*/
static int
vehicle_file_sat_attr_get(void *priv_data, enum attr_type type, struct attr *attr)
{
@@ -922,23 +952,17 @@ static struct vehicle_methods vehicle_file_methods = {
vehicle_file_position_attr_get,
};
-//***************************************************************************
-/** @fn static struct vehicle_priv * vehicle_file_new_file(
-* struct vehicle_methods *meth,
-* struct callback_list *cbl,
-* struct attr **attrs)
-*****************************************************************************
-* @b Description: Function called to initialize the plugin
-*****************************************************************************
-* @param meth : ?
-* @param cbl : ?
-* @param attrs : ?
-*****************************************************************************
-* @return pointer on the private data of the plugin
-*****************************************************************************
-* @remarks private data is allocated by this function (g_new0)
-*****************************************************************************
-**/
+/**
+* @brief Function called to initialize the plugin
+*
+* @param meth ?
+* @param cbl ?
+* @param attrs ?
+*
+* @return Pointer on the private data of the plugin
+*
+* @remarks Private data is allocated by this function (g_new0)
+*/
static struct vehicle_priv *
vehicle_file_new_file(struct vehicle_methods
*meth, struct callback_list
@@ -958,7 +982,7 @@ vehicle_file_new_file(struct vehicle_methods
if(source == NULL){
dbg(lvl_error,"Missing source attribute");
return NULL;
- }
+ }
ret = g_new0(struct vehicle_priv, 1); // allocate and initialize to 0
ret->fd = -1;
ret->cbl = cbl;
@@ -966,6 +990,8 @@ vehicle_file_new_file(struct vehicle_methods
ret->buffer = g_malloc(buffer_size);
ret->time=1000;
ret->baudrate=B4800;
+ ret->fixtime[0] = '\0';
+ ret->ev_fix_timeout = NULL;
state_file=attr_search(attrs, NULL, attr_state_file);
if (state_file)
ret->statefile=g_strdup(state_file->u.str);
@@ -1014,6 +1040,7 @@ vehicle_file_new_file(struct vehicle_methods
*meth = vehicle_file_methods;
ret->cb=callback_new_1(callback_cast(vehicle_file_io), ret);
ret->cbt=callback_new_1(callback_cast(vehicle_file_enable_watch_timer), ret);
+ ret->cb_fix_timeout=callback_new_1(callback_cast(vehicle_file_fix_timeout_cb), ret);
if (ret->statefile && file_exists(ret->statefile)) {
ret->process_statefile=1;
event_add_timeout(1000, 0, ret->cb);
@@ -1038,12 +1065,9 @@ vehicle_file_new_file(struct vehicle_methods
return ret;
}
-//***************************************************************************
-/** @fn void plugin_init(void)
-*****************************************************************************
-* @b Description: Initialisation of vehicle_file plugin
-*****************************************************************************
-**/
+/**
+* @brief Initialisation of vehicle_file plugin
+*/
void plugin_init(void)
{
dbg(lvl_debug, "vehicle_file:plugin_init:enter\n");
diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c
index d43c516f7..aee3394b2 100644
--- a/navit/vehicle/wince/vehicle_wince.c
+++ b/navit/vehicle/wince/vehicle_wince.c
@@ -83,6 +83,8 @@ struct vehicle_priv {
char *source;
struct callback_list *cbl;
struct callback_list *priv_cbl;
+ struct callback *cb_fix_timeout;
+ struct event_timeout *ev_fix_timeout;
int is_running;
int thread_up;
int fd;
@@ -365,6 +367,36 @@ vehicle_wince_available_ports(void)
}
+/**
+* @brief This is a callback function, called when the fix timeout
+* is done. Set the position to invalid.
+*
+* @param priv Pointer on the private data of the plugin
+*/
+static void
+vehicle_wince_fix_timeout_cb(struct vehicle_priv *priv)
+{
+ priv->valid = attr_position_valid_invalid;
+ priv->ev_fix_timeout = NULL;
+ callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
+}
+
+
+/**
+* @brief Cancel previous fix timeout event and add a new one
+*
+* @param priv Pointer on the private data of the plugin
+*/
+static void
+vehicle_wince_restart_fix_timeout(struct vehicle_priv *priv)
+{
+ if (priv->ev_fix_timeout != NULL)
+ event_remove_timeout(priv->ev_fix_timeout);
+ priv->ev_fix_timeout = event_add_timeout(10000, 0, priv->cb_fix_timeout);
+}
+
+
+
static int
vehicle_wince_open(struct vehicle_priv *priv)
{
@@ -474,7 +506,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7],
HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14]
*/
- if (*item[2] && *item[3] && *item[4] && *item[5]) {
+ if (*item[2] && *item[3] && *item[4] && *item[5] && *item[6] > 0) {
lat = g_ascii_strtod(item[2], NULL);
priv->geo.lat = floor(lat / 100);
lat -= priv->geo.lat * 100;
@@ -490,20 +522,31 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
if (!g_strcasecmp(item[5],"W"))
priv->geo.lng=-priv->geo.lng;
- priv->valid=attr_position_valid_valid;
+
+ if (priv->valid == attr_position_valid_invalid)
+ ret = 1;
+ priv->valid = attr_position_valid_valid;
+ vehicle_wince_restart_fix_timeout(priv);
+
+ if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) {
+ ret = 1;
+ strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
+ }
dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
- } else
+ } else {
+ if (priv->valid == attr_position_valid_valid)
+ ret = 1;
priv->valid=attr_position_valid_invalid;
+ }
+
if (*item[6])
sscanf(item[6], "%d", &priv->status);
if (*item[7])
- sscanf(item[7], "%d", &priv->sats_used);
+ sscanf(item[7], "%d", &priv->sats_used);
if (*item[8])
sscanf(item[8], "%lf", &priv->hdop);
- if (*item[1])
- strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
if (*item[9])
sscanf(item[9], "%lf", &priv->height);
@@ -547,8 +590,40 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
&priv->fixmonth,
&priv->fixyear);
priv->fixyear += 2000;
+
+ lat = g_ascii_strtod(item[3], NULL);
+ priv->geo.lat = floor(lat / 100);
+ lat -= priv->geo.lat * 100;
+ priv->geo.lat += lat / 60;
+
+ if (!g_ascii_strcasecmp(item[4],"S"))
+ priv->geo.lat=-priv->geo.lat;
+
+ lng = g_ascii_strtod(item[5], NULL);
+ priv->geo.lng = floor(lng / 100);
+ lng -= priv->geo.lng * 100;
+ priv->geo.lng += lng / 60;
+
+ if (!g_ascii_strcasecmp(item[6],"W"))
+ priv->geo.lng=-priv->geo.lng;
+
+ if (priv->valid == attr_position_valid_invalid)
+ ret = 1;
+ priv->valid=attr_position_valid_valid;
+ vehicle_wince_restart_fix_timeout(priv);
+
+ if (*item[1] && strncmp(priv->fixtime, item[1], sizeof(priv->fixtime))) {
+ ret = 1;
+ strncpy(priv->fixtime, item[1], sizeof(priv->fixtime));
+ }
+
+ dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
+
+ } else {
+ if (priv->valid == attr_position_valid_valid)
+ ret = 1;
+ priv->valid=attr_position_valid_invalid;
}
- ret = 1;
}
if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) {
/*
@@ -741,7 +816,8 @@ vehicle_wince_destroy(struct vehicle_priv *priv)
* @param priv vehicle_priv structure for the vehicle
* @param type The attribute type to retrieve
* @param attr Points to an attr structure that will receive the attribute data
- * @returns True for success, false for failure
+ *
+ * @return True for success, false for failure
*/
static int
vehicle_wince_position_attr_get(struct vehicle_priv *priv,
@@ -863,10 +939,11 @@ struct vehicle_methods vehicle_wince_methods = {
/**
* @brief Creates a new wince_vehicle
*
- * @param meth
- * @param cbl
- * @param attrs
- * @returns vehicle_priv
+ * @param meth ?
+ * @param cbl ?
+ * @param attrs ?
+ *
+ * @return vehicle_priv
*/
static struct vehicle_priv *
vehicle_wince_new(struct vehicle_methods
@@ -902,6 +979,8 @@ vehicle_wince_new(struct vehicle_methods
ret->buffer = g_malloc(buffer_size);
ret->time=1000;
ret->baudrate=0; // do not change the rate if not configured
+ ret->fixtime[0] = '\0';
+ ret->ev_fix_timeout = NULL;
time = attr_search(attrs, NULL, attr_time);
if (time)
@@ -923,6 +1002,7 @@ vehicle_wince_new(struct vehicle_methods
*meth = vehicle_wince_methods;
ret->priv_cbl = callback_list_new();
callback_list_add(ret->priv_cbl, callback_new_1(callback_cast(vehicle_wince_io), ret));
+ ret->cb_fix_timeout=callback_new_1(callback_cast(vehicle_wince_fix_timeout_cb), ret);
ret->sat_item.type=type_position_sat;
ret->sat_item.id_hi=ret->sat_item.id_lo=0;
ret->sat_item.priv_data=ret;