PTLib Version 2.10.2
PVXMLChannel Class Reference

#include <vxml.h>

Inheritance diagram for PVXMLChannel:
PDelayChannel PIndirectChannel PChannel PObject

List of all members.

Public Member Functions

 PVXMLChannel (unsigned frameDelay, PINDEX frameSize)
 ~PVXMLChannel ()
virtual PBoolean Open (PVXMLChannelInterface *vxml)
virtual PBoolean IsOpen () const
 Determine if the channel is currently open and read and write operations can be executed on it.
virtual PBoolean Close ()
 Close the channel.
virtual PBoolean Read (void *buffer, PINDEX amount)
 Low level read from the file channel.
virtual PBoolean Write (const void *buf, PINDEX len)
 Low level write to the file channel.
virtual PWAVFileCreateWAVFile (const PFilePath &fn, PBoolean recording=false)
const PStringGetMediaFormat () const
PBoolean IsMediaPCM () const
virtual PString AdjustWavFilename (const PString &fn)
virtual PBoolean WriteFrame (const void *buf, PINDEX len)=0
virtual PBoolean IsSilenceFrame (const void *buf, PINDEX len) const =0
virtual PBoolean QueueRecordable (PVXMLRecordable *newItem)
PBoolean StartRecording (const PFilePath &fn, unsigned finalSilence=3000, unsigned maxDuration=30000)
PBoolean EndRecording ()
PBoolean IsRecording () const
virtual PBoolean ReadFrame (void *buffer, PINDEX amount)=0
virtual PINDEX CreateSilenceFrame (void *buffer, PINDEX amount)=0
virtual void GetBeepData (PBYTEArray &, unsigned)
virtual PBoolean QueueResource (const PURL &url, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean QueuePlayable (const PString &type, const PString &str, PINDEX repeat=1, PINDEX delay=0, PBoolean autoDelete=false)
virtual PBoolean QueuePlayable (PVXMLPlayable *newItem)
virtual PBoolean QueueData (const PBYTEArray &data, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean QueueFile (const PString &fn, PINDEX repeat=1, PINDEX delay=0, PBoolean autoDelete=false)
virtual PBoolean QueueCommand (const PString &cmd, PINDEX repeat=1, PINDEX delay=0)
virtual void FlushQueue ()
virtual PBoolean IsPlaying () const
void SetPause (PBoolean pause)
void SetName (const PString &name)
unsigned GetSampleFrequency () const
void SetSilence (unsigned msecs)

Protected Attributes

PVXMLChannelInterfacevxmlInterface
unsigned sampleFrequency
PString mediaFormat
PString wavFilePrefix
PMutex channelWriteMutex
PMutex channelReadMutex
PBoolean closed
PBoolean recording
PVXMLRecordablerecordable
unsigned finalSilence
unsigned silenceRun
PMutex queueMutex
PVXMLQueue playQueue
PVXMLPlayablecurrentPlayItem
PBoolean paused
PTimer m_silenceTimer
int totalData
PString channelName

Constructor & Destructor Documentation

PVXMLChannel::PVXMLChannel ( unsigned  frameDelay,
PINDEX  frameSize 
)
PVXMLChannel::~PVXMLChannel ( )

Member Function Documentation

virtual PString PVXMLChannel::AdjustWavFilename ( const PString fn) [virtual]
virtual PBoolean PVXMLChannel::Close ( ) [virtual]

Close the channel.

This will detach itself from the read and write channels and delete both of them if they are auto delete.

Returns:
true if the channel is closed.

Reimplemented from PIndirectChannel.

virtual PINDEX PVXMLChannel::CreateSilenceFrame ( void *  buffer,
PINDEX  amount 
) [pure virtual]
virtual PWAVFile* PVXMLChannel::CreateWAVFile ( const PFilePath fn,
PBoolean  recording = false 
) [virtual]
PBoolean PVXMLChannel::EndRecording ( )
virtual void PVXMLChannel::FlushQueue ( ) [virtual]
virtual void PVXMLChannel::GetBeepData ( PBYTEArray ,
unsigned   
) [inline, virtual]
const PString& PVXMLChannel::GetMediaFormat ( ) const [inline]

References mediaFormat.

unsigned PVXMLChannel::GetSampleFrequency ( ) const [inline]

References sampleFrequency.

PBoolean PVXMLChannel::IsMediaPCM ( ) const [inline]

References mediaFormat.

virtual PBoolean PVXMLChannel::IsOpen ( ) const [virtual]

Determine if the channel is currently open and read and write operations can be executed on it.

For example, in the PFile class it returns if the file is currently open.

Returns:
true if the channel is open.

Reimplemented from PIndirectChannel.

virtual PBoolean PVXMLChannel::IsPlaying ( ) const [inline, virtual]

References currentPlayItem, and playQueue.

PBoolean PVXMLChannel::IsRecording ( ) const [inline]

References recording.

virtual PBoolean PVXMLChannel::IsSilenceFrame ( const void *  buf,
PINDEX  len 
) const [pure virtual]
virtual PBoolean PVXMLChannel::Open ( PVXMLChannelInterface vxml) [virtual]
virtual PBoolean PVXMLChannel::QueueCommand ( const PString cmd,
PINDEX  repeat = 1,
PINDEX  delay = 0 
) [inline, virtual]

References QueuePlayable().

virtual PBoolean PVXMLChannel::QueueData ( const PBYTEArray data,
PINDEX  repeat = 1,
PINDEX  delay = 0 
) [virtual]
virtual PBoolean PVXMLChannel::QueueFile ( const PString fn,
PINDEX  repeat = 1,
PINDEX  delay = 0,
PBoolean  autoDelete = false 
) [inline, virtual]

References QueuePlayable().

virtual PBoolean PVXMLChannel::QueuePlayable ( const PString type,
const PString str,
PINDEX  repeat = 1,
PINDEX  delay = 0,
PBoolean  autoDelete = false 
) [virtual]

Referenced by QueueCommand(), and QueueFile().

virtual PBoolean PVXMLChannel::QueuePlayable ( PVXMLPlayable newItem) [virtual]
virtual PBoolean PVXMLChannel::QueueRecordable ( PVXMLRecordable newItem) [virtual]
virtual PBoolean PVXMLChannel::QueueResource ( const PURL url,
PINDEX  repeat = 1,
PINDEX  delay = 0 
) [virtual]
virtual PBoolean PVXMLChannel::Read ( void *  buf,
PINDEX  len 
) [virtual]

Low level read from the file channel.

The read timeout is ignored for file I/O. The GetLastReadCount() function returns the actual number of bytes read.

The GetErrorCode() function should be consulted after Read() returns false to determine what caused the failure.

Returns:
true indicates that at least one character was read from the channel. false means no bytes were read due to timeout or some other I/O error.

Reimplemented from PDelayChannel.

virtual PBoolean PVXMLChannel::ReadFrame ( void *  buffer,
PINDEX  amount 
) [pure virtual]
void PVXMLChannel::SetName ( const PString name) [inline]

References channelName.

void PVXMLChannel::SetPause ( PBoolean  pause) [inline]

References paused.

void PVXMLChannel::SetSilence ( unsigned  msecs)
PBoolean PVXMLChannel::StartRecording ( const PFilePath fn,
unsigned  finalSilence = 3000,
unsigned  maxDuration = 30000 
)
virtual PBoolean PVXMLChannel::Write ( const void *  buf,
PINDEX  len 
) [virtual]

Low level write to the file channel.

The write timeout is ignored for file I/O. The GetLastWriteCount() function returns the actual number of bytes written.

The GetErrorCode() function should be consulted after Write() returns false to determine what caused the failure.

Returns:
true if at least len bytes were written to the channel.

Reimplemented from PDelayChannel.

virtual PBoolean PVXMLChannel::WriteFrame ( const void *  buf,
PINDEX  len 
) [pure virtual]

Member Data Documentation

Reimplemented from PChannel.

Referenced by SetName().

unsigned PVXMLChannel::finalSilence [protected]

Referenced by SetPause().

PVXMLQueue PVXMLChannel::playQueue [protected]

Referenced by IsPlaying().

Referenced by IsRecording().

unsigned PVXMLChannel::sampleFrequency [protected]

Referenced by GetSampleFrequency().

unsigned PVXMLChannel::silenceRun [protected]
int PVXMLChannel::totalData [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines