aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmosdr/osmosdr_source_c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmosdr/osmosdr_source_c.h')
-rw-r--r--include/osmosdr/osmosdr_source_c.h149
1 files changed, 73 insertions, 76 deletions
diff --git a/include/osmosdr/osmosdr_source_c.h b/include/osmosdr/osmosdr_source_c.h
index e4bb6ca..d55bb21 100644
--- a/include/osmosdr/osmosdr_source_c.h
+++ b/include/osmosdr/osmosdr_source_c.h
@@ -49,165 +49,162 @@ typedef boost::shared_ptr<osmosdr_source_c> osmosdr_source_c_sptr;
* constructor is private. osmosdr_make_source_c is the public
* interface for creating new instances.
*/
-OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c (const std::string & args = "");
+OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c ( const std::string & args = "" );
/*!
* \brief Provides a stream of complex samples.
* \ingroup block
*
- * \sa osmosdr_sink_c for a version that subclasses gr_hier_block2.
+ * This uses the preferred technique: subclassing gr_hier_block2.
*/
class OSMOSDR_API osmosdr_source_c : virtual public gr_hier_block2
{
public:
/*!
- * Get the possible sample rates for the OsmoSDR device.
+ * Get the number of channels the underlying radio hardware offers.
+ * \return the number of available channels
+ */
+ virtual size_t get_num_channels( void ) = 0;
+
+ /*!
+ * Get the possible sample rates for the underlying radio hardware.
* \return a range of rates in Sps
*/
- virtual osmosdr::meta_range_t get_samp_rates( void ) = 0;
+ virtual osmosdr::meta_range_t get_sample_rates( void ) = 0;
/*!
- * Set the sample rate for the OsmoSDR device.
+ * Set the sample rate for the underlying radio hardware.
* This also will select the appropriate IF bandpass, if applicable.
* \param rate a new rate in Sps
*/
- virtual double set_samp_rate( double rate ) = 0;
+ virtual double set_sample_rate( double rate ) = 0;
/*!
- * Get the sample rate for the OsmoSDR device.
+ * Get the sample rate for the underlying radio hardware.
* This is the actual sample rate and may differ from the rate set.
* \return the actual rate in Sps
*/
- virtual double get_samp_rate( void ) = 0;
+ virtual double get_sample_rate( void ) = 0;
/*!
- * Get the tunable frequency range.
+ * Get the tunable frequency range for the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
* \return the frequency range in Hz
*/
virtual osmosdr::freq_range_t get_freq_range( size_t chan = 0 ) = 0;
/*!
- * Tune the OsmoSDR device to the desired center frequency.
+ * Tune the underlying radio hardware to the desired center frequency.
* This also will select the appropriate RF bandpass.
* \param freq the desired frequency in Hz
- * \return a tune result with the actual frequencies
+ * \param chan the channel index 0 to N-1
+ * \return the actual frequency in Hz
*/
virtual double set_center_freq( double freq, size_t chan = 0 ) = 0;
/*!
- * Get the center frequency.
+ * Get the center frequency the underlying radio hardware is tuned to.
+ * This is the actual frequency and may differ from the frequency set.
+ * \param chan the channel index 0 to N-1
* \return the frequency in Hz
*/
virtual double get_center_freq( size_t chan = 0 ) = 0;
/*!
* Set the frequency correction value in parts per million.
+ * \param ppm the desired correction value in parts per million
+ * \param chan the channel index 0 to N-1
* \return correction value in parts per million
*/
- virtual double set_freq_correction( double ppm, size_t chan = 0 ) = 0;
+ virtual double set_freq_corr( double ppm, size_t chan = 0 ) = 0;
/*!
* Get the frequency correction value.
+ * \param chan the channel index 0 to N-1
* \return correction value in parts per million
*/
- virtual double get_freq_correction( size_t chan = 0 ) = 0;
+ virtual double get_freq_corr( size_t chan = 0 ) = 0;
/*!
- * Get the actual OsmoSDR gain setting of named stage.
- * \return the actual gain in dB
+ * Get the gain stage names of the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of strings containing the names of gain stages
*/
virtual std::vector<std::string> get_gain_names( size_t chan = 0 ) = 0;
/*!
- * Get the settable gain range.
- * \param name the name of the gain stage
+ * Get the settable overall gain range for the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
* \return the gain range in dB
*/
- virtual osmosdr::gain_range_t get_gain_range( const std::string & name = "", size_t chan = 0 ) = 0;
+ virtual osmosdr::gain_range_t get_gain_range( size_t chan = 0 ) = 0;
/*!
- * Set the gain for the OsmoSDR.
- * \param gain the gain in dB
+ * Get the settable gain range for a specific gain stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
*/
- virtual void set_gain( double gain, size_t chan = 0 ) = 0;
+ virtual osmosdr::gain_range_t get_gain_range( const std::string & name,
+ size_t chan = 0 ) = 0;
/*!
- * Set the named gain on the OsmoSDR.
+ * Set the gain for the underlying radio hardware.
+ * This function will automatically distribute the desired gain value over
+ * available gain stages in an appropriate way and return the actual value.
* \param gain the gain in dB
- * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
*/
- virtual void set_gain( double gain, const std::string & name = "", size_t chan = 0 ) = 0;
+ virtual double set_gain( double gain, size_t chan = 0 ) = 0;
/*!
- * Get the actual OsmoSDR gain setting of a named stage.
+ * Set the named gain on the underlying radio hardware.
+ * \param gain the gain in dB
* \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
* \return the actual gain in dB
*/
- virtual double get_gain( const std::string & name = "", size_t chan = 0 ) = 0;
-
-#if 0
-
- virtual std::vector< std::string > get_antennas( size_t chan = 0 ) = 0;
- virtual std::string set_antenna( const std::string & antenna, size_t chan = 0 ) = 0;
- virtual std::string get_antenna( size_t chan = 0 ) = 0;
-
- /*!
- * Enable/disable the automatic DC offset correction.
- * The automatic correction subtracts out the long-run average.
- *
- * When disabled, the averaging option operation is halted.
- * Once halted, the average value will be held constant
- * until the user re-enables the automatic correction
- * or overrides the value by manually setting the offset.
- *
- * \param enb true to enable automatic DC offset correction
- */
- virtual void set_dc_offset(const bool enb) = 0;
-
- /*!
- * Set a constant DC offset value.
- * The value is complex to control both I and Q.
- * Only set this when automatic correction is disabled.
- * \param offset the dc offset (1.0 is full-scale)
- */
- virtual void set_dc_offset(const std::complex<double> &offset) = 0;
+ virtual double set_gain( double gain,
+ const std::string & name,
+ size_t chan = 0 ) = 0;
/*!
- * Set the RX frontend IQ imbalance correction.
- * Use this to adjust the magnitude and phase of I and Q.
- *
- * \param correction the complex correction value
+ * Get the actual gain setting of the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
*/
- virtual void set_iq_balance(const std::complex<double> &correction) = 0;
+ virtual double get_gain( size_t chan = 0 ) = 0;
/*!
- * Get the master clock rate.
- * \return the clock rate in Hz
+ * Get the actual gain setting of a named stage.
+ * \param name the name of the gain stage
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
*/
- virtual double get_clock_rate() = 0;
+ virtual double get_gain( const std::string & name, size_t chan = 0 ) = 0;
/*!
- * Set the master clock rate.
- * \param rate the new rate in Hz
+ * Get the available antennas of the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of strings containing the names of available antennas
*/
- virtual void set_clock_rate(double rate) = 0;
+ virtual std::vector< std::string > get_antennas( size_t chan = 0 ) = 0;
/*!
- * Get automatic gain control status
- * \return the clock rate in Hz
+ * Select the active antenna of the underlying radio hardware.
+ * \param chan the channel index 0 to N-1
+ * \return the actual antenna's name
*/
- virtual bool get_agc() = 0;
+ virtual std::string set_antenna( const std::string & antenna,
+ size_t chan = 0 ) = 0;
/*!
- * Enable/disable the automatic gain control.
- * \param enb true to enable automatic gain control
- * \param attack attack time of the AGC circuit
- * \param decay decay time of the AGC circuit
+ * Get the actual underlying radio hardware antenna setting.
+ * \param chan the channel index 0 to N-1
+ * \return antenna the actual antenna's name
*/
- virtual void set_agc(bool enb, double attack, double decay) = 0;
-
- /*! TODO: add more */
-#endif
+ virtual std::string get_antenna( size_t chan = 0 ) = 0;
};
#endif /* INCLUDED_OSMOSDR_SOURCE_C_H */