23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"

This commit is contained in:
peri4
2014-06-23 21:08:27 +04:00
parent 2e5e75c4c4
commit 15a20d40ac
56 changed files with 10315 additions and 760 deletions

View File

@@ -94,12 +94,12 @@ bool PIBinaryLog::openDevice() {
return false;
}
if (isEmpty()) piCoutObj << "Error: Empty BinLog file";
// startlogtime = currentSystemTime();
// startlogtime = PISystemTime::current();
play_time = 0;
// nextrecord = readsRecord();
if (!rapidStart()) is_started = true;
}
startlogtime = currentSystemTime();
startlogtime = PISystemTime::current();
return true;
}
@@ -119,7 +119,7 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
double delay;
switch (playMode()) {
case PlayRealTime:
pt = currentSystemTime() - startlogtime;
pt = PISystemTime::current() - startlogtime;
// if (real_speedX > 0)
// for (int i=0; i<real_speedX-1; i++) pt += pt;
// piCout << pt << lastrecord.timestamp << lastrecord.timestamp - pt;
@@ -127,10 +127,10 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
if (lastrecord.timestamp > pt)
(lastrecord.timestamp - pt).sleep();
} else {
startlogtime = currentSystemTime() - lastrecord.timestamp;
startlogtime = PISystemTime::current() - lastrecord.timestamp;
is_started = true;
}
// int delay = piRoundd(lastread_timestamp.toMilliseconds() - (currentSystemTime() - startlogtime).toMilliseconds());
// int delay = piRoundd(lastread_timestamp.toMilliseconds() - (PISystemTime::current() - startlogtime).toMilliseconds());
break;
case PlayVariableSpeed:
delay = lastrecord.timestamp.toMilliseconds() - play_time;
@@ -152,7 +152,7 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
PIString PIBinaryLog::createNewFile() {
if (!file.close()) return PIString();
if (open(logDir() + "/" + filePrefix() + currentDateTime().toString("yyyy_MM_dd__hh_mm_ss.binlog"), PIIODevice::WriteOnly))
if (open(logDir() + "/" + filePrefix() + PIDateTime::current().toString("yyyy_MM_dd__hh_mm_ss.binlog"), PIIODevice::WriteOnly))
return file.path();
piCoutObj << "Can't create new file, maybe LogDir is invalid.";
return PIString();
@@ -162,7 +162,7 @@ PIString PIBinaryLog::createNewFile() {
int PIBinaryLog::writeBinLog(int id, const void *data, int size) {
if (size <= 0 || !canWrite()) return -1;
PIByteArray logdata;
logdata << id << size << (currentSystemTime() - startlogtime) << PIByteArray::RawData(data, size);
logdata << id << size << (PISystemTime::current() - startlogtime) << PIByteArray::RawData(data, size);
int res = file.write(logdata.data(), logdata.size());
file.flush();
if (res > 0) return size;
@@ -242,7 +242,7 @@ void PIBinaryLog::restart() {
play_time = 0;
file.seekToBegin();
checkFileHeader();
startlogtime = currentSystemTime();
startlogtime = PISystemTime::current();
if (th) startThreadedRead();
}
@@ -306,6 +306,13 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
}
PIString PIBinaryLog::constructFullPath() const {
PIString ret(fullPathPrefix() + "://");
ret << logDir() << ":" << filePrefix() << ":" << defaultID();
return ret;
}
void PIBinaryLog::configureFromFullPath(const PIString & full_path) {
PIStringList pl = full_path.split(":");
for (int i = 0; i < pl.size_s(); ++i) {