There are several sample UDDF files around on the net, so we might as
well start importing some of it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static struct units {
enum { METERS, FEET } length;
enum { LITER, CUFT } volume;
static struct units {
enum { METERS, FEET } length;
enum { LITER, CUFT } volume;
- enum { BAR, PSI } pressure;
- enum { CELSIUS, FAHRENHEIT } temperature;
+ enum { BAR, PSI, PASCAL } pressure;
+ enum { CELSIUS, FAHRENHEIT, KELVIN } temperature;
enum { KG, LBS } weight;
} units;
enum { KG, LBS } weight;
} units;
-/* We're going to default to SI units for input */
+/*
+ * We're going to default to SI units for input. Yes,
+ * technically the SI unit for pressure is Pascal, but
+ * we default to bar (10^5 pascal), which people
+ * actually use. Similarly, C instead of Kelvin.
+ */
static const struct units SI_units = {
.length = METERS,
.volume = LITER,
static const struct units SI_units = {
.length = METERS,
.volume = LITER,
SUUNTO,
UEMIS,
DIVINGLOG,
SUUNTO,
UEMIS,
DIVINGLOG,
} import_source;
static time_t utc_mktime(struct tm *tm)
} import_source;
static time_t utc_mktime(struct tm *tm)
if (!val.fp)
break;
switch (units.pressure) {
if (!val.fp)
break;
switch (units.pressure) {
+ case PASCAL:
+ mbar = val.fp / 100;
+ break;
case BAR:
/* Assume mbar, but if it's really small, it's bar */
mbar = val.fp;
case BAR:
/* Assume mbar, but if it's really small, it's bar */
mbar = val.fp;
break;
/* Celsius */
switch (units.temperature) {
break;
/* Celsius */
switch (units.temperature) {
+ case KELVIN:
+ temperature->mkelvin = val.fp * 1000;
+ break;
case CELSIUS:
temperature->mkelvin = (val.fp + 273.15) * 1000 + 0.5;
break;
case CELSIUS:
temperature->mkelvin = (val.fp + 273.15) * 1000 + 0.5;
break;
+static void uddf_importer(void)
+{
+ import_source = UDDF;
+ units = SI_units;
+ units.pressure = PASCAL;
+ units.temperature = KELVIN;
+}
+
/*
* I'm sure this could be done as some fancy DTD rules.
* It's just not worth the headache.
/*
* I'm sure this could be done as some fancy DTD rules.
* It's just not worth the headache.
{ "dive", dive_start, dive_end },
{ "Dive", dive_start, dive_end },
{ "sample", sample_start, sample_end },
{ "dive", dive_start, dive_end },
{ "Dive", dive_start, dive_end },
{ "sample", sample_start, sample_end },
+ { "waypoint", sample_start, sample_end },
{ "SAMPLE", sample_start, sample_end },
{ "reading", sample_start, sample_end },
{ "event", event_start, event_end },
{ "SAMPLE", sample_start, sample_end },
{ "reading", sample_start, sample_end },
{ "event", event_start, event_end },
{ "SUUNTO", suunto_importer },
{ "Divinglog", DivingLog_importer },
{ "pre_dive", uemis_importer },
{ "SUUNTO", suunto_importer },
{ "Divinglog", DivingLog_importer },
{ "pre_dive", uemis_importer },
+ { "uddf", uddf_importer },