libcyberradio  22.01.24
RadioController.h
1 /*
2  * RadioContoller - Class to send radio configuration to the NDR651
3  * Author: Nathan Harter
4  * Author: Joseph Martin
5  * Date: 5/24/2017
6  */
7 
8 #ifndef INCLUDED_LIBCYBERRADIO_NDR651_RADIOCONTROLLER_H
9 #define INCLUDED_LIBCYBERRADIO_NDR651_RADIOCONTROLLER_H
10 
11 #include "LibCyberRadio/Common/Debuggable.h"
12 #include "LibCyberRadio/NDR651/ClientSocket.h"
13 #include "LibCyberRadio/Common/BasicList.h"
14 #include <boost/algorithm/string.hpp>
15 #include <boost/format.hpp>
16 #include <cmath>
17 
18 #define CMD_TIMEOUT 10000 // How long to wait for a response from radio
19 
20 namespace LibCyberRadio
21 {
22  namespace NDR651
23  {
24  class RadioController : public Debuggable
25  {
26  private:
27  /* Member Variables */
28  ClientSocket *clientSocket; // Handles communication to NDR651
29  std::string radioHostname;
30  unsigned short radioPort;
31  BasicStringList rspVec;
32 
33  /* Private Methods */
34  bool sendCmd(const std::string& cmd, bool splitResponse = true);
35  bool sendCmdAndQry(const std::string& cmd, const std::string& qry, bool splitResponse = true);
36  void dumpRspVec();
37 
38  public:
39  /* Constructors and Destructors */
40  RadioController(const std::string& radioHostname, unsigned short radioPort, bool debug = false);
41  ~RadioController();
42 
43  /* Public Methods */
44  std::string getRadioMac(unsigned int tenGbeIndex);
45  std::string getRadioIP(unsigned int tenGbeIndex);
46  bool setTXF(unsigned int channel, double freq);
47  double getTXA(unsigned int channel);
48  bool setTXA(unsigned int channel, double attenuation);
49  bool setTXP(unsigned int channel, bool enable);
50  bool setTXINV(unsigned int ducChannel, bool invert);
51  bool setDUCP(unsigned int ducChannel, bool pause);
52  bool setDUCA(unsigned int ducChannel, double attenuation);
53  bool setDUCF(unsigned int ducChannel, double freq);
54  bool setSHF(unsigned int channel, bool enable);
55  bool setSIP(unsigned int tenGbeIndex, const std::string& sourceIP);
56  bool setDIP(
57  unsigned int ducChannel,
58  unsigned int tenGbeIndex,
59  const std::string& destIP,
60  const std::string& destMAC,
61  unsigned short ducStatusPort
62  );
63  bool setDUC(
64  unsigned int ducChannel,
65  unsigned int tenGbeIndex,
66  double ducFreq,
67  double attenuation,
68  unsigned int ducRateIndex,
69  unsigned int rfTxChannel, // Note 3 is TX on RF1 and RF2
70  unsigned int mode,
71  unsigned int streamID
72  );
73  bool setDUCHS(
74  unsigned int ducChannel,
75  unsigned int tenGbeIndex,
76  unsigned int fullThresh,
77  unsigned int emptyThresh,
78  unsigned int duchsPeriod,
79  unsigned int ducStreamID
80  );
81  bool setDUCHSPercent(
82  unsigned int ducChannel,
83  unsigned int tenGbeIndex,
84  double fullThreshPercent,
85  double emptyThreshPercent,
86  unsigned int updatesPerSecond,
87  unsigned int ducStreamID
88  );
89  bool clearDUC(unsigned int ducChannel);
90  bool clearDUCHS(unsigned int ducChannel);
91  bool clearDUCG(unsigned int ducGroup);
92  bool setDUCG(unsigned int ducGroup, unsigned int ducChannel, bool enable);
93  bool setDUCGE(unsigned int ducGroup, bool enable);
94  bool querySTAT(bool verbose);
95  bool queryTSTAT(bool verbose);
96  };
97  }
98 }
99 
100 #endif /* INCLUDED_LIBCYBERRADIO_NDR651_RADIOCONTROLLER_H */
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.
Definition: BasicList.h:25
Defines functionality for LibCyberRadio applications.
Definition: App.h:23