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

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