otsdaq  v2_04_01
FESlowControlsChannel.h
1 #ifndef _ots_FESlowControlsChannel_h_
2 #define _ots_FESlowControlsChannel_h_
3 
4 #include <iostream>
5 #include <string>
6 
7 namespace ots
8 {
10 {
11  public:
12  FESlowControlsChannel(const std::string& interfaceUID,
13  const std::string& channelName,
14  const std::string& dataType,
15  unsigned int universalDataSize,
16  unsigned int universalAddressSize,
17  const std::string& universalAddress,
18  unsigned int universalDataBitOffset,
19  bool readAccess,
20  bool writeAccess,
21  bool monitoringEnabled,
22  bool recordChangesOnly,
23  time_t delayBetweenSamples,
24  bool saveEnabled,
25  const std::string& savePath,
26  const std::string& saveFileRadix,
27  bool saveBinaryFormat,
28  bool alarmsEnabled,
29  bool latchAlarms,
30  const std::string& lolo,
31  const std::string& lo,
32  const std::string& hi,
33  const std::string& hihi);
34 
36 
37  char* getUniversalAddress() { return &universalAddress_[0]; }
38  void handleSample(const std::string& universalReadValue,
39  std::string& txBuffer,
40  FILE* fpAggregate = 0,
41  bool aggregateIsBinaryFormat = false);
42  void clearAlarms(int targetAlarm = -1); // default to all
43 
44  static std::string underscoreString(const std::string& str);
45 
46  private:
47  void extractSample(const std::string& universalReadValue);
48  char checkAlarms(std::string& txBuffer);
49  void convertStringToBuffer(const std::string& inString,
50  std::string& buffer,
51  bool useDataType = false);
52 
53  public:
54  const std::string interfaceUID_;
55  const std::string channelName_;
56  const std::string fullChannelName_;
57  const std::string dataType_;
58 
59  private:
60  std::string universalAddress_; // get size from parent FE interface
61  unsigned int sizeOfDataTypeBits_; // defines the size of all data string buffers,
62  // must be less than or equal to universalDataSize
63  unsigned int sizeOfDataTypeBytes_;
64  unsigned int universalDataBitOffset_;
65  unsigned char txPacketSequenceNumber_;
66 
67  public:
68  const bool readAccess_, writeAccess_, monitoringEnabled_;
69  const bool recordChangesOnly_;
70  const time_t delayBetweenSamples_;
71 
72  const bool saveEnabled_;
73  const std::string savePath_;
74  const std::string saveFileRadix_;
75  const bool saveBinaryFormat_;
76 
77  const bool alarmsEnabled_, latchAlarms_;
78 
79  private:
80  std::string sample_, lastSample_;
81  std::string lolo_, lo_, hi_, hihi_;
82  time_t lastSampleTime_;
83  bool loloAlarmed_, loAlarmed_, hiAlarmed_, hihiAlarmed_;
84 
85  std::string saveFullFileName_;
86 };
87 
88 } // namespace ots
89 
90 #endif