CMS50F37 debug test 3

This commit is contained in:
Mark Watkins 2014-08-18 10:22:16 +10:00
parent 81dfc2fb50
commit face1259ee
4 changed files with 35 additions and 4 deletions

View File

@ -35,9 +35,6 @@ using namespace std;
extern QProgressBar *qprogress;
static unsigned char cms50_sequence[] = { 0xa7, 0xa2, 0xa0, 0xb0, 0xac, 0xb3, 0xad, 0xa3, 0xab, 0xa4, 0xa5, 0xaf, 0xa7, 0xa2, 0xa6 };
int cms50_seqlength = sizeof(cms50_sequence);
CMS50F37Loader::CMS50F37Loader()
{
m_type = MT_OXIMETER;
@ -116,9 +113,22 @@ int CMS50F37Loader::Open(QString path)
return 0;
}
static unsigned char cms50_sequence[] = { 0xa7, 0xa2, 0xa0, 0xb0, 0xac, 0xb3, 0xad, 0xa3, 0xab, 0xa4, 0xa5, 0xaf, 0xa7, 0xa2, 0xa6 };
int cms50_seqlength = sizeof(cms50_sequence);
void CMS50F37Loader::processBytes(QByteArray bytes)
{
if (sequence < cms50_seqlength) {
unsigned char cmd = cms50_sequence[sequence];
if (cmd == 0xa5) { // DateTime
// > 7d 81 a5 80 80 80 80 80 80
// < 07 80 80 80 94 8e 88 92
// < 12 80 80 80 80 a3 bb 80
}
}
QStringList data;

View File

@ -45,6 +45,16 @@ MachineLoader * lookupLoader(Machine * m)
return nullptr;
}
MachineLoader * lookupLoader(QString loaderName)
{
for (int i=0; i < m_loaders.size(); ++i) {
MachineLoader * loader = m_loaders.at(i);
if (loader->loaderName() == loaderName)
return loader;
}
return nullptr;
}
QHash<QString, QHash<QString, Machine *> > MachineList;

View File

@ -148,6 +148,8 @@ struct ImportPath
// Put in machine loader class as static??
void RegisterLoader(MachineLoader *loader);
MachineLoader * lookupLoader(Machine * m);
MachineLoader * lookupLoader(QString loaderName);
void DestroyLoaders();
bool compressFile(QString inpath, QString outpath = "");

View File

@ -22,6 +22,7 @@
extern MainWindow * mainwin;
#include "SleepLib/loader_plugins/cms50_loader.h"
#include "SleepLib/loader_plugins/cms50f37_loader.h"
Qt::DayOfWeek firstDayOfWeekFromLocale();
QList<SerialOximeter *> GetOxiLoaders();
@ -155,7 +156,15 @@ SerialOximeter * OximeterImport::detectOximeter()
ui->retryButton->setVisible(false);
QList<SerialOximeter *> loaders = GetOxiLoaders();
QList<SerialOximeter *> loaders; //= GetOxiLoaders();
if (p_profile->oxi->oximeterType() == "Contec CMS50D+/E/F") {
SerialOximeter * oxi = qobject_cast<SerialOximeter *>(lookupLoader(cms50_class_name));
loaders.push_back(oxi);
} else if (p_profile->oxi->oximeterType() == "Contec CMS50F v3.7+") {
SerialOximeter * oxi = qobject_cast<SerialOximeter *>(lookupLoader(cms50f37_class_name));
loaders.push_back(oxi);
} else return nullptr;
updateStatus(tr("Scanning for compatible oximeters"));