SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Static Public Member Functions | Protected Member Functions | Static Private Member Functions | List of all members
DeviceHackRF Class Reference

#include <devicehackrf.h>

Static Public Member Functions

static DeviceHackRFinstance ()
 
static hackrf_device * open_hackrf (int sequence)
 
static hackrf_device * open_hackrf (const char *const serial)
 

Protected Member Functions

 DeviceHackRF ()
 
 DeviceHackRF (const DeviceHackRF &)
 
DeviceHackRFoperator= (const DeviceHackRF &other)
 
 ~DeviceHackRF ()
 

Static Private Member Functions

static hackrf_device * open_hackrf_from_sequence (int sequence)
 

Detailed Description

Definition at line 25 of file devicehackrf.h.

Constructor & Destructor Documentation

◆ DeviceHackRF() [1/2]

DeviceHackRF::DeviceHackRF ( )
protected

Definition at line 22 of file devicehackrf.cpp.

23 {
24  hackrf_error rc = (hackrf_error) hackrf_init();
25 
26  if (rc != HACKRF_SUCCESS) {
27  qCritical("DeviceHackRF::open_hackrf: failed to initiate HackRF library %s", hackrf_error_name(rc));
28  }
29 }

◆ DeviceHackRF() [2/2]

DeviceHackRF::DeviceHackRF ( const DeviceHackRF )
inlineprotected

Definition at line 33 of file devicehackrf.h.

33 {}

◆ ~DeviceHackRF()

DeviceHackRF::~DeviceHackRF ( )
protected

Definition at line 31 of file devicehackrf.cpp.

32 {
33  hackrf_exit();
34 }

Member Function Documentation

◆ instance()

DeviceHackRF & DeviceHackRF::instance ( )
static

Definition at line 36 of file devicehackrf.cpp.

Referenced by HackRFInputPlugin::enumSampleSources(), open_hackrf(), and open_hackrf_from_sequence().

37 {
38  static DeviceHackRF inst;
39  return inst;
40 }
+ Here is the caller graph for this function:

◆ open_hackrf() [1/2]

hackrf_device * DeviceHackRF::open_hackrf ( int  sequence)
static

Definition at line 42 of file devicehackrf.cpp.

References instance(), and open_hackrf_from_sequence().

Referenced by HackRFOutput::openDevice(), and HackRFInput::openDevice().

43 {
44  instance();
45 
46  return open_hackrf_from_sequence(sequence);
47 }
static DeviceHackRF & instance()
static hackrf_device * open_hackrf_from_sequence(int sequence)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open_hackrf() [2/2]

hackrf_device * DeviceHackRF::open_hackrf ( const char *const  serial)
static

Definition at line 49 of file devicehackrf.cpp.

References instance().

50 {
51  hackrf_error rc;
52  hackrf_device *hackrf_ptr;
53 
54  instance();
55 
56  rc = (hackrf_error) hackrf_open_by_serial(serial, &hackrf_ptr);
57 
58  if (rc == HACKRF_SUCCESS)
59  {
60  return hackrf_ptr;
61  }
62  else
63  {
64  qCritical("DeviceHackRF::open_hackrf: error #%d: %s", (int) rc, hackrf_error_name(rc));
65  return 0;
66  }
67 }
static DeviceHackRF & instance()
+ Here is the call graph for this function:

◆ open_hackrf_from_sequence()

hackrf_device * DeviceHackRF::open_hackrf_from_sequence ( int  sequence)
staticprivate

Definition at line 69 of file devicehackrf.cpp.

References instance().

Referenced by open_hackrf().

70 {
71  hackrf_device_list_t *hackrf_devices = hackrf_device_list();
72  hackrf_device *hackrf_ptr;
73  hackrf_error rc;
74 
75  instance();
76 
77  rc = (hackrf_error) hackrf_device_list_open(hackrf_devices, sequence, &hackrf_ptr);
78 
79  if (rc == HACKRF_SUCCESS)
80  {
81  return hackrf_ptr;
82  }
83  else
84  {
85  qCritical("DeviceHackRF::open_hackrf_from_sequence: error #%d: %s", (int) rc, hackrf_error_name(rc));
86  return 0;
87  }
88 }
static DeviceHackRF & instance()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

DeviceHackRF& DeviceHackRF::operator= ( const DeviceHackRF other)
inlineprotected

Definition at line 34 of file devicehackrf.h.

34 { (void) other; return *this; }

The documentation for this class was generated from the following files: