(Page 1 of 1 in this chapter)

Figure 1. CT Access With the ADI Service and the DTM Service
void MyServiceInit()
{
DWORD ret;
CTA_INIT_PARMS initparms = { 0 };
CTA_ERROR_HANDLER hdlr;
CTA_SERVICE_NAME InitServices[] = /* for ctaInitialize */
{ { "ADI", "ADIMGR" },
{ "DTM", "ADIMGR" },
{ "VCE", "VCEMGR" },
};
/* Initialize size of init parms structure */
initparms.size = sizeof(CTA_INIT_PARMS);
if ( ( ret = ctaInitialize(
InitServices,
sizeof(InitServices)/sizeof(InitServices[0]),
&initparms)) != SUCCESS)
{
/* ... handle error conditions here.... */
}
}
typedef struct CTA_SERVICE_DESC
{
CTA_SERVICE_NAME name; /* service name */
CTA_SERVICE_ADDR svcaddr; /* reserved */
CTA_SERVICE_ARGS svcargs; /* passes service-specific arguments */
CTA_MVIP_ADDR mvipaddr; /* AG board #, stream, timeslot, mode */
}CTA_SERVICE_DESC;
DWORD ret ;
CTA_EVENT event ;
CTA_SERVICE_DESC service[] =
{
{ {"DTM", "ADIMGR"}, { 0 }, { 0 }, { 0 } } ,
} ;
/* open the DTM service */
ret = ctaOpenServices( ctahd, /* a CTA context handle */
services,
1 );
if(ret != SUCCESS)
{
/* opening DTM service failed */
DemoShowError( "ctaOpenServices", ret );
}
else
{
/* wait for the CTAEVN_OPEN_SERVICES_DONE event */
DemoWaitForSpecificEvent(ctahd,
CTAEVN_OPEN_SERVICES_DONE,
& event ) ;
/* check the reason of completion */
if (event.value != CTA_REASON_FINISHED)
{
DemoShowError( "ctaOpenServices", event.value );
}
}
(Page 1 of 1 in this chapter)