return 0;
}
+/**
+ * Check if an enumeration of attribute types contains a specific attribute.
+ *
+ * @param types Pointer to the attr_type enumeration to be searched
+ * @param type The attr_type to be searched for
+ *
+ * @return 1 if the attribute type was found, 0 if it was not found or if a null pointer was passed as types
+ */
int
attr_types_contains(enum attr_type *types, enum attr_type type)
{
return 0;
}
+/**
+ * Check if an enumeration of attribute types contains a specific attribute.
+ * It is different from attr_types_contains in that it returns a caller-defined value if the pointer to the enumeration is NULL.
+ *
+ * @param types Pointer to the attr_type enumeration to be searched
+ * @param type The attr_type to be searched for
+ * @param deflt The default value to return if types is NULL.
+ *
+ * @return 1 if the attribute type was found, 0 if it was not found, the value of the deflt argument if types is NULL.
+ */
int
attr_types_contains_default(enum attr_type *types, enum attr_type type, int deflt)
{
/**
* Generic get function
*
- * @param this_ A vehicle
+ * @param this_ Pointer to a vehicle structure
* @param type The attribute type to look for
- * @param attr A struct attr to store the attribute
+ * @param attr Pointer to an attr structure to store the attribute
* @param iter A vehicle attr_iter
*/
int
/**
* Generic set function
*
- * @param this_ A vehicle
- * @param attr
- * @param attrs
+ * @param this_ Pointer to a vehicle structure
+ * @param attr Pointer to an attr structure for the attribute to be set
+ * @return nonzero on success, zero on failure
*/
int
vehicle_set_attr(struct vehicle *this_, struct attr *attr)
}
}
+/**
+ * Writes to an NMEA log.
+ *
+ * @param this_ Pointer to the vehicle structure of the data source
+ * @param log Pointer to a log structure for the log file
+ */
static void
vehicle_log_nmea(struct vehicle *this_, struct log *log)
{
g_free(end);
}
+/**
+ * Writes to a GPX log.
+ *
+ * @param this_ Pointer to the vehicle structure of the data source
+ * @param log Pointer to a log structure for the log file
+ */
static void
vehicle_log_gpx(struct vehicle *this_, struct log *log)
{
g_free(this_->gpx_desc);
this_->gpx_desc = NULL;
}
+ if (attr_types_contains_default(attr_types, attr_position_height,0) && this_->meth.position_attr_get(this_->priv, attr_position_height, &attr))
+ logstr=g_strconcat_printf(logstr,"\t<ele>%.6f</ele>\n",*attr.u.numd);
+ // <magvar> magnetic variation in degrees; we might use position_magnetic_direction and position_direction to figure it out
+ // <geoidheight> Height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message (field 11, which vehicle_wince.c ignores)
+ // <name> GPS name (arbitrary)
+ // <cmt> comment
+ // <src> Source of data
+ // <link> Link to additional information (URL)
+ // <sym> Text of GPS symbol name
+ // <type> Type (classification)
+ // <fix> Type of GPS fix {'none'|'2d'|'3d'|'dgps'|'pps'}, leave out if unknown. Similar to position_fix_type but more detailed.
+ if (attr_types_contains_default(attr_types, attr_position_sats_used,0) && this_->meth.position_attr_get(this_->priv, attr_position_sats_used, &attr))
+ logstr=g_strconcat_printf(logstr,"\t<sat>%d</sat>\n",attr.u.num);
+ if (attr_types_contains_default(attr_types, attr_position_hdop,0) && this_->meth.position_attr_get(this_->priv, attr_position_hdop, &attr))
+ logstr=g_strconcat_printf(logstr,"\t<hdop>%.6f</hdop>\n",*attr.u.numd);
+ // <vdop>, <pdop> Vertical and position dilution of precision, no corresponding attribute
if (attr_types_contains_default(attr_types, attr_position_direction,0) && this_->meth.position_attr_get(this_->priv, attr_position_direction, &attr))
logstr=g_strconcat_printf(logstr,"\t<course>%.1f</course>\n",*attr.u.numd);
if (attr_types_contains_default(attr_types, attr_position_speed, 0) && this_->meth.position_attr_get(this_->priv, attr_position_speed, &attr))
g_free(logstr);
}
+/**
+ * Writes to a text log.
+ *
+ * @param this_ Pointer to the vehicle structure of the data source
+ * @param log Pointer to a log structure for the log file
+ */
static void
vehicle_log_textfile(struct vehicle *this_, struct log *log)
{
log_write(log, logstr, strlen(logstr), 0);
}
+/**
+ * Writes to a binary log.
+ *
+ * @param this_ Pointer to the vehicle structure of the data source
+ * @param log Pointer to a log structure for the log file
+ */
static void
vehicle_log_binfile(struct vehicle *this_, struct log *log)
{
}
}
+/**
+ * Register a new log to receive data.
+ *
+ * @param this_ Pointer to the vehicle structure of the data source
+ * @param log Pointer to a log structure for the log file
+ */
static int
vehicle_add_log(struct vehicle *this_, struct log *log)
{