Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[vtp-dev] New log class and Eventing API examples


Hi,

I checked in a new class, VoiceXMLLogMessage, which allows simple log messages to be communicated to the input view for display. Logs can be communicated by throwing a Debug Event such as shown below in a simple implementation of the IVoiceXMLBrowser's sendInput() method:

        public void sendInput(VoiceXMLBrowserInput input) {                
                DebugEvent event[] = new DebugEvent[1];
                event[0] = new DebugEvent(this, DebugEvent.MODEL_SPECIFIC, IVoiceXMLBrowserConstants.EVENT_LOG_MESSAGE);
                if (input.getInputType()==VoiceXMLBrowserInput.TYPE_DTMF) {
                        event[0].setData(new VoiceXMLLogMessage(new Date(), "Got DTMF " + input.getInput()));
                } else {
                        event[0].setData(new VoiceXMLLogMessage(new Date(), "Got some other input"));
                }
                DebugPlugin.getDefault().fireDebugEventSet(event);
        }

I've also added a method setProcess(VoiceXMLBrowserProcess process) to the IVoiceXMLBrowser interface. This allows access to the IProcess and through it the ILaunch object to throw additional events, notably the TERMINATE event to notify the UI that the Browser has finished. An example of how to do this is:

DebugEvent event[] = new DebugEvent[1];
event[0] = new DebugEvent(process.getLaunch(), DebugEvent.TERMINATE);
DebugPlugin.getDefault().fireDebugEventSet(event);

The launch object can also be referenced as the source of other events, such as the CHANGE event, to signify that something in the browser has changed, such as the input state. The input view supplied with the VTP listens for CHANGE events and will refresh the UI as needed based on the browser's current set of capabilities returned by IVoiceXMLBrowser.hasCapability().

--
Brent D. Metz
Enterprise Voice Tools
bdmetz@xxxxxxxxxx
"Simple things should be simple, and complex things should be possible." - Alan Kay

Back to the top