/[projects]/smsdaemon/main.cpp
ViewVC logotype

Diff of /smsdaemon/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 196 by torben, Thu Dec 18 06:53:29 2008 UTC revision 214 by torben, Mon Dec 22 22:22:42 2008 UTC
# Line 9  Line 9 
9  #include "ModemTransceiver.h"  #include "ModemTransceiver.h"
10  #include "DebugTransceiver.h"  #include "DebugTransceiver.h"
11  #include "SmsToolTransceiver.h"  #include "SmsToolTransceiver.h"
12    #include "ProxyTransceiver.h"
13    
14  #include "serialport/SerialPort.h"  #include "serialport/SerialPort.h"
15  #include "SmsDaemon.h"  #include "SmsDaemon.h"
# Line 33  void openModemPort() Line 34  void openModemPort()
34          Common* cmn = Common::instance();          Common* cmn = Common::instance();
35          ConfigFile* config = cmn->GetConfigfile();          ConfigFile* config = cmn->GetConfigfile();
36    
37          port = new SerialPort ( config->GetValue("gsmmodem","serialport") );          std::string portstr = config->GetValue("gsmmodem","serialport","");
38            if (portstr == "")
39            {
40                    Logger::logMessage("'serialport' not defined in config file");
41                    sms_exit(2);
42            }
43    
44            port = new SerialPort ( portstr );
45          try          try
46          {          {
47                  port->Open( SerialPort::BAUD_9600,                  port->Open( SerialPort::BAUD_9600,
# Line 94  int main(int argc, char* argv[]) Line 102  int main(int argc, char* argv[])
102    
103    
104          /////////////////////          /////////////////////
105          string transconf = config->GetValue("smsdaemon", "transceiver");          string transconf = config->GetValue("smsdaemon", "transceiver", "");
   
106    
107          if (transconf == "internal")          if (transconf == "")
108            {
109                    Logger::logMessage("No transceiver defined in config file");
110                    exit(1);
111            }
112            else if (transconf == "internal")
113          {          {
114                  openModemPort();                  openModemPort();
115                  closeModemPort();                  closeModemPort();
# Line 135  int main(int argc, char* argv[]) Line 147  int main(int argc, char* argv[])
147                  transceiver = new DebugTransceiver();                  transceiver = new DebugTransceiver();
148          }          }
149    
150            ProxyTransceiver proxy(*transceiver);
151    
152          //////////////////////////////////          //////////////////////////////////
153    
154          SmsDaemon daemon(*transceiver);          SmsDaemon daemon(proxy);
155    
156          daemon.Start();          daemon.Start();
157          //returns here when main-loop exits          //returns here when main-loop exits

Legend:
Removed from v.196  
changed lines
  Added in v.214

  ViewVC Help
Powered by ViewVC 1.1.20