Difference between revisions of "Extensions.Measure.GetDeviceServiceNameFromEvent"

From emotive
Jump to navigation Jump to search
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:Measure]]
+
{{DISPLAYTITLE:'''GetDeviceServiceNameFromEvent '''}}[[Category:Measure]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | GetDeviceServiceNameFromEvent | Returns a string that contains the name of the device and services | [[Term]] | [[Measure|OTX Measure extension]] | [[Event related terms]] | - | - }}
+
{{ClassificationActivity | GetDeviceServiceNameFromEvent | Gets the device and service name of the device and service that caused the event. | [[Term]] | [[Extensions.Measure|OTX Measure extension]] | [[Extensions.Measure#Terms|Event related terms]] | [[Core.DataTypes.ComplexDataType.TypeMismatchException|TypeMismatchException]] | - }}
  
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
StringTerm = Measure.GetDeviceServiceNameFromEvent(EventTerm);
+
StringTerm Measure.GetDeviceServiceNameFromEvent(EventValue event);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
An event object accepts the '''GetDeviceServiceNameFromEvent''' term and returns a string that contains the device - and service name of the device and the service, which caused the event. By using this term can wait a sequence of OTX for an event from a device when receiving a new result and then decide which service of the device caused the event.
+
The '''GetDeviceServiceNameFromEvent''' term accepts an '''EventValue''' term and returns a string which contains the device and service name of the device and service that caused the event. By using this term, an OTX sequence can wait for an '''Event''' raised by a device receiving a new result and then evaluate which service of that device caused the event.
  
The string value that is returned will consist of two parts: ''"devicename.ServiceName"'', where ''devicename'' and ''servicename'' is the name as specified by the corresponding ''DeviceSignature'' has.
+
The returned string value will be composed out of two parts: '''"devicename.servicename"''', where '''"devicename"''' and '''"servicename"''' are the names as given by the corresponding '''DeviceSignature'''.
  
{{TermReturnValue| [[String]] | The string that contains the name of the device and services. }}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.String|String]] | The string that contains the name of the device and services. }}
  
 
== Properties ==
 
== Properties ==
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| Event | [[Event]] | [[Term]] | - | [1] | The event that is raised after the execution of a device services.}}
+
{{TableRowPropertie2| Event | [[Extensions.EventHandling.Event|Event]] | [[Value]] | - | [1] | Represents the '''event''' that was raised after executing a device service.}}
 
|}
 
|}
  
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
package Measure.DeviceSignature TestDocument
+
/// Signatures
 +
 
 +
package Measure.DeviceSignature DeviceSignature1
 
{
 
{
  DeviceServiceSignature Addition(in Integer a, in Integer b, out Measure.Measurement OutValue);
+
Measure.DeviceServiceSignature Add(in Integer a, out Measure.Measurement Measurement);
 
}
 
}
  
public procedure IsDeviceEvent()
+
/// Global Declarations
 +
 
 +
public procedure main()
 
{
 
{
  EventHandling.EventSource EventSource;
+
/// Local Declarations
  Measure.Measurement Addition_Return;
+
 
  EventHandling.Event Event;
+
Measure.Measurement Measurement1;
  String DeviceName;
+
Integer a1 = 10;
 +
EventHandling.EventSource EventSource1;
 +
EventHandling.Event Event1;
 +
String String1 = "";
 +
 
 +
/// Flow
  
  EventSource = Measure.DeviceEventSource(TestDocument);
+
EventSource1 = Measure.DeviceEventSource(DeviceSignature1);
  
  parallel
+
parallel
  {
+
{
      lane
+
lane
      {
+
{
        EventHandling.WaitForEvent({EventSource}, Event);
+
Measure.ExecuteDeviceService(DeviceSignature1, Add, {a = a1, Measurement = Measurement1}, false, false);
      }
+
}
      lane
+
lane
      {
+
{
        Measure.ExecuteDeviceService(TestDocument, Addition, {in a = 2, in b = 3, out OutValue = Addition_Return}, false, false);
+
EventHandling.WaitForEvent({EventSource1}, Event1);
      }
+
}
  }
+
}
  
  DeviceName = Measure.GetDeviceServiceNameFromEvent(Event);
+
String1 = Measure.GetDeviceServiceNameFromEvent(Event1);
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[DeviceEventSource]] <br/>
+
[[Extensions.Measure.DeviceEventSource|DeviceEventSource]] <br/>
[[IsDeviceEvent]]
+
[[Extensions.Measure.IsDeviceEvent|IsDeviceEvent]]

Latest revision as of 02:56, 13 September 2019

Classification

Name GetDeviceServiceNameFromEvent
Short Description Gets the device and service name of the device and service that caused the event.
Class Term
Extension OTX Measure extension
Group Event related terms
Exceptions TypeMismatchException
Checker Rules -
Standard Compliant Yes

OTL Syntax

StringTerm Measure.GetDeviceServiceNameFromEvent(EventValue event);

Description

The GetDeviceServiceNameFromEvent term accepts an EventValue term and returns a string which contains the device and service name of the device and service that caused the event. By using this term, an OTX sequence can wait for an Event raised by a device receiving a new result and then evaluate which service of that device caused the event.

The returned string value will be composed out of two parts: "devicename.servicename", where "devicename" and "servicename" are the names as given by the corresponding DeviceSignature.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
String The string that contains the name of the device and services.

Properties

Name Data Type Class Default Cardinality Description
Event Event Value - [1] Represents the event that was raised after executing a device service.

OTL Examples

/// Signatures

package Measure.DeviceSignature DeviceSignature1
{
	Measure.DeviceServiceSignature Add(in Integer a, out Measure.Measurement Measurement);
}

/// Global Declarations

public procedure main()
{
	/// Local Declarations

	Measure.Measurement Measurement1;
	Integer a1 = 10;
	EventHandling.EventSource EventSource1;
	EventHandling.Event Event1;
	String String1 = "";

	/// Flow

	EventSource1 = Measure.DeviceEventSource(DeviceSignature1);

	parallel
	{
		lane
		{
			Measure.ExecuteDeviceService(DeviceSignature1, Add, {a = a1, Measurement = Measurement1}, false, false);
		}
		lane
		{
			EventHandling.WaitForEvent({EventSource1}, Event1);
		}
	}

	String1 = Measure.GetDeviceServiceNameFromEvent(Event1);
}

See also

DeviceEventSource
IsDeviceEvent