libcyberradio  22.01.24
RadioComponent.h
1 /***************************************************************************
2  * \file RadioComponent.h
3  * \brief Defines the basic component interface for an NDR-class radio.
4  * \author DA
5  * \author NH
6  * \author MN
7  * \copyright (c) 2017 CyberRadio Solutions, Inc. All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #ifndef INCLUDED_LIBCYBERRADIO_DRIVER_RADIOCOMPONENT_H
12 #define INCLUDED_LIBCYBERRADIO_DRIVER_RADIOCOMPONENT_H
13 
14 #include "LibCyberRadio/Driver/Configurable.h"
15 #include <string>
16 
17 
21 namespace LibCyberRadio
22 {
26  namespace Driver
27  {
28  // Forward declaration for RadioHandler
29  class RadioHandler;
30 
45  {
46  public:
55  RadioComponent(const std::string& name = "<unknown>",
56  int index = 0,
57  RadioHandler* parent = NULL,
58  bool debug = false);
62  virtual ~RadioComponent();
67  RadioComponent(const RadioComponent& other);
73  virtual RadioComponent& operator=(const RadioComponent& other);
78  virtual int getIndex() const;
83  virtual void setIndex(int index);
88  virtual RadioHandler* getParent() const;
93  virtual void setParent(RadioHandler* parent);
98  virtual bool disable();
104  virtual bool enable(bool enabled = true);
109  virtual bool isEnabled() const;
115  virtual bool setConfiguration(ConfigurationDict& cfg);
120  virtual void queryConfiguration();
121 
122  protected:
127  virtual void initConfigurationDict();
131  virtual void updateConfigurationDict();
132 
133  protected:
134  // Index number of the component
135  int _index;
136  // Parent radio handler object
137  RadioHandler* _parent;
138  // Whether or not the component is enabled
139  bool _enabled;
140 
141  }; // class RadioComponent
142 
143  } // namespace Driver
144 
145 } // namespace LibCyberRadio
146 
147 
148 #endif // INCLUDED_LIBCYBERRADIO_DRIVER_RADIOCOMPONENT_H
virtual void updateConfigurationDict()
Updates the configuration dictionary from component settings.
RadioComponent(const std::string &name="<unknown>", int index=0, RadioHandler *parent=NULL, bool debug=false)
Constructs a RadioComponent object.
Base hardware component class.
virtual bool setConfiguration(ConfigurationDict &cfg)
Sets the configuration dictionary for this component.
virtual RadioComponent & operator=(const RadioComponent &other)
Assignment operator for RadioComponent objects.
virtual bool isEnabled() const
Gets whether or not the component is enabled.
virtual void setIndex(int index)
Sets the index number of the component.
virtual bool enable(bool enabled=true)
Enables this component.
Generic radio handler class.
Definition: RadioHandler.h:54
virtual int debug(const char *format,...)
Outputs debug information.
Definition: Debuggable.cpp:95
virtual void initConfigurationDict()
Initializes the configuration dictionary, defining the allowed keys.
Defines functionality for LibCyberRadio applications.
Definition: App.h:23
A configuration dictionary.
Definition: Configurable.h:51
virtual bool disable()
Disables this component.
virtual RadioHandler * getParent() const
Gets the "parent" radio handler for this component.
virtual int getIndex() const
Gets the index number of the component.
virtual void queryConfiguration()
Tells the component to query its hardware configuration in order to create its configuration dictiona...
Base configurable object class.
Definition: Configurable.h:79
virtual void setParent(RadioHandler *parent)
Sets the "parent" radio handler for this component.
virtual ~RadioComponent()
Destroys a RadioComponent object.