Example #1
0
        /// <summary>
        /// Constructs a OpcResult object.
        /// </summary>
        /// <param name="resultID">The code returned by a   system function or OPC function. The code can be retrieved with the member function Code() and a description text can be retrieved with the member function <see cref="Description" />. </param>
        /// <param name="eFuncType">Specifies   the type of function which has returned the code. This parameter is used to create the code type which can be retrieved with the member function <see cref="Type" />. </param>
        /// <param name="caller">Object which   caused the error. Can be null</param>
        /// <returns></returns>
        internal OpcResult(OpcResult resultID, FuncCallType eFuncType, object caller)
        {
            _name    = null;
            _message = null;
            _code    = resultID.Code;
            _caller  = caller;
            _type    = CodeType.OpcSysCode;

            if (eFuncType == FuncCallType.SysFuncCall)
            {
                _type = CodeType.SysCode;                                              // System specific errror returned by a system function
            }
            else if ((((resultID.Code) >> 16) & 0x1fff) == 0x4)
            {                 // FACILITY_ITF                    0x4
                if (eFuncType == FuncCallType.DaFuncCall)
                {
                    _type = CodeType.DaCode;
                }
                else
                {
                    _type = CodeType.AeCode;
                }
            }
            else
            {
                _type = CodeType.OpcSysCode;                                           // System specific error returned by an OPC function
            }
        }
        /// <summary>
        /// Constructs a OpcResult object.
        /// </summary>
        /// <param name="resultId">The code returned by a   system function or OPC function. The code can be retrieved with the member function Code() and a description text can be retrieved with the member function <see cref="Description" />. </param>
        /// <param name="eFuncType">Specifies   the type of function which has returned the code. This parameter is used to create the code type which can be retrieved with the member function <see cref="Type" />. </param>
        /// <param name="caller">Object which   caused the error. Can be null</param>
        /// <returns></returns>
        internal OpcResult(OpcResult resultId, FuncCallType eFuncType, object caller)
        {
            name_    = null;
            message_ = null;
            code_    = resultId.Code;
            caller_  = caller;
            type_    = CodeType.OpcSysCode;

            if (eFuncType == FuncCallType.SysFuncCall)
            {
                type_ = CodeType.SysCode;                              // System specific error returned by a system function
            }
            else if ((((resultId.Code) >> 16) & 0x1fff) == 0x4)
            {     // FACILITY_ITF                    0x4
                if (eFuncType == FuncCallType.DaFuncCall)
                {
                    type_ = CodeType.DaCode;
                }
                else
                {
                    type_ = CodeType.AeCode;
                }
            }
            else
            {
                type_ = CodeType.OpcSysCode;                           // System specific error returned by an OPC function
            }
        }