Beispiel #1
0
        /// <summary>
        /// 依据容器控件中的对应映射控件,将本地配置参数配置到远程设备;
        /// </summary>
        /// <param name="ownerPage">容器控件;</param>
        /// <param name="channelNum">参数所属通道号;</param>
        /// <returns>tagErrorCode</returns>
        public DevControl.tagErrorCode SetParameter(Control ownerPage, int channelNum)
        {
            IntPtr setParaList;

            DevControl.tagErrorCode eCode;

            //将配置参数设置到对应远程设备;

            setParaList = DevControl.paralistCreate(this._devHandle);
            if (setParaList == IntPtr.Zero)
            {
                return(DevControl.tagErrorCode.DM_ERR_MEM);
            }

            eCode = GetParameterFromProperty(ownerPage, channelNum, setParaList);
            if (eCode == DevControl.tagErrorCode.DM_ERR_OK)
            {
                Debug.Assert(setParaList != IntPtr.Zero);
                eCode = DevControl.DM_SetPara(this._devHandle, setParaList, 1000);
                DevControl.paralistDestroy(setParaList);
            }
            return(eCode);
        }
Beispiel #2
0
        /// <summary>
        /// 依据容器控件中的对应映射控件,从设备获取参数并填充对应映射控件;
        /// </summary>
        /// <param name="ownerPage">容器控件;</param>
        /// <param name="channelNum">参数所属通道号;</param>
        /// <returns>tagErrorCode</returns>
        public DevControl.tagErrorCode GetParameter(Control ownerPage, int channelNum)
        {
            IntPtr getParaList;

            //从远程设备获取其当前配置参数;
            getParaList = DevControl.paralistCreate(this._devHandle);
            if (getParaList == IntPtr.Zero)
            {
                return(DevControl.tagErrorCode.DM_ERR_MEM);
            }

            GetQueryParaList(ownerPage, channelNum, getParaList);

            DevControl.tagErrorCode errCode = DevControl.DM_GetPara(this._devHandle, getParaList, 1000);
            if (errCode == DevControl.tagErrorCode.DM_ERR_OK)
            {
                SetParameterToProperty(getParaList, ownerPage, channelNum);
            }

            DevControl.paralistDestroy(getParaList);

            return(errCode);
        }