pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
beaconEmitter.h
1 
7 #ifndef BEACONEMITTER_H
8 #define BEACONEMITTER_H
9 
10 #ifdef epicsExportSharedSymbols
11 # define beaconEmitterEpicsExportSharedSymbols
12 # undef epicsExportSharedSymbols
13 #endif
14 
15 #include <osiSock.h>
16 
17 #include <pv/timer.h>
18 #include <pv/timeStamp.h>
19 #include <pv/sharedPtr.h>
20 
21 #ifdef beaconEmitterEpicsExportSharedSymbols
22 # define epicsExportSharedSymbols
23 # undef beaconEmitterEpicsExportSharedSymbols
24 #endif
25 
26 #include <pv/remote.h>
27 #include <pv/beaconServerStatusProvider.h>
28 //#include <pv/serverContext.h>
29 
30 namespace epics {
31 namespace pvAccess {
32 
33 class ServerContextImpl;
34 
41  public TransportSender,
42  public epics::pvData::TimerCallback,
43  public std::tr1::enable_shared_from_this<BeaconEmitter>
44 {
45 public:
46  typedef std::tr1::shared_ptr<BeaconEmitter> shared_pointer;
47  typedef std::tr1::shared_ptr<const BeaconEmitter> const_shared_pointer;
48 
55 // BeaconEmitter(std::sting const & protocol,
56 // Transport::shared_pointer const & transport, ServerContextImpl::shared_pointer const & context);
57  BeaconEmitter(std::string const & protocol,
58  Transport::shared_pointer const & transport, std::tr1::shared_ptr<ServerContextImpl>& context);
59 
60  virtual ~BeaconEmitter();
61 
62  void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
63 
64  void timerStopped();
65 
69  void start();
70 
74  void reschedule();
75 
79  void callback();
80 
81  void destroy();
82 
83 private:
84 
88  static const float EPICS_PVA_MIN_BEACON_PERIOD;
89 
93  static const float EPICS_PVA_MIN_BEACON_COUNT_LIMIT;
94 
98  const std::string _protocol;
99 
103  Transport::shared_pointer _transport;
104 
108  epics::pvData::int8 _beaconSequenceID;
109 
113  const ServerGUID _guid;
114 
118  const double _fastBeaconPeriod;
119 
123  const double _slowBeaconPeriod;
124 
128  const epics::pvData::int16 _beaconCountLimit;
129 
133  const osiSockAddr _serverAddress;
134 
138  const epics::pvData::int32 _serverPort;
139 
143  BeaconServerStatusProvider::shared_pointer _serverStatusProvider;
144 
149  epics::pvData::Timer::weak_pointer _timer;
150 };
151 
152 }
153 }
154 
155 #endif /* BEACONEMITTER_H */
void send(epics::pvData::ByteBuffer *buffer, TransportSendControl *control)
Called by transport.
void reschedule()
Reschedule timer.
Interface defining transport send control.
Definition: remote.h:122
void start()
Start emitting.
void callback()
Timer callback.
Globally unique ID.
Definition: pvaDefs.h:14
BeaconEmitter(std::string const &protocol, Transport::shared_pointer const &transport, std::tr1::shared_ptr< ServerContextImpl > &context)
Constructor.
Interface defining transport sender (instance sending data over transport).
Definition: remote.h:139