otsdaq  v2_05_02_indev
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  // clang-format off
12  public:
13  FESlowControlsChannel(const std::string& interfaceUID,
14  const std::string& channelName,
15  const std::string& dataType,
16  unsigned int universalDataSize,
17  unsigned int universalAddressSize,
18  const std::string& universalAddress,
19  unsigned int universalDataBitOffset,
20  bool readAccess,
21  bool writeAccess,
22  bool monitoringEnabled,
23  bool recordChangesOnly,
24  time_t delayBetweenSamples,
25  bool saveEnabled,
26  const std::string& savePath,
27  const std::string& saveFileRadix,
28  bool saveBinaryFormat,
29  bool alarmsEnabled,
30  bool latchAlarms,
31  const std::string& lolo,
32  const std::string& lo,
33  const std::string& hi,
34  const std::string& hihi);
35 
37 
38 
39  void print (std::ostream& out = std::cout) const;
40 
41 
42  char* getUniversalAddress () { return &universalAddress_[0]; }
43  void handleSample (const std::string& universalReadValue, std::string& txBuffer, FILE* fpAggregate = 0, bool aggregateIsBinaryFormat = false);
44  void clearAlarms (int targetAlarm = -1); // default to all
45 
46  static std::string underscoreString (const std::string& str);
47 
48  private:
49  void extractSample (const std::string& universalReadValue);
50  char checkAlarms (std::string& txBuffer);
51  void convertStringToBuffer (const std::string& inString, std::string& buffer, 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  // clang-format on
88 };
89 
90 } // namespace ots
91 
92 #endif