Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cATModem.h
Go to the documentation of this file.
1 //
4 
5 #ifndef _INC_cATModem_H
6 #define _INC_cATModem_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "../GrayLibBase.h"
19 
20 namespace GrayLib
21 {
23  class cSerialPort;
24 
26  {
32 
33  static const int k_SizeMaxResult = 256;
34  static const TIMESYSD_t k_tResultCharMin = 100;
35 
36  public:
38  {
39  ATMODE_UNK = 0,
43  ATMODE_DataFax,
45  };
46 
47  public:
48  bool m_bIsInit;
50 
51  private:
52  cStream* const m_pStream;
53  const cStringF m_sPortName;
54 
55  ATMODE_TYPE m_eMode;
56  cStringA m_sCommand;
57  cStringA m_sResult;
58 
59  public:
60  cATModem(cStream* pStream, cStringF sPortName);
61  virtual ~cATModem();
62 
63  void SetModeUnk(bool bUnInit = false);
64  HRESULT SetModeCommand();
65 
66  HRESULT SendATCmd(const char* pszCmd, bool bCR = true);
67  HRESULT PollForResult();
68  HRESULT WaitForResult(TIMESYSD_t tWaitMin = 10, TIMESYSD_t tWaitMax = 10 * cTimeSys::k_FREQ);
69  HRESULT SendATCmdAndWait(const char* pszCmd, TIMESYSD_t tWaitMin = 10, TIMESYSD_t tWaitMax = 10 * cTimeSys::k_FREQ);
70  HRESULT SendATCmdScript(const char* pszCmdScript);
71 
72  HRESULT SendSMS(const char* pszNumber, const char* pszMsg);
73 
74  static HRESULT GRAYCALL FindATModemStream(OUT cNewPtr<cStream>& rpStream, _Inout_ cStringF& sPortName);
75 
77  };
78 
79 #if defined(_WIN32) && ! defined(UNDER_CE)
80  class GRAYLIB_LINK cATModemExt : public cATModem
81  {
85 
86  public:
87  cATModemExt(cSerialPort* pStream, cStringF sPortName);
88  virtual ~cATModemExt();
89  };
90 #endif
91 };
92 
93 #endif // _INC_cATModem_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cATModem.h:26
cStringA m_sInitCommandScript
My command init script. Must put the modem into known state.
Definition: cATModem.h:49
bool m_bIsInit
I have applied my modem init set. m_sInitCommandScript.
Definition: cATModem.h:48
UNITTEST_FRIEND(cATModem)
ATMODE_TYPE
Definition: cATModem.h:38
@ ATMODE_DataCarrier
We are in connected data mode now. Use m_pStream freely for data.
Definition: cATModem.h:41
@ ATMODE_DataVoice
in voice mode. PCM ?
Definition: cATModem.h:42
@ ATMODE_Command
In command mode now.
Definition: cATModem.h:40
Definition: cSerialPort.h:26
Definition: cNewPtr.h:18
Definition: cStream.h:456
static const TIMESYS_t k_FREQ
milliSec per Sec
Definition: cTimeSys.h:100
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28