/[projects]/smsdaemon/plugins/StatusPlugin.cpp
ViewVC logotype

Contents of /smsdaemon/plugins/StatusPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101 - (show annotations) (download)
Mon Jun 16 16:41:18 2008 UTC (15 years, 11 months ago) by torben
File size: 737 byte(s)
Finally is the version.h working as i want to

Added a StatusPlugin

1 #include "StatusPlugin.h"
2 #include "IGsmModem.h"
3 #include "Sms.h"
4
5 #include <sstream>
6 #include "version.h"
7
8 #include "common.h"
9
10 StatusPlugin::StatusPlugin()
11 : Plugin("status", "Returns a status of the smsdaemon")
12 {
13
14 }
15
16 void StatusPlugin::Execute(IGsmModem& modem, SMS& sms)
17 {
18 Common* cmn = Common::instance();
19
20
21 int sec = time(0) - cmn->daemonStart;
22 int min = sec / 60;
23 int hour = min / 60;
24
25 std::ostringstream os;
26 os << VERSION << std::endl;
27 os << SVNVERSION << std::endl;
28 os << "Status:" << std::endl;
29 os << "Recv: " << cmn->smsCounter.incomming << std::endl;
30 os << "Send: " << cmn->smsCounter.outgoing << std::endl;
31 os << "Uptime: " << hour << ":" << min << ":" << sec;
32
33
34 modem.SendSms(sms.sender, os.str(), true );
35
36 }

  ViewVC Help
Powered by ViewVC 1.1.20