/* SleepLib ResMed Loader Implementation Author: Mark Watkins License: GPL */ #include #include #include #include #include #include #include "resmed_loader.h" #include "SleepLib/session.h" ResmedLoader::ResmedLoader() { } ResmedLoader::~ResmedLoader() { } Machine *ResmedLoader::CreateMachine(QString serial,Profile *profile) { qDebug(("Create ResMed Machine "+serial).toLatin1()); assert(profile!=NULL); vector ml=profile->GetMachines(MT_CPAP); bool found=false; for (vector::iterator i=ml.begin(); i!=ml.end(); i++) { if (((*i)->GetClass()=="ResMed") && ((*i)->properties["Serial"]==serial)) { ResmedList[serial]=*i; //static_cast(*i); found=true; break; } } if (found) return ResmedList[serial]; Machine *m=new CPAP(profile,0); ResmedList[serial]=m; profile->AddMachine(m); m->properties["Serial"]=serial; return m; } bool ResmedLoader::Open(QString & path,Profile *profile) { QString newpath; QString dirtag="DATALOG"; if (path.endsWith("/"+dirtag)) { newpath=path; } else { newpath=path+"/"+dirtag; } QDir dir(newpath); if ((!dir.exists() || !dir.isReadable())) return 0; qDebug(("ResmedLoader::Open newpath="+newpath).toLatin1()); dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setSorting(QDir::Name); QFileInfoList flist=dir.entryInfoList(); list SerialNumbers; list::iterator sn; for (int i=0;i