Main Page   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

SignalDev.h

Go to the documentation of this file.
00001 /*
00002  * SignalDev.h
00003  *
00004  * Copyright 2003, MobileSpear Inc. (www.mobilespear.com). All rights reserved.
00005  * Copyright 2003, David Resnick. All rights reserved.
00006  *
00007  * See the file doc\license.txt for the terms of usage and distribution.
00008  */
00009 
00010 #ifndef _BOGOTEL_SIGNALDEV_H
00011 #define _BOGOTEL_SIGNALDEV_H
00012 
00013 #include <bogotel/devbase.h>
00014 #include <bogotel/MsgTransport.h>
00015 
00016 #include <string>
00017 
00018 namespace bogotel {
00019 
00020     class CVoiceDev;
00021 
00022     class CSignalDev : public CDevBase
00023     {
00024     public:
00025         CSignalDev(CBgtRt *pBgtRt);
00026     //  virtual ~CSignalDev();
00027         int init(std::string strNetDev, std::string strProt, void *usrattr, long lHandle, long lTimeslot);
00028         int listen(CVoiceDev *pVD);
00029         int setAni(char *szAni);
00030         int waitCall();
00031         int makeCall(CRN *pCrn, char *szNumber, int iTimeout, char *szAni = NULL);
00032         int answerCall(CRN crn);
00033         int acceptCall(CRN crn);
00034         int dropCall(CRN crn, int iCause);
00035         int releaseCall(CRN crn, unsigned long ulMode);
00036         int resetLineDev();
00037         int putEvt(unsigned long event_type, long len, void *pData, long err);
00038 
00039         int receiveMsg(CMsg *pMsg);
00040 
00041         int getDnis(char *szDnis);
00042         int getAni(char *szAni);
00043         long getTimeslot() { return m_lSCbusTimeslot; }
00044         void *getUsrAttr() { return m_pUsrAttr; }
00045         long getHandle() { return m_lHandle; }
00046         int resultValue(METAEVENT *pMetaEvent, int *piGcResult, int *pCcLibId, long *pCcLibResult);
00047         const std::string& getStateName(int state);
00048         static const std::string& getEventName(long lType);
00049 
00050     protected:
00051         enum NetworkState {
00052             NS_RESET = 0,
00053             NS_NULL,        // 1
00054             NS_IDLE,        // 2
00055             NS_DIALING,     // 3
00056             NS_ALERTING,    // 4
00057             NS_OFFERED,     // 5
00058             NS_ACCEPTED,    // 6
00059             NS_CONNECTED,   // 7
00060             NS_DISCONNECTED,// 8
00061             NS_DROPPING     // 9
00062         };
00063         static const std::string stateNames[10];
00064         static const std::string eventNames[10];
00065 
00066         NetworkState m_state;
00067         bool m_bWaitCall;
00068         bool m_bBlocked;
00069         std::string m_strNetDev;
00070         std::string m_strProt;
00071         // this is the ANI of an incoming call - also the number for outgoing calls
00072         std::string m_strAni;
00073         // this is the DNIS of an incoming call
00074         std::string m_strDnis;
00075         long m_lHandle;
00076         long m_lSCbusTimeslot;
00077         void *m_pUsrAttr;
00078         CVoiceDev *m_pVoiceDev;
00079         // the reason for the previous event
00080         int m_iGcResult;
00081 
00082         static long m_lNextCrn;
00083 
00084         int sendEvent(long lType, long lCrn);
00085         void log(int iLevel, char *szMsg, ...);
00086         void logF(char *szFunc, int iLevel, char *szMsg, ...);
00087         int sendMsg(CMsg *pMsg);
00088     };
00089 }
00090 
00091 #endif // ! _BOGOTEL_SIGNALDEV_H
00092 

Generated on Tue Aug 12 12:41:30 2003 for bogotel by doxygen 1.3. Hosted by SourceForge.net Logo