本文整理汇总了C++中CGXDLMSVariant::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CGXDLMSVariant::GetSize方法的具体用法?C++ CGXDLMSVariant::GetSize怎么用?C++ CGXDLMSVariant::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGXDLMSVariant
的用法示例。
在下文中一共展示了CGXDLMSVariant::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue
// Set value of given attribute.
int CGXDLMSMBusSlavePortSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_DefaultBaud = (BAUDRATE) value.ToInteger();
}
else if (index == 3)
{
m_AvailableBaud = (BAUDRATE) value.ToInteger();
}
else if (index == 4)
{
m_AddressState = (ADDRESS_STATE) value.ToInteger();
}
else if (index == 5)
{
m_BusAddress = value.ToInteger();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例2: SetValue
// Set value of given attribute.
int CGXDLMSMessageHandler::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_ListeningWindow.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(it->Arr[0].byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
CGXDateTime start = tmp.dateTime;
CGXDLMSClient::ChangeType(it->Arr[1].byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
CGXDateTime end = tmp.dateTime;
m_ListeningWindow.push_back(std::pair<CGXDateTime, CGXDateTime>(start, end));
}
}
}
else if (index == 3)
{
m_AllowedSenders.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
m_AllowedSenders.push_back((char*) &it->byteArr[0]);
}
}
}
else if (index == 4)
{
m_SendersAndActions.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
string id((char*) &it->Arr[0].byteArr[0]);
//Object[] tmp2 = (Object[]) tmp[1];
/*TODO:
KeyValuePair<int, GXDLMSScriptAction> executed_script = new KeyValuePair<int, GXDLMSScriptAction>(Convert.ToInt32(tmp2[1], tmp2[2]));
m_SendersAndActions.Add(new KeyValuePair<string, KeyValuePair<int, GXDLMSScriptAction>>(id, tmp[1] as GXDateTime));
* */
}
}
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例3: SetValue
// Set value of given attribute.
int CGXDLMSSpecialDaysTable::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_Entries.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
CGXDLMSVariant tmp;
for (vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
{
CGXDLMSSpecialDay it;
it.SetIndex((*item).Arr[0].ToInteger());
CGXDLMSClient::ChangeType((*item).Arr[1].byteArr, DLMS_DATA_TYPE_DATE, tmp);
it.SetDate(tmp.dateTime);
it.SetDayId((*item).Arr[2].ToInteger());
m_Entries.push_back(it);
}
}
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例4: SetValue
// Set value of given attribute.
int CGXDLMSModemConfiguration::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
m_CommunicationSpeed = (BAUDRATE) value.bVal;
return ERROR_CODES_OK;
}
else if (index == 3)
{
m_InitialisationStrings.clear();
int ret;
for (vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSModemInitialisation item;
CGXDLMSVariant tmp;
if((ret = CGXDLMSClient::ChangeType(it->Arr[0].byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
item.SetRequest(tmp.ToString());
if((ret = CGXDLMSClient::ChangeType(it->Arr[1].byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
item.SetResponse(tmp.ToString());
if (it->Arr.size() > 2)
{
item.SetDelay(it->Arr[2].uiVal);
}
m_InitialisationStrings.push_back(item);
}
return ERROR_CODES_OK;
}
else if (index == 4)
{
m_ModemProfile.clear();
int ret;
for (vector<CGXDLMSVariant>::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
CGXDLMSVariant tmp;
if((ret = CGXDLMSClient::ChangeType(it->byteArr, DLMS_DATA_TYPE_STRING, tmp)) != ERROR_CODES_OK)
{
return ret;
}
m_ModemProfile.push_back(tmp.ToString());
}
return ERROR_CODES_OK;
}
return ERROR_CODES_INVALID_PARAMETER;
}
示例5: SetLogicalName
int CGXDLMSObject::SetLogicalName(CGXDLMSObject * target, CGXDLMSVariant& value)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(target->m_LN, value.byteArr, 6);
return ERROR_CODES_OK;
}
示例6: SetValue
int CGXDLMSAssociationShortName::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
m_ObjectList.clear();
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for(vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
{
int sn = item->Arr[0].ToInteger();
CGXDLMSObject* pObj = GetParent()->FindBySN(sn);
if (pObj == NULL)
{
OBJECT_TYPE type = (OBJECT_TYPE) item->Arr[1].ToInteger();
int version = item->Arr[2].ToInteger();
string ln;
CGXOBISTemplate::GetLogicalName(&(*item).Arr[3].byteArr[0], ln);
pObj = CGXDLMSObjectFactory::CreateObject(type);
pObj->SetLogicalName(ln);
pObj->SetShortName(sn);
pObj->SetVersion(version);
}
m_ObjectList.push_back(pObj);
}
}
}
else if (index == 3)
{
if (value.vt == DLMS_DATA_TYPE_NONE)
{
for(vector<CGXDLMSObject*>::iterator it = m_ObjectList.begin(); it != m_ObjectList.end(); ++it)
{
for(int pos = 1; pos != (*it)->GetAttributeCount(); ++pos)
{
(*it)->SetAccess(pos, ACCESSMODE_NONE);
}
}
}
else
{
UpdateAccessRights(value);
}
}
return ERROR_CODES_INVALID_PARAMETER;
}
示例7: SetValue
int CGXDLMSDemandRegister::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
SetCurrentAvarageValue(value.lVal);
}
else if (index == 3)
{
SetLastAvarageValue(value);
}
else if (index == 4)
{
m_Scaler = value.Arr[0].bVal;
m_Unit = value.Arr[1].bVal;
}
else if (index == 5)
{
SetStatus(value.lVal);
}
else if (index == 6)
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
SetCaptureTime(tmp.dateTime);
}
else if (index == 7)
{
CGXDLMSVariant tmp;
CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
SetStartTimeCurrent(tmp.dateTime);
}
else if (index == 8)
{
SetPeriod(value.ulVal);
}
else if (index == 9)
{
SetNumberOfPeriods(value.lVal);
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例8: SetValue
// Set value of given attribute.
int CGXDLMSGPRSSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
if (value.vt == DLMS_DATA_TYPE_STRING)
{
m_APN = value.ToString();
}
else
{
CGXDLMSVariant tmp;
int ret;
if ((ret = CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_STRING, tmp)) != 0)
{
return ret;
}
m_APN = tmp.strVal;
}
value = m_APN;
}
else if (index == 3)
{
m_PINCode = value.uiVal;
}
else if (index == 4)
{
m_DefaultQualityOfService.SetPrecedence(value.Arr[0].Arr[0].iVal);
m_DefaultQualityOfService.SetDelay(value.Arr[0].Arr[1].iVal);
m_DefaultQualityOfService.SetReliability(value.Arr[0].Arr[2].iVal);
m_DefaultQualityOfService.SetPeakThroughput(value.Arr[0].Arr[3].iVal);
m_DefaultQualityOfService.SetMeanThroughput(value.Arr[0].Arr[4].iVal);
m_RequestedQualityOfService.SetPrecedence(value.Arr[1].Arr[0].iVal);
m_RequestedQualityOfService.SetDelay(value.Arr[1].Arr[1].iVal);
m_RequestedQualityOfService.SetReliability(value.Arr[1].Arr[2].iVal);
m_RequestedQualityOfService.SetPeakThroughput(value.Arr[1].Arr[3].iVal);
m_RequestedQualityOfService.SetMeanThroughput(value.Arr[1].Arr[4].iVal);
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例9: SetValue
/*
* Set value of given attribute.
*/
int CGXDLMSAutoAnswer::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
if (index == 2)
{
SetMode((AUTO_CONNECT_MODE) value.lVal);
return ERROR_CODES_OK;
}
if (index == 3)
{
m_ListeningWindow.clear();
for (vector<CGXDLMSVariant>::iterator item = value.Arr.begin(); item != value.Arr.end(); ++item)
{
CGXDLMSVariant start, end;
CGXDLMSClient::ChangeType((*item).Arr[0].byteArr, DLMS_DATA_TYPE_DATETIME, start);
CGXDLMSClient::ChangeType((*item).Arr[1].byteArr, DLMS_DATA_TYPE_DATETIME, end);
m_ListeningWindow.push_back(std::pair< CGXDateTime, CGXDateTime>(start.dateTime, end.dateTime));
}
return ERROR_CODES_OK;
}
if (index == 4)
{
SetStatus((AUTO_ANSWER_STATUS) value.lVal);
return ERROR_CODES_OK;
}
if (index == 5)
{
SetNumberOfCalls(value.lVal);
return ERROR_CODES_OK;
}
if (index == 6)
{
m_NumberOfRingsInListeningWindow = m_NumberOfRingsOutListeningWindow = 0;
if (value.vt != DLMS_DATA_TYPE_NONE)
{
m_NumberOfRingsInListeningWindow = value.Arr[0].ToInteger();
m_NumberOfRingsOutListeningWindow = value.Arr[1].ToInteger();
}
return ERROR_CODES_OK;
}
return ERROR_CODES_INVALID_PARAMETER;
}
示例10: SetValue
// Set value of given attribute.
int CGXDLMSHdlcSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_CommunicationSpeed = (BAUDRATE) value.ToInteger();
}
else if (index == 3)
{
m_WindowSizeTransmit = value.ToInteger();
}
else if (index == 4)
{
m_WindowSizeReceive = value.ToInteger();
}
else if (index == 5)
{
m_MaximumInfoLengthTransmit = value.ToInteger();
}
else if (index == 6)
{
m_MaximumInfoLengthReceive = value.ToInteger();
}
else if (index == 7)
{
m_InterCharachterTimeout = value.ToInteger();
}
else if (index == 8)
{
m_InactivityTimeout = value.ToInteger();
}
else if (index == 9)
{
m_DeviceAddress = value.ToInteger();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例11: Equals
bool CGXDLMSVariant::Equals(CGXDLMSVariant& item)
{
if (vt != item.vt)
{
return false;
}
int size = GetSize();
if (size == -1 || size != item.GetSize())
{
return false;
}
if (size != 0)
{
return memcmp(&this->bVal, &item.bVal, size) == 0;
}
return true;
}
示例12: SetValue
// Set value of given attribute.
int CGXDLMSMBusMasterPortSetup::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_CommSpeed = (BAUDRATE) value.ToInteger();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例13: SetValue
// Set value of given attribute.
int CGXDLMSActionSchedule::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
return ERROR_CODES_OK;
}
else if (index == 2)
{
//CGXDLMSVariant tmp;
//CGXDLMSClient::ChangeType(value.Arr[0].byteArr, DLMS_DATA_TYPE_OCTET_STRING, tmp);
SetExecutedScriptLogicalName(value.Arr[0].ToString());
SetExecutedScriptSelector(value.Arr[1].lVal);
return ERROR_CODES_OK;
}
else if (index == 3)
{
SetType((SINGLE_ACTION_SCHEDULE_TYPE) value.lVal);
return ERROR_CODES_OK;
}
else if (index == 4)
{
m_ExecutionTime.clear();
for (vector<CGXDLMSVariant>::iterator it = value.Arr.begin();
it != value.Arr.end(); ++it)
{
CGXDLMSVariant time, date;
CGXDLMSClient::ChangeType((*it).Arr[0].byteArr, DLMS_DATA_TYPE_TIME, time);
CGXDLMSClient::ChangeType((*it).Arr[1].byteArr, DLMS_DATA_TYPE_DATE, date);
tm tm2 = time.dateTime.GetValue();
tm dt2 = date.dateTime.GetValue();
m_ExecutionTime.push_back(CGXDateTime(dt2.tm_year, dt2.tm_mon, dt2.tm_mday, tm2.tm_hour, tm2.tm_min, tm2.tm_sec, 0));
}
return ERROR_CODES_OK;
}
return ERROR_CODES_INVALID_PARAMETER;
}
示例14: SetValue
int CGXDLMSAssociationLogicalName::SetValue(int index, CGXDLMSVariant& value)
{
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
m_ObjectList.clear();
if (value.vt != DLMS_DATA_TYPE_NONE)
{
for (std::vector<CGXDLMSVariant >::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
OBJECT_TYPE type = (OBJECT_TYPE) (*it).Arr[0].ToInteger();
int version = (*it).Arr[1].ToInteger();
string ln;
CGXOBISTemplate::GetLogicalName(&(*it).Arr[2].byteArr[0], ln);
CGXDLMSObject* pObj = GetParent()->FindByLN(type, ln);
if (pObj == NULL)
{
pObj = CGXDLMSObjectFactory::CreateObject(type);
pObj->SetLogicalName(ln);
pObj->SetVersion(version);
}
UpdateAccessRights(pObj, (*it).Arr[3]);
m_ObjectList.push_back(pObj);
}
}
}
else if (index == 3)
{
m_AssociatedPartnersId = value;
}
else if (index == 4)
{
m_ApplicationContextName = value;
}
else if (index == 5)
{
m_XDLMSContextInfo = value;
}
else if (index == 6)
{
m_AuthenticationMechanismMame = value;
}
else if (index == 7)
{
m_Secret = value;
}
else if (index == 8)
{
m_AssociationStatus = (GX_ASSOCIATION_STATUS) value.ToInteger();
}
else if (index == 9)
{
m_SecuritySetupReference = value.ToString();
}
else
{
return ERROR_CODES_INVALID_PARAMETER;
}
return ERROR_CODES_OK;
}
示例15: SetValue
/*
* Set value of given attribute.
*/
int CGXDLMSProfileGeneric::SetValue(int index, CGXDLMSVariant& value)
{
int ret;
if (index == 1)
{
if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
{
return ERROR_CODES_INVALID_PARAMETER;
}
memcpy(m_LN, &value.byteArr[0], 6);
}
else if (index == 2)
{
if (m_CaptureObjects.size() == 0)
{
//Read capture objects first.
return ERROR_CODES_INVALID_PARAMETER;
}
m_Buffer.clear();
if (value.vt != DLMS_DATA_TYPE_NONE)
{
vector<DLMS_DATA_TYPE> types;
DLMS_DATA_TYPE type;
for (std::vector<std::pair<CGXDLMSObject*, CGXDLMSCaptureObject*> >::iterator it = m_CaptureObjects.begin(); it != m_CaptureObjects.end(); ++it)
{
if ((ret = (*it).first->GetUIDataType((*it).second->GetAttributeIndex(), type)) != 0)
{
return ret;
}
types.push_back(type);
}
for (std::vector<CGXDLMSVariant >::iterator row = value.Arr.begin(); row != value.Arr.end(); ++row)
{
if ((*row).Arr.size() != m_CaptureObjects.size())
{
//Number of columns do not match.
return ERROR_CODES_INVALID_PARAMETER;
}
for(unsigned int a = 0; a < (*row).Arr.size(); ++a)
{
CGXDLMSVariant data = (*row).Arr[a];
DLMS_DATA_TYPE type = types[a];
if (type != DLMS_DATA_TYPE_NONE && data.vt == DLMS_DATA_TYPE_OCTET_STRING)
{
unsigned char* pBuff = &data.byteArr[0];
int size = data.byteArr.size();
if ((ret = CGXOBISTemplate::GetData(pBuff, size, type, (*row).Arr[a])) != 0)
{
return ret;
}
}
std::pair<CGXDLMSObject*, CGXDLMSCaptureObject*> item = m_CaptureObjects[a];
if (item.first->GetObjectType() == OBJECT_TYPE_REGISTER && item.second->GetAttributeIndex() == 2)
{
double scaler = ((CGXDLMSRegister*) item.first)->GetScaler();
if (scaler != 1)
{
row[a] = data.ToDouble() * scaler;
}
}
}
m_Buffer.push_back(row->Arr);
}
}
m_EntriesInUse = m_Buffer.size();
}
else if (index == 3)
{
m_CaptureObjects.clear();
m_Buffer.clear();
m_EntriesInUse = 0;
if (value.vt == DLMS_DATA_TYPE_ARRAY)
{
for (std::vector<CGXDLMSVariant >::iterator it = value.Arr.begin(); it != value.Arr.end(); ++it)
{
if ((*it).Arr.size() != 4)
{
//Invalid structure format.
return ERROR_CODES_INVALID_PARAMETER;
}
OBJECT_TYPE type = (OBJECT_TYPE) (*it).Arr[0].ToInteger();
string ln;
CGXOBISTemplate::GetLogicalName(&(*it).Arr[1].byteArr[0], ln);
CGXDLMSObject* pObj = NULL;
if (GetParent() != NULL)
{
pObj = GetParent()->FindByLN(type, ln);
}
if(pObj == NULL)
{
pObj = CGXDLMSObjectFactory::CreateObject(type);
pObj->SetLogicalName(ln);
}
AddCaptureObject(pObj, (*it).Arr[2].ToInteger(), (*it).Arr[3].ToInteger());
}
}
//.........这里部分代码省略.........