本文整理汇总了C++中CGXDLMSValueEventArg::SetByteArray方法的典型用法代码示例。如果您正苦于以下问题:C++ CGXDLMSValueEventArg::SetByteArray方法的具体用法?C++ CGXDLMSValueEventArg::SetByteArray怎么用?C++ CGXDLMSValueEventArg::SetByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGXDLMSValueEventArg
的用法示例。
在下文中一共展示了CGXDLMSValueEventArg::SetByteArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValue
// Returns value of given attribute.
int CGXDLMSSpecialDaysTable::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
if (e.GetIndex() == 1)
{
int ret;
CGXDLMSVariant tmp;
if ((ret = GetLogicalName(this, tmp)) != 0)
{
return ret;
}
e.SetValue(tmp);
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 2)
{
e.SetByteArray(true);
CGXByteBuffer data;
data.SetUInt8(DLMS_DATA_TYPE_ARRAY);
//Add count
GXHelpers::SetObjectCount((unsigned long)m_Entries.size(), data);
int ret;
CGXDLMSVariant index, date, id;
for (std::vector<CGXDLMSSpecialDay*>::iterator it = m_Entries.begin(); it != m_Entries.end(); ++it)
{
data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE);
data.SetUInt8(3); //Count
index = (*it)->GetIndex();
date = (*it)->GetDate();
id = (*it)->GetDayId();
if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT16, index)) != DLMS_ERROR_CODE_OK ||
(ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, date)) != DLMS_ERROR_CODE_OK ||
(ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT8, id)) != DLMS_ERROR_CODE_OK)
{
return ret;
}
}
e.SetValue(data);
return DLMS_ERROR_CODE_OK;
}
return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
示例2: GetValue
// Returns value of given attribute.
int CGXDLMSAutoAnswer::GetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
if (e.GetIndex() == 1)
{
int ret;
CGXDLMSVariant tmp;
if ((ret = GetLogicalName(this, tmp)) != 0)
{
return ret;
}
e.SetValue(tmp);
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 2)
{
e.SetValue(GetMode());
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 3)
{
e.SetByteArray(true);
int ret;
unsigned long cnt = (unsigned long)m_ListeningWindow.size();
CGXByteBuffer data;
data.SetUInt8(DLMS_DATA_TYPE_ARRAY);
//Add count
GXHelpers::SetObjectCount(cnt, data);
CGXDLMSVariant f, s;
for (std::vector<std::pair<CGXDateTime, CGXDateTime> >::iterator it =
m_ListeningWindow.begin(); it != m_ListeningWindow.end(); ++it)
{
data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE);
data.SetUInt8(2); //Count
f = it->first;
s = it->second;
if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, f)) != 0 || //start_time
(ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, s)) != 0) //end_time
{
return ret;
}
}
e.SetValue(data);
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 4)
{
e.SetValue(GetStatus());
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 5)
{
e.SetValue(GetNumberOfCalls());
return DLMS_ERROR_CODE_OK;
}
if (e.GetIndex() == 6)
{
e.SetByteArray(true);
CGXByteBuffer data;
data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE);
GXHelpers::SetObjectCount(2, data);
CGXDLMSVariant in = m_NumberOfRingsInListeningWindow;
CGXDLMSVariant out = m_NumberOfRingsOutListeningWindow;
int ret;
if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT8, in)) != DLMS_ERROR_CODE_OK ||
(ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_UINT8, out)) != DLMS_ERROR_CODE_OK)
{
return ret;
}
e.SetValue(data);
return DLMS_ERROR_CODE_OK;
}
return DLMS_ERROR_CODE_INVALID_PARAMETER;
}