Opc.Ua.Com.Client.ComDaClientNodeManager.LocalToRemoteValue C# (CSharp) Method

LocalToRemoteValue() public static method

Converts a value to something the DA server can accept.
public static LocalToRemoteValue ( Variant srcValue, object &dstValue ) : int
srcValue Variant The source value.
dstValue object The converted value.
return int
        public static int LocalToRemoteValue(Variant srcValue, out object dstValue)
        {
            dstValue = null;

            TypeInfo srcType = srcValue.TypeInfo;

            if (srcType == null)
            {
                srcType = TypeInfo.Construct(srcValue.Value);
            }

            if (srcType.BuiltInType <= BuiltInType.DateTime
                || srcType.BuiltInType == BuiltInType.ByteString) // OPC UA specification ver 1.02 compliant.
            {
                dstValue = srcValue.Value;
                return ResultIds.S_OK;
            }

            try
            {
                if (srcType.BuiltInType == BuiltInType.Variant && srcType.ValueRank >= 0)
                {
                    dstValue = TypeInfo.CastArray((Array)srcValue.Value, BuiltInType.Variant, BuiltInType.Null, LocalToRemoteValue);
                    return ResultIds.S_OK;
                }
            }
            catch (Exception)
            {
                return ResultIds.E_BADTYPE;
            }

            return ResultIds.E_BADTYPE;
        }

Same methods

ComDaClientNodeManager::LocalToRemoteValue ( object srcValue, BuiltInType srcType, BuiltInType dstType ) : object