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

Annotation of /smsdaemon/plugins/StatusPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 142 - (hide annotations) (download)
Sun Dec 7 15:51:02 2008 UTC (15 years, 5 months ago) by torben
File size: 845 byte(s)
Refacerored SMS class

1 torben 101 #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 torben 102 int tot_sec = time(0) - cmn->daemonStart;
22 torben 101
23 torben 102 int sec = tot_sec % 60;
24     int min = (tot_sec / 60) % 60;
25     int hour = (tot_sec / 3600) %24;
26     int days = tot_sec / (3600*24);
27    
28 torben 101 std::ostringstream os;
29     os << VERSION << std::endl;
30     os << SVNVERSION << std::endl;
31     os << "Status:" << std::endl;
32     os << "Recv: " << cmn->smsCounter.incomming << std::endl;
33     os << "Send: " << cmn->smsCounter.outgoing << std::endl;
34 torben 102 os << "Uptime: " << days << "d, " << hour << ":" << min << ":" << sec;
35 torben 101
36    
37 torben 142 modem.SendSms(sms.GetSender(), os.str(), true );
38 torben 101
39     }

  ViewVC Help
Powered by ViewVC 1.1.20