:Revision=29
:HTML
<<
128.190
LANMutex-Objekt|LANMutex
$NoSort
--
The Object LanMutex  enables the shared control of double TestManager to one common resource(Hardware).
The synchronisation could be realized by file(=Filemode) or socket-Server(=Servermode).

The settings for the object will be done in the Setup menu.
>>


<<
128.190.1
General functions of the LANMutex-Objects|General functions
--
Management of LANMutex Object
>>


<<
128.190.1.1
LANMutex.IsActive|IsActive
--
<!DEF>
function <!TW>LANMutex.IsActive : real;
<!TXT>
Returns den activity status of the LANMutex object.
The activity can be changed in the setup menue of TestManager.

Parameter/Result:

Result
values in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>not active<!>
<!c>1<!>active<!>
<!ETBL>

Example:
<!CODE>
var 
  rActive : real;

rActive := LanMutex.IsActive;
<!TXT>
>>


<<
128.190.1.2
LANMutex.Error|Error
--
<!DEF>
function <!TW>LANMutex.Error: real;
<!TXT>
Returns the current Errorcode of the Object

Result
Results in <!PW>Result could be:
<!STBL>
<!+>Value<!+>Description<!>
<!c>>0<!>Object in Errormode<!>
<!c>0<!>Object active and ready<!>
<!c>-1<!>Object not active<!>
<!c>-2<!>Object not enabled<!>
<!ETBL>

>>




<<
128.190.2
Mutex and Sequences|Mutex
--
Management of  Mutex and Sequences
>>



<<
128.190.2.1
LANMutex.GetStatus|GetStatus
!128.190.2.2
!128.190.2.3
--
<!DEF>
function <!TW>LANMutex.GetStatus(sMutex : string): real;
<!TXT>

Return the status of the Mutex with the name <!PW>sMutex.
The mutex can not be used, if it is already occupied by another (Status=0) TestManager.


Parameter/Result:

Result
Values in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Used by this TestManager<!>
<!c>0<!>Occupied by another TestManager<!>
<!c>-1<!>Free<!>
<!ETBL>


Parameter:
<!PW>sMutex
  Mutexname as String. 

  Note for LanMutex in Filemode: This name will be used for creation of a file.
  The filepath is in the setup defined.

Examples:
<!CODE>
rLM := LanMutex.GetStatus('A');  
<!TXT>
>>


<<
128.190.2.2
LANMutex.Locking|Locking
!128.190.2.1
!128.190.2.3
--
<!DEF>
function <!TW>LANMutex.Locking(sMutex : string; rMode : real): real;
<!TXT>
The locking funnction occupies a common ressource <!PW>sMutex on a common 
network folder(Filemode)  or  the SocketServer(ServerMode). 

After Occupation this mutex will is not available for other TestManagers.

It is also possible to occupy a virtual Mutex, this Mutex can be used by
resources with multiple access. Here is not conflict possible, because this
Mutex can be used by each TestManager.

Note: After Using the Mutex, Unlock has to be done.



Parameter/Result:

Result
value in <!PW>Result could be
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Used by this TestManager<!>
<!c>0<!>Occupied by another TestManager<!>
<!c>-1<!>free<!>
<!ETBL>


Parameter:
<!PW>Parameter sMutex
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Virtua Mutex, Ressource will always got<!>
<!c>0<!>Ressource with Hardware<!>
<!ETBL>


<!PW>sMutex
  Unique Mutexname as String.


Examples:
<!CODE>
rLM := LanMutex.UnLocking('A');  // unlock

rLM := LanMutex.Locking('A',0);  // lock, with real Hardware
<!TXT>

>>


<<
128.190.2.3
LANMutex.UnLocking|UnLocking
!128.190.2.1
!128.190.2.2
--
<!DEF>
function <!TW>LANMutex.UnLocking(sMutex : string): real;
<!TXT>


After the release this mutex can be used by other TestManager.


The Unlocking funnction occupies a common ressource <!PW>sMutex on a common 
network folder(Filemode)  or  the SocketServer(ServerMode). 

After Unlock this mutex will be free for other TestManagers.




Parameter/Result:

Result
value in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>Mutex is free<!>
<!ETBL>


Parameter
<!PW>sMutex
  unique Mutexname as String.


Examples:
<!CODE>
rLM := LanMutex.UnLocking('A');  // unlock

<!TXT>
>>





