WEBfactory 2010

WFServerConnector Class Overview

Abstract

Check out this article and learn more details about the WFServerConnector Class and the parameters involved in its management.

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 name

result: Numeric value representing the result of the operation

Return value

-3: Illegal calling parameters

0: Success

Result

-1: Signal already used by some other connector object

1: Signal already used by this connector object (but still success)

2: Ownership of the signals is "forcibly" taken from other instance of the server interface

0: 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 names

result: Numeric values representing the result of the operation

Return value

-2signalNames parameter is not a valid string array

-3: Illegal calling parameters

0: Success

Result

-1: Signal already used by some other connector object

1: Signal already used by this connector object (but still success)

2: Ownership of the signals is "forcibly" taken from other instance of the server interface

0: 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 name

result: Numeric value representing the result of the operation

Return value

-3: Illegal parameter for signalName

0: Success

Result

-1: Signal is not registered by the connector object

0: 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 names

result: Numeric values representing the result of the operation

Return value

-2signalNames parameter is not a valid string array

-3: Illegal parameter for signalNames

0: Success

Result

-1: Signal is not registered by the connector object

0: 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.

UpdateSignal

Method definition

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

Calling parameters

signalName: Signal name

signalValue: Signal value

result: Numeric value representing the result of the operation

Return value

-3: Illegal parameter for signalName

-5: Illegal parameter for signalValue

0: Success

Result

-1: Signal is not registered by the connector object

0: 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.

UpdateSignals

Method definition

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

Calling parameters

signalNames: Signal names

signalValues: Signal values

result: Numeric values representing the result of the operation

Return value

-2signalNames parameter is not a valid string array

-3: Illegal parameter for signalNames

-2signalValues parameter is not a valid string array

-5: Illegal parameter for signalValues

0: Success

Result

-1: Signal is not registered by the connector object

0: 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.

WriteAsyncRequest

Method definition

event WFWriteAsyncRequestEventHandler WriteAsyncRequest;
delegate void WFWriteAsyncRequestEventHandler(string[] signalNames, object[] signalValues, string asyncID);

Calling parameters

signalNames: Signal names

signalValues: Signal values

asyncID: 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.

WriteAsynchRequestResult

Method definition

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

Calling parameters

asyncID: Unique ID for the write request

result: Numeric values representing the result of each operation

Return value

-3: Illegal parameter for signalName

-5: Illegal parameter for signalValue

0: Success

Result

-2signalNames parameter is not a valid string array

-3: Illegal parameter for signalNames

0: 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.

WriteTrace

Method definition

int WriteTrace(WFTraceLevels level, string message);

Calling parameters

level: Level of the message

message: Text message

Return value

0: Success

Result

-2signalNames parameter is not a valid string array

-3: Illegal parameter for signalNames

0: 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
};