SoapySDR  0.1.0
Vendor and platform neutral SDR interface library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Device.h
Go to the documentation of this file.
1 
15 #pragma once
16 #include <SoapySDR/Config.h>
17 #include <SoapySDR/Types.h>
18 #include <SoapySDR/Constants.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
25 struct SoapySDRDevice;
26 
28 struct SoapySDRStream;
29 
37 
45 SOAPY_SDR_API SoapySDRKwargs *SoapySDRDevice_enumerateStrArgs(const char *args, size_t *length);
46 
59 SOAPY_SDR_API SoapySDRDevice *SoapySDRDevice_make(const SoapySDRKwargs *args);
60 
73 SOAPY_SDR_API SoapySDRDevice *SoapySDRDevice_makeStrArgs(const char *args);
74 
83 SOAPY_SDR_API void SoapySDRDevice_unmake(SoapySDRDevice *device);
84 
85 /*******************************************************************
86  * Identification API
87  ******************************************************************/
88 
95 SOAPY_SDR_API char *SoapySDRDevice_getDriverKey(const SoapySDRDevice *device);
96 
103 SOAPY_SDR_API char *SoapySDRDevice_getHardwareKey(const SoapySDRDevice *device);
104 
113 SOAPY_SDR_API SoapySDRKwargs SoapySDRDevice_getHardwareInfo(const SoapySDRDevice *device);
114 
115 /*******************************************************************
116  * Channels API
117  ******************************************************************/
118 
127 SOAPY_SDR_API char *SoapySDRDevice_setFrontendMapping(SoapySDRDevice *device, const int direction, const char *mapping);
128 
135 SOAPY_SDR_API char *SoapySDRDevice_getFrontendMapping(const SoapySDRDevice *device, const int direction);
136 
143 SOAPY_SDR_API size_t SoapySDRDevice_getNumChannels(const SoapySDRDevice *device, const int direction);
144 
152 SOAPY_SDR_API bool SoapySDRDevice_getFullDuplex(const SoapySDRDevice *device, const int direction, const size_t channel);
153 
154 /*******************************************************************
155  * Stream API
156  ******************************************************************/
157 
192 SOAPY_SDR_API char *SoapySDRDevice_setupStream(SoapySDRDevice *device,
193  SoapySDRStream **stream,
194  const int direction,
195  const char *format,
196  const size_t *channels,
197  const size_t numChans,
198  const SoapySDRKwargs *args);
199 
205 SOAPY_SDR_API void SoapySDRDevice_closeStream(SoapySDRDevice *device, SoapySDRStream *stream);
206 
225 SOAPY_SDR_API int SoapySDRDevice_activateStream(SoapySDRDevice *device,
226  SoapySDRStream *stream,
227  const int flags,
228  const long long timeNs,
229  const size_t numElems);
230 
246 SOAPY_SDR_API int SoapySDRDevice_deactivateStream(SoapySDRDevice *device,
247  SoapySDRStream *stream,
248  const int flags,
249  const long long timeNs);
250 
265 SOAPY_SDR_API int SoapySDRDevice_readStream(SoapySDRDevice *device,
266  SoapySDRStream *stream,
267  void * const *buffs,
268  const size_t numElems,
269  int *flags,
270  long long *timeNs,
271  const long timeoutUs);
272 
287 SOAPY_SDR_API int SoapySDRDevice_writeStream(SoapySDRDevice *device,
288  SoapySDRStream *stream,
289  const void * const *buffs,
290  const size_t numElems,
291  int *flags,
292  const long long timeNs,
293  const long timeoutUs);
294 
295 /*******************************************************************
296  * Antenna API
297  ******************************************************************/
298 
307 SOAPY_SDR_API char **SoapySDRDevice_listAntennas(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
308 
317 SOAPY_SDR_API char *SoapySDRDevice_setAntenna(SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
318 
326 SOAPY_SDR_API char *SoapySDRDevice_getAntenna(const SoapySDRDevice *device, const int direction, const size_t channel);
327 
328 /*******************************************************************
329  * Frontend corrections API
330  ******************************************************************/
331 
340 SOAPY_SDR_API char *SoapySDRDevice_setDCOffsetMode(SoapySDRDevice *device, const int direction, const size_t channel, const bool automatic);
341 
349 SOAPY_SDR_API bool SoapySDRDevice_getDCOffsetMode(const SoapySDRDevice *device, const int direction, const size_t channel);
350 
360 SOAPY_SDR_API char *SoapySDRDevice_setDCOffset(SoapySDRDevice *device, const int direction, const size_t channel, const double offsetI, const double offsetQ);
361 
370 SOAPY_SDR_API void SoapySDRDevice_getDCOffset(const SoapySDRDevice *device, const int direction, const size_t channel, double *offsetI, double *offsetQ);
371 
381 SOAPY_SDR_API char *SoapySDRDevice_setIQBalance(SoapySDRDevice *device, const int direction, const size_t channel, const double balanceI, const double balanceQ);
382 
391 SOAPY_SDR_API void SoapySDRDevice_getIQBalance(const SoapySDRDevice *device, const int direction, const size_t channel, double *balanceI, double *balanceQ);
392 
393 /*******************************************************************
394  * Gain API
395  ******************************************************************/
396 
405 SOAPY_SDR_API char **SoapySDRDevice_listGains(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
406 
415 SOAPY_SDR_API char *SoapySDRDevice_setGainMode(SoapySDRDevice *device, const int direction, const size_t channel, const bool automatic);
416 
424 SOAPY_SDR_API bool SoapySDRDevice_getGainMode(const SoapySDRDevice *device, const int direction, const size_t channel);
425 
436 SOAPY_SDR_API char *SoapySDRDevice_setGain(SoapySDRDevice *device, const int direction, const size_t channel, const double value);
437 
447 SOAPY_SDR_API char *SoapySDRDevice_setGainElement(SoapySDRDevice *device, const int direction, const size_t channel, const char *name, const double value);
448 
456 SOAPY_SDR_API double SoapySDRDevice_getGain(const SoapySDRDevice *device, const int direction, const size_t channel);
457 
466 SOAPY_SDR_API double SoapySDRDevice_getGainElement(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
467 
475 SOAPY_SDR_API SoapySDRRange SoapySDRDevice_getGainRange(const SoapySDRDevice *device, const int direction, const size_t channel);
476 
485 SOAPY_SDR_API SoapySDRRange SoapySDRDevice_getGainElementRange(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
486 
487 /*******************************************************************
488  * Frequency API
489  ******************************************************************/
490 
505 SOAPY_SDR_API char *SoapySDRDevice_setFrequency(SoapySDRDevice *device, const int direction, const size_t channel, const double frequency, const SoapySDRKwargs *args);
506 
514 SOAPY_SDR_API double SoapySDRDevice_getFrequency(const SoapySDRDevice *device, const int direction, const size_t channel);
515 
528 SOAPY_SDR_API double SoapySDRDevice_getFrequencyComponent(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
529 
538 SOAPY_SDR_API char **SoapySDRDevice_listFrequencies(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
539 
548 SOAPY_SDR_API SoapySDRRange *SoapySDRDevice_getFrequencyRange(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
549 
550 /*******************************************************************
551  * Sample Rate API
552  ******************************************************************/
553 
562 SOAPY_SDR_API char *SoapySDRDevice_setSampleRate(SoapySDRDevice *device, const int direction, const size_t channel, const double rate);
563 
571 SOAPY_SDR_API double SoapySDRDevice_getSampleRate(const SoapySDRDevice *device, const int direction, const size_t channel);
572 
581 SOAPY_SDR_API double *SoapySDRDevice_listSampleRates(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
582 
591 SOAPY_SDR_API char *SoapySDRDevice_setBandwidth(SoapySDRDevice *device, const int direction, const size_t channel, const double bw);
592 
600 SOAPY_SDR_API double SoapySDRDevice_getBandwidth(const SoapySDRDevice *device, const int direction, const size_t channel);
601 
610 SOAPY_SDR_API double *SoapySDRDevice_listBandwidths(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length);
611 
612 /*******************************************************************
613  * Clocking API
614  ******************************************************************/
615 
622 SOAPY_SDR_API char *SoapySDRDevice_setMasterClockRate(SoapySDRDevice *device, const double rate);
623 
629 SOAPY_SDR_API double SoapySDRDevice_getMasterClockRate(const SoapySDRDevice *device);
630 
637 SOAPY_SDR_API char **SoapySDRDevice_listClockSources(const SoapySDRDevice *device, size_t *length);
638 
645 SOAPY_SDR_API char *SoapySDRDevice_setClockSource(SoapySDRDevice *device, const char *source);
646 
652 SOAPY_SDR_API char *SoapySDRDevice_getClockSource(const SoapySDRDevice *device);
653 
660 SOAPY_SDR_API char **SoapySDRDevice_listTimeSources(const SoapySDRDevice *device, size_t *length);
661 
668 SOAPY_SDR_API char *SoapySDRDevice_setTimeSource(SoapySDRDevice *device, const char *source);
669 
675 SOAPY_SDR_API char *SoapySDRDevice_getTimeSource(const SoapySDRDevice *device);
676 
677 /*******************************************************************
678  * Time API
679  ******************************************************************/
680 
687 SOAPY_SDR_API bool SoapySDRDevice_hasHardwareTime(const SoapySDRDevice *device, const char *what);
688 
696 SOAPY_SDR_API long long SoapySDRDevice_getHardwareTime(const SoapySDRDevice *device, const char *what);
697 
705 SOAPY_SDR_API void SoapySDRDevice_setHardwareTime(SoapySDRDevice *device, const long long timeNs, const char *what);
706 
715 SOAPY_SDR_API void SoapySDRDevice_setCommandTime(SoapySDRDevice *device, const long long timeNs, const char *what);
716 
717 /*******************************************************************
718  * Sensor API
719  ******************************************************************/
720 
728 SOAPY_SDR_API char **SoapySDRDevice_listSensors(const SoapySDRDevice *device, size_t *length);
729 
738 SOAPY_SDR_API char *SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *name);
739 
740 /*******************************************************************
741  * Register API
742  ******************************************************************/
743 
752 SOAPY_SDR_API void SoapySDRDevice_writeRegister(SoapySDRDevice *device, const unsigned addr, const unsigned value);
753 
760 SOAPY_SDR_API unsigned SoapySDRDevice_readRegister(const SoapySDRDevice *device, const unsigned addr);
761 
762 /*******************************************************************
763  * Settings API
764  ******************************************************************/
765 
773 SOAPY_SDR_API void SoapySDRDevice_writeSetting(SoapySDRDevice *device, const char *key, const char *value);
774 
781 SOAPY_SDR_API char *SoapySDRDevice_readSetting(const SoapySDRDevice *device, const char *key);
782 
783 /*******************************************************************
784  * GPIO API
785  ******************************************************************/
786 
792 SOAPY_SDR_API char **SoapySDRDevice_listGPIOBanks(const SoapySDRDevice *device, size_t *length);
793 
800 SOAPY_SDR_API void SoapySDRDevice_writeGPIO(SoapySDRDevice *device, const char *bank, const unsigned value);
801 
808 SOAPY_SDR_API unsigned SoapySDRDevice_readGPIO(const SoapySDRDevice *device, const char *bank);
809 
810 /*******************************************************************
811  * I2C API
812  ******************************************************************/
813 
823 SOAPY_SDR_API void SoapySDRDevice_writeI2C(SoapySDRDevice *device, const int addr, const char *data, const size_t numBytes);
824 
834 SOAPY_SDR_API char *SoapySDRDevice_readI2C(SoapySDRDevice *device, const int addr, const size_t numBytes);
835 
836 /*******************************************************************
837  * SPI API
838  ******************************************************************/
839 
855 SOAPY_SDR_API unsigned SoapySDRDevice_transactSPI(SoapySDRDevice *device, const int addr, const unsigned data, const size_t numBits);
856 
857 /*******************************************************************
858  * UART API
859  ******************************************************************/
860 
867 SOAPY_SDR_API char **SoapySDRDevice_listUARTs(const SoapySDRDevice *device, size_t *length);
868 
877 SOAPY_SDR_API void SoapySDRDevice_writeUART(SoapySDRDevice *device, const char *which, const char *data);
878 
888 SOAPY_SDR_API char *SoapySDRDevice_readUART(const SoapySDRDevice *device, const char *which, const long timeoutUs);
889 
890 #ifdef __cplusplus
891 }
892 #endif
SOAPY_SDR_API void SoapySDRDevice_setCommandTime(SoapySDRDevice *device, const long long timeNs, const char *what)
SOAPY_SDR_API void SoapySDRDevice_setHardwareTime(SoapySDRDevice *device, const long long timeNs, const char *what)
SOAPY_SDR_API int SoapySDRDevice_writeStream(SoapySDRDevice *device, SoapySDRStream *stream, const void *const *buffs, const size_t numElems, int *flags, const long long timeNs, const long timeoutUs)
SOAPY_SDR_API double SoapySDRDevice_getFrequencyComponent(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
SOAPY_SDR_API char ** SoapySDRDevice_listFrequencies(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API char ** SoapySDRDevice_listUARTs(const SoapySDRDevice *device, size_t *length)
SOAPY_SDR_API SoapySDRKwargs * SoapySDRDevice_enumerateStrArgs(const char *args, size_t *length)
SOAPY_SDR_API double SoapySDRDevice_getSampleRate(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API void SoapySDRDevice_getIQBalance(const SoapySDRDevice *device, const int direction, const size_t channel, double *balanceI, double *balanceQ)
SOAPY_SDR_API SoapySDRRange SoapySDRDevice_getGainElementRange(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
SOAPY_SDR_API double SoapySDRDevice_getMasterClockRate(const SoapySDRDevice *device)
SOAPY_SDR_API char * SoapySDRDevice_setFrontendMapping(SoapySDRDevice *device, const int direction, const char *mapping)
SOAPY_SDR_API bool SoapySDRDevice_getFullDuplex(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API SoapySDRRange * SoapySDRDevice_getFrequencyRange(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API bool SoapySDRDevice_getGainMode(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API char * SoapySDRDevice_setDCOffset(SoapySDRDevice *device, const int direction, const size_t channel, const double offsetI, const double offsetQ)
SOAPY_SDR_API int SoapySDRDevice_readStream(SoapySDRDevice *device, SoapySDRStream *stream, void *const *buffs, const size_t numElems, int *flags, long long *timeNs, const long timeoutUs)
SOAPY_SDR_API char * SoapySDRDevice_readSetting(const SoapySDRDevice *device, const char *key)
SOAPY_SDR_API void SoapySDRDevice_writeRegister(SoapySDRDevice *device, const unsigned addr, const unsigned value)
SOAPY_SDR_API SoapySDRKwargs * SoapySDRDevice_enumerate(const SoapySDRKwargs *args, size_t *length)
SOAPY_SDR_API char * SoapySDRDevice_getDriverKey(const SoapySDRDevice *device)
SOAPY_SDR_API SoapySDRDevice * SoapySDRDevice_make(const SoapySDRKwargs *args)
SOAPY_SDR_API char ** SoapySDRDevice_listSensors(const SoapySDRDevice *device, size_t *length)
SOAPY_SDR_API char ** SoapySDRDevice_listGPIOBanks(const SoapySDRDevice *device, size_t *length)
SOAPY_SDR_API char * SoapySDRDevice_setupStream(SoapySDRDevice *device, SoapySDRStream **stream, const int direction, const char *format, const size_t *channels, const size_t numChans, const SoapySDRKwargs *args)
SOAPY_SDR_API char * SoapySDRDevice_readUART(const SoapySDRDevice *device, const char *which, const long timeoutUs)
SOAPY_SDR_API unsigned SoapySDRDevice_readRegister(const SoapySDRDevice *device, const unsigned addr)
SOAPY_SDR_API void SoapySDRDevice_writeGPIO(SoapySDRDevice *device, const char *bank, const unsigned value)
SOAPY_SDR_API char ** SoapySDRDevice_listTimeSources(const SoapySDRDevice *device, size_t *length)
SOAPY_SDR_API void SoapySDRDevice_unmake(SoapySDRDevice *device)
SOAPY_SDR_API char * SoapySDRDevice_getHardwareKey(const SoapySDRDevice *device)
SOAPY_SDR_API char * SoapySDRDevice_getFrontendMapping(const SoapySDRDevice *device, const int direction)
SOAPY_SDR_API void SoapySDRDevice_writeSetting(SoapySDRDevice *device, const char *key, const char *value)
SOAPY_SDR_API char * SoapySDRDevice_setIQBalance(SoapySDRDevice *device, const int direction, const size_t channel, const double balanceI, const double balanceQ)
SOAPY_SDR_API char ** SoapySDRDevice_listAntennas(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API double * SoapySDRDevice_listBandwidths(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API size_t SoapySDRDevice_getNumChannels(const SoapySDRDevice *device, const int direction)
Definition for a key/value string map.
Definition: Types.h:27
SOAPY_SDR_API char * SoapySDRDevice_getClockSource(const SoapySDRDevice *device)
SOAPY_SDR_API bool SoapySDRDevice_hasHardwareTime(const SoapySDRDevice *device, const char *what)
SOAPY_SDR_API char ** SoapySDRDevice_listGains(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API SoapySDRDevice * SoapySDRDevice_makeStrArgs(const char *args)
SOAPY_SDR_API char * SoapySDRDevice_getTimeSource(const SoapySDRDevice *device)
SOAPY_SDR_API void SoapySDRDevice_writeI2C(SoapySDRDevice *device, const int addr, const char *data, const size_t numBytes)
SOAPY_SDR_API char * SoapySDRDevice_setGainElement(SoapySDRDevice *device, const int direction, const size_t channel, const char *name, const double value)
SOAPY_SDR_API int SoapySDRDevice_deactivateStream(SoapySDRDevice *device, SoapySDRStream *stream, const int flags, const long long timeNs)
SOAPY_SDR_API double SoapySDRDevice_getFrequency(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API SoapySDRRange SoapySDRDevice_getGainRange(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API SoapySDRKwargs SoapySDRDevice_getHardwareInfo(const SoapySDRDevice *device)
SOAPY_SDR_API void SoapySDRDevice_writeUART(SoapySDRDevice *device, const char *which, const char *data)
SOAPY_SDR_API char * SoapySDRDevice_getAntenna(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API unsigned SoapySDRDevice_readGPIO(const SoapySDRDevice *device, const char *bank)
SOAPY_SDR_API unsigned SoapySDRDevice_transactSPI(SoapySDRDevice *device, const int addr, const unsigned data, const size_t numBits)
SOAPY_SDR_API char * SoapySDRDevice_setGain(SoapySDRDevice *device, const int direction, const size_t channel, const double value)
SOAPY_SDR_API void SoapySDRDevice_closeStream(SoapySDRDevice *device, SoapySDRStream *stream)
SOAPY_SDR_API char * SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *name)
SOAPY_SDR_API char * SoapySDRDevice_setMasterClockRate(SoapySDRDevice *device, const double rate)
SOAPY_SDR_API char * SoapySDRDevice_readI2C(SoapySDRDevice *device, const int addr, const size_t numBytes)
SOAPY_SDR_API double SoapySDRDevice_getGainElement(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
Definition for a min/max numeric range.
Definition: Types.h:20
SOAPY_SDR_API void SoapySDRDevice_getDCOffset(const SoapySDRDevice *device, const int direction, const size_t channel, double *offsetI, double *offsetQ)
SOAPY_SDR_API char ** SoapySDRDevice_listClockSources(const SoapySDRDevice *device, size_t *length)
#define SOAPY_SDR_API
Definition: Config.h:41
SOAPY_SDR_API char * SoapySDRDevice_setTimeSource(SoapySDRDevice *device, const char *source)
SOAPY_SDR_API bool SoapySDRDevice_getDCOffsetMode(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API char * SoapySDRDevice_setClockSource(SoapySDRDevice *device, const char *source)
SOAPY_SDR_API double SoapySDRDevice_getGain(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API char * SoapySDRDevice_setBandwidth(SoapySDRDevice *device, const int direction, const size_t channel, const double bw)
SOAPY_SDR_API char * SoapySDRDevice_setGainMode(SoapySDRDevice *device, const int direction, const size_t channel, const bool automatic)
SOAPY_SDR_API char * SoapySDRDevice_setFrequency(SoapySDRDevice *device, const int direction, const size_t channel, const double frequency, const SoapySDRKwargs *args)
SOAPY_SDR_API char * SoapySDRDevice_setAntenna(SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
SOAPY_SDR_API long long SoapySDRDevice_getHardwareTime(const SoapySDRDevice *device, const char *what)
SOAPY_SDR_API char * SoapySDRDevice_setSampleRate(SoapySDRDevice *device, const int direction, const size_t channel, const double rate)
SOAPY_SDR_API double SoapySDRDevice_getBandwidth(const SoapySDRDevice *device, const int direction, const size_t channel)
SOAPY_SDR_API double * SoapySDRDevice_listSampleRates(const SoapySDRDevice *device, const int direction, const size_t channel, size_t *length)
SOAPY_SDR_API char * SoapySDRDevice_setDCOffsetMode(SoapySDRDevice *device, const int direction, const size_t channel, const bool automatic)
SOAPY_SDR_API int SoapySDRDevice_activateStream(SoapySDRDevice *device, SoapySDRStream *stream, const int flags, const long long timeNs, const size_t numElems)