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

BgtRt.cpp

Go to the documentation of this file.
00001 /*
00002  * BgtRt.cpp
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 #include <bogotel/Portability.h>
00011 #include <bogotel/BgtRt.h>
00012 #include <bogotel/VoiceDev.h>
00013 #include <bogotel/SignalDev.h>
00014 #include <bogotel/MsgTransport.h>
00015 #include <bogotel/BgtErrors.h>
00016 #include <bogotel/util.h>
00017 #include <bogotel/Timer.h>
00018 
00019 #include <io.h>
00020 #include <stdexcept>
00021 
00022 #include <cc_s7.h> // for S7_MAKECALL_BLK
00023 
00024 namespace bogotel {
00025 
00026     const std::string CBgtRt::astrCcResultMsgs[1] = {
00027         "Unknown"
00028     };
00029 
00030     const std::string CBgtRt::astrGcResultMsgs[2] = {
00031         "Unknown",
00032         "NORMAL CLEARING"
00033     };
00034 
00035     const std::string CBgtRt::astrCcLibNames[1] = {
00036         "CC-Lib-name"
00037     };
00038 
00040     // Construction/Destruction
00042 
00043     CBgtRt::CBgtRt() :
00044     m_iGcResult(0),
00045     m_iCcLibId(0),
00046     m_lCcLibResult(0),
00047     m_lNextSignalHandle(1),
00048     m_lNextVoiceHandle(1001),
00049     m_lNextSCbusTimeslot(0),
00050     m_lMode(-1),
00051     m_hEvent(NULL),
00052     m_pQueue(NULL),
00053     m_pLatestEvt(NULL),
00054     m_pDlgHdlr(NULL)
00055     {
00056         g_util->init();
00057 
00058         int rc;
00059         if (CDevBase::m_pTransport == NULL) {
00060             CDevBase::m_pTransport = new CMsgTransport(this);
00061             if (CDevBase::m_pTransport == NULL) {
00062                 g_util->log(3, -1, "new CMsgTransport failed.");
00063                 throw std::runtime_error("new CMsgTransport failed.");
00064             }
00065             if ((rc = CDevBase::m_pTransport->init()) != resultSUCCESS) {
00066                 g_util->log(3, -1, "CMsgTransport.init() failed. rc = %d", rc);
00067                 throw std::runtime_error("CMsgTransport.init() failed");
00068             }
00069         }
00070 
00071         if (CDevBase::m_pTimer == NULL) {
00072             CDevBase::m_pTimer = new CTimer();
00073             if (CDevBase::m_pTimer == NULL) {
00074                 g_util->log(3, -1, "new CTimer failed.");
00075                 throw std::runtime_error("new CTimer failed.");
00076             }
00077         }
00078 
00079         m_pQueue = new CEvtQueue();
00080         if (m_pQueue == NULL) {
00081             g_util->log(3, -1, "new CEvtQueue failed.");
00082             throw std::runtime_error("new CEvtQueue failed.");
00083         }
00084         g_util->log(9, -1, "CBgtRt::CBgtRt() complete.", rc);
00085     }
00086 
00087     CBgtRt::~CBgtRt()
00088     {
00089         if (m_pQueue) {
00090             delete m_pQueue;
00091             m_pQueue = NULL;
00092         }
00093         if (m_pLatestEvt) {
00094             delete m_pLatestEvt;
00095             m_pLatestEvt = NULL;
00096         }
00097         if (CDevBase::m_pTransport) {
00098             delete CDevBase::m_pTransport;
00099             CDevBase::m_pTransport = NULL;
00100         }
00101         if (CDevBase::m_pTimer) {
00102             delete CDevBase::m_pTimer;
00103             CDevBase::m_pTimer = NULL;
00104         }
00105         if (m_pDlgHdlr) {
00106             delete m_pDlgHdlr;
00107             m_pDlgHdlr = NULL;
00108         }
00109     }
00110 
00111     CBgtRt* CBgtRt::_instance = 0;
00112 
00113     CBgtRt* CBgtRt::Instance() {
00114 
00115         if (_instance == 0) {
00116             _instance = new CBgtRt;
00117         }
00118 
00119         return _instance;
00120 
00121     } //Instance()
00122 
00123     int CBgtRt::addEvent(CEvt *pEvt)
00124     {
00125         int rc;
00126 
00127         if ((rc = m_pQueue->add(pEvt)) != resultSUCCESS) {
00128             g_util->log(3, -1, "m_pQueue->add() failed. rc = %d", rc);
00129             return rc;
00130         }
00131 
00132         if (m_hEvent) {
00133             ::SetEvent(m_hEvent);
00134         }
00135         g_util->log(9, -1, "CBgtRt.addEvent() complete.", rc);
00136         return resultSUCCESS;
00137     }
00138 
00139     int CBgtRt::waitEvent(long lTimeout, long *plRemaining)
00140     {
00141         int rc;
00142         CEvt* pEvt = NULL;
00143 
00145         (*plRemaining) = 0; 
00146 
00147         if ((rc = m_pQueue->wait(lTimeout, &pEvt)) != resultSUCCESS) {
00148             g_util->log(3, -1, "m_pQueue->wait() failed. rc = %d", rc);
00149             return rc;
00150         }
00151 
00152         if (pEvt && pEvt->m_iSysType == CEvt::SysType::DISABLE_HANDLER) {
00153             // don't touch the last event just disable the event handler
00154             delete pEvt;
00155             return resultDISABLE;
00156         }
00157 
00158         // get rid of old event
00159         if (m_pLatestEvt) {
00160             delete m_pLatestEvt;
00161             m_pLatestEvt = NULL;
00162         }
00163 
00164         if (pEvt == NULL) {
00165             (*plRemaining) = -1;
00166     //      g_util->log(9, -1, "CBgtRt.waitEvent() complete. No event pending.");
00167             return resultSUCCESS;
00168         }
00169 
00170         // save new event
00171         m_pLatestEvt = pEvt;
00172 
00173         g_util->log(9, -1, "CBgtRt.waitEvent() complete. Event pending.");
00174 
00175         return resultSUCCESS;
00176     }
00177 
00179     int CBgtRt::incomingMsg(CMsg *pMsg)
00180     {
00181         int rc;
00182         switch (pMsg->m_class) {
00183         case MC_SIGNAL: {
00184             // find the signalling device based on the ID
00185             MAP_LONG2PTR::iterator itL2P;
00186             itL2P = m_mapSignalDev.find(pMsg->m_id);
00187             if (itL2P == m_mapSignalDev.end()) {
00188                 g_util->log(3, -1, "signal handle not found in BgtRt.incomingMsg. handle is %d", pMsg->m_id);
00189                 return resultFUNC_BAD_PARAMETER;
00190             }
00191             CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00192             if ((rc = pSig->receiveMsg(pMsg)) != resultSUCCESS) {
00193                 g_util->log(3, pMsg->m_id, "CBgtRt::incomingMsg(): CSignalDev::receiveMsg() failed. rc is %d", rc);
00194             }
00195             g_util->log(9, pMsg->m_id, "CBgtRt::incomingMsg() complete. Signal dev Msg handled.");
00196             return rc;
00197                                  }
00198         case MC_VOICE: {
00199             // get voice dev with handle supplied
00200             MAP_LONG2PTR::iterator itL2P;
00201             itL2P = m_mapVoiceDev.find(pMsg->m_id);
00202             if (itL2P == m_mapVoiceDev.end()) {
00203                 g_util->log(3, -1, "voice handle not found in BgtRt.incomingMsg. handle is %d", pMsg->m_id);
00204                 return resultFUNC_BAD_PARAMETER;
00205             }
00206             CVoiceDev *pVoice = reinterpret_cast<CVoiceDev *>(itL2P->second);
00207             if ((rc = pVoice->receiveMsg(pMsg)) != resultSUCCESS) {
00208                 g_util->log(3, pVoice->getSignalHandle(), "CBgtRt::incomingMsg(): CVoiceDev::receiveMsg() failed. rc is %d", rc);
00209             }
00210             g_util->log(9, pVoice->getSignalHandle(), "CBgtRt::incomingMsg() complete. Voice dev Msg handled.");
00211             return rc;
00212                                      }
00213         }
00214         return resultSUCCESS;
00215     }
00216 
00217     int CBgtRt::enableHandler(long dev, unsigned long event_type, CDlgEvtHdlr::ptr_evt_hndlr hdlr)
00218     {
00219         char _func[] = "CBgtRt::enableHandler";
00220         // currently, the handler must enabled for all devices and all event types
00221         if (dev != EV_ANYDEV) {
00222             g_util->log(3, -1, "Invalid dev mask in %s. Mask is %xl", _func, dev);
00223             return resultFUNC_BAD_PARAMETER;
00224         }
00225         if (event_type != EV_ANYEVT) {
00226             g_util->log(3, -1, "Invalid event type mask in %s. Mask is %xl", _func, event_type);
00227             return resultFUNC_BAD_PARAMETER;
00228         }
00229         if (hdlr == NULL) {
00230             g_util->log(3, -1, "Null pointer received in %s.", _func);
00231             return resultFUNC_BAD_PARAMETER;
00232         }
00233 
00234         // initialize event handler model class
00235         m_pDlgHdlr = new CDlgEvtHdlr(hdlr);
00236 
00237         return resultSUCCESS;
00238     }
00239 
00240     int CBgtRt::disableHandler(long dev, unsigned long event_type, CDlgEvtHdlr::ptr_evt_hndlr hdlr)
00241     {
00242         char _func[] = "CBgtRt::disableHandler";
00243 
00244         // check to make sure this is the same handler as was enabled previously
00245         if (m_pDlgHdlr == NULL) {
00246             g_util->log(3, -1, "%s: No handler enabled.", _func);
00247             return resultUNEXPECTED;
00248         }
00249         if (dev != EV_ANYDEV) {
00250             g_util->log(3, -1, "Invalid dev mask in %s. Mask is %xl", _func, dev);
00251             return resultFUNC_BAD_PARAMETER;
00252         }
00253         if (event_type != EV_ANYEVT) {
00254             g_util->log(3, -1, "Invalid event type mask in %s. Mask is %xl", _func, event_type);
00255             return resultFUNC_BAD_PARAMETER;
00256         }
00257         if (! m_pDlgHdlr->matchesHandler(hdlr)) {
00258             g_util->log(3, -1, "%s: Handler to disable doesn't match current handler.", _func);
00259             return resultFUNC_BAD_PARAMETER;
00260         }
00261 
00262         delete m_pDlgHdlr;
00263         m_pDlgHdlr = NULL;
00264 
00265         return resultSUCCESS;
00266     }
00267 
00268     int CBgtRt::getEvtDevHandle(unsigned long evt_handle, long *plHandle)
00269     {
00270         char _func[] = "CBgtRt::getEvtDevHandle";
00271         if (m_pLatestEvt == NULL) {
00272             g_util->log(3, -1, "%s called when no event is pending", _func);
00273             return resultPOINTER;
00274         }
00275         // we have to figure out what type of event we have (signal or voice)
00276         if (m_pLatestEvt->m_lType & DT_GC) {
00277             // it's a GC event -- return signal handle
00278             (*plHandle) = m_pLatestEvt->m_lSignalDevHandle;
00279         } else {
00280             // it's not a GC event -- assume voice event
00281             (*plHandle) = m_pLatestEvt->m_lVoiceDevHandle;
00282         }
00283         
00284     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "%s complete.", _func);
00285         return resultSUCCESS;
00286     }
00287 
00288     int CBgtRt::getEvtVoiceDevHandle(unsigned long evt_handle, long *plHandle)
00289     {
00290         if (m_pLatestEvt == NULL) {
00291             g_util->log(3, -1, "BgtRt::getEvtVoiceDevHandle called when no event is pending");
00292             return resultPOINTER;
00293         }
00294         (*plHandle) = m_pLatestEvt->m_lVoiceDevHandle;
00295 
00296     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtVoiceDevHandle() complete.");
00297         return resultSUCCESS;
00298     }
00299 
00300     int CBgtRt::getEvtSignalDevHandle(unsigned long evt_handle, long *plHandle)
00301     {
00302         if (m_pLatestEvt == NULL) {
00303             g_util->log(3, -1, "BgtRt::getEvtSignalDevHandle called when no event is pending");
00304             return resultPOINTER;
00305         }
00306         (*plHandle) = m_pLatestEvt->m_lSignalDevHandle;
00307 
00308     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtSignalDevHandle() complete.");
00309         return resultSUCCESS;
00310     }
00311 
00312     int CBgtRt::putEvt(long hSignal, unsigned long event_type, long len, void *pData, long err)
00313     {
00314         // get SignalDev with handle supplied
00315         MAP_LONG2PTR::iterator itL2P = m_mapSignalDev.find(hSignal);
00316         if (itL2P == m_mapSignalDev.end()) {
00317             g_util->log(3, -1, "signal handle not found in BgtRt.putEvt(). handle is %d", hSignal);
00318             return resultFUNC_BAD_PARAMETER;
00319         }
00320 
00321         CSignalDev *pSig = reinterpret_cast<CSignalDev*>(itL2P->second);
00322         pSig->putEvt(event_type, len, pData, err);
00323 
00324     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::putEvt() complete.");
00325         return resultSUCCESS;
00326     }
00327 
00328 
00329     int CBgtRt::getEvtType(unsigned long evt_handle, long *plType)
00330     {
00331         if (m_pLatestEvt == NULL) {
00332             // return 0 to indicate that there is no event here
00333             (*plType) = 0;
00334             g_util->log(9, -1, "BgtRt::getEvtType() complete. no event pending.");
00335             return resultSUCCESS;
00336         }
00337         (*plType) = m_pLatestEvt->m_lType;
00338 
00339     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtType() complete.");
00340         return resultSUCCESS;
00341     }
00342 
00343     int CBgtRt::getEvtFlags(unsigned long *pulFlags)
00344     {
00345         if (m_pLatestEvt == NULL) {
00346             g_util->log(3, -1, "BgtRt::getEvtFlags called when no event is pending");
00347             return resultPOINTER;
00348         }
00349         (*pulFlags) = m_pLatestEvt->m_ulFlags;
00350 
00351     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtFlags() complete.");
00352         return resultSUCCESS;
00353     }
00354 
00355     int CBgtRt::getEvtCrn(CRN *pCrn)
00356     {
00357         if (m_pLatestEvt == NULL) {
00358             g_util->log(9, -1, "BgtRt::getEvtCrn called when no event is pending");
00359             return resultPOINTER;
00360         }
00361         (*pCrn) = m_pLatestEvt->m_lCrn;
00362 
00363     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtCrn() complete.");
00364         return resultSUCCESS;
00365     }
00366 
00367     int CBgtRt::getEvtUsrAttr(unsigned long evt_handle, void **ppUsrAttr)
00368     {
00369         if (m_pLatestEvt == NULL) {
00370             g_util->log(3, -1, "BgtRt::getEvtUsrAttr called when no event is pending");
00371             return resultPOINTER;
00372         }
00373         (*ppUsrAttr) = m_pLatestEvt->m_pUsrAttr;
00374 
00375     //  g_util->log(9, m_pLatestEvt->m_lSignalDevHandle, "BgtRt::getEvtUsrAttr() complete.");
00376         return resultSUCCESS;
00377     }
00378 
00379     int CBgtRt::getUsrAttr(LINEDEV hSignal, void **ppUsrData)
00380     {
00381         // get SignalDev with handle supplied
00382         MAP_LONG2PTR::iterator itL2P;
00383         itL2P = m_mapSignalDev.find(hSignal);
00384         if (itL2P == m_mapSignalDev.end()) {
00385             g_util->log(3, -1, "signal handle not found in BgtRt.getUsrAttr(). handle is %d", hSignal);
00386             return resultFUNC_BAD_PARAMETER;
00387         }
00388 
00389         *(ppUsrData) = (reinterpret_cast <CSignalDev*>(itL2P->second))->getUsrAttr();
00390     //  g_util->log(9, hSignal, "BgtRt::getUsrAttr() completed.");
00391         return resultSUCCESS;
00392     }
00393 
00394     int CBgtRt::setMode(long parmid, void *hEvent)
00395     {
00396         if (hEvent) {
00397             m_hEvent = reinterpret_cast<HANDLE>(hEvent);
00398         }
00399         m_lMode = parmid;
00400         return resultSUCCESS;
00401     }
00402 
00403     int CBgtRt::resetLineDev(LINEDEV hSignal, unsigned long ulMode)
00404     {
00405         // we only work in asyncronous mode
00406         if (ulMode != EV_ASYNC) {
00407             return resultFUNC_BAD_PARAMETER;
00408         }
00409 
00410         // get SignalDev with handle supplied
00411         MAP_LONG2PTR::iterator itL2P;
00412         itL2P = m_mapSignalDev.find(hSignal);
00413         if (itL2P == m_mapSignalDev.end()) {
00414             g_util->log(3, -1, "signal handle not found in CBgtRt::resetLineDev(). handle is %d", hSignal);
00415             return resultFUNC_BAD_PARAMETER;
00416         }
00417 
00418         CSignalDev *pSig = reinterpret_cast <CSignalDev*>(itL2P->second);
00419         int rc;
00420         if ((rc = pSig->resetLineDev()) != resultSUCCESS) {
00421             g_util->log(3, hSignal, "CSigDev.resetLineDev() failed in BgtRt.resetLineDev(). rc is %d", rc);
00422             return rc;
00423         }
00424         g_util->log(9, hSignal, "CBgtRt::resetLineDev() completed.");
00425         return rc;
00426     }
00427 
00428     int CBgtRt::waitCall(LINEDEV hSignal, CRN *pCrn, int iTimeout, unsigned long ulMode)
00429     {
00430         // we only work in asyncronous mode
00431         if (ulMode != EV_ASYNC) {
00432             return resultFUNC_BAD_PARAMETER;
00433         }
00434 
00435         // get SignalDev with handle supplied
00436         MAP_LONG2PTR::iterator itL2P;
00437         itL2P = m_mapSignalDev.find(hSignal);
00438         if (itL2P == m_mapSignalDev.end()) {
00439             g_util->log(3, -1, "signal handle not found in BgtRt.waitCall(). handle is %d", hSignal);
00440             return resultFUNC_BAD_PARAMETER;
00441         }
00442         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00443 
00444         int rc;
00445         if ((rc = pSig->waitCall()) != resultSUCCESS) {
00446             g_util->log(3, hSignal, "CSigDev.waitCall() failed in BgtRt.waitCall(). rc is %d", rc);
00447             return rc;
00448         }
00449         g_util->log(9, hSignal, "BgtRt::waitCall() completed.");
00450         return rc;
00451     }
00452 
00453     int CBgtRt::makeCall(LINEDEV hSignal, CRN *pCrn, char *szNumber, GC_MAKECALL_BLK *pMakecall, 
00454                                int iTimeout, unsigned long ulMode)
00455     {
00456         char _func[] = "CBgtRt::makeCall";
00457         // we only work in asyncronous mode
00458         if (ulMode != EV_ASYNC) {
00459             return resultFUNC_BAD_PARAMETER;
00460         }
00461 
00462         // get SignalDev with handle supplied
00463         MAP_LONG2PTR::iterator itL2P;
00464         itL2P = m_mapSignalDev.find(hSignal);
00465         if (itL2P == m_mapSignalDev.end()) {
00466             g_util->log(3, -1, "signal handle not found in BgtRt.makeCall(). handle is %d", hSignal);
00467             return resultFUNC_BAD_PARAMETER;
00468         }
00469         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00470 
00471         int rc;
00472         char *pAni = NULL;
00473         // check if we a makecall block
00474         if (pMakecall) {
00475             if (pMakecall->cclib) {
00476                 try {
00477                     S7_MAKECALL_BLK *block = (S7_MAKECALL_BLK *)pMakecall->cclib;
00478                     pAni = block->ss7.origination_phone_number;
00479                 } catch (...) {
00480                     g_util->log(3, hSignal, "%s: Failed to cast cclib to S7_MAKECALL_BLK", _func);
00481                 }
00482             } else {
00483                 g_util->log(3, hSignal, "%s: cclib NULL in pMakecall", _func);
00484                 return resultFUNC_BAD_PARAMETER;
00485             }
00486         }
00487         if ((rc = pSig->makeCall(pCrn, szNumber, iTimeout, pAni)) != resultSUCCESS) {
00488             g_util->log(3, hSignal, "CSigDev.makeCall() failed in BgtRt.makeCall(). rc is %d", rc);
00489             return rc;
00490         }
00491 
00492         // save the device under the CRN
00493         m_mapCrn2SignalDev.insert(MAP_LONG2PTR::value_type((*pCrn), pSig));
00494 
00495         g_util->log(9, hSignal, "BgtRt::makeCall() completed.");
00496         return resultSUCCESS;
00497     }
00498 
00499     // registers SignalDev instance under the CRN specified
00500     int CBgtRt::registerCrn(CSignalDev *pSig, CRN crn)
00501     {
00502         // check if the CRN is already stored in the map
00503         MAP_LONG2PTR::iterator itL2P;
00504         itL2P = m_mapCrn2SignalDev.find(crn);
00505         if (itL2P != m_mapCrn2SignalDev.end()) {
00506             // the CRN is already stored in the map
00507             g_util->log(3, pSig->getHandle(), "CRN is already stored in the map. CRN is %d", crn);
00508         }
00509 
00510         // save the device under the CRN
00511         m_mapCrn2SignalDev.insert(MAP_LONG2PTR::value_type(crn, pSig));
00512         
00513         g_util->log(9, pSig->getHandle(), "BgtRt.registerCrn() completed.");
00514         return resultSUCCESS;
00515     }
00516 
00517     int CBgtRt::deregisterCrn(CRN crn)
00518     {
00519         // remove the CRN from the map
00520         m_mapCrn2SignalDev.erase(crn);
00521         
00522         g_util->log(9, -1, "BgtRt.deregisterCrn() completed.");
00523 
00524         return resultSUCCESS;
00525     }
00526 
00527     int CBgtRt::getDnis(CRN crn, char *szDnis)
00528     {
00529         // get SignalDev with handle supplied
00530         MAP_LONG2PTR::iterator itL2P;
00531         itL2P = m_mapCrn2SignalDev.find(crn);
00532         if (itL2P == m_mapCrn2SignalDev.end()) {
00533             g_util->log(3, -1, "CRN not found in BgtRt.getDnis(). crn is %d", crn);
00534             return resultFUNC_BAD_PARAMETER;
00535         }
00536         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00537 
00538         pSig->getDnis(szDnis);
00539 
00540         g_util->log(9, pSig->getHandle(), "BgtRt::getDnis() completed. DNIS is %s", szDnis);
00541         return resultSUCCESS;
00542     }
00543 
00544     int CBgtRt::getAni(CRN crn, char *szAni)
00545     {
00546         // get SignalDev with handle supplied
00547         MAP_LONG2PTR::iterator itL2P;
00548         itL2P = m_mapCrn2SignalDev.find(crn);
00549         if (itL2P == m_mapCrn2SignalDev.end()) {
00550             g_util->log(3, -1, "CRN not found in BgtRt.getAni(). crn is %d", crn);
00551             return resultFUNC_BAD_PARAMETER;
00552         }
00553         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00554 
00555         pSig->getAni(szAni);
00556 
00557         g_util->log(9, pSig->getHandle(), "BgtRt.getAni() completed. ANI is %s", szAni);
00558         return resultSUCCESS;
00559     }
00560 
00561     int CBgtRt::setCallingNum(LINEDEV hSignal, char *szCallingNum)
00562     {
00563         // get SignalDev with handle supplied
00564         MAP_LONG2PTR::iterator itL2P;
00565         itL2P = m_mapSignalDev.find(hSignal);
00566         if (itL2P == m_mapSignalDev.end()) {
00567             g_util->log(3, -1, "Signal handle not found in BgtRt::setCallingNum(). handle is %d", hSignal);
00568             return resultFUNC_BAD_PARAMETER;
00569         }
00570         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00571 
00572         pSig->setAni(szCallingNum);
00573 
00574         g_util->log(9, pSig->getHandle(), "BgtRt::setCallingNum() completed. calling num is %s", szCallingNum);
00575         return resultSUCCESS;
00576     }
00577 
00578     int CBgtRt::openVoiceDev(int *piHandle, const char *szName)
00579     {
00580         SET_STRING::iterator itString;
00581 
00582         // first check if this device has already been opened
00583         std::string strName = szName;
00584         itString = m_setVoiceDevNames.find(strName);
00585         if (itString != m_setVoiceDevNames.end()) {
00586             g_util->log(3, -1, "voice dev already opened in CBgtRt::openVoiceDev(). voice name is %s", szName);
00587             return resultFUNC_BAD_PARAMETER;
00588         }
00589 
00590         // add the device name to the set
00591         m_setVoiceDevNames.insert(strName);
00592 
00593         CVoiceDev *pVD = (CVoiceDev *)new CVoiceDev(this);
00594         if (pVD == NULL) {
00595             g_util->log(3, -1, "new CVoiceDev failed.");
00596             return resultNOTENOUGHMEMORY;
00597         }
00598 
00599         int rc;
00600         if ((rc = pVD->init(strName, m_lNextVoiceHandle, m_lNextSCbusTimeslot)) != resultSUCCESS) {
00601             g_util->log(3, -1, "CVoiceDev::init() failed in CBgtRt::openVoiceDev(). voice name is %s", szName);
00602             return rc;
00603         }
00604 
00605         m_mapVoiceDev.insert(MAP_LONG2PTR::value_type(m_lNextVoiceHandle,pVD));
00606         m_mapScTsVoiceDev.insert(MAP_LONG2PTR::value_type(m_lNextSCbusTimeslot,pVD));
00607         (*piHandle) = m_lNextVoiceHandle;
00608 
00609         m_lNextVoiceHandle++;
00610         m_lNextSCbusTimeslot++;
00611 
00612         g_util->log(9, -1, "BgtRt.openVoiceDev() completed. voice dev is %s", szName);
00613         return resultSUCCESS;
00614     }
00615 
00616     int CBgtRt::openSignalDev(LINEDEV *pHandle, char *szName, void *pUsrattr)
00617     {
00618         SET_STRING::iterator itString;
00619         std::string strProt;
00620         std::string strNetDev;
00621         std::string strVoxDev;
00622         char *szToken;
00623 
00624         // separate the different portions of the device name
00625         szToken = strtok(szName, ":");
00626         // the format for the string is ":<key>_<name>"
00627         while(szToken != NULL) {
00628             switch (szToken[0]) {
00629             case 'P':
00630                 strProt = &szToken[2];
00631                 break;
00632             case 'N':
00633                 strNetDev = &szToken[2];
00634                 break;
00635             case 'V':
00636                 // we will parse the voice name but not use it
00637                 // @todo use voice device name
00638                 strVoxDev = &szToken[2];
00639                 break;
00640             default:
00641                 // unknown field
00642                 return resultFUNC_BAD_PARAMETER;
00643             }
00644             szToken = strtok(NULL, ":");
00645         }
00646         
00647         // check if we've already been asked to open this network device
00648         itString = m_setSignalDevNames.find(strNetDev);
00649         if (itString != m_setSignalDevNames.end()) {
00650             g_util->log(3, -1, "signal dev already opened in CBgtRt::openSignalDev(). signal name is %s", szName);
00651             return resultFUNC_BAD_PARAMETER;
00652         }
00653 
00654         // add the device name to the set
00655         m_setSignalDevNames.insert(strNetDev);
00656 
00657         CSignalDev *pSD = (CSignalDev *)new CSignalDev(this);
00658         if (pSD== NULL) {
00659             g_util->log(3, -1, "new CSignalDev failed.");
00660             return resultNOTENOUGHMEMORY;
00661         }
00662 
00663         int rc;
00664         if ((rc = pSD->init(strNetDev, strProt, pUsrattr, m_lNextSignalHandle, m_lNextSCbusTimeslot)) != resultSUCCESS) {
00665             g_util->log(3, -1, "CSignalDev::init() failed in CBgtRt::openSignalDev(). voice name is %s", szName);
00666             return rc;
00667         }
00668 
00669         m_mapSignalDev.insert(MAP_LONG2PTR::value_type(m_lNextSignalHandle,pSD));
00670         m_mapScTsSignalDev.insert(MAP_LONG2PTR::value_type(m_lNextSCbusTimeslot,pSD));
00671         (*pHandle) = m_lNextSignalHandle;
00672         
00673         m_lNextSignalHandle++;
00674         m_lNextSCbusTimeslot++;
00675 
00676         g_util->log(9, pSD->getHandle(), "BgtRt.openSignalDev() completed. voice dev is %s", szName);
00677         return resultSUCCESS;
00678     }
00679 
00680     int CBgtRt::getVoiceTimeslot(int iVoiceHandle, long *plTimeslot)
00681     {
00682         // get VoiceDev with handle supplied
00683         MAP_LONG2PTR::iterator itL2P;
00684         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
00685         if (itL2P == m_mapVoiceDev.end()) {
00686             g_util->log(3, -1, "voice handle not found in BgtRt.getVoiceTimeslot(). handle is %d", iVoiceHandle);
00687             return resultFUNC_BAD_PARAMETER;
00688         }
00689 
00690         (*plTimeslot) = ((CVoiceDev*)itL2P->second)->getTimeslot();
00691         g_util->log(9, -1, "BgtRt::getVoiceTimeslot() completed.");
00692         return resultSUCCESS;
00693     }
00694 
00695     int CBgtRt::getSignalTimeslot(LINEDEV hSignal, SC_TSINFO *pScTsInfo)
00696     {
00697         // get SignalDev with handle supplied
00698         MAP_LONG2PTR::iterator itL2P;
00699         itL2P = m_mapSignalDev.find(hSignal);
00700         if (itL2P == m_mapSignalDev.end()) {
00701             g_util->log(3, -1, "signal handle not found in BgtRt.getSignalTimeslot(). handle is %d", hSignal);
00702             return resultFUNC_BAD_PARAMETER;
00703         }
00704 
00705         pScTsInfo->sc_tsarrayp[0] = ((CSignalDev*)itL2P->second)->getTimeslot();
00706         g_util->log(9, ((CSignalDev*)itL2P->second)->getHandle(), "BgtRt::getSignalTimeslot() completed.");
00707         return resultSUCCESS;
00708     }
00709 
00710     int CBgtRt::listenVoiceTimeslot(LINEDEV hSignal, SC_TSINFO *pScTsInfo)
00711     {
00712         CVoiceDev *pVD;
00713         CSignalDev *pSD;
00714 
00715         // get VoiceDev with timeslot handle supplied
00716         MAP_LONG2PTR::iterator itL2P;
00717         itL2P = m_mapScTsVoiceDev.find(pScTsInfo->sc_tsarrayp[0]);
00718         if (itL2P == m_mapScTsVoiceDev.end()) {
00719             g_util->log(3, hSignal, "signal handle not found in BgtRt.listenVoiceTimeslot()");
00720             return resultFUNC_BAD_PARAMETER;
00721         }
00722         try {
00723             pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
00724         } catch (...) {
00725             g_util->log(3, hSignal, "invalid handle in BgtRt.listenVoiceTimeslot()");
00726             return resultFUNC_BAD_PARAMETER;
00727         }
00728 
00729         // get SignalDev with hande supplied
00730         itL2P = m_mapSignalDev.find(hSignal);
00731         if (itL2P == m_mapSignalDev.end()) {
00732             g_util->log(3, hSignal, "signal dev not found in BgtRt.listenVoiceTimeslot()");
00733             return resultFUNC_BAD_PARAMETER;
00734         }
00735 
00736         pSD = reinterpret_cast<CSignalDev*>(itL2P->second);
00737 
00738         pSD->listen(pVD);
00739 
00740         g_util->log(9, pSD->getHandle(), "BgtRt::listenVoiceTimeslot() completed.");
00741         return resultSUCCESS;
00742     }
00743 
00744     int CBgtRt::listenSignalTimeslot(LINEDEV lVoiceHandle, long lTimeslot)
00745     {
00746         CSignalDev *pSD;
00747         CVoiceDev *pVD;
00748 
00749         // get SignalDev with timeslot handle supplied
00750         MAP_LONG2PTR::iterator itL2P;
00751         itL2P = m_mapScTsSignalDev.find(lTimeslot);
00752         if (itL2P == m_mapScTsSignalDev.end()) {
00753             g_util->log(3, -1, "signal dev not found in BgtRt.listenSignalTimeslot()");
00754             return resultFUNC_BAD_PARAMETER;
00755         }
00756         try {
00757             pSD = reinterpret_cast<CSignalDev*>(itL2P->second);
00758         } catch (...) {
00759             g_util->log(3, -1, "invalid handle in BgtRt.listenSignalTimeslot()");
00760             return resultFUNC_BAD_PARAMETER;
00761         }
00762 
00763         // get VoiceDev with handle supplied
00764         itL2P = m_mapVoiceDev.find(lVoiceHandle);
00765         if (itL2P == m_mapVoiceDev.end()) {
00766             g_util->log(3, -1, "voice handle not found in BgtRt.listenSignalTimeslot()");
00767             return resultFUNC_BAD_PARAMETER;
00768         }
00769 
00770         pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
00771 
00772         pVD->listen(pSD);
00773 
00774         g_util->log(9, pSD->getHandle(), "BgtRt::listenSignalTimeslot() completed.");
00775         return resultSUCCESS;
00776     }
00777 
00778     int CBgtRt::acceptCall(CRN crn, int iRings, unsigned long ulMode)
00779     {
00780         // we only work in asyncronous mode
00781         if (ulMode != EV_ASYNC) {
00782             return resultFUNC_BAD_PARAMETER;
00783         }
00784 
00785         // get SignalDev with CRN supplied
00786         MAP_LONG2PTR::iterator itL2P;
00787         itL2P = m_mapCrn2SignalDev.find(crn);
00788         if (itL2P == m_mapCrn2SignalDev.end()) {
00789             g_util->log(3, -1, "CRN not found in BgtRt.acceptCall(). crn is %d", crn);
00790             return resultFUNC_BAD_PARAMETER;
00791         }
00792         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00793 
00794         int rc;
00795         if ((rc = pSig->acceptCall(crn)) != resultSUCCESS) {
00796             g_util->log(3, pSig->getHandle(), "CSigDev->acceptCall failed in BgtRt.acceptCall(). rc is %d", rc);
00797             return rc;
00798         }
00799         g_util->log(9, pSig->getHandle(), "BgtRt::acceptCall() completed.");
00800         return rc;
00801     }
00802 
00803     int CBgtRt::answerCall(CRN crn, int iRings, unsigned long ulMode)
00804     {
00805         // we only work in asyncronous mode
00806         if (ulMode != EV_ASYNC) {
00807             return resultFUNC_BAD_PARAMETER;
00808         }
00809 
00810         // get SignalDev with CRN supplied
00811         MAP_LONG2PTR::iterator itL2P;
00812         itL2P = m_mapCrn2SignalDev.find(crn);
00813         if (itL2P == m_mapCrn2SignalDev.end()) {
00814             g_util->log(3, -1, "CRN not found in BgtRt.answerCall(). crn is %d", crn);
00815             return resultFUNC_BAD_PARAMETER;
00816         }
00817         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00818 
00819         int rc;
00820         if ((rc = pSig->answerCall(crn)) != resultSUCCESS) {
00821             g_util->log(3, pSig->getHandle(), "CSigDev->answerCall failed in BgtRt.answerCall(). rc is %d", rc);
00822             return rc;
00823         }
00824         g_util->log(9, pSig->getHandle(), "BgtRt::answerCall() completed.");
00825         return rc;
00826     }
00827 
00828     int CBgtRt::dropCall(CRN crn, int iCause, unsigned long ulMode)
00829     {
00830         // we only work in asyncronous mode
00831         if (ulMode != EV_ASYNC) {
00832             return resultFUNC_BAD_PARAMETER;
00833         }
00834 
00835         // get SignalDev with CRN supplied
00836         MAP_LONG2PTR::iterator itL2P;
00837         itL2P = m_mapCrn2SignalDev.find(crn);
00838         if (itL2P == m_mapCrn2SignalDev.end()) {
00839             g_util->log(3, -1, "BgtRt::dropCall(): crn not found. crn is %d", crn);
00840             return resultFUNC_BAD_PARAMETER;
00841         }
00842         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00843 
00844         int rc;
00845         if ((rc = pSig->dropCall(crn, iCause)) != resultSUCCESS) {
00846             g_util->log(3, pSig->getHandle(), "BgtRt::dropCall(): CSignalDev::dropCall failed. rc is %d", rc);
00847             return rc;
00848         }
00849         g_util->log(9, pSig->getHandle(), "BgtRt::dropCall() completed.");
00850         return rc;
00851     }
00852 
00853     int CBgtRt::releaseCall(CRN crn, unsigned long ulMode)
00854     {
00855         // get SignalDev with CRN supplied
00856         MAP_LONG2PTR::iterator itL2P;
00857         itL2P = m_mapCrn2SignalDev.find(crn);
00858         if (itL2P == m_mapCrn2SignalDev.end()) {
00859             g_util->log(3, -1, "BgtRt::releaseCall(): crn not found. crn is %d", crn);
00860             return resultFUNC_BAD_PARAMETER;
00861         }
00862         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00863 
00864         int rc;
00865         if ((rc = pSig->releaseCall(crn, ulMode)) != resultSUCCESS) {
00866             g_util->log(3, pSig->getHandle(), "BgtRt::releaseCall(): CSignalDev::releaseCall failed. rc is %d", rc);
00867             return rc;
00868         }
00869         g_util->log(9, pSig->getHandle(), "BgtRt::releaseCall() completed.");
00870         return rc;
00871     }
00872 
00873     int CBgtRt::resultValue(METAEVENT *pMetaEvent, int *piGcResult, int *pCcLibId, long *pCcLibResult)
00874     {
00875         // get SignalDev with CRN from metaevent
00876         MAP_LONG2PTR::iterator itL2P;
00877         itL2P = m_mapCrn2SignalDev.find(pMetaEvent->crn);
00878         if (itL2P == m_mapCrn2SignalDev.end()) {
00879             g_util->log(3, -1, "BgtRt::resultValue(): crn not found. crn is %d", pMetaEvent->crn);
00880             return resultFUNC_BAD_PARAMETER;
00881         }
00882         CSignalDev *pSig = reinterpret_cast<CSignalDev *>(itL2P->second);
00883 
00884         int rc;
00885         if ((rc = pSig->resultValue(pMetaEvent, piGcResult, pCcLibId, pCcLibResult)) != resultSUCCESS) {
00886             g_util->log(3, pSig->getHandle(), "BgtRt::resultValue(): CSignalDev::resultValue failed. rc is %d", rc);
00887             return rc;
00888         }
00889         g_util->log(9, pSig->getHandle(), "BgtRt::resultValue() completed.");
00890         return rc;
00891     }
00892 
00893     int CBgtRt::errorValue(int *piGcResult, int *piCcLibId, long *plCcLibResult)
00894     {
00895         (*piGcResult)    = m_iGcResult;
00896         (*piCcLibId)     = m_iCcLibId;
00897         (*plCcLibResult) = m_lCcLibResult;
00898 
00899         // we'll be simplistic here and assume that if the values have been read,
00900         // we can reset them
00901         m_iGcResult    = 0;
00902         m_iCcLibId     = 0;
00903         m_lCcLibResult = 0;
00904 
00905         return resultSUCCESS;
00906     }
00907 
00908     int CBgtRt::mediaFileOpen(int *piHandle, const char *szFilename, int iFlags)
00909     {
00910         if (((*piHandle) = _open(szFilename, iFlags)) == -1) {
00911             return resultIOERROR;
00912         }
00913 
00914         // Store the handle along with the filename
00915         // We'll defer getting more info about the WAV for until it is played;
00916         // after all, we don't know if it will be played.
00917         std::string str = szFilename;
00918 
00919         {
00920             boost::mutex::scoped_lock lock(m_mtxFilenameMap);
00921             CVoiceDev::s_mapHandle2Filename.insert(MAP_INT2STR::value_type((*piHandle), str));
00922         }
00923 
00924         return resultSUCCESS;
00925     }
00926 
00927     int CBgtRt::mediaFileClose(int iHandle)
00928     {
00929         {
00930             boost::mutex::scoped_lock lock(m_mtxFilenameMap);
00931             CVoiceDev::s_mapHandle2Filename.erase(iHandle);
00932         }
00933 
00934         if (_close(iHandle) == -1) {
00935             return resultIOERROR;
00936         }
00937         return resultSUCCESS;
00938     }
00939 
00940     int CBgtRt::mediaFilePlay(int iVoiceHandle,DX_IOTT *pIott,const DV_TPT *pTpt,const DX_XPB *pXpb,unsigned short usMode)
00941     {
00942         // get VoiceDev with handle supplied
00943         MAP_LONG2PTR::iterator itL2P;
00944         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
00945         if (itL2P == m_mapVoiceDev.end()) {
00946             g_util->log(3, -1, "voice handle not found in BgtRt.mediaFilePlay(). handle is %d", iVoiceHandle);
00947             return resultFUNC_BAD_PARAMETER;
00948         }
00949 
00950         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
00951 
00952         int rc;
00953         if ((rc = pVD->play(pIott,pTpt,pXpb,usMode)) != resultSUCCESS) {
00954             g_util->log(3, -1, "BgtRt::mediaFilePlay(): CVoiceDev::play() failed. rc is %d", rc);
00955             return rc;
00956         }
00957 
00958         g_util->log(9, -1, "BgtRt::mediaFilePlay() completed.");
00959         return resultSUCCESS;
00960     }
00961 
00962     int CBgtRt::stopVoice(int iVoiceHandle, unsigned short usMode)
00963     {
00964         // get VoiceDev with handle supplied
00965         MAP_LONG2PTR::iterator itL2P;
00966         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
00967         if (itL2P == m_mapVoiceDev.end()) {
00968             g_util->log(3, -1, "CBgtRt::stopVoice(): voice handle not found. handle is %d", iVoiceHandle);
00969             return resultFUNC_BAD_PARAMETER;
00970         }
00971 
00972         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
00973 
00974         int rc;
00975         if ((rc = pVD->stop(usMode)) != resultSUCCESS) {
00976             g_util->log(3, -1, "CBgtRt::stopVoice(): CVoiceDev::stop() failed. rc is %d", rc);
00977             return rc;
00978         }
00979 
00980         g_util->log(9, -1, "BgtRt::stopVoice() completed.");
00981         return resultSUCCESS;
00982     }
00983 
00984     int CBgtRt::clearDigitBuffer(int iVoiceHandle)
00985     {
00986         // get VoiceDev with handle supplied
00987         MAP_LONG2PTR::iterator itL2P;
00988         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
00989         if (itL2P == m_mapVoiceDev.end()) {
00990             g_util->log(3, -1, "CBgtRt::clearDigitBuffer(): voice handle not found. handle is %d", iVoiceHandle);
00991             return resultFUNC_BAD_PARAMETER;
00992         }
00993 
00994         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
00995 
00996         int rc;
00997         if ((rc = pVD->clearDigitBuffer()) != resultSUCCESS) {
00998             g_util->log(3, -1, "CBgtRt::clearDigitBuffer(): CVoiceDev::clearDigitBuffer() failed. rc is %d", rc);
00999             return rc;
01000         }
01001 
01002         g_util->log(9, -1, "CBgtRt::clearDigitBuffer() completed.");
01003         return resultSUCCESS;
01004     }
01005 
01006     int CBgtRt::getDigit(int iVoiceHandle, const DV_TPT *pTpt, DV_DIGIT *pDigit, unsigned short usMode)
01007     {
01008         char method[] = "CBgtRt::getDigit";
01009         g_util->log(9, -1, "%s: Entered", method);
01010 
01011         // get VoiceDev with handle supplied
01012         MAP_LONG2PTR::iterator itL2P;
01013         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
01014         if (itL2P == m_mapVoiceDev.end()) {
01015             g_util->log(3, -1, "CBgtRt::getDigit(): voice handle not found. handle is %d", iVoiceHandle);
01016             return resultFUNC_BAD_PARAMETER;
01017         }
01018 
01019         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
01020 
01021         int rc;
01022 
01023         memset(pDigit, 0, sizeof(DV_DIGIT));
01024 
01025         if ((rc = pVD->getDigit(pTpt, pDigit, usMode)) != resultSUCCESS) {
01026             g_util->log(3, -1, "CBgtRt::getDigit(): CVoiceDev::getDigit() failed. rc is %d", rc);
01027             return rc;
01028         }
01029 
01030         g_util->log(9, -1, "%s: Completed", method);
01031         return resultSUCCESS;
01032     }
01033 
01034     int CBgtRt::dial(int iHandle, const char *szDialStr, const DX_CAP *pCAP, unsigned short usMode)
01035     {
01036         // get VoiceDev with handle supplied
01037         MAP_LONG2PTR::iterator itL2P;
01038         itL2P = m_mapVoiceDev.find((long)iHandle);
01039         if (itL2P == m_mapVoiceDev.end()) {
01040             g_util->log(3, -1, "CBgtRt::dial(): voice handle not found. handle is %d", iHandle);
01041             return resultFUNC_BAD_PARAMETER;
01042         }
01043 
01044         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
01045 
01046         int rc;
01047 
01048         if ((rc = pVD->dial(szDialStr, pCAP, usMode)) != resultSUCCESS) {
01049             g_util->log(3, -1, "CBgtRt::dial(): CVoiceDev::dial() failed. rc is %d", rc);
01050             return rc;
01051         }
01052 
01053         g_util->log(9, -1, "CBgtRt::dial() completed.");
01054         return resultSUCCESS;
01055     }
01056 
01057     int CBgtRt::getTermMsk(INT iVoiceHandle, long *lMask)
01058     {
01059         // get VoiceDev with handle supplied
01060         MAP_LONG2PTR::iterator itL2P;
01061         itL2P = m_mapVoiceDev.find((long)iVoiceHandle);
01062         if (itL2P == m_mapVoiceDev.end()) {
01063             g_util->log(3, -1, "CBgtRt::getTermMsk(): voice handle not found. handle is %d", iVoiceHandle);
01064             return resultFUNC_BAD_PARAMETER;
01065         }
01066 
01067         CVoiceDev *pVD = reinterpret_cast<CVoiceDev*>(itL2P->second);
01068 
01069         (*lMask) = pVD->getTermMsk();
01070 
01071         return resultSUCCESS;
01072     }
01073 
01074     int CBgtRt::resultMsg(int iGcValue, char** pszGcMsg, int iCcValue, char** pszCcMsg)
01075     {
01076         switch (iGcValue) {
01077         case GC_NORMAL_CLEARING:
01078             (*pszGcMsg) = const_cast<char*>(astrGcResultMsgs[1].c_str());
01079             break;
01080         default:
01081             (*pszGcMsg) = const_cast<char*>(astrGcResultMsgs[0].c_str());
01082             break;
01083         }
01084         (*pszCcMsg) = const_cast<char*>(astrCcResultMsgs[0].c_str());
01085         return resultSUCCESS;
01086     }
01087 
01088     int CBgtRt::resultMsg(int iCcLibId, long lResultCode, char **pszMsg)
01089     {
01090         // messages are dependent on type of CC lib used; cclibid should
01091         // be to checked to get correct message
01092         switch (lResultCode) {
01093         case GC_NORMAL_CLEARING:
01094             (*pszMsg) = const_cast<char*>(astrGcResultMsgs[1].c_str());
01095             break;
01096         default:
01097             (*pszMsg) = const_cast<char*>(astrGcResultMsgs[0].c_str());
01098             break;
01099         }
01100         return resultSUCCESS;
01101     }
01102 
01103     int CBgtRt::ccLibIDToName(long lCcLibId, char** pszCcLibName)
01104     {
01105         (*pszCcLibName) = const_cast<char*>(astrCcLibNames[0].c_str());
01106         return resultSUCCESS;
01107     }
01108 
01109     void CBgtRt::setGcResult(int iGcResult) 
01110     { 
01111         m_iGcResult = iGcResult; 
01112     }
01113 
01114     void CBgtRt::setCcLibId(int iCcLibId)
01115     { 
01116         m_iCcLibId = iCcLibId; 
01117     }
01118 
01119     void CBgtRt::setCcLibResult(long lCcLibResult)
01120     { 
01121         m_lCcLibResult = lCcLibResult; 
01122     }
01123 }

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