ctaSetEventSources

Provides a list of services from which the specified context receives events.

Prototype

DWORD ctaSetEventSources ( CTAHD ctahd, char *svcname, unsigned nsvcs)

Argument

Description

ctahd

Context handle.

svcname

Pointer to an array containing a list of services from which the application will receive events.

nsvcs

Number of services in the svcname list.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

Invalid svcname was specified.

CTAERR_INVALID_CTAHD

 

CTAERR_NOT_IMPLEMENTED

This function is not available in the execution mode associated with the specified context.

CTAERR_NOT_INITIALIZED

Natural Access is not initialized. Call ctaInitialize first.

CTAERR_SVR_COMM

Server communication error.

 


Events

None.

Details

This function specifies the types of events Natural Access sends to an event queue associated with a shared context. Each client application that uses the shared context can keep its own list of services. Natural Access sends only events to the event queue corresponding to entries in the svcname list.

Note: By default, if a context is created in Declared Access mode, applications that attach to it receive service events only for services they explicitly open (even if other services have been opened by other client applications). If a context is created in Common Access mode, all applications that attach to it receive events for all service instances opened on the context.

The specified svcname list can include service instances not yet opened on the shared context. Reset the event mask by invoking ctaSetEventSources again and specifying a different svcname list.

Applications can retrieve the current list of svcnames in the existing event mask by invoking ctaGetEventSources.

Refer to Receiving events on event queues for more information.

See also

ctaAttachContext, ctaCreateContextEx, ctaGetEventSources

Example

case PAIR('S', 'M' ):               /* Set Event Mask */
     {
     char *svcarr[MAX_SERVICES];
     int nsvcs;
     if (!Ioffline)
        printf("Enter list of services to mask; Press Enter to end list\n")
      nsvcs = PromptForStrings("Enter service name", svcarr,
                               MAX_SVC_NAME_LEN);
      ret = ctaSetEventSources(ctahd, svcname, nsvcs);
      for ( ; nsvcs >= 0; nsvcs--)
      {
        free(svcarr[nsvcs]);
      } break;
     }