<<
128.190.2.4
LANMutex.GetSequence|GetSequence
!128.190.2.5
--
<!DEF>
function <!TW>LANMutex.GetSequence(sSequence: string): real;
<!TXT>

The sequence <!PW>sSequence descripes a block of test steps in which will Mutexes used.

Before first use of mutex, a sequence has to be generated  with this command.
The Status will be set to (0=runnig).
After the last used of the mutexes , the sequence has to be set to status Done(=1).
The Sequencename will be used as aliasname for later functions.

Note: The first call of this funnction will generate the sequence atomatically.

Th status of the single sequences or all running sequenencen could also be
find by this function.
When all Sequences done, the testsequence can continued.

The Management of LanMutex can now determines, if all sequenzen were done.


Parameter/Result:

Result (SingleSequenz -> SequenceName)
value in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>The sequence is not done<!>
<!c>1<!>sequence ist fertig<!>
<!ETBL>




Result (Alle sequenceen -> sSequence = '' (Leerstring))
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>The sequences are not all ready<!>
<!c>1<!>All sequences are done<!>
<!ETBL>



Parameter:
<!PW>Parameter sSequence
<!STBL>
<!+>value<!+>Description<!>
<!c>name<!>sequencename for the status will be returned<!>
<!c>''<!>(common command) Status for all sequences of testsequence will returnded<!>
<!ETBL>


Examples:
<!CODE>
var rR : real;

// Creating sequence 'A' und call the status of sequence
rR := LanMutex.GetSequence('A');  


// Status of the sequence 'A'  
rR := LanMutex.GetSequence('A');  

// Calling the common Status of all Sequences
rR := LanMutex.GetSequence('');  

<!TXT>
>>


<<
128.190.2.5
LANMutex.SetSequence|SetSequence
!128.190.2.4
--
<!DEF>
function <!TW>LANMutex.SetSequence(sSequence: real, rStatus:real): real;
<!TXT>


The sequence <!PW>sSequence descripes a block of test steps in which will Mutexes used.

Before first use of mutex, a sequence has to be generated  with this command.
The Status will be set to (0=runnig).
After the last used of the mutexes , the sequence has to be set to status Done(=1).
The Sequencename will be used as aliasname for later functions.

Note: The first call of this funnction will generate the sequence atomatically.

Th status of the single sequences or all running sequenencen could also be
find by this function.
When all Sequences done, the testsequence can continued.

The Management of LanMutex can now determines, if all sequenzen were done.



Parameter/Result:

Result
value in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>sequence is created<!>
<!c>-1<!>Error while using sequence<!>
<!ETBL>



value in <!PW>rStatus could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>0<!>sequence is active<!>
<!c>1<!>sequence is done<!>
<!ETBL>

Examples:
<!CODE>
// Status of sequence 'A' will be set to Running
rR := LanMutex.SetSequence('A',0);  

// Status of sequence 'A' will be set to Done 
rR := LanMutex.SetSequence('A',1);   
<!TXT>
>>



<<
128.190.3
ServerVariablen|Servervariablen
--
Management of global Variables on the commen SocketServer.


>>


<<
128.190.3.1
LANMutex.CreateVar|CreateVar
!128.190.3.2
!128.190.3.3
!128.190.3.4
--
<!DEF>
function <!TW>LANMutex.CreateVar(sName : string; value): real;
<!TXT>

Creating of a globale Variable (String,Real) <!PW>sName on the SocketServer.

In case the the Variable is used (Result=0), this variable can not be created by this TestManager.
After the variable will be created by this TestManage, she could be overwrite by the Create-command

The variable is for all connected TestManagers visible and can be read out.


Note: The Servervariables could only be created in servermodus (MutexMaster=ServerMutex)

Parameter/Result:

Result
valuee in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Used by this own TestManager<!>
<!c>0<!>Occupied by another TestManager, no creation possible<!>
<!ETBL>


