当前位置: 首页>>代码示例>>C++>>正文


C++ CGXDLMSValueEventArg::GetIndex方法代码示例

本文整理汇总了C++中CGXDLMSValueEventArg::GetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ CGXDLMSValueEventArg::GetIndex方法的具体用法?C++ CGXDLMSValueEventArg::GetIndex怎么用?C++ CGXDLMSValueEventArg::GetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGXDLMSValueEventArg的用法示例。


在下文中一共展示了CGXDLMSValueEventArg::GetIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetValue

// Returns value of given attribute.
int CGXDLMSMessageHandler::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)
    {
        //TODO: e.SetValue(m_ListeningWindow);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 3)
    {
        //TODO: e.SetValue(m_AllowedSenders);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 4)
    {
        //TODO: e.SetValue(m_SendersAndActions);
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:31,代码来源:GXDLMSMessageHandler.cpp

示例2: GetValue

// Returns value of given attribute.
int CGXDLMSDisconnectControl::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(m_OutputState);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 3)
    {
        e.SetValue(m_ControlState);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 4)
    {
        e.SetValue(m_ControlMode);
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:31,代码来源:GXDLMSDisconnectControl.cpp

示例3: SetValue

// Set value of given attribute.
int CGXDLMSMessageHandler::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        m_ListeningWindow.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            for (std::vector<CGXDLMSVariant>::iterator it = e.GetValue().Arr.begin(); it != e.GetValue().Arr.end(); ++it)
            {
                CGXDLMSVariant tmp;
                CGXDLMSClient::ChangeType(it->Arr[0], DLMS_DATA_TYPE_DATETIME, tmp);
                CGXDateTime start = tmp.dateTime;
                CGXDLMSClient::ChangeType(it->Arr[1], DLMS_DATA_TYPE_DATETIME, tmp);
                CGXDateTime end = tmp.dateTime;
                m_ListeningWindow.push_back(std::pair<CGXDateTime, CGXDateTime>(start, end));
            }
        }

    }
    else if (e.GetIndex() == 3)
    {
        m_AllowedSenders.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            for (std::vector<CGXDLMSVariant>::iterator it = e.GetValue().Arr.begin(); it != e.GetValue().Arr.end(); ++it)
            {
                std::string str;
                str.append(reinterpret_cast<char const*>(it->byteArr), it->size);
                m_AllowedSenders.push_back(str);
            }
        }
    }
    else if (e.GetIndex() == 4)
    {
        m_SendersAndActions.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            for (std::vector<CGXDLMSVariant>::iterator it = e.GetValue().Arr.begin(); it != e.GetValue().Arr.end(); ++it)
            {
                //std::string id = it->Arr[0].byteArr.ToString();
                //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<std::string, KeyValuePair<int, GXDLMSScriptAction>>(id, tmp[1] as GXDateTime));
                 * */
            }
        }
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:59,代码来源:GXDLMSMessageHandler.cpp

示例4: SetValue

