faxSendApp.h
上传用户:weiyuanprp
上传日期:2020-05-20
资源大小:1169k
文件大小:3k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /* $Id: faxSendApp.h,v 1.1.1.1 2005/11/11 21:32: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. #ifndef _faxSendApp_
  27. #define _faxSendApp_
  28. /*
  29.  * HylaFAX Send Job App.
  30.  */
  31. #include "faxApp.h"
  32. #include "FaxServer.h"
  33. class UUCPLock;
  34. class faxSendApp : public FaxServer, public faxApp {
  35. public:
  36.     struct stringtag {
  37. const char*  name;
  38. fxStr faxSendApp::* p;
  39. const char*  def; // NULL is shorthand for ""
  40.     };
  41.     struct numbertag {
  42. const char*  name;
  43. u_int faxSendApp::* p;
  44. u_int  def;
  45.     };
  46.     struct booltag {
  47. const char*  name;
  48. bool faxSendApp::* p;
  49. bool  def;
  50.     };
  51. private:
  52. // runtime state
  53.     bool ready; // modem ready for use
  54.     UUCPLock* modemLock; // uucp lockfile handle
  55.     fxStr pollRcvdCmd; // command for docs received by polling
  56.     u_int desiredDF; // desired data format
  57.     u_int desiredBR; // desired signalling rate
  58.     u_int desiredST; // desired min-scanline-time
  59.     u_int desiredEC; // enable use of ECM if available
  60.     bool useJobTSI; // User the Job submitted TSI
  61.     static faxSendApp* _instance;
  62.     static stringtag strings[];
  63.     static numbertag numbers[];
  64.     static booltag booleans[];
  65. // configuration support
  66.     void setupConfig();
  67.     void resetConfig();
  68.     bool setConfigItem(const char* tag, const char* value);
  69. // modem handling
  70.     bool canLockModem();
  71.     bool lockModem();
  72.     void unlockModem();
  73. // notification interfaces used by FaxServer
  74.     void notifyModemReady();
  75.     void notifyModemWedged();
  76.     void notifyCallPlaced(const FaxRequest&);
  77.     void notifyConnected(const FaxRequest&);
  78.     void notifyPageSent(FaxRequest& req, const char* filename);
  79.     void notifyDocumentSent(FaxRequest&, u_int fileIndex);
  80.     void notifyPollRecvd(FaxRequest&, FaxRecvInfo&);
  81.     void notifyPollDone(FaxRequest&, u_int pollIndex);
  82. public:
  83.     faxSendApp(const fxStr& device, const fxStr& devID);
  84.     ~faxSendApp();
  85.     static faxSendApp& instance();
  86.     void initialize(int argc, char** argv);
  87.     void open();
  88.     void close();
  89.     FaxSendStatus send(const char** filename, int num);
  90.     bool isReady() const;
  91. };
  92. inline bool faxSendApp::isReady() const  { return ready; }
  93. #endif