Java Programmer's Guide and Reference


Receiving private data events

Private data events are transported as a special type of provider event. In order for an application to receive these events, the application author must implement a ProviderObserver (javax.telephony) with special code to identify and handle private provider events. This code can access the internal data from an event using the method getPrivateData() which returns a CSAEvtPrivDataObj instance. The application can extract the data length and the data contents as a byte array. The method names for these actions are short getDataLength() and byte[] getData(). This code should screen events as they come into the providerChangedEvent() method, identify whether they are a subclass of PrivateProvEv, and if so, handle them in an application specific manner. The following code provides a sample framework of this mechanism.


import javax.telephony.ProviderObserver;
 import javax.telephony.privatedata.events.PrivateProvEv;
 
 public class TestProviderObserver implements ProviderObserver {
 
    synchronized public void providerChangedEvent(ProvEv[] eventList) {
       for(int x = 0; x < eventList.length; x++) {
             if(eventList[x] instanceof PrivateProvEv) {
                 byte[] myData =
                     ((CSAEvtPrivDataObj)
                     eventList[x].getPrivateData()).getData();
                 // application specific processing of
                 // Private Provider Events should occur here
             }
       } /* endfor */
    }
 }
 

Private data events must come from a CallPath Enterprise Daemon, which may or may not have been written by the application author. This daemon, which is communicating with the application, must send the events to be received. To properly identify the events the daemon is sending as escape mechanism events, the daemon author must select an event type identifier that is greater than those used in the standard JTAPI system and less than those used for CallPath Enterprise. The safe range of identifiers is from 101-4999. Identifiers outside this range are not guaranteed to avoid conflict. Instructions for writing a CallPath Enterprise Daemon can be found in the CallPath Enterprise Planning, Installation and Problem Determination Guide.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]