Class1Poll.c++
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:2k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /* $Id: Class1Poll.c++,v 1.2 2006/05/05 01:21:02 faxguy Exp $ */
  2. /*
  3.  * Copyright (c) 1990-1996 Sam Leffler
  4.  * Copyright (c) 1991-1996 Silicon Graphics, Inc.
  5.  * HylaFAX is a trademark of Silicon Graphics
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26. #include "Class1.h"
  27. #include "ModemConfig.h"
  28. #include "HDLCFrame.h"
  29. #include "t.30.h"
  30. #include "config.h"
  31. bool
  32. Class1Modem::requestToPoll(fxStr&)
  33. {
  34.     return true;
  35. }
  36. bool
  37. Class1Modem::pollBegin(const fxStr& cig0,
  38.     const fxStr& sep0, const fxStr& pwd0, fxStr& emsg)
  39. {
  40.     FaxParams dtc = modemDIS();
  41.     u_int send = 0;
  42.     fxStr cig;
  43.     encodeTSI(cig, cig0);
  44.     fxStr sep;
  45.     if (sep0 != fxStr::null && (dis_caps.isBitEnabled(FaxParams::BITNUM_SEP))) {
  46. encodePWD(sep, sep0);
  47. send |= DIS_SEP;
  48.     }
  49.     fxStr pwd;
  50.     if (pwd0 != fxStr::null && (dis_caps.isBitEnabled(FaxParams::BITNUM_PWD))) {
  51. encodePWD(pwd, pwd0);
  52. send |= DIS_PWD;
  53.     }
  54.     setInputBuffering(false);
  55.     prevPage = false; // no previous page received
  56.     pageGood = false; // quality of received page
  57.     return atCmd(thCmd, AT_NOTHING) &&
  58. atResponse(rbuf, 7550) == AT_CONNECT &&
  59. recvIdentification(
  60.     (send&DIS_PWD ? FCF_PPW : 0), pwd,
  61.     (send&DIS_SEP ? FCF_SEP : 0), sep,
  62.     0, fxStr::null,
  63.     FCF_CIG, cig,
  64.     FCF_DTC, dtc,
  65.     conf.t1Timer, false, emsg);
  66. }