A
download otdialev.cpp
Language: C++
Copyright: (c) 1995-99 OpenComm do Brasil Ltda.
LOC: 123
Project Info
Open Telephony Server(opentel)
Server: SourceForge
Type: cvs
...el\server\drivers\dialogic\
   dialogic.dsp
   otdialap.cpp
   otdialap.h
   otdialar.cpp
   otdialar.h
   otdialdev.h
   otdialdrv.cpp
   otdialdrv.h
   otdialdti.cpp
   otdialdti.h
   otdialdxx.cpp
   otdialdxx.h
   otdialei.cpp
   otdialei.h
   otdialev.cpp
   otdialev.h
   otdialex.cpp
   otdialex.h
   otdialgc.cpp
   otdialgc.h
   otdialmsi.cpp
   otdialmsi.h
   otdialogic.cpp
   otdialogic.h
   otdialsc.cpp
   otdialsc.h
   otdialtd.cpp
   otdialtd.h
   otdialtg.cpp
   otdialtg.h

/*****************************************************************************
* OpenTel Telephony Server & Framework
* Copyright (c) 1995-99 OpenComm do Brasil Ltda.
* Todos os direitos reservados.
* Este arquivo contem material confidencial de OpenComm do Brasil, e deve
* darse tratamento como tal.
******************************************************************************/


#ident "@(#) $Header: /cvsroot/opentel/opentel/server/drivers/dialogic/otdialev.cpp,v 1.2 2000/03/24 05:16:43 jbernab Exp $"

#include <otconfig.h>

#ifdef _WINDOWS
#include <windows.h>
#include <io.h>
#endif

extern "C" {
#include <srllib.h>

#ifdef CONFIG_DIALOGIC_DTI
#include <dtilib.h>
#endif

#include <dxxxlib.h>

#ifdef CONFIG_DIALOGIC_GC
#include <gclib.h>
#include <gcerr.h>
#endif

#include <string.h>
#include <stdio.h>
#include <malloc.h>
};

#include <otcall.includes>
#include <dialogic/otdialogic.h>
#include <otarchive.includes>



//
// OtDialogicEvent Class
//

OT_IMPLEMENT_SERIAL(OtDialogicEvent,OtEvent,0);

OtDialogicEvent::OtDialogicEvent()
//////////////////////////////////
:
        OtEvent(eventClass,1, OtObjectId::Null )
{
        _type=sr_getevttype();
        _devh=sr_getevtdev();
        _datap=sr_getevtdatap();
        _len=sr_getevtlen();
        _evtType=_type;
}


OtDialogicEvent::OtDialogicEvent( const OtObjectId& src, OtEventClass c )
/////////////////////////////////////////////////////////////////////////
:
        OtEvent( eventClass|(c&0x0000FFFF),1, src )
{
        _type=sr_getevttype();
        _devh=sr_getevtdev();
        _datap=sr_getevtdatap();
        _len=sr_getevtlen();
        _evtType=_type;
}


OtDialogicEvent::~OtDialogicEvent(void)
///////////////////////////////////////
{
        _type=0;
        _devh=0;
        _datap=0;
        _len=0;
}


//
// Encapsulao de um OtEvent em um OtDlgMsg.
//

OtDlgMsg::OtDlgMsg(OtEvent *e) :
        _ev(e)
{
}

OtDlgMsg::~OtDlgMsg()
{
        if(_ev) {
                _ev=NULL;
                }
}



//
//      OtDialogicDev class
//  Todos os devices dialogic derivan de esta clase base
//  Ela serve como forma de encaminhar os mensagen automaticamente desde el
//  Thread del driver dialogic
//


OtList<OtDialogicDev> OtDialogicDev::_devs;



OtDialogicDev::OtDialogicDev()
{
        _devs.add(this);
}


OtDialogicDev::~OtDialogicDev(void)
{
        _devs.del(this);
        m_listener=NULL;
        m_transmitter=NULL;
}

OtTimeSlotTransmitter *OtDialogicDev::getTransmitter(void)
{
        return m_transmitter;
}

OtTimeSlotListener *OtDialogicDev::getListener(void)
{
        return m_listener;
}

OtMessageTarget *OtDialogicDev::findTargetDevice(OtDialogicEvent *e)
{
        OtListCursor<OtDialogicDev> c(_devs);
        OtDialogicDev *d=NULL;
        for(c.first(); d=c.current(); c.next()) {
                if(d->isForMe(e))
                        return d;
                }
        return NULL;
}

OtDialogicEvent *OtDialogicDev::waitEvent(long tmout)
{
        // This is Dialogic Sco Unix Driver dependant
        // might have to change to DOS or even WinNt

        OtDialogicEvent *e;
        if(sr_waitevt(tmout)==-1)               // Timed out
                return NULL;
                                                                        // Create the event object
        switch(sr_getevttype()&0xFFFFFF00) {
                                // This mask is empirical look at dialogic headers for DT_...
#ifdef DT_GC
                case DT_GC:                     // Here comes all Global Call events
                        e=new OtDialogicGcEvent();
                        break;
#endif
#ifdef DT_DTI
                case DT_DTI:            // Here comes DTI,DMX alarm events
                                                        // and some MSI offhook, onhook and hookflash event
                        e=new OtDialogicEvent();
                        break;
#endif
#ifdef DT_VRXXX
                case DT_VRXXX:          // Check in vrxxlib.h
                        e=new OtDialogicEvent();
                        break;
#endif
#ifdef DT_DCB
                case DT_DCB:
                        e=new OtDialogicEvent();
                        break;
#endif
                default:                        // Here comes the DXXX events
                        e=new OtDialogicEvent();
                        break;
                }
        OtDebug(OT_DEBUG_DEVENTS,"OtDialogicDev::waitEvent: OtEvent:class=%08x type=%08x\n",e->getClass(), e->getType());
        return e;
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us