Skip to content
Permalink
Browse files

FitRideFile: Unify handling of invalid product id

  • Loading branch information...
frnky authored and grauser committed May 13, 2019
1 parent f334097 commit 1dbe3c9be85bee26e457284c6d773ca40d7db0d3
Showing with 15 additions and 44 deletions.
  1. +15 −44 src/FileIO/FitRideFile.cpp
@@ -321,12 +321,10 @@ struct FitFileReaderState
QString getManuProd(int manu, int prod) {
if (manu == 1) {
// Garmin
if (prod == -1)
return "Garmin";

// Product IDs can be found in c/fit_example.h in the FIT SDK.
// Multiple product IDs refer to different regions e.g. China, Japan etc.
switch (prod) {
case -1: return "Garmin";
case 473: case 474: case 475: case 494: return "Garmin FR301";
case 717: case 987: return "Garmin FR405";
case 782: return "Garmin FR50";
@@ -388,97 +386,75 @@ struct FitFileReaderState
}
} else if (manu == 6 ) {
// SRM
if (prod == -1)
return "SRM";

// powercontrol now uses FIT files from PC8
switch (prod) {
case -1: return "SRM";
case 6: return "SRM PC6";
case 7: return "SRM PC7";
case 8: return "SRM PC8";
default: return "SRM Powercontrol";
}
} else if (manu == 7 ) {
// Quarq
if (prod == -1)
return "Quarq";

switch (prod) {
case -1: return "Quarq";
case 1: return "Quarq Cinqo";

case 9479: return "Quarq DZERO";

default: return QString("Quarq %1").arg(prod);
}
} else if (manu == 8 ) {
// iBike
if (prod == -1)
return "iBike";

switch (prod) {
case -1: return "iBike";
case 2054: return "iBike AeroPod";

default: return QString("iBike %1").arg(prod);
}
} else if (manu == 9 ) {
// Powertap
if (prod == -1)
return "Powertap";

switch (prod) {
case -1: return "Powertap";
case 14: return "Joule 2.0";
case 18: return "Joule";
case 19: return "Joule GPS";
case 22: return "Joule GPS+";
case 272: return "Powertap C1";
case 288: return "Powertap P1";
case 4096: return "Powertap G3";

default: return QString("Powertap Device %1").arg(prod);
}
} else if (manu == 13 ) {
// dynastream_oem
if (prod == -1)
return "Dynastream";

switch (prod) {
case -1: return "Dynastream";
default: return QString("Dynastream %1").arg(prod);
}
} else if (manu == 29 ) {
// saxonar
if (prod == -1)
return "Power2max";

switch (prod) {
case -1: return "Power2max";
case 1031: return "Power2max S";
default: return QString("Power2max %1").arg(prod);
}
} else if (manu == 32) {
// wahoo
if (prod == -1)
return "Wahoo";

switch (prod) {
case -1: return "Wahoo";
case 0: return "Wahoo fitness";
case 28: return "Wahoo ELEMNT";
case 31: return "Wahoo ELEMNT BOLT";
default: return QString("Wahoo fitness %1").arg(prod);
}
} else if (manu == 38) {
// o_synce
if (prod == -1)
return "o_synce";

switch (prod) {
case -1: return "o_synce";
case 1: return "o_synce navi2coach";
default: return QString("o_synce %1").arg(prod);
}
} else if (manu == 48) {
if (prod == -1)
return "Pioneer";

// Pioneer
switch (prod) {
case -1: return "Pioneer";
case 2: return "Pioneer SGX-CA500";
default: return QString("Pioneer %1").arg(prod);
}
@@ -493,12 +469,10 @@ struct FitFileReaderState
return "Stryd";
} else if (manu == 98) {
// BSX
if (prod == -1)
return "BSX";

switch(prod) {
case 2: return "BSX Insight 2";
default: return QString("BSX %1").arg(prod);
case -1: return "BSX";
case 2: return "BSX Insight 2";
default: return QString("BSX %1").arg(prod);
}
} else if (manu == 107) {
// Magene
@@ -510,12 +484,9 @@ struct FitFileReaderState
}
} else if (manu == 115) {
// igpsport
if (prod == -1)
return "igpsport";

switch(prod) {
case 2: return "BSX Insight 2";
default: return QString("igpsport %1").arg(prod);
case -1: return "igpsport";
default: return QString("igpsport %1").arg(prod);
}
} else if (manu == 258) {
// Lezyne

0 comments on commit 1dbe3c9

Please sign in to comment.
You can’t perform that action at this time.