Skip to content

Commit

Permalink
Merge branch 'master' of github.com:avp-avp/libs
Browse files Browse the repository at this point in the history
  • Loading branch information
avp-avp committed Feb 26, 2017
2 parents f22be81 + 5999bdd commit 0225b2e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
1 change: 1 addition & 0 deletions libcomm/libcomm.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>../libutils/jsoncpp.w32</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand Down
3 changes: 2 additions & 1 deletion libutils/libutils.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JSON_DLL_BUILD;LIBUTILS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>jsoncpp.w32</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -153,7 +154,7 @@
<ClCompile Include="ConfigItem.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="Exception.cpp" />
<ClCompile Include="jsoncpp\jsoncpp.cpp" />
<ClCompile Include="jsoncpp.w32\jsoncpp.cpp" />
<ClCompile Include="libutils.cpp" />
<ClCompile Include="locks.cpp" />
<ClCompile Include="logging.cpp" />
Expand Down
4 changes: 2 additions & 2 deletions libutils/libutils.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
<ClCompile Include="XmlDocument.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="jsoncpp\jsoncpp.cpp">
<ClCompile Include="Config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Config.cpp">
<ClCompile Include="jsoncpp.w32\jsoncpp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
Expand Down
17 changes: 10 additions & 7 deletions libutils/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ LogParam::LogParam()
#ifdef USE_CONFIG
LogParam::LogParam(CConfigItem node)
{
FileName = node.getStr("FileName");
LogTime = (node.getStr("LogTime", false, "yes")=="yes")?true:false;
ConsoleLevel = node.getInt("ConsoleLevel", false, -1);
FileLevel = node.getInt("FileLevel", false, 0);
FileName = node.getStr("FileName", false, node.getStr("file_name"));
LogTime = (node.getStr("LogTime", false, node.getStr("log_time", false, "yes"))=="yes")?true:false;
ConsoleLevel = node.getInt("ConsoleLevel", false, node.getInt("console_level", false, -1));
FileLevel = node.getInt("FileLevel", false, node.getInt("file_level", false, 0));
}
#endif

Expand Down Expand Up @@ -73,8 +73,8 @@ CLog* CLog::GetLog(string Name)
if (pos>0)
m_BasePath = m_BasePath.substr(0, pos+1);
#else
m_BasePath = ".";
// m_BasePath = "/run/";
// m_BasePath = ".";
m_BasePath = "/run/";
#endif

log->Open((m_BasePath+Name+".log").c_str());
Expand Down Expand Up @@ -112,10 +112,13 @@ void CLog::Init(CConfigItem *Config)
{
CConfigItemList nodes;
Config->getList("Log", nodes);

if (nodes.size()==0)
Config->getList("log", nodes);

for(CConfigItemList::iterator i=nodes.begin();i!=nodes.end();i++)
{
m_LogsCfg[(*i)->getStr("Name")] = LogParam(**i);
m_LogsCfg[(*i)->getStr("Name", false, (*i)->getStr("name"))] = LogParam(**i);
}
}
#endif
Expand Down
13 changes: 8 additions & 5 deletions libwb/WBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const char *g_Topics[] =
"WindSpeed", // wind_speed m / s float
"PowerPower", // watt float
"PowerConsumption", // power_consumption kWh float
"VoltageVoltage", // volts float
"WaterFlow", // water_flow m ^ 3 / hour float
"voltage", // volts float
"water_flow", // water_flow m ^ 3 / hour float
"WaterTotal", // consumption water_consumption m ^ 3 float
"Resistance", // resistance Ohm float
"resistance", // resistance Ohm float
"concentration", // concentration ppm float(unsigned)

"",
Expand Down Expand Up @@ -94,6 +94,9 @@ string CWBControl::getTypeName()
void CWBControl::setType(const string& type)
{
Type = getType(type);

if (Type == Error && type != "" && type != "Error")
throw CHaException(CHaException::ErrBadParam, "Unknown device type '%s'", type.c_str());
}

bool CWBControl::isLoaded()
Expand Down Expand Up @@ -296,7 +299,7 @@ void CWBDevice::setBySource(string source, string sourceType, string Value)
}
}

void CWBDevice::subscribeToEntich(string_vector &v)
void CWBDevice::subscribeToEnrich(string_vector &v)
{
if (m_Description.size()==0)
v.push_back("/devices/" + m_Name+ "/meta/#");
Expand Down Expand Up @@ -338,4 +341,4 @@ bool CWBDevice::isLoaded()
}

return true;
}
}
2 changes: 1 addition & 1 deletion libwb/WBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class LIBWB_API CWBDevice
void updateValues(string_map &);
const CControlMap *getControls(){return &m_Controls;};
string getTopic(string Control);
void subscribeToEntich(string_vector &v);
void subscribeToEnrich(string_vector &v);
void enrichDevice(const string &meta, const string &val);
void enrichControl(const string &control, const string &meta, const string &val);
bool isLoaded();
Expand Down
1 change: 1 addition & 0 deletions libwb/libwb.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBWB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../libutils/jsoncpp.w32</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down

0 comments on commit 0225b2e

Please sign in to comment.