void Initialize()
{
dword aep; // application endpoint handle
dword psi; // provided service handle
dword peg; // provided eventgroup handle
dword pev; // provided event handle
// open application endpoint
aep = SomeIpOpenLocalApplicationEndpoint(17, 50002);
// create service instance
psi = SomeIpCreateProvidedServiceInstance(aep,10,1);
// create eventgroup
peg = SomeIpAddProvidedEventGroup(psi,1);
// create event and add event to eventgroup
pev = SomeIpAddEvent(psi, 1, "OnPrepareEvent1");
SomeIpAddEventToEventgroup(peg, pev);
// ensure that event is sent cyclically
SomeIpSetProperty(pev,"CycleTimeMs",1000);
}
void OnPrepareEvent1(dword eventHandle, dword messageHandle)
{
WORD isOpt; // return value if parameter or member is optional
// this function is called before the event is sent. Parameters
// can be specified here.
// set parameter "value1" of struct "param1" only if it is mandatory
// get if member is optional or mandatory
isOpt = SomeIpIsOptional(messageHandle,"param1.value1");
if(isOpt == 0)
{
SomeIpSetValueDWord(messageHandle,"param1.value1",7);
}
}