mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-19 04:00:45 +00:00
Committing some M-Series work in progress
This commit is contained in:
parent
27a56ec8bd
commit
c7b66c5267
@ -168,7 +168,7 @@ int FPIconLoader::OpenMachine(Machine *mach, QString & path, Profile * profile)
|
|||||||
OpenDetail(mach,det[i],profile);
|
OpenDetail(mach,det[i],profile);
|
||||||
}
|
}
|
||||||
for (int i=0;i<flw.size();i++) {
|
for (int i=0;i<flw.size();i++) {
|
||||||
//OpenFLW(mach,flw[i],profile);
|
OpenFLW(mach,flw[i],profile);
|
||||||
}
|
}
|
||||||
SessionID zz,sid,st;
|
SessionID zz,sid,st;
|
||||||
float hours,dur,mins;
|
float hours,dur,mins;
|
||||||
|
@ -214,13 +214,19 @@ int MSeriesLoader::Open(QString & path,Profile *profile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *cb=controlblock;
|
unsigned char *cb=controlblock;
|
||||||
|
quint16 u1,u2,u3,u4,d1;
|
||||||
|
quint32 ts,st,lt;
|
||||||
|
QDateTime dt;
|
||||||
|
QDate date;
|
||||||
|
QTime time;
|
||||||
|
|
||||||
for (int chk=0;chk<8;chk++) {
|
for (int chk=0;chk<7;chk++) {
|
||||||
quint32 ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
|
ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
|
||||||
//ts-=epoch;
|
//ts-=epoch;
|
||||||
QDateTime dt=QDateTime::fromTime_t(ts);
|
dt=QDateTime::fromTime_t(ts);
|
||||||
QDate date=dt.date();
|
date=dt.date();
|
||||||
QTime time=dt.time();
|
time=dt.time();
|
||||||
|
qDebug() << "New Sparse Chunk" << chk << dt << hex << ts;
|
||||||
|
|
||||||
cb+=4;
|
cb+=4;
|
||||||
quint8 sum=0;
|
quint8 sum=0;
|
||||||
@ -231,6 +237,133 @@ int MSeriesLoader::Open(QString & path,Profile *profile)
|
|||||||
cb+=0x26a;
|
cb+=0x26a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char * endcard=(unsigned char *)block.data()+dataends;
|
||||||
|
bool done=false;
|
||||||
|
qint64 ti;
|
||||||
|
int cnt=0;
|
||||||
|
do {
|
||||||
|
ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
|
||||||
|
lt=st=ts;
|
||||||
|
ti=qint64(ts)*1000L;
|
||||||
|
dt=QDateTime::fromTime_t(ts);
|
||||||
|
date=dt.date();
|
||||||
|
time=dt.time();
|
||||||
|
qDebug() << "Details New Data Chunk" << cnt << dt << hex << ts;
|
||||||
|
|
||||||
|
cb+=4;
|
||||||
|
do {
|
||||||
|
if (cb[0]==0xfe) { // not sure what this means
|
||||||
|
cb++;
|
||||||
|
}
|
||||||
|
u1=cb[0] << 8 | cb[1]; // expecting 0xCXXX
|
||||||
|
|
||||||
|
if (u1==0xffff) { // adjust timestamp code
|
||||||
|
cb+=2;
|
||||||
|
u1=cb[0];
|
||||||
|
cb++;
|
||||||
|
|
||||||
|
if ((cb[0]==0xfe)) {
|
||||||
|
u1=cb[0] << 8 | cb[1]; // fe 0a, followed by timestamp
|
||||||
|
cb+=2;
|
||||||
|
break; // start on the next timestamp
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((cb[0] & 0xc0) == 0xc0) {
|
||||||
|
cb+=2;
|
||||||
|
u1 &= 0x0fff; // time delta??
|
||||||
|
lt=ts;
|
||||||
|
ts=st+(u1*60);
|
||||||
|
ti=qint64(ts) * 1000L;
|
||||||
|
|
||||||
|
d1=cb[0] << 8 | cb[1];
|
||||||
|
u2=cb[2] << 8 | cb[3];
|
||||||
|
u3=cb[4] << 8 | cb[5];
|
||||||
|
u4=cb[6] << 8 | cb[7];
|
||||||
|
if ((d1!=0xf302) || (u2!=0xf097) || (u3!=0xf2ff) || (u4!=0xf281)) {
|
||||||
|
qDebug() << "Lost details sync reading M-Series file" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cb+=8;
|
||||||
|
} else cb++;
|
||||||
|
dt=QDateTime::fromTime_t(ts);
|
||||||
|
qDebug() << "Details Data Chunk" << cnt++ << dt;
|
||||||
|
|
||||||
|
do {
|
||||||
|
d1=cb[0] << 8 | cb[1];
|
||||||
|
cb+=2;
|
||||||
|
|
||||||
|
if (d1==0x7f0a) { // end of entire block
|
||||||
|
done=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((d1 & 0xb000) == 0xb000) {
|
||||||
|
qDebug() << "Duration" << (d1 & 0x7ff);
|
||||||
|
break; // end of section
|
||||||
|
}
|
||||||
|
// process binary data..
|
||||||
|
// 64 c0
|
||||||
|
} while (cb<endcard);
|
||||||
|
}
|
||||||
|
} while (cb<endcard && !done);
|
||||||
|
} while (cb < endcard && !done);
|
||||||
|
|
||||||
|
done=false;
|
||||||
|
bool first=true;
|
||||||
|
quint8 exch;
|
||||||
|
cnt=0;
|
||||||
|
do {
|
||||||
|
u1=cb[0] << 8 | cb[1];
|
||||||
|
if (u1!=0xfe0b) {
|
||||||
|
done=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cb+=2;
|
||||||
|
st=ts=cb[0] << 24 | cb[1] << 16 | cb[2] << 8 | cb[3];
|
||||||
|
dt=QDateTime::fromTime_t(ts);
|
||||||
|
date=dt.date();
|
||||||
|
time=dt.time();
|
||||||
|
//qDebug() << "Summary Data Chunk" << cnt << dt << hex << ts;
|
||||||
|
cb+=4;
|
||||||
|
while (cb < endcard) {
|
||||||
|
if (((cb[0]&0xc0)!=0xc0) || ((cb[0]&0xf0)==0xf0)) {
|
||||||
|
// what is this for??
|
||||||
|
exch=cb[0];
|
||||||
|
cb++;
|
||||||
|
}
|
||||||
|
|
||||||
|
u1=(cb[0] << 8 | cb[1]) & 0x7ff; // time delta
|
||||||
|
|
||||||
|
u2=(cb[2] << 8 | cb[3]) & 0x7ff; // 0xBX XX??
|
||||||
|
ts=st+u1*60;
|
||||||
|
dt=QDateTime::fromTime_t(ts);
|
||||||
|
//qDebug() << "Summary Sub Chunk" << dt << u1 << u2 << hex << ts;
|
||||||
|
cb+=4;
|
||||||
|
if (cb[0]==0xff) break;
|
||||||
|
}
|
||||||
|
cb++; // ff;
|
||||||
|
|
||||||
|
// 05905: "22 48 00 00 04 01 01 5C 9E 30 00 F0 00 01 73 00 00 00 F2 Sat Jul 9 2011 10:44:25"
|
||||||
|
// 05905: "20 58 00 00 00 00 00 32 69 88 00 70 00 01 73 00 00 00 AF Sun Jul 10 2011 05:09:21"
|
||||||
|
// 05906: "22 00 00 00 0B 00 01 4E 79 F8 02 70 00 01 73 00 00 00 56 Sun Jul 10 2011 10:27:05"
|
||||||
|
// 05907: "21 4C 00 00 11 00 01 5C 95 F8 01 F0 00 01 73 00 00 00 54 Mon Jul 11 2011 10:59:42"
|
||||||
|
// 05908: "20 A8 00 00 02 00 01 4E 7D 88 00 F0 00 01 73 00 00 00 90 Tue Jul 12 2011 03:44:38"
|
||||||
|
// 05909: "21 94 00 00 34 01 01 6A 96 D8 01 70 00 01 73 00 00 00 FC Tue Jul 12 2011 10:30:49"
|
||||||
|
// 05910: "21 84 00 00 19 01 01 6A A2 30 00 F0 00 01 73 00 00 00 3E Wed Jul 13 2011 10:30:14"
|
||||||
|
// 05911: "22 38 00 00 3F 01 01 86 B2 A0 00 F1 00 01 73 00 00 00 F4 Thu Jul 14 2011 10:01:50"
|
||||||
|
// 05912: "21 68 00 00 36 01 01 5C 91 F8 02 70 00 01 73 00 00 00 BF Fri Jul 15 2011 10:46:33"
|
||||||
|
// 05913: "22 6C 0E 00 A1 01 01 78 AB 10 00 F0 00 01 73 00 00 00 9A Sat Jul 16 2011 10:44:56"
|
||||||
|
|
||||||
|
|
||||||
|
// 0x04 Vibratory Snore
|
||||||
|
cnt++;
|
||||||
|
QString a;
|
||||||
|
for (int i=0;i<0x13;i++) {
|
||||||
|
a+=QString().sprintf("%02X ",cb[i]);
|
||||||
|
}
|
||||||
|
a+=" "+date.toString()+" "+time.toString();
|
||||||
|
qDebug() << a;
|
||||||
|
cb+=0x13;
|
||||||
|
} while (cb < endcard && !done);
|
||||||
|
|
||||||
//graph data
|
//graph data
|
||||||
//starts with timestamp.. or time delta if high bit is set.
|
//starts with timestamp.. or time delta if high bit is set.
|
||||||
@ -244,28 +377,27 @@ int MSeriesLoader::Open(QString & path,Profile *profile)
|
|||||||
// tailPtrTwo = 12,
|
// tailPtrTwo = 12,
|
||||||
// cdbChecksumTwo = 14,
|
// cdbChecksumTwo = 14,
|
||||||
|
|
||||||
const char * datablock=block.data()+data_offset;
|
// const char * datablock=block.data()+data_offset;
|
||||||
quint8 basicCompliance=datablock[1];
|
// quint8 basicCompliance=datablock[1];
|
||||||
quint8 fosq=datablock[2];
|
// quint8 fosq=datablock[2];
|
||||||
quint8 smartAutoCPAPProfile=datablock[3];
|
// quint8 smartAutoCPAPProfile=datablock[3];
|
||||||
quint8 smartAutoCPAPTrend=datablock[4];
|
// quint8 smartAutoCPAPTrend=datablock[4];
|
||||||
quint8 ventProfile=datablock[6];
|
// quint8 ventProfile=datablock[6];
|
||||||
quint8 ventCompliance1=datablock[7];
|
// quint8 ventCompliance1=datablock[7];
|
||||||
quint8 sleepProfile1=datablock[8];
|
// quint8 sleepProfile1=datablock[8];
|
||||||
quint8 sleepTrend1=datablock[9];
|
// quint8 sleepTrend1=datablock[9];
|
||||||
quint8 sleepProfile2=datablock[10];
|
// quint8 sleepProfile2=datablock[10];
|
||||||
quint8 sleepTrend2=datablock[11];
|
// quint8 sleepTrend2=datablock[11];
|
||||||
quint8 ventProfile2=datablock[12];
|
// quint8 ventProfile2=datablock[12];
|
||||||
quint8 ventCompliance2=datablock[13];
|
// quint8 ventCompliance2=datablock[13];
|
||||||
quint8 sleepProfile3=datablock[14];
|
// quint8 sleepProfile3=datablock[14];
|
||||||
quint8 sleepTrend3=datablock[15];
|
// quint8 sleepTrend3=datablock[15];
|
||||||
|
|
||||||
int xblock_offset=data_offset+datablock[16];
|
|
||||||
|
|
||||||
// 0xa6: 01 00 b2 7f ff 31
|
// 0xa6: 01 00 b2 7f ff 31
|
||||||
// 0xac: 01 00 b2 7f ff 31
|
// 0xac: 01 00 b2 7f ff 31
|
||||||
|
|
||||||
// 0xb2: prescription block... ?
|
// 0xb2: ??? block... ?
|
||||||
// 0xb2: 00 00
|
// 0xb2: 00 00
|
||||||
|
|
||||||
// 0xb4: 01 36 a3 36 a2 b2 // the last bytes of all these are 8 bit additive checksums.
|
// 0xb4: 01 36 a3 36 a2 b2 // the last bytes of all these are 8 bit additive checksums.
|
||||||
@ -279,10 +411,6 @@ int MSeriesLoader::Open(QString & path,Profile *profile)
|
|||||||
// 0xd8: 4e 1a 4a fe
|
// 0xd8: 4e 1a 4a fe
|
||||||
// 268 bytes
|
// 268 bytes
|
||||||
// 1 byte checksum
|
// 1 byte checksum
|
||||||
|
|
||||||
const char * xblock=block.data()+xblock_offset;
|
|
||||||
|
|
||||||
|
|
||||||
// starting at 0xD8, with timestamp?
|
// starting at 0xD8, with timestamp?
|
||||||
// 8 blocks of 0x26e in size
|
// 8 blocks of 0x26e in size
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QString loadingtxt="<HTML><body style='text-align: center; vertical-align: center'><table width='100%' height='100%'><tr><td align=center><h1>Loading...</h1></td></tr></table></body></HTML>";
|
QString loadingtxt="<HTML><body style='text-align: center; vertical-align: center'><table width='100%' height='100%'><tr><td align=center><h1>Loading...</h1></td></tr></table></body></HTML>";
|
||||||
ui->summaryView->setHtml(loadingtxt);
|
ui->summaryView->setHtml(loadingtxt);
|
||||||
on_tabWidget_currentChanged(0);
|
on_tabWidget_currentChanged(0);
|
||||||
ui->actionImport_RemStar_MSeries_Data->setVisible(false);
|
//ui->actionImport_RemStar_MSeries_Data->setVisible(false);
|
||||||
}
|
}
|
||||||
extern MainWindow *mainwin;
|
extern MainWindow *mainwin;
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
Loading…
Reference in New Issue
Block a user