コード例 #1
0
            private void nativeOperateHandler(UInt32 invokeId, IntPtr parameter, int err, int type, bool success)
            {
                GCHandle handle = GCHandle.FromIntPtr(parameter);

                Tuple <ControlActionHandler, object> callbackInfo = handle.Target as Tuple <ControlActionHandler, object>;

                ControlActionHandler handler = callbackInfo.Item1;
                object handlerParameter      = callbackInfo.Item2;

                handle.Free();

                IedClientError clientError = (IedClientError)err;

                handler(invokeId, handlerParameter, clientError, (ControlActionType)type, success);
            }
コード例 #2
0
            /// <summary>
            /// Cancel a selection or time activated operation
            /// </summary>
            public UInt32 CancelAsync(ControlActionHandler handler, object parameter)
            {
                int error;

                Tuple <ControlActionHandler, object> callbackInfo = Tuple.Create(handler, parameter);

                GCHandle handle = GCHandle.Alloc(callbackInfo);

                UInt32 invokeId = ControlObjectClient_cancelAsync(self, out error, nativeOperateHandler, GCHandle.ToIntPtr(handle));

                if (error != 0)
                {
                    handle.Free();
                    throw new IedConnectionException("Cancel failed", error);
                }

                return(invokeId);
            }
コード例 #3
0
            /// <summary>
            /// Send a select with value command for generic MmsValue instances - asynchronous version
            /// </summary>
            /// <param name='ctlVal'>the value to be checked.</param>
            /// <param name="handler">Callback function to handle the received response or service timeout</param>
            /// <param name="parameter">User provided callback parameter. Will be passed to the callback function</param>
            /// <returns>the invoke ID of the sent request</returns>
            /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
            public UInt32 SelectWithValueAsync(MmsValue ctlVal, ControlActionHandler handler, object parameter)
            {
                int error;

                Tuple <ControlActionHandler, object> callbackInfo = Tuple.Create(handler, parameter);

                GCHandle handle = GCHandle.Alloc(callbackInfo);

                UInt32 invokeId = ControlObjectClient_selectWithValueAsync(self, out error, ctlVal.valueReference, nativeOperateHandler, GCHandle.ToIntPtr(handle));

                if (error != 0)
                {
                    handle.Free();
                    throw new IedConnectionException("Select with value failed", error);
                }

                return(invokeId);
            }
コード例 #4
0
 /// <summary>
 /// Send a select with value command for float controls - asynchronous version
 /// </summary>
 /// <param name='ctlVal'>the value to be checked.</param>
 /// <param name="handler">Callback function to handle the received response or service timeout</param>
 /// <param name="parameter">User provided callback parameter. Will be passed to the callback function</param>
 /// <returns>the invoke ID of the sent request</returns>
 /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
 public UInt32 SelectWithValueAsync(float ctlVal, ControlActionHandler handler, object parameter)
 {
     return(SelectWithValueAsync(new MmsValue(ctlVal), handler, parameter));
 }
コード例 #5
0
 /// <summary>
 /// Operate the control with the specified control value.
 /// </summary>
 /// <param name='ctlVal'>the new value of the control</param>
 /// <param name="handler">Callback function to handle the received response or service timeout</param>
 /// <param name="parameter">User provided callback parameter. Will be passed to the callback function</param>
 /// <returns>the invoke ID of the sent request</returns>
 /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
 public UInt32 OperateAsync(MmsValue ctlVal, ControlActionHandler handler, object parameter)
 {
     return(OperateAsync(ctlVal, 0, handler, parameter));
 }
コード例 #6
0
 /// <summary>
 /// Operate the control with the specified control value (time activated control).
 /// </summary>
 /// <param name='ctlVal'>the new value of the control</param>
 /// <param name='operTime'>the time when the operation will be executed</param>
 /// <param name="handler">Callback function to handle the received response or service timeout</param>
 /// <param name="parameter">User provided callback parameter. Will be passed to the callback function</param>
 /// <returns>the invoke ID of the sent request</returns>
 /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
 public UInt32 OperateAsync(int ctlVal, UInt64 operTime, ControlActionHandler handler, object parameter)
 {
     return(OperateAsync(ctlVal, operTime, handler, parameter));
 }
コード例 #7
0
            /// <summary>
            /// Operate the control with the specified control value (time activated control).
            /// </summary>
            /// <param name='ctlVal'>the new value of the control</param>
            /// <param name='operTime'>the time when the operation will be executed</param>
            /// <param name="handler">Callback function to handle the received response or service timeout</param>
            /// <param name="parameter">User provided callback parameter. Will be passed to the callback function</param>
            /// <returns>the invoke ID of the sent request</returns>
            /// <exception cref="IedConnectionException">This exception is thrown if there is a connection or service error</exception>
            public UInt32 OperateAsync(float ctlVal, UInt64 operTime, ControlActionHandler handler, object parameter)
            {
                MmsValue value = new MmsValue(ctlVal);

                return(OperateAsync(value, operTime, handler, parameter));
            }