Parameter:
<!PW>sName
<!TXT>
  Variablenxname as String. 
  This name is the aliasname for the creating on the SocketServer. 
  The name of the variables must not includes this Chars (#13#10) or Semikolon (;).

<!PW>value
  Variable or value from type real or String. 
  The maximum Stringlen is 255 letters.


Examples:
<!CODE>
var 
 rR : real;
 sV : string;
 rV : real;

// Creating of the Variable 'alpha' with value 1239.87
rR := LanMutex.CreateVar('alpha','1239.87');  

// Creating of the variable 'beta' with value 19.999
rV := 19.999;
rR := LanMutex.CreateVar('beta',rV);  

// Creating of the variable 'gamma' with the value 'Hallo'
sV := 'Hallo';
rR := LanMutex.CreateVar('gamma',sV);  
<!TXT>
>>


<<
128.190.3.2
LANMutex.ReadVar|ReadVar
!128.190.3.1
!128.190.3.3
!128.190.3.4
--
<!DEF>
function <!TW>LANMutex.ReadVar(sName : string; var value): real;
<!TXT>

Readout of the value of an global Variable (String,Real) <!PW>sName on the SocketServer.
The Variable is by all TestManagers visible and could be read.


Note: The Servervariables could only be used in Servermode (MutexMaster=ServerMutex).



Parameter/Result:

Result
value in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Variable exist<!>
<!c>-1<!>Variable not exist<!>
<!ETBL>

Parameter:
<!PW>sName
<!TXT>
  Variablenxname as String. 
  This name is the aliasname for the creating on the SocketServer. 
  The name of the variables must not includes this Chars (#13#10) or Semikolon (;).


<!PW>value
<!TXT>
  Variable for getting the value of the servervariable  (real or String). 
  The TestManagers try to convert the wished Datatype. 
  If conversions fails, the value will be set to -999999999 , 
  also the result is set (= -1). 


Examples:
<!CODE>
var 
 rR : real;
 sV : string;
 rV : real; 

//Reading the Variablen 'alpha' as String
rR := LanMutex.ReasdVar('alpha',sV);  

//Reading der Variablen 'alpha' as Real Variable
rR := LanMutex.ReadVar('beta',rV);  
<!TXT>
>>



<<
128.190.3.3
LANMutex.CheckVar|CheckVar
!128.190.3.1
!128.190.3.2
!128.190.3.4

--
<!DEF>
function <!TW>LANMutex.CheckVar(sName : string): real;
<!TXT>

Reading the status of a global variablen <!PW>sName on the SocketServer.
It will no variable generated, only checked the status.


Note: The Servervariables could only be used in Servermode (MutexMaster=ServerMutex).


Parameter/Result:

Result
Werte in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Variable is used by own TestManager<!>
<!c>0<!>Variable Occupied by another TestManager<!>
<!c>-1<!>Variable ist not used, free<!>
<!ETBL>


Parameter:
<!PW>sName
<!TXT>
  Variablenxname as String. 
  This name is the aliasname for the creating on the SocketServer. 
  The name of the variables must not includes this Chars (#13#10) or Semikolon (;).



Examples:
<!CODE>
var 
 rR : real;

rR:= LanMutex.CheckVar('alpha');  

vR:= LanMutex.CheckVar('beta');  
<!TXT>
>>



<<
128.190.3.4
LANMutex.DelVar|DelVar
!128.190.3.1
!128.190.3.2
!128.190.3.3
--
<!DEF>
function <!TW>LANMutex.DelVar(sName : string; nMode : real): real;
<!TXT>

Delete of one or more globale Variables <!PW>sName on the SocketServer.

The parameter with name <!PW>sName specifies the Variable, which will be deleted.
Is the variablenname an empty string ''., all variables will be deleted.
Usually, only the own variables should be deleted.  The parameter
nMode could also be used the delete strange Variables.



Note: The Servervariables could only be used in Servermode (MutexMaster=ServerMutex).

Parameter/Result

Result
Werte in <!PW>Result could be:
<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>Own Variable is deleted<!>
<!c>0<!>All Variables has been deleted<!>
<!c>-1<!>find no variables to delete<!>
<!ETBL>



Parameter:
<!PW>sName
<!TXT>
  Variables name as String. 
  This name is the aliasname for the creating on the SocketServer. 
  The name of the variables must not includes this Chars (#13#10) or Semikolon (;).



<!PW>nMode <!> Modus of deleting

<!STBL>
<!+>value<!+>Description<!>
<!c>1<!>only own Variables will be deleted<!>
<!c>0<!>All Variables (own, strange) will be deleted<!>
<!ETBL>


Examples:
<!CODE>
var 
 rR : string;

// own Variable 'alpha' on Server delete
rR := LanMutex.DelVar('alpha',1);  

// strange variable 'beta' delete
rR := LanMutex.DelVar('beta',0);  

// all own Variables will be deletet
rR := LanMutex.DelVar('',1);  

// all Variablen on SocketServer delete
rR := LanMutex.DelVar('',0);  

<!TXT>
>>


