variables
{
DWORD gMcGetter; // getter method call
DWORD gMcSetter; // setter method call
}
void Initialize()
{
CONST DWORD FieldNotificationID = 30;
CONST DWORD FieldGetterID = 31;
CONST DWORD FieldSetterID = 32;
DWORD aep; // application endpoint handle
DWORD csi; // consumed Service Instance handle
DWORD ceg; // consumed Eventgroup handle
// open application endpoint
aep = SomeIpOpenLocalApplicationEndpoint(17, 50002);
// create Service Instance
csi = SomeIpCreateConsumedServiceInstance(aep,12,1);
// create Eventgroup
ceg = SomeIpAddConsumedEventGroup(csi,300);
// create field consumer as well as getter and setter method calls
SomeIpCreateFieldConsumer(csi,FieldNotificationID,FieldGetterID,FieldSetterID, "OnSomeIpFieldNotification");
gMcGetter = SomeIpCreateMethodCall(csi,FieldGetterID,"OnFieldGetterResponse");
gMcSetter = SomeIpCreateMethodCall(csi,FieldSetterID,"OnFieldSetterResponse");
}
void OnSomeIpFieldNotification(DWORD pfHandle,DWORD messageHandle)
{
write ("Field Notification Received");
// do something here
}
void OnFieldGetterResponse(dword methodCallHandle, dword messageResponseHandle )
{
write ("Field Getter Response Received");
// do something here
}
void OnFieldSetterResponse(dword methodCallHandle, dword messageResponseHandle )
{
write ("Field Setter Response Received");
// do something here
}
on key 'g'
{
// call getter method
SomeIpCallMethod(gMcGetter);
}
on key 's'
{
// set value of field content (field has common data type so no value path is needed)
SomeIpSetValueDWord(gMcSetter,"",200);
// call setter method
SomeIpCallMethod(gMcSetter);
}