source: trunk/MagicSoft/Control/SubsystemIO/mainForSubsystem.cxx@ 1056

Last change on this file since 1056 was 1054, checked in by casaldaliga, 23 years ago
changed .H to .hxx in includes to work with new naming
File size: 1.9 KB
Line 
1#include "Subsystem.hxx"
2// class MySubsystem: public Subsystem
3// {
4// public:
5
6// MySubsystem (unsigned short int portCommandListener, unsigned long int
7// reportPeriod, char * ccName, unsigned short int
8// portReportListener, unsigned short int maxTimeoutCount_,
9// char * specialReportOnStartup)
10// :Subsystem( portCommandListener, reportPeriod, ccName,
11// portReportListener, maxTimeoutCount_,
12// specialReportOnStartup)
13// {};
14
15// protected:
16
17// virtual void ProcessCmd(char *)
18// {};
19// virtual void GenerateReport()
20// {};
21// virtual void HandleConnectionTimeoutIsOver()
22// {};
23
24// };
25
26
27#include <unistd.h>
28int main()
29{
30 //This two ports depend on your subsystem
31 unsigned short int portCommandListener=2001;
32 unsigned short int portReportListener=2002;
33
34 unsigned long int reportPeriod=3000000;//in usec
35 unsigned short int maxTimeoutCount=10;
36 //Unless your subsystem functionallity is integrated in Subsystem
37 //derived class, setup your subsystem hardware here
38 //...
39
40 //checkout subsystem setup and elaborate the setup/special report:
41 char * specialReportOnStartup="2.34:5:6.89:5.2";
42
43 //now start subsystem communication
44 Subsystem
45 mySubsys(portCommandListener,reportPeriod,"ifae-w41.ifae.es",
46 portReportListener,maxTimeoutCount,specialReportOnStartup);
47
48
49 //if you haven't overriden ElaborateReport you have to take care to
50 //SetReportString periodically here, along with your subsystem's
51 //hardware control
52
53 //If you have overriden ElaborateReport you just have to
54 //WaitingForShutdown
55 mySubsys.WaitingForShutdown();
56
57 //setup your subsystem hardware to shutdown ...
58
59 return 0;
60}
Note: See TracBrowser for help on using the repository browser.