|
|
@ -1,7 +1,9 @@ |
|
|
|
#include "../../include/LowLevel/HonaLowLevelAPI.h" |
|
|
|
#include <include/LowLevel/Utils/Utils.h> |
|
|
|
|
|
|
|
#include "qdebug.h" |
|
|
|
#include "QTime" |
|
|
|
#include "QtConcurrent/QtConcurrent" |
|
|
|
|
|
|
|
bool HonaLowLevelAPI::getHsruIsStarted() const |
|
|
|
{ |
|
|
@ -46,6 +48,11 @@ bool HonaLowLevelAPI::isHiruStarted() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::deviceReset() |
|
|
|
{ |
|
|
|
ApiResult status; |
|
|
|
if(ApiResult::success) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
/*
|
|
|
|
QTime t; |
|
|
|
t.elapsed() |
|
|
@ -97,13 +104,17 @@ QString HonaLowLevelAPI::getDeviceId() |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruStarte() |
|
|
|
void HonaLowLevelAPI::hsruStart() |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hiruStart() |
|
|
|
{ |
|
|
|
if (isHiruStarted()) |
|
|
|
//exceptiom
|
|
|
|
|
|
|
|
QtConcurrent::run(this,&HonaLowLevelAPI::hsruMainThread); |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -114,6 +125,7 @@ void HonaLowLevelAPI::init() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::writeSettingToRegisters(HonaSetting& honaSetting) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
@ -124,16 +136,48 @@ void HonaLowLevelAPI::setConfig() |
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruMainThread() |
|
|
|
{ |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruReadThread); |
|
|
|
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread); |
|
|
|
|
|
|
|
_mutex.lock(); |
|
|
|
HsruStopEvent.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
|
|
|
|
_isReaderThreadFree = true; |
|
|
|
_isUpdateThreadFree = true; |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hiruReadThread() |
|
|
|
void HonaLowLevelAPI::hsruReadThread() |
|
|
|
{ |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
if (_isReaderThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
_mutex.lock(); |
|
|
|
HsruReadDone.wakeAll(); |
|
|
|
HsruUpdateAck.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|
void HonaLowLevelAPI::hsruUpdateThread() |
|
|
|
{ |
|
|
|
|
|
|
|
while (true) |
|
|
|
{ |
|
|
|
_mutex.lock(); |
|
|
|
HsruReadDone.wait(&_mutex); |
|
|
|
_mutex.unlock(); |
|
|
|
if (_isUpdateThreadFree) |
|
|
|
break; |
|
|
|
//dosth
|
|
|
|
HsruUpdateAck.wakeAll(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*************************************************************************************************/ |
|
|
|