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