由于安车项目每10ms采集一次数据,时间极短,采集任务与上报任务不同步,造成历史数据一样,现增加每次历史数据在写入时执行一次数据采集
This commit is contained in:
parent
0000a66827
commit
edbcc43b35
|
@ -102,7 +102,7 @@ void HistoryStore::RenderTask(void* param)
|
|||
void HistoryStore::Reader()
|
||||
{
|
||||
//ds_printf("HistoryStore::Reader %d/%d/%d \r\n", Size, Cache.Position(), Cache.Length);
|
||||
|
||||
Process(OnWrite);
|
||||
// 生成历史数据
|
||||
Buffer bs(Data, Size);
|
||||
Write(bs);
|
||||
|
@ -153,6 +153,12 @@ void HistoryStore::Store()
|
|||
Process(len, OnStore);
|
||||
}
|
||||
|
||||
void HistoryStore::Process(EventHandler handler)
|
||||
{
|
||||
if (!handler) return;
|
||||
handler(this, nullptr);
|
||||
}
|
||||
|
||||
void HistoryStore::Process(int len, DataHandler handler)
|
||||
{
|
||||
if (!len || !handler) return;
|
||||
|
|
|
@ -21,6 +21,8 @@ public:
|
|||
DataHandler OnReport;
|
||||
// 数据存储句柄
|
||||
DataHandler OnStore;
|
||||
// 数据写入句柄
|
||||
EventHandler OnWrite;
|
||||
|
||||
// 初始化
|
||||
HistoryStore();
|
||||
|
@ -52,6 +54,7 @@ private:
|
|||
void Report();
|
||||
void Store();
|
||||
|
||||
void Process(EventHandler handler);
|
||||
void Process(int len, DataHandler handler);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue