/// <summary> /// 戻り値をAppVarで取得する通信。 /// </summary> /// <param name="invoker">呼び出し元。</param> /// <param name="friendlyConnector">アプリケーションとの接続者。</param> /// <param name="protocolType">通信タイプ。</param> /// <param name="operationTypeInfo">操作タイプ情報。</param> /// <param name="varAddress">変数アドレス。</param> /// <param name="typeFullName">タイプフルネーム。</param> /// <param name="operation">操作名称。</param> /// <param name="arguments">引数。</param> /// <returns>変数。</returns> internal static AppVar SendAndVarReceive(object invoker, IFriendlyConnector friendlyConnector, ProtocolType protocolType, OperationTypeInfo operationTypeInfo, VarAddress varAddress, string typeFullName, string operation, object[] arguments) { object value = SendAndValueReceive(invoker, friendlyConnector, protocolType, operationTypeInfo, varAddress, typeFullName, operation, arguments); VarAddress retHandle = value as VarAddress; return (retHandle == null) ? (null) : (new AppVar(friendlyConnector, retHandle)); }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="protocolType">通信タイプ。</param> /// <param name="operationTypeInfo">操作タイプ情報。</param> /// <param name="varAddress">変数アドレス。</param> /// <param name="typeFullName">タイプフルネーム。</param> /// <param name="operation">操作名称。</param> /// <param name="arguments">引数。</param> public ProtocolInfo(ProtocolType protocolType, OperationTypeInfo operationTypeInfo, VarAddress varAddress, string typeFullName, string operation, object[] arguments) { _protocolType = protocolType; _operationTypeInfo = operationTypeInfo; _varAddress = varAddress; _typeFullName = typeFullName; _operation = operation; _arguments = arguments; }
/// <summary> /// 戻り値を値で取得する通信処理。 /// 通信基本形。 /// </summary> /// <param name="invoker">呼び出し元。</param> /// <param name="friendlyConnector">アプリケーションとの接続者。</param> /// <param name="protocolType">通信タイプ。</param> /// <param name="operationTypeInfo">操作タイプ情報。</param> /// <param name="varAddress">変数アドレス。</param> /// <param name="typeFullName">タイプフルネーム。</param> /// <param name="operation">操作名称。</param> /// <param name="arguments">引数。</param> /// <returns>値。</returns> internal static object SendAndValueReceive(object invoker, IFriendlyConnector friendlyConnector, ProtocolType protocolType, OperationTypeInfo operationTypeInfo, VarAddress varAddress, string typeFullName, string operation, object[] arguments) { //配列の場合の調整 arguments = AdjustArrayArgs(arguments); ReturnInfo ret = friendlyConnector.SendAndReceive(new ProtocolInfo(protocolType, operationTypeInfo, varAddress, typeFullName, operation, ConvertAppVar(friendlyConnector, arguments))); GC.KeepAlive(invoker); GC.KeepAlive(friendlyConnector); for (int i = 0; i < arguments.Length; i++) { if (arguments[i] != null) { GC.KeepAlive(arguments[i]); } } if (ret.Exception != null) { throw new FriendlyOperationException(ret.Exception); } return ret.ReturnValue; }
/// <summary> /// コンストラクタ。 /// </summary> /// <param name="friendlyConnector">アプリケーションとの接続クラス。</param> /// <param name="varAddress">変数アドレス</param> internal AppVar(IFriendlyConnector friendlyConnector, VarAddress varAddress) { _friendlyConnector = friendlyConnector; _varAddress = varAddress; }