Code Examples.
Code Examples.
The code for EO is generated by the IDE (refer IDE User Guide). The users might want to be cautious when using the CL_EO_USE_THREAD_FOR_APP. The application take control of the main thread and has to hold the thread through it's lifetime. If the thread is released prematurely the behavior is undefined. The only way the application can be shutdown is through the invocation of clCpmComponentTerminate() which in turn invokes the callback clCompAppTerminate(). The logic to unblock the main thread should reside in this callback just before clCpmResponse().
clCompAppInitialize(
ClUint32T argc,
ClCharT *argv[])
{
mypid = getpid();
goto errorexit;
#if HAS_EO_SERVICES
rc = clSAFComponent1EO0ClientInstall();
#endif
goto errorexit;
goto errorexit;
clprintf ("Component [%s] : PID [%d]. Initializing\n",
clprintf (" IOC Port : 0x%x\n", iocPort);
{
}
return rc;
errorexit:
clprintf ("Component [%s] : PID [%d]. Initialization error [0x%x]\n",
appName.
value, mypid, rc);
return rc;
}
clCompAppTerminate(
ClInvocationT invocation,
{
clprintf ("Component [%s] : PID [%d]. Terminating\n",
goto errorexit;
goto errorexit;
clprintf ("Component [%s] : PID [%d]. Terminated\n",
return rc;
errorexit:
clprintf ("Component [%s] : PID [%d]. Termination error [0x%x]\n",
compName->
value, mypid, rc);
return rc;
}
#define CL_FALSE
define the False
Definition: clCommon.h:61
#define CL_TRUE
define the Truth
Definition: clCommon.h:59
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OK
Every thing is OK.
Definition: clCommonErrors.h:68
ClRcT clCpmComponentNameGet(CL_IN ClCpmHandleT cpmHandle, CL_OUT ClNameT *pCompName)
Returns the component name.
ClRcT clCpmClientInitialize(CL_OUT ClCpmHandleT *pCpmHandle, CL_IN const ClCpmCallbacksT *pCallback, CL_INOUT ClVersionT *pVersion)
Initializes the client Component Manager library.
ClRcT clCpmClientFinalize(CL_IN ClCpmHandleT cpmHandle)
Cleans up the client Component Manager library.
ClRcT clCpmResponse(CL_IN ClCpmHandleT cpmHandle, CL_IN ClInvocationT invocation, CL_IN ClRcT rc)
Respond to AMF with the result of components execution of a particular request by AMF.
ClRcT clCpmComponentRegister(CL_IN ClCpmHandleT cpmHandle, CL_IN const ClNameT *pCompName, CL_IN const ClNameT *pProxyCompName)
Registers a component with CPM.
ClRcT clCpmComponentUnregister(CL_IN ClCpmHandleT cpmHandle, CL_IN const ClNameT *pCompName, CL_IN const ClNameT *pProxyCompName)
Un-registers a component.
ClRcT clEoMyEoIocPortGet(CL_OUT ClIocPortT *pIocPort)
Returns EO IocPort from task specific area.
ClIocNodeAddressT clIocLocalAddressGet(void)
Returns the local IOC node addrress.
ClUint32T ClIocPortT
The IOC communication port.
Definition: clIocApi.h:348
ClRcT clOsalTaskDelay(ClTimerTimeOutT timeOut)
Delays a task.
A name.
Definition: clCommon.h:197
ClCharT value[CL_MAX_NAME_LENGTH]
Actual name represented as a null terminated ASCII string.
Definition: clCommon.h:201
Version Information for various services.
Definition: clCommon.h:250
ClUint8T minorVersion
Minor Number in range of [01-255].
Definition: clCommon.h:256
ClUint8T releaseCode
single ASCII capitol letter "A-Z"
Definition: clCommon.h:252
ClUint8T majorVersion
Major Number in range of [01-255].
Definition: clCommon.h:254
The structure ClCpmCallbacksT contains the various callback functions that the Component Manager can ...
Definition: clCpmApi.h:474
ClCpmProtectionGroupTrackCallbackT appProtectionGroupTrack
Callback invoked when the component registers for tracking changes in protection group and protection...
Definition: clCpmApi.h:498
ClCpmTerminateCallbackT appTerminate
Callback for gracefully shutting down the component.
Definition: clCpmApi.h:482
ClCpmCSISetCallbackT appCSISet
Callback for assigning the component service instance to the component.
Definition: clCpmApi.h:487
ClCpmHealthCheckCallbackT appHealthCheck
Callback for checking the health of the component.
Definition: clCpmApi.h:478
ClCpmCSIRmvCallbackT appCSIRmv
Callback for removing the component service instance assigned to the component.
Definition: clCpmApi.h:492
The timeout value in seconds and milliseconds.
Definition: clTimerApi.h:87