增加采集配置
This commit is contained in:
parent
d1523be4ba
commit
11dbe463ec
|
@ -0,0 +1,64 @@
|
|||
#include "Kernel\Sys.h"
|
||||
|
||||
#include "Device\Flash.h"
|
||||
|
||||
#include "GatherConfig.h"
|
||||
|
||||
GatherConfig::GatherConfig()
|
||||
{
|
||||
_Name = "Gather";
|
||||
_Start = &RenderPeriod;
|
||||
_End = &TagEnd;
|
||||
}
|
||||
|
||||
void GatherConfig::Init()
|
||||
{
|
||||
ConfigBase::Init();
|
||||
|
||||
RenderPeriod = 30;
|
||||
ReportPeriod = 300;
|
||||
StorePeriod = 600;
|
||||
|
||||
MaxCache = 16 * 1024;
|
||||
MaxReport = 1024;
|
||||
}
|
||||
|
||||
bool GatherConfig::Set(const Pair& args, Stream& result)
|
||||
{
|
||||
debug_printf("GatherConfig::Set\r\n");
|
||||
|
||||
auto cfg = GatherConfig::Create();
|
||||
|
||||
args.Get("RenderPeriod", cfg->RenderPeriod);
|
||||
args.Get("ReportPeriod", cfg->ReportPeriod);
|
||||
args.Get("StorePeriod", cfg->StorePeriod);
|
||||
|
||||
args.Get("MaxCache", cfg->MaxCache);
|
||||
args.Get("MaxReport", cfg->MaxReport);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GatherConfig::Get(const Pair& args, Stream& result)
|
||||
{
|
||||
debug_printf("GatherConfig::Get\r\n");
|
||||
|
||||
auto cfg = GatherConfig::Create();
|
||||
cfg->Write(result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GatherConfig* GatherConfig::Current;
|
||||
GatherConfig* GatherConfig::Create()
|
||||
{
|
||||
static GatherConfig tc;
|
||||
if(!Current)
|
||||
{
|
||||
GatherConfig::Current = &tc;
|
||||
tc.Init();
|
||||
tc.Load();
|
||||
}
|
||||
|
||||
return &tc;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef __GatherConfig_H__
|
||||
#define __GatherConfig_H__
|
||||
|
||||
#include "..\Config.h"
|
||||
#include "Message\BinaryPair.h"
|
||||
#include "Message\DataStore.h"
|
||||
|
||||
// 采集配置
|
||||
class GatherConfig : public ConfigBase
|
||||
{
|
||||
public:
|
||||
ushort RenderPeriod; // 生成历史数据周期。默认30s
|
||||
ushort ReportPeriod; // 上报数据周期。默认300s
|
||||
ushort StorePeriod; // 写入Store周期。默认600s
|
||||
|
||||
ushort MaxCache; // 缓存最大长度。默认16 * 1024
|
||||
ushort MaxReport; // 每次最大上报长度。默认1024
|
||||
|
||||
byte TagEnd; // 数据区结束标识符
|
||||
|
||||
GatherConfig();
|
||||
|
||||
virtual void Init();
|
||||
|
||||
// 注册给 TokenClient 名称 Gather/Set
|
||||
bool Set(const Pair& args, Stream& result);
|
||||
// 注册给 TokenClient 名称 Gather/Get
|
||||
bool Get(const Pair& args, Stream& result);
|
||||
|
||||
static GatherConfig* Current;
|
||||
static GatherConfig* Create();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -8,12 +8,12 @@ class HistoryStore
|
|||
{
|
||||
public:
|
||||
MemoryStream Cache; // 数据
|
||||
short RenderPeriod; // 生成历史数据周期。默认30s
|
||||
short ReportPeriod; // 上报数据周期。默认300s
|
||||
short StorePeriod; // 写入Store周期。默认600s
|
||||
ushort RenderPeriod; // 生成历史数据周期。默认30s
|
||||
ushort ReportPeriod; // 上报数据周期。默认300s
|
||||
ushort StorePeriod; // 写入Store周期。默认600s
|
||||
|
||||
short MaxCache; // 缓存最大长度。默认16 * 1024
|
||||
short MaxReport; // 每次最大上报长度。默认1024
|
||||
ushort MaxCache; // 缓存最大长度。默认16 * 1024
|
||||
ushort MaxReport; // 每次最大上报长度。默认1024
|
||||
|
||||
bool Opened;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,26 +27,26 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -199,13 +199,13 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
Loading…
Reference in New Issue