"Fossies" - the Fresh Open Source Software Archive

Member "bayonne-1.2.16/drivers/vpb/flash.cpp" (24 Apr 2003, 2409 Bytes) of package /linux/misc/old/bayonne-1.2.16.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "flash.cpp" see the Fossies "Dox" file reference documentation.

    1 // Copyright (C) 2000 Open Source Telecom Corporation.
    2 //  
    3 // This program is free software; you can redistribute it and/or modify
    4 // it under the terms of the GNU General Public License as published by
    5 // the Free Software Foundation; either version 2 of the License, or
    6 // (at your option) any later version.
    7 // 
    8 // This program is distributed in the hope that it will be useful,
    9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 // GNU General Public License for more details.
   12 // 
   13 // You should have received a copy of the GNU General Public License
   14 // along with this program; if not, write to the Free Software 
   15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   16 
   17 #include "driver.h"
   18 
   19 #ifdef  CCXX_NAMESPACES
   20 using namespace std;
   21 namespace ost {
   22 #endif
   23 
   24 bool VPBTrunk::flashoffHandler(TrunkEvent *event)
   25 {
   26     switch(event->id)
   27     {
   28     case TRUNK_DTMF_KEYUP:
   29     case TRUNK_STOP_DISCONNECT:
   30         return true;
   31     case TRUNK_CPA_DIALTONE:
   32         endTimer();
   33         setSymbol(SYM_TONE, "dial");
   34         if(data.dialxfer.digit)
   35         {
   36             endTimer();
   37             handler = &VPBTrunk::dialHandler;
   38             return true;
   39         }
   40         if(trunkSignal(TRUNK_SIGNAL_TONE))
   41         {
   42             endTimer();
   43             handler = &VPBTrunk::stepHandler;
   44             return true;
   45         }
   46     case TRUNK_TIMER_EXPIRED:
   47         if(data.dialxfer.digit)
   48         {
   49             handler = &VPBTrunk::dialHandler;
   50             return true;
   51         }
   52         trunkSignal(TRUNK_SIGNAL_STEP);
   53         handler = &VPBTrunk::stepHandler;
   54         return true;
   55     case TRUNK_ENTER_STATE:
   56         enterState("flashoff");
   57         setSymbol(SYM_TONE, "none");
   58         flags.offhook = true;
   59         vpb_sethook_async(handle, VPB_OFFHOOK);
   60         if(data.dialxfer.offhook < getPickupTimer())
   61             data.dialxfer.offhook = getPickupTimer();
   62         setTimer(data.dialxfer.offhook);
   63         return true;
   64     }
   65     return false;
   66 }
   67 
   68 bool VPBTrunk::flashonHandler(TrunkEvent *event)
   69 {
   70     switch(event->id)
   71     {
   72     case TRUNK_DTMF_KEYUP:
   73     case TRUNK_STOP_DISCONNECT:
   74         return true;
   75     case TRUNK_TIMER_EXPIRED:
   76         handler = &VPBTrunk::flashoffHandler;
   77         return true;
   78     case TRUNK_ENTER_STATE:
   79         enterState("flashon");
   80         setDTMFDetect(false);
   81         flags.dsp = DSP_MODE_VOICE;
   82         status[id] = 'f';
   83         if(!flags.offhook)
   84         {
   85             handler = &VPBTrunk::flashoffHandler;
   86             return true;
   87         }
   88         flags.offhook = false;
   89         vpb_sethook_async(handle, VPB_ONHOOK);
   90         setTimer(data.dialxfer.onhook);
   91         return true;
   92     }
   93     return false;
   94 }       
   95 
   96 #ifdef  CCXX_NAMESPACES
   97 };
   98 #endif