# WEBfactory 2010

#### WFServerConnector Class Overview

Abstract

WFServerConnector provides methods and events to create own WEBfactory signals.

The following methods and events are implemented by WFServerConnector class:

• Create and Release Signal Operations

• int CreateSignal(string signalName, out int result);

• int CreateSignals(string[] signalNames, out int[] results);

• int ReleaseSignal (string signalName, out int result);

• int ReleaseSignals(string[] signalNames, out int[] results);

• Update Signal Operations

• int UpdateSignal(string signalName, object signalValue, out int result);

• int UpdateSignals(string[] signalNames, object[] signalValues, out int[] results);

• User Interaction Operations

• event WFWriteAsyncRequestEventHandler WriteAsyncRequest;

• int WriteAsyncRequestResult (string asynchID, int[] results);

• Debug Operations

• int WriteTrace(WFTraceLevels level, string message);

The following sections will describe each method and event of the WFServerConnector class:

##### CreateSignal
 Method definition int CreateSignal(string signalName, out int result); Calling parameters signalName: Signal nameresult: Numeric value representing the result of the operation Return value -3: Illegal calling parameters0: Success Result -1: Signal already used by some other connector object1: Signal already used by this connector object (but still success)2: Ownership of the signals is "forcibly" taken from other instance of the server interface0: Success Description This method creates a signal inside the custom connector. This signal is then available for WEBfactory Server after it was added inside WEBfactory Studio.Before the connector can operate with signals it has to create them.
##### CreateSignals
 Method definition int CreateSignals(string[] signalNames, out int[] results); Calling parameters signalNames: Signal namesresult: Numeric values representing the result of the operation Return value -2: signalNames parameter is not a valid string array-3: Illegal calling parameters0: Success Result -1: Signal already used by some other connector object1: Signal already used by this connector object (but still success)2: Ownership of the signals is "forcibly" taken from other instance of the server interface0: Success Description This method creates multiple signals inside the custom connector at once. Therefore it gets signalNames as string array of signal names. The results array indicates the result of each create operation WEBfactory 2010 Server SDK.Details for creating signals can be taken from CreateSignal.
##### ReleaseSignal
 Method definition int ReleaseSignal (string signalName, out int result); Calling parameters signalName: Signal nameresult: Numeric value representing the result of the operation Return value -3: Illegal parameter for signalName0: Success Result -1: Signal is not registered by the connector object0: Success Description This method releases a signal that was created before. Afterward the value of the signal will become empty for WEBfactory.
##### ReleaseSignals
 Method definition int ReleaseSignals(string[] signalNames, out int[] results); Calling parameters signalNames: Signal namesresult: Numeric values representing the result of the operation Return value -2: signalNames parameter is not a valid string array-3: Illegal parameter for signalNames0: Success Result -1: Signal is not registered by the connector object0: Success Description This method releases multiple signals inside the custom connector at once. Therefore it gets signalNames as string array of signal names. The results array indicates the result of each create operation.Details for releasing signals can be taken from ReleaseSignal.
 Method definition int UpdateSignal(string signalName, object signalValue, out int result); Calling parameters signalName: Signal namesignalValue: Signal valueresult: Numeric value representing the result of the operation Return value -3: Illegal parameter for signalName-5: Illegal parameter for signalValue0: Success Result -1: Signal is not registered by the connector object0: Success Description This method updates a value of a signal. WEBfactory Server will get this update like an update from an OPC server.This change for a custom connector is normally triggered by an external device or data source. A simulation connector could invoke that method periodically.
 Method definition int UpdateSignals(string[] signalNames, object[] signalValues, out int[] results); Calling parameters signalNames: Signal namessignalValues: Signal valuesresult: Numeric values representing the result of the operation Return value -2: signalNames parameter is not a valid string array-3: Illegal parameter for signalNames-2: signalValues parameter is not a valid string array-5: Illegal parameter for signalValues0: Success Result -1: Signal is not registered by the connector object0: Success Description This method updates multiple signals inside the custom connector at once. Therefore it gets signalNames as string array of signal names and signalValues as object array for values. The results array indicates the result of each create operation.Details for updating signals can be taken from UpdateSignal.
 Method definition event WFWriteAsyncRequestEventHandler WriteAsyncRequest; delegate void WFWriteAsyncRequestEventHandler(string[] signalNames, object[] signalValues, string asyncID); Calling parameters signalNames: Signal namessignalValues: Signal valuesasyncID: Unique ID for the write request Description This event is fired after a user tries to change a signal of the custom connector. The event handler defines which signal the user wants to change and what value he tries to setup. The asyncID string is a uniquie identifier for the write operation. It can happen that multiple write requests are coming up at once.The connector must invoke WriteAsyncRequestResult for each WriteAsyncRequest event and define whether the request was successful or not.
 Method definition int WriteAsyncRequestResult (string asynchID, int[] results); Calling parameters asyncID: Unique ID for the write requestresult: Numeric values representing the result of each operation Return value -3: Illegal parameter for signalName-5: Illegal parameter for signalValue0: Success Result -2: signalNames parameter is not a valid string array-3: Illegal parameter for signalNames0: Success Description The connector should invoke WriteAsyncRequestResult for each WriteAsyncRequest event and define whether the request was successful or not. The write request will be logged into Operation Diary as successful or unsuccessful.The results parameter is not an out parameter in this case. The programmer is free to define own error values to let the user know why it was not possible to change the value from the write request.
 Method definition int WriteTrace(WFTraceLevels level, string message); Calling parameters level: Level of the messagemessage: Text message Return value 0: Success Result -2: signalNames parameter is not a valid string array-3: Illegal parameter for signalNames0: Success Description This method writes a message to WEBfactoryActivity Analyzer. All error messages from WEBfactory server modules can be displayed in that tool. This allows finding out any problems between them.Parameter level is an enumeration:enum WFTraceLevels { TraceInfo = 4, TraceWarning = 2, TraceError = 1, NoTrace = 0 };