// Set value of given attribute.
int CGXDLMSGPRSSetup::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        if (e.GetValue().vt == DLMS_DATA_TYPE_STRING)
        {
            m_APN = e.GetValue().ToString();
        }
        else
        {
            CGXDLMSVariant tmp;
            int ret;
            if ((ret = CGXDLMSClient::ChangeType(e.GetValue(), DLMS_DATA_TYPE_STRING, tmp)) != 0)
            {
                return ret;
            }
            m_APN = tmp.strVal;
        }
        e.SetValue(m_APN);
    }
    else if (e.GetIndex() == 3)
    {
        m_PINCode = e.GetValue().uiVal;
    }
    else if (e.GetIndex() == 4)
    {
        m_DefaultQualityOfService.SetPrecedence(e.GetValue().Arr[0].Arr[0].iVal);
        m_DefaultQualityOfService.SetDelay(e.GetValue().Arr[0].Arr[1].iVal);
        m_DefaultQualityOfService.SetReliability(e.GetValue().Arr[0].Arr[2].iVal);
        m_DefaultQualityOfService.SetPeakThroughput(e.GetValue().Arr[0].Arr[3].iVal);
        m_DefaultQualityOfService.SetMeanThroughput(e.GetValue().Arr[0].Arr[4].iVal);

        m_RequestedQualityOfService.SetPrecedence(e.GetValue().Arr[1].Arr[0].iVal);
        m_RequestedQualityOfService.SetDelay(e.GetValue().Arr[1].Arr[1].iVal);
        m_RequestedQualityOfService.SetReliability(e.GetValue().Arr[1].Arr[2].iVal);
        m_RequestedQualityOfService.SetPeakThroughput(e.GetValue().Arr[1].Arr[3].iVal);
        m_RequestedQualityOfService.SetMeanThroughput(e.GetValue().Arr[1].Arr[4].iVal);
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:49,代码来源:GXDLMSGPRSSetup.cpp

示例5: GetValue

// Returns value of given attribute.
int CGXDLMSIecHdlcSetup::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;
    }
    else if (e.GetIndex() == 2)
    {
        e.SetValue(m_CommunicationSpeed);
    }
    else if (e.GetIndex() == 3)
    {
        e.SetValue(m_WindowSizeTransmit);
    }
    else if (e.GetIndex() == 4)
    {
        e.SetValue(m_WindowSizeReceive);
    }
    else if (e.GetIndex() == 5)
    {
        e.SetValue(m_MaximumInfoLengthTransmit);
    }
    else if (e.GetIndex() == 6)
    {
        e.SetValue(m_MaximumInfoLengthReceive);
    }
    else if (e.GetIndex() == 7)
    {
        e.SetValue(m_InterCharachterTimeout);
    }
    else if (e.GetIndex() == 8)
    {
        e.SetValue(m_InactivityTimeout);
    }
    else if (e.GetIndex() == 9)
    {
        e.SetValue(m_DeviceAddress);
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:52,代码来源:GXDLMSHdlcSetup.cpp

示例6: 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;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:42,代码来源:GXDLMSSpecialDaysTable.cpp

示例7: SetValue

// Set value of given attribute.
int CGXDLMSSpecialDaysTable::SetValue(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;
    }
    else if (e.GetIndex() == 2)
    {
        for (std::vector<CGXDLMSSpecialDay*>::iterator it = m_Entries.begin(); it != m_Entries.end(); ++it)
        {
            delete *it;
        }
        m_Entries.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            CGXDLMSVariant tmp;
            for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
            {
                CGXDLMSSpecialDay *it = new CGXDLMSSpecialDay();
                it->SetIndex((*item).Arr[0].ToInteger());
                CGXDLMSClient::ChangeType((*item).Arr[1], DLMS_DATA_TYPE_DATE, tmp);
                it->SetDate(tmp.dateTime);
                it->SetDayId((*item).Arr[2].ToInteger());
                m_Entries.push_back(it);
            }
        }
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:41,代码来源:GXDLMSSpecialDaysTable.cpp

示例8: SetValue

// Set value of given attribute.
int CGXDLMSIecHdlcSetup::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        m_CommunicationSpeed = (DLMS_BAUD_RATE) e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 3)
    {
        m_WindowSizeTransmit = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 4)
    {
        m_WindowSizeReceive = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 5)
    {
        m_MaximumInfoLengthTransmit = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 6)
    {
        m_MaximumInfoLengthReceive = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 7)
    {
        m_InterCharachterTimeout = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 8)
    {
        m_InactivityTimeout = e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 9)
    {
        m_DeviceAddress = e.GetValue().ToInteger();
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:45,代码来源:GXDLMSHdlcSetup.cpp

示例9: SetValue

// Set value of given attribute.
int CGXDLMSDisconnectControl::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        m_OutputState = e.GetValue().boolVal;
    }
    else if (e.GetIndex() == 3)
    {
        m_ControlState = (DLMS_CONTROL_STATE) e.GetValue().ToInteger();
    }
    else if (e.GetIndex() == 4)
    {
        m_ControlMode = (DLMS_CONTROL_MODE) e.GetValue().ToInteger();
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:25,代码来源:GXDLMSDisconnectControl.cpp

示例10: SetValue

// Set value of given attribute.
int CGXDLMSAutoConnect::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        SetMode((AUTO_CONNECT_MODE) e.GetValue().ToInteger());
        return DLMS_ERROR_CODE_OK;
    }
    else if (e.GetIndex() == 3)
    {
        SetRepetitions(e.GetValue().lVal);
        return DLMS_ERROR_CODE_OK;
    }
    else if (e.GetIndex() == 4)
    {
        SetRepetitionDelay(e.GetValue().lVal);
        return DLMS_ERROR_CODE_OK;
    }
    else if (e.GetIndex() == 5)
    {
        m_CallingWindow.clear();
        for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
        {
            CGXDLMSVariant tmp;
            CGXDLMSClient::ChangeType(item->Arr[0], DLMS_DATA_TYPE_DATETIME, tmp);
            CGXDateTime start = tmp.dateTime;
            CGXDLMSClient::ChangeType(item->Arr[1], DLMS_DATA_TYPE_DATETIME, tmp);
            CGXDateTime end = tmp.dateTime;
            m_CallingWindow.push_back(std::make_pair(start, end));
        }
        return DLMS_ERROR_CODE_OK;
    }
    else if (e.GetIndex() == 6)
    {
        m_Destinations.clear();
        std::vector< std::string > items;
        for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
        {
            CGXDLMSVariant value;
            CGXDLMSClient::ChangeType(*item, DLMS_DATA_TYPE_STRING, value);
            items.push_back(e.GetValue().ToString());
        }
        SetDestinations(items);
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:51,代码来源:GXDLMSAutoConnect.cpp

示例11: GetValue

// Returns value of given attribute.
int CGXDLMSTcpUdpSetup::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)
    {
        CGXDLMSVariant tmp = GetPort();
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 3)
    {
        CGXDLMSVariant tmp;
        GXHelpers::SetLogicalName(m_IPReference.c_str(), tmp);
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 4)
    {
        CGXDLMSVariant tmp = GetMaximumSegmentSize();
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        CGXDLMSVariant tmp = GetMaximumSimultaneousConnections();
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 6)
    {
        CGXDLMSVariant tmp = GetInactivityTimeout();
        e.SetValue(tmp);
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:47,代码来源:GXDLMSTcpUdpSetup.cpp

示例12: SetValue

/*
 * Set value of given attribute.
 */
int CGXDLMSAutoAnswer::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    if (e.GetIndex() == 2)
    {
        SetMode((AUTO_CONNECT_MODE)e.GetValue().lVal);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 3)
    {
        m_ListeningWindow.clear();
        for (std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
        {
            CGXDLMSVariant start, end;
            CGXDLMSClient::ChangeType((*item).Arr[0], DLMS_DATA_TYPE_DATETIME, start);
            CGXDLMSClient::ChangeType((*item).Arr[1], DLMS_DATA_TYPE_DATETIME, end);
            m_ListeningWindow.push_back(std::pair< CGXDateTime, CGXDateTime>(start.dateTime, end.dateTime));
        }
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 4)
    {
        SetStatus((AUTO_ANSWER_STATUS)e.GetValue().lVal);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        SetNumberOfCalls(e.GetValue().lVal);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 6)
    {
        m_NumberOfRingsInListeningWindow = m_NumberOfRingsOutListeningWindow = 0;
        if (e.GetValue().vt != DLMS_DATA_TYPE_NONE)
        {
            m_NumberOfRingsInListeningWindow = e.GetValue().Arr[0].ToInteger();
            m_NumberOfRingsOutListeningWindow = e.GetValue().Arr[1].ToInteger();
        }
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:Gurux,项目名称:Gurux.DLMS.cpp,代码行数:48,代码来源:GXDLMSAutoAnswer.cpp

示例13: SetValue

// Set value of given attribute.
int CGXDLMSPppSetup::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArg& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        if (e.GetValue().vt == DLMS_DATA_TYPE_STRING)
        {
            m_PHYReference = e.GetValue().ToString();
        }
        else
        {
            CGXDLMSVariant tmp;
            CGXDLMSClient::ChangeType(e.GetValue(), DLMS_DATA_TYPE_OCTET_STRING, tmp);
            m_PHYReference = tmp.ToString();
        }
    }
    else if (e.GetIndex() == 3)
    {
        m_LCPOptions.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            for(std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
            {
                CGXDLMSPppSetupLcpOption it;
                it.SetType((PPP_SETUP_LCP_OPTION_TYPE) (*item).Arr[0].ToInteger());
                it.SetLength((*item).Arr[1].ToInteger());
                it.SetData((*item).Arr[2]);
                m_LCPOptions.push_back(it);
            }
        }
    }
    else if (e.GetIndex() == 4)
    {
        m_IPCPOptions.clear();
        if (e.GetValue().vt == DLMS_DATA_TYPE_ARRAY)
        {
            for(std::vector<CGXDLMSVariant>::iterator item = e.GetValue().Arr.begin(); item != e.GetValue().Arr.end(); ++item)
            {
                CGXDLMSPppSetupIPCPOption it;
                it.SetType((PPP_SETUP_IPCP_OPTION_TYPE)(*item).Arr[0].ToInteger());
                it.SetLength((*item).Arr[1].ToInteger());
                it.SetData((*item).Arr[2]);
                m_IPCPOptions.push_back(it);
            }
        }
    }
    else if (e.GetIndex() == 5)
    {
        m_UserName.Clear();
        m_Password.Clear();
        m_UserName.Set(e.GetValue().Arr[0].byteArr, e.GetValue().Arr[0].size);
        m_Password.Set(e.GetValue().Arr[1].byteArr, e.GetValue().Arr[1].size);
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:63,代码来源:GXDLMSPppSetup.cpp

示例14: GetValue

/*
* Returns value of given attribute.
*/
int CGXDLMSProfileGeneric::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)
    {
        CGXByteBuffer tmp;
        tmp.Set(e.GetValue().byteArr, e.GetValue().size);
        int ret = GetProfileGenericData(e.GetSelector(), e.GetParameters(), tmp);
        e.SetValue(tmp);
        return ret;
    }
    if (e.GetIndex() == 3)
    {
        CGXByteBuffer data;
        int ret = GetColumns(data);
        e.SetValue(data);
        return ret;
    }
    if (e.GetIndex() == 4)
    {
        e.SetValue(GetCapturePeriod());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        e.SetValue(GetSortMethod());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 6)
    {
        char empty[6] = {0};
        CGXByteBuffer data;
        data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE);
        data.SetUInt8(4);
        if (m_SortObject == NULL)
        {
            //ClassID
            data.SetUInt8(DLMS_DATA_TYPE_UINT16);
            data.SetUInt16(0);
            //LN
            data.SetUInt8(DLMS_DATA_TYPE_OCTET_STRING);
            data.SetUInt8(6);
            data.Set(empty, 6);
            //Selected Attribute Index
            data.SetUInt8(DLMS_DATA_TYPE_INT8);
            data.SetUInt8(0);
            //Selected Data Index
            data.SetUInt8(DLMS_DATA_TYPE_UINT16);
            data.SetUInt16(0);
        }
        else
        {
            int ret;
            CGXDLMSVariant ln;
            //ClassID
            data.SetUInt8(DLMS_DATA_TYPE_UINT16);
            data.SetUInt16(m_SortObject->GetObjectType());
            //LN
            data.SetUInt8(DLMS_DATA_TYPE_OCTET_STRING);
            data.SetUInt8(6);
            if ((ret = GetLogicalName(m_SortObject, ln)) != 0)
            {
                return ret;
            }
            data.Set(&ln.byteArr, 6);
            //Selected Attribute Index
            data.SetUInt8(DLMS_DATA_TYPE_INT8);
            data.SetUInt8(m_SortObjectAttributeIndex);
            //Selected Data Index
            data.SetUInt8(DLMS_DATA_TYPE_UINT16);
            data.SetUInt16(m_SortObjectDataIndex);
        }
        e.SetValue(data);
    }
    if (e.GetIndex() == 7)
    {
        e.SetValue(GetEntriesInUse());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 8)
    {
        e.SetValue(GetProfileEntries());
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:99,代码来源:GXDLMSProfileGeneric.cpp

示例15: GetValue

// Returns value of given attribute.
int CGXDLMSAutoConnect::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((unsigned char) GetMode());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 3)
    {
        e.SetValue(GetRepetitions());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 4)
    {
        e.SetValue(GetRepetitionDelay());
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 5)
    {
        int cnt = m_CallingWindow.size();
        CGXByteBuffer data;
        data.SetUInt8(DLMS_DATA_TYPE_ARRAY);
        int ret;
        //Add count
        GXHelpers::SetObjectCount(cnt, data);
        if (cnt != 0)
        {
            CGXDLMSVariant s, e;
            for (std::vector<std::pair< CGXDateTime, CGXDateTime> >::iterator it = m_CallingWindow.begin(); it != m_CallingWindow.end(); ++it)
            {
                data.SetUInt8(DLMS_DATA_TYPE_STRUCTURE);
                data.SetUInt8(2); //Count
                s = it->first;
                e = it->second;
                if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, s)) != 0 || //start_time
                        (ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, e)) != 0) //end_time
                {
                    return ret;
                }
            }
        }
        e.SetValue(data);
        return DLMS_ERROR_CODE_OK;
    }
    if (e.GetIndex() == 6)
    {
        CGXByteBuffer data;
        data.SetUInt8(DLMS_DATA_TYPE_ARRAY);
        int ret;
        int cnt = m_Destinations.size();
        //Add count
        GXHelpers::SetObjectCount(cnt, data);
        for (std::vector< std::string >::iterator it = m_Destinations.begin(); it != m_Destinations.end(); ++it)
        {
            CGXDLMSVariant value;
            e.GetValue().Add(&(*it)[0], it->size());
            if ((ret = GXHelpers::SetData(data, DLMS_DATA_TYPE_OCTET_STRING, value)) != 0) //destination
            {
                return ret;
            }
        }
        e.SetValue(data);
        return DLMS_ERROR_CODE_OK;
    }
    return DLMS_ERROR_CODE_INVALID_PARAMETER;
}
开发者ID:bfabio,项目名称:Gurux.DLMS.cpp,代码行数:78,代码来源:GXDLMSAutoConnect.cpp


注:本文中的CGXDLMSValueEventArg::GetIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。