![]() |
SP API
|
API functions for the SP145 spectrum analyzer. More...
Go to the source code of this file.
Macros | |
#define | SP_TRUE (1) |
#define | SP_FALSE (0) |
#define | SP_MAX_DEVICES (9) |
#define | SP_MAX_REF_LEVEL (20.0) |
#define | SP_AUTO_ATTEN (-1) |
#define | SP_MAX_ATTEN (6) |
#define | SP_MIN_FREQ (9.0e3) |
#define | SP_MAX_FREQ (15.0e9) |
#define | SP_MIN_SWEEP_TIME (1.0e-6) |
#define | SP_MAX_SWEEP_TIME (100.0) |
#define | SP_REAL_TIME_MIN_SPAN (200.0e3) |
#define | SP_REAL_TIME_MAX_SPAN (40.0e6) |
#define | SP_REAL_TIME_MIN_RBW (2.0e3) |
#define | SP_REAL_TIME_MAX_RBW (1.0e6) |
#define | SP_MAX_IQ_DECIMATION (8192) |
#define | SP_MAX_IQ_SWEEP_STEPS (1000) |
#define | SP_MIN_FAN_SET_POINT (0.0) |
#define | SP_MAX_FAN_SET_POINT (60.0) |
#define | SP_MAX_SWEEP_QUEUE_SZ (16) |
Functions | |
SP_API SpStatus | spGetDeviceList (int *serials, int *deviceCount) |
SP_API SpStatus | spOpenDevice (int *device) |
SP_API SpStatus | spOpenDeviceBySerial (int *device, int serialNumber) |
SP_API SpStatus | spCloseDevice (int device) |
SP_API SpStatus | spPresetDevice (int device) |
SP_API SpStatus | spSetPowerState (int device, SpPowerState powerState) |
SP_API SpStatus | spGetPowerState (int device, SpPowerState *powerState) |
SP_API SpStatus | spGetSerialNumber (int device, int *serialNumber) |
SP_API SpStatus | spGetFirmwareVersion (int device, int *major, int *minor, int *revision) |
SP_API SpStatus | spGetDeviceDiagnostics (int device, float *voltage, float *current, float *temperature) |
SP_API SpStatus | spGetCalDate (int device, uint32_t *lastCalDate) |
SP_API SpStatus | spSetReference (int device, SpReference reference) |
SP_API SpStatus | spGetReference (int device, SpReference *reference) |
SP_API SpStatus | spSetGPIOPort (int device, SpGPIOFunction func) |
SP_API SpStatus | spGetGPIOPort (int device, SpGPIOFunction *func) |
SP_API SpStatus | spSetUARTBaudRate (int device, float rate) |
SP_API SpStatus | spGetUARTBaudRate (int device, float *rate) |
SP_API SpStatus | spWriteUARTDirect (int device, uint8_t data) |
SP_API SpStatus | spSetGPSTimebaseUpdate (int device, SpBool enabled) |
SP_API SpStatus | spGetGPSTimebaseUpdate (int device, SpBool *enabled) |
SP_API SpStatus | spGetGPSHoldoverInfo (int device, SpBool *usingGPSHoldover, uint32_t *lastHoldoverTime) |
SP_API SpStatus | spGetGPSState (int device, SpGPSState *GPSState) |
SP_API SpStatus | spSetRefLevel (int device, double refLevel) |
SP_API SpStatus | spGetRefLevel (int device, double *refLevel) |
SP_API SpStatus | spSetAttenuator (int device, int atten) |
SP_API SpStatus | spGetAttenuator (int device, int *atten) |
SP_API SpStatus | spSetSweepCenterSpan (int device, double centerFreqHz, double spanHz) |
SP_API SpStatus | spSetSweepStartStop (int device, double startFreqHz, double stopFreqHz) |
SP_API SpStatus | spSetSweepCoupling (int device, double rbw, double vbw, double sweepTime) |
SP_API SpStatus | spSetSweepDetector (int device, SpDetector detector, SpVideoUnits videoUnits) |
SP_API SpStatus | spSetSweepScale (int device, SpScale scale) |
SP_API SpStatus | spSetSweepWindow (int device, SpWindowType window) |
SP_API SpStatus | spSetSweepGPIOSwitching (int device, double *freqs, uint8_t *data, int count) |
SP_API SpStatus | spSetSweepGPIOSwitchingDisabled (int device) |
SP_API SpStatus | spSetRealTimeCenterSpan (int device, double centerFreqHz, double spanHz) |
SP_API SpStatus | spSetRealTimeRBW (int device, double rbw) |
SP_API SpStatus | spSetRealTimeDetector (int device, SpDetector detector) |
SP_API SpStatus | spSetRealTimeScale (int device, SpScale scale, double frameRef, double frameScale) |
SP_API SpStatus | spSetRealTimeWindow (int device, SpWindowType window) |
SP_API SpStatus | spSetIQDataType (int device, SpDataType dataType) |
SP_API SpStatus | spSetIQCenterFreq (int device, double centerFreqHz) |
SP_API SpStatus | spGetIQCenterFreq (int device, double *centerFreqHz) |
SP_API SpStatus | spSetIQSampleRate (int device, int decimation) |
SP_API SpStatus | spSetIQSoftwareFilter (int device, SpBool enabled) |
SP_API SpStatus | spSetIQBandwidth (int device, double bandwidth) |
SP_API SpStatus | spSetIQExtTriggerEdge (int device, SpTriggerEdge edge) |
SP_API SpStatus | spSetIQTriggerSentinel (double sentinelValue) |
SP_API SpStatus | spSetIQQueueSize (int device, int units) |
SP_API SpStatus | spSetIQSweepListDataType (int device, SpDataType dataType) |
SP_API SpStatus | spSetIQSweepListCorrected (int device, SpBool corrected) |
SP_API SpStatus | spSetIQSweepListSteps (int device, int steps) |
SP_API SpStatus | spGetIQSweepListSteps (int device, int *steps) |
SP_API SpStatus | spSetIQSweepListFreq (int device, int step, double freq) |
SP_API SpStatus | spSetIQSweepListRef (int device, int step, double level) |
SP_API SpStatus | spSetIQSweepListAtten (int device, int step, int atten) |
SP_API SpStatus | spSetIQSweepListSampleCount (int device, int step, uint32_t samples) |
SP_API SpStatus | spSetAudioCenterFreq (int device, double centerFreqHz) |
SP_API SpStatus | spSetAudioType (int device, SpAudioType audioType) |
SP_API SpStatus | spSetAudioFilters (int device, double ifBandwidth, double audioLpf, double audioHpf) |
SP_API SpStatus | spSetAudioFMDeemphasis (int device, double deemphasis) |
SP_API SpStatus | spConfigure (int device, SpMode mode) |
SP_API SpStatus | spGetCurrentMode (int device, SpMode *mode) |
SP_API SpStatus | spAbort (int device) |
SP_API SpStatus | spGetSweepParameters (int device, double *actualRBW, double *actualVBW, double *actualStartFreq, double *binSize, int *sweepSize) |
SP_API SpStatus | spGetRealTimeParameters (int device, double *actualRBW, int *sweepSize, double *actualStartFreq, double *binSize, int *frameWidth, int *frameHeight, double *poi) |
SP_API SpStatus | spGetIQParameters (int device, double *sampleRate, double *bandwidth) |
SP_API SpStatus | spGetIQCorrection (int device, float *scale) |
SP_API SpStatus | spIQSweepListGetCorrections (int device, float *corrections) |
SP_API SpStatus | spGetSweep (int device, float *sweepMin, float *sweepMax, int64_t *nsSinceEpoch) |
SP_API SpStatus | spGetRealTimeFrame (int device, float *colorFrame, float *alphaFrame, float *sweepMin, float *sweepMax, int *frameCount, int64_t *nsSinceEpoch) |
SP_API SpStatus | spGetIQ (int device, void *iqBuf, int iqBufSize, double *triggers, int triggerBufSize, int64_t *nsSinceEpoch, SpBool purge, int *sampleLoss, int *samplesRemaining) |
SP_API SpStatus | spIQSweepListGetSweep (int device, void *dst, int64_t *timestamps) |
SP_API SpStatus | spIQSweepListStartSweep (int device, int pos, void *dst, int64_t *timestamps) |
SP_API SpStatus | spIQSweepListFinishSweep (int device, int pos) |
SP_API SpStatus | spGetAudio (int device, float *audio) |
SP_API SpStatus | spGetGPSInfo (int device, SpBool refresh, SpBool *updated, int64_t *secSinceEpoch, double *latitude, double *longitude, double *altitude, char *nmea, int *nmeaLen) |
SP_API SpStatus | spWriteToGPS (int device, const uint8_t *mem, int len) |
SP_API SpStatus | spSetFanSetPoint (int device, float setPoint) |
SP_API SpStatus | spGetFanSettings (int device, float *setPoint, float *voltage) |
SP_API const char * | spGetErrorString (SpStatus status) |
SP_API const char * | spGetAPIVersion () |
API functions for the SP145 spectrum analyzer.
This is the main file for user-accessible functions for controlling the SP145 spectrum analyzer.
#define SP_TRUE (1) |
Used for boolean true when integer parameters are being used. Also see SpBool.
#define SP_FALSE (0) |
Used for boolean false when integer parameters are being used. Also see SpBool.
#define SP_MAX_DEVICES (9) |
Max number of devices that can be interfaced in the API.
#define SP_MAX_REF_LEVEL (20.0) |
Maximum reference level in dBm
#define SP_AUTO_ATTEN (-1) |
Tells the API to automatically choose attenuation based on reference level.
#define SP_MAX_ATTEN (6) |
Valid atten values [0,6] or -1 for auto
#define SP_MIN_FREQ (9.0e3) |
Min frequency for sweeps, and min center frequency for I/Q measurements.
#define SP_MAX_FREQ (15.0e9) |
Max frequency for sweeps, and max center frequency for I/Q measurements.
#define SP_MIN_SWEEP_TIME (1.0e-6) |
Min sweep time in seconds. See spSetSweepCoupling.
#define SP_MAX_SWEEP_TIME (100.0) |
Max sweep time in seconds. See spSetSweepCoupling.
#define SP_REAL_TIME_MIN_SPAN (200.0e3) |
Min span for device configured in real-time measurement mode
#define SP_REAL_TIME_MAX_SPAN (40.0e6) |
Max span for device configured in real-time measurement mode
#define SP_REAL_TIME_MIN_RBW (2.0e3) |
Min RBW for device configured in real-time measurement mode
#define SP_REAL_TIME_MAX_RBW (1.0e6) |
Max RBW for device configured in real-time measurement mode
#define SP_MAX_IQ_DECIMATION (8192) |
Max decimation for I/Q streaming.
#define SP_MAX_IQ_SWEEP_STEPS (1000) |
Maximum number of definable steps in a I/Q sweep
#define SP_MIN_FAN_SET_POINT (0.0) |
Minimum fan set point in Celcius
#define SP_MAX_FAN_SET_POINT (60.0) |
Maximum fan set point in Celcius
#define SP_MAX_SWEEP_QUEUE_SZ (16) |
Maximum number of I/Q sweeps that can be queued up. Valid sweep indices between [0,15]. See I/Q Sweep List / Frequency Hopping
enum SpStatus |
Status code returned from all SP API functions.
enum SpBool |
enum SpPowerState |
Specifies device power state. See Power States for more information.
Enumerator | |
---|---|
spPowerStateOn | On |
spPowerStateStandby | Standby |
enum SpMode |
enum SpDetector |
enum SpScale |
enum SpVideoUnits |
enum SpWindowType |
enum SpDataType |
Specifies the data type of I/Q data returned from the API. For I/Q streaming and I/Q sweep lists. See I/Q Data Types
Enumerator | |
---|---|
spDataType32fc | 32-bit complex floats |
spDataType16sc | 16-bit complex shorts |
enum SpTriggerEdge |
enum SpGPSState |
enum SpReference |
enum SpGPIOFunction |
Used to specify the function of the GPIO port. See spSetGPIOPort.
enum SpAudioType |
SP_API SpStatus spGetDeviceList | ( | int * | serials, |
int * | deviceCount | ||
) |
This function is used to retrieve the serial numbers of all unopened SP devices connected to the PC. The maximum number of serial numbers that can be returned is equal to the value deviceCount points to. The serial numbers returned can then be used to open specific devices with the spOpenDeviceBySerial function. When the function returns successfully, the serials array will contain deviceCount number of unique SP serial numbers. Only deviceCount values will be modified. Note that this function will only report devices that are not opened in the current process. If a device is opened in another application/process, it will be returned by this function. See Multiple Devices and Multiple Processes.
[out] | serials | Pointer to an array of integers. The array must be larger than the number of SP devices connected to the PC. |
[out] | deviceCount | Initially the value pointed to by deviceCount should be equal to or less than the size of the serials array. If the function returns successfully the value will be set to the number of serial numbers returned int the serials array. |
SP_API SpStatus spOpenDevice | ( | int * | device | ) |
Claim the first unopened SP device detected on the system. If the device is opened successfully, a handle to the function will be returned through the device pointer. This handle can then be used to refer to this device for all future API calls. This function has the same effect as calling spGetDeviceList and using the first device found to call spOpenDeviceBySerial.
[out] | device | Returns handle that can be used to interface the device. If this function returns an error, the handle will be invalid. |
SP_API SpStatus spOpenDeviceBySerial | ( | int * | device, |
int | serialNumber | ||
) |
This function is similar to spOpenDevice except it allows you to specify the device you wish to open. This function is often used in conjunction with spGetDeviceList when managing several SP devices on one PC.
[out] | device | Returns handle that can be used to interface the device. If this function returns an error, the handle will be invalid. |
[in] | serialNumber | Serial number of the device you wish to open. |
SP_API SpStatus spCloseDevice | ( | int | device | ) |
This function should be called when you want to release the resources for a device. All resources (memory, etc.) will be released, and the device will become available again for use in the current process. The device handle specified will no longer point to a valid device and the device must be re-opened again to be used. This function should be called before the process exits, but it is not strictly required.
[in] | device | Device handle. |
SP_API SpStatus spPresetDevice | ( | int | device | ) |
Performs a full device preset. When this function returns, the hardware will have performed a full reset, the device handle will no longer be valid, the spCloseDevice function will have been called for the device handle, and the device will need to be re-opened again. This function can be used to recover from an undesirable device state.
[in] | device | Device handle. |
SP_API SpStatus spSetPowerState | ( | int | device, |
SpPowerState | powerState | ||
) |
Change the power state of the device. The power state controls the power consumption of the device. See Power States for more information.
[in] | device | Device handle. |
[in] | powerState | New power state. |
SP_API SpStatus spGetPowerState | ( | int | device, |
SpPowerState * | powerState | ||
) |
Retrieves the current power state. See Power States for more information.
[in] | device | Device handle. |
[out] | powerState | Pointer to SpPowerState. |
SP_API SpStatus spGetSerialNumber | ( | int | device, |
int * | serialNumber | ||
) |
This function returns the serial number of an open device.
[in] | device | Device handle. |
[out] | serialNumber | Returns device serial number. |
SP_API SpStatus spGetFirmwareVersion | ( | int | device, |
int * | major, | ||
int * | minor, | ||
int * | revision | ||
) |
Get the firmware version of the device. The firmware version is of the form major.minor.revision
.
[in] | device | Device handle. |
[out] | major | Pointer to int. |
[out] | minor | Pointer to int. |
[out] | revision | Pointer to int. |
SP_API SpStatus spGetDeviceDiagnostics | ( | int | device, |
float * | voltage, | ||
float * | current, | ||
float * | temperature | ||
) |
Return operational information of a device.
[in] | device | Device handle. |
[out] | voltage | Pointer to float, to contain device voltage. Reported in Voltas. Can be NULL . |
[out] | current | Pointer to float, to contain device current. Can be NULL . |
[out] | temperature | Pointer to float, to contain device temperature. Reported in Celcius. Can be NULL . |
SP_API SpStatus spGetCalDate | ( | int | device, |
uint32_t * | lastCalDate | ||
) |
Return the last device adjustment date. This is the date in which the current device adjustments were made.
[in] | device | Device handle. |
[out] | lastCalDate | Last adjustment data as seconds since epoch. |
SP_API SpStatus spSetReference | ( | int | device, |
SpReference | reference | ||
) |
Configure the receiver to use either the internal 10MHz reference or use a 10MHz reference present on the 10MHz in port. The device must be in the idle state. For high precision frequency measurements allow adequate settling time after setting the device to use an external reference. The device defaults to using the internal reference after opening the device.
[in] | device | Device handle. |
[in] | reference | New reference state. |
SP_API SpStatus spGetReference | ( | int | device, |
SpReference * | reference | ||
) |
Get the current reference state.
[in] | device | Device handle. |
[out] | reference | Returns the last set reference state. |
SP_API SpStatus spSetGPIOPort | ( | int | device, |
SpGPIOFunction | func | ||
) |
Configure the GPIO port function. The device should be idle when calling this function. See SpGPIOFunction descriptions of each function. Also see GPIO.
[in] | device | Device handle. |
[in] | func | Set the function of the GPIO port. |
SP_API SpStatus spGetGPIOPort | ( | int | device, |
SpGPIOFunction * | func | ||
) |
Retrieve the current function of the GPIO port.
[in] | device | Device handle. |
[out] | func | Get the function of the GPIO port. |
SP_API SpStatus spSetUARTBaudRate | ( | int | device, |
float | rate | ||
) |
Set the UART baud rate for the GPIO port. If the GPIO port is configured for UART writes, the baud rate is updated immediately. The requested baud rate may not be able to be achieved exactly, request the actual baud rate with spGetUARTBaudRate.
[in] | device | Device handle. |
[in] | rate | Desired baud rate in Hz. |
SP_API SpStatus spGetUARTBaudRate | ( | int | device, |
float * | rate | ||
) |
Retrieve the current configured UART baud rate.
[in] | device | Device handle. |
[out] | rate | Current baud rate in Hz. |
SP_API SpStatus spWriteUARTDirect | ( | int | device, |
uint8_t | data | ||
) |
Write a single byte to the UART on the GPIO port. The port must be configured for direct writes using the spSetGPIOPort function. The baud rate of the write is specified using the spSetUARTBaudRate function.
[in] | device | Device handle. |
[in] | data | Byte to write. |
Enable whether or not the API automatically updates the timebase calibration value when a valid GPS lock is acquired. This function must be called in an idle state. For accurate timestamping using GPS timestamps, this should be enabled. See Automatic GPS Timebase Discipline for more information.
[in] | device | Device handle. |
[in] | enabled | Send spTrue to enable. |
Get GPS timebase update enabled. See Automatic GPS Timebase Discipline for more information.
[in] | device | Device handle. |
[out] | enabled | Returns spTrue if auto GPS timebase update is enabled. |
SP_API SpStatus spGetGPSHoldoverInfo | ( | int | device, |
SpBool * | usingGPSHoldover, | ||
uint32_t * | lastHoldoverTime | ||
) |
Return information about the GPS holdover correction. Determine if a correction exists and when it was generated.
[in] | device | Device handle. |
[out] | usingGPSHoldover | Returns whether the GPS holdover value is newer than the factory calibration value. To determine whether the holdover value is actively in use, you will need to use this function in combination with spGetGPSState. This parameter can be NULL. |
[out] | lastHoldoverTime | If a GPS holdover value exists on the system, return the timestamp of the value. Value is seconds since epoch. This parameter can be NULL. |
SP_API SpStatus spGetGPSState | ( | int | device, |
SpGPSState * | GPSState | ||
) |
Determine the lock and discipline status of the GPS. See the Acquiring GPS Lock section for more information. The GPS state is updated after every measurement, or if no measurement is active, it is updated at most once per second.
[in] | device | Device handle. |
[out] | GPSState | Pointer to SpGPSState. |
SP_API SpStatus spSetRefLevel | ( | int | device, |
double | refLevel | ||
) |
The reference level controls the sensitivity of the receiver by setting the attenuation of the receiver to optimize measurements for signals at or below the reference level. See Reference Level and Sensitivity for more information. Attenuation must be set to automatic (-1) to set reference level. This setting is used by all measurements except I/Q sweep lists/frequency hopping.
[in] | device | Device handle. |
[in] | refLevel | Set the reference level of the receiver in dBm. |
SP_API SpStatus spGetRefLevel | ( | int | device, |
double * | refLevel | ||
) |
Retrieve the current device reference level.
[in] | device | Device handle. |
[out] | refLevel | Reference level returned in dBm. |
SP_API SpStatus spSetAttenuator | ( | int | device, |
int | atten | ||
) |
Set the device attenuation. See Reference Level and Sensitivity for more information. Valid values for attenuation are between [0,6] representing between [0,30] dB of attenuation (5dB steps). Setting the attenuation to SP_AUTO_ATTEN(-1) tells the receiver to automatically choose the best attenuation value for the specified reference level selected. Setting attenuation to a non-auto value overrides the reference level selection.
[in] | device | Device handle. |
[in] | atten | Attenuation value between [-1,6]. |
SP_API SpStatus spGetAttenuator | ( | int | device, |
int * | atten | ||
) |
Get the device attenuation. See Reference Level and Sensitivity for more information.
[in] | device | Device handle. |
[out] | atten | Returns current attenuation value. |
SP_API SpStatus spSetSweepCenterSpan | ( | int | device, |
double | centerFreqHz, | ||
double | spanHz | ||
) |
Set sweep center/span.
[in] | device | Device handle. |
[in] | centerFreqHz | New center frequency in Hz. |
[in] | spanHz | New span in Hz. |
SP_API SpStatus spSetSweepStartStop | ( | int | device, |
double | startFreqHz, | ||
double | stopFreqHz | ||
) |
Set sweep start/stop frequency.
[in] | device | Device handle. |
[in] | startFreqHz | Start frequency in Hz. |
[in] | stopFreqHz | Stop frequency in Hz. |
SP_API SpStatus spSetSweepCoupling | ( | int | device, |
double | rbw, | ||
double | vbw, | ||
double | sweepTime | ||
) |
Set sweep RBW/VBW parameters.
[in] | device | Device handle. |
[in] | rbw | Resolution bandwidth in Hz. |
[in] | vbw | Video bandwidth in Hz. Cannot be greater than RBW. |
[in] | sweepTime | Suggest the total acquisition time of the sweep. Specified in seconds. This parameter is a suggestion and will ensure RBW and VBW are first met before increasing sweep time. |
SP_API SpStatus spSetSweepDetector | ( | int | device, |
SpDetector | detector, | ||
SpVideoUnits | videoUnits | ||
) |
Set sweep detector.
[in] | device | Device handle. |
[in] | detector | New sweep detector. |
[in] | videoUnits | New video processing units. |
Set the sweep mode output unit type.
[in] | device | Device handle. |
[in] | scale | New sweep mode units. |
SP_API SpStatus spSetSweepWindow | ( | int | device, |
SpWindowType | window | ||
) |
Set sweep mode window function.
[in] | device | Device handle. |
[in] | window | New window function. |
SP_API SpStatus spSetSweepGPIOSwitching | ( | int | device, |
double * | freqs, | ||
uint8_t * | data, | ||
int | count | ||
) |
This function is used to set the frequency cross over points for the GPIO sweep functionality and the associated GPIO output logic levels for each frequency. See GPIO for more information.
[in] | device | Device handle. |
[in] | freqs | Array of frequencies at which the associated data will be written to the UART. Array must be 'count' length. |
[in] | data | Array of bytes. Corresponds to values in freqs array. Array must be 'count' length. |
[in] | count | Length of freqs and data arrays. Set to zero to disable sweep GPIO switching. |
SP_API SpStatus spSetSweepGPIOSwitchingDisabled | ( | int | device | ) |
Disables and clears the current GPIO sweep setup. The effect of this function will be seen the next time the device is configured. See the GPIO section for more information.
[in] | device | Device handle. |
SP_API SpStatus spSetRealTimeCenterSpan | ( | int | device, |
double | centerFreqHz, | ||
double | spanHz | ||
) |
Set the center frequency and span for real-time spectrum analysis.
[in] | device | Device handle. |
[in] | centerFreqHz | Center frequency in Hz. |
[in] | spanHz | Span in Hz. |
SP_API SpStatus spSetRealTimeRBW | ( | int | device, |
double | rbw | ||
) |
Set the resolution bandwidth for real-time spectrum analysis.
[in] | device | Device handle. |
[in] | rbw | Resolution bandwidth in Hz. |
SP_API SpStatus spSetRealTimeDetector | ( | int | device, |
SpDetector | detector | ||
) |
Set the detector for real-time spectrum analysis.
[in] | device | Device handle. |
[in] | detector | New detector. |
SP_API SpStatus spSetRealTimeScale | ( | int | device, |
SpScale | scale, | ||
double | frameRef, | ||
double | frameScale | ||
) |
Set the sweep and frame units used in real-time spectrum analysis.
[in] | device | Device handle. |
[in] | scale | Scale for the returned sweeps. |
[in] | frameRef | Sets the reference level of the real-time frame, or, the amplitude of the highest pixel in the frame. |
[in] | frameScale | Specify the height of the frame in dB. A common value is 100dB. |
SP_API SpStatus spSetRealTimeWindow | ( | int | device, |
SpWindowType | window | ||
) |
Specify the window function used for real-time spectrum analysis.
[in] | device | Device handle. |
[in] | window | New window function. |
SP_API SpStatus spSetIQDataType | ( | int | device, |
SpDataType | dataType | ||
) |
Set the I/Q data type of the samples returned for I/Q streaming.
[in] | device | Device handle. |
[in] | dataType | Data type. See I/Q Data Types for more information. |
SP_API SpStatus spSetIQCenterFreq | ( | int | device, |
double | centerFreqHz | ||
) |
Set the center frequency for I/Q streaming.
[in] | device | Device handle. |
[in] | centerFreqHz | Center frequency in Hz. |
SP_API SpStatus spGetIQCenterFreq | ( | int | device, |
double * | centerFreqHz | ||
) |
Get the I/Q streaming center frequency.
[in] | device | Device handle. |
[in] | centerFreqHz | Pointer to double. |
SP_API SpStatus spSetIQSampleRate | ( | int | device, |
int | decimation | ||
) |
Set sample rate for I/Q streaming.
[in] | device | Device handle. |
[in] | decimation | Decimation of the I/Q data as a power of 2. See I/Q Sample Rates for more information. |
Enable/disable software filtering.
[in] | device | Device handle. |
[in] | enabled | Set to spTrue to enable software filtering. |
SP_API SpStatus spSetIQBandwidth | ( | int | device, |
double | bandwidth | ||
) |
Specify the software filter bandwidth in I/Q streaming. See I/Q Sample Rates for more information.
[in] | device | Device handle. |
[in] | bandwidth | The bandwidth in Hz. |
SP_API SpStatus spSetIQExtTriggerEdge | ( | int | device, |
SpTriggerEdge | edge | ||
) |
Configure the external trigger edge detect in I/Q streaming.
[in] | device | Device handle. |
[in] | edge | Set the external trigger edge. |
SP_API SpStatus spSetIQTriggerSentinel | ( | double | sentinelValue | ) |
Configure how external triggers are reported for I/Q streaming.
[in] | sentinelValue | Value used to fill the remainder of the trigger buffer when the trigger buffer provided is larger than the number of triggers returned. The default sentinel value is zero. See the I/Q Streaming section for more information on triggering. |
SP_API SpStatus spSetIQQueueSize | ( | int | device, |
int | units | ||
) |
Controls the USB queue size of I/Q data that is being actively requested by the API. For example, a queue size of 21ms means the API keeps 21ms of data requests active. A larger queue size means a greater tolerance to data loss in the event of an interruption. Because once data is requested, its transfer must be completed, a smaller queue size can give you faster reconfiguration times. For instance, if you wanted to change frequencies quickly, a smaller queue size would allow this. A default (16) is chosen for the best resistance to data loss for both Linux and Windows. If you are on Linux and you are using multiple devices, please see Linux Notes. This setting applies to I/Q streaming only.
[in] | device | Device handle |
[in] | units | Should be a value between [2,16]. Each unit represent 2.1ms. For example, 4 units = 4 * 2.1 = 8.4ms queue size. |
SP_API SpStatus spSetIQSweepListDataType | ( | int | device, |
SpDataType | dataType | ||
) |
Set the data type for data returned for I/Q sweep list measurements.
[in] | device | Device handle. |
[in] | dataType | See I/Q Data Types for more information. |
Set whether the data returns for I/Q sweep list meausurements is full-scale or corrected.
[in] | device | Device handle. |
[in] | corrected | Set to spFalse for the data to be returned as full scale, and spTrue to be returned amplitude corrected. See I/Q Data Types for more information on how to perform these conversions. |
SP_API SpStatus spSetIQSweepListSteps | ( | int | device, |
int | steps | ||
) |
Set the number of frequency steps for I/Q sweep list measurements.
[in] | device | Device handle. |
[in] | steps | Number of frequency steps in I/Q sweep. |
SP_API SpStatus spGetIQSweepListSteps | ( | int | device, |
int * | steps | ||
) |
Get the number steps in the I/Q sweep list measurement.
[in] | device | Device handle. |
[out] | steps | Pointer to int. |
SP_API SpStatus spSetIQSweepListFreq | ( | int | device, |
int | step, | ||
double | freq | ||
) |
Set the center frequency of the acquisition at a given step for the I/Q sweep list measurement.
[in] | device | Device handle. |
[in] | step | Step at which to configure the center frequency. Should be between [0, steps-1] where steps is set in the spSetIQSweepListSteps function. |
[in] | freq | Center frequency in Hz. |
SP_API SpStatus spSetIQSweepListRef | ( | int | device, |
int | step, | ||
double | level | ||
) |
Set the reference level for a step for the I/Q sweep list measurement.
[in] | device | Device handle. |
[in] | step | Step at which to configure the reference level. Should be between [0, steps-1] where steps is set in the spSetIQSweepListSteps function. |
[in] | level | Reference level in dBm. If this is set, attenuation is set to automatic for this step. |
SP_API SpStatus spSetIQSweepListAtten | ( | int | device, |
int | step, | ||
int | atten | ||
) |
Set the attenuation for a step for the I/Q sweep list measurement.
[in] | device | Device handle. |
[in] | step | Step at which to configure the attenuation. Should be between [0, steps-1] where steps is set in the spSetIQSweepListSteps function. |
[in] | atten | Attenuation value between [0,6] representing [0,30] dB of attenuation (5dB steps). Setting the attenuation to -1 forces the attenuation to auto, at which time the reference level is used to control the attenuator instead. |
SP_API SpStatus spSetIQSweepListSampleCount | ( | int | device, |
int | step, | ||
uint32_t | samples | ||
) |
Set the number of I/Q samples to be collected at a step.
[in] | device | Device handle. |
[in] | step | Step at which to configure the sample count. Should be between [0, steps-1] where steps is set in the spSetIQSweepListSteps function. |
[in] | samples | Number of samples. Must be greater than 0. There is no upper limit, but keep in mind contiguous memory must be allocated for the capture. Memory allocation for the capture is the responsibility of the user program. |
SP_API SpStatus spSetAudioCenterFreq | ( | int | device, |
double | centerFreqHz | ||
) |
Set the center frequency for audio demodulation.
[in] | device | Device handle. |
[in] | centerFreqHz | Center frequency in Hz. |
SP_API SpStatus spSetAudioType | ( | int | device, |
SpAudioType | audioType | ||
) |
Set the audio demodulator for audio demodulation.
[in] | device | Device handle. |
[in] | audioType | Demodulator. |
SP_API SpStatus spSetAudioFilters | ( | int | device, |
double | ifBandwidth, | ||
double | audioLpf, | ||
double | audioHpf | ||
) |
Set the audio demodulation filters for audio demodulation.
[in] | device | Device handle. |
[in] | ifBandwidth | IF bandwidth (RBW) in Hz. |
[in] | audioLpf | Audio low pass frequency in Hz. |
[in] | audioHpf | Audio high pass frequency in Hz. |
SP_API SpStatus spSetAudioFMDeemphasis | ( | int | device, |
double | deemphasis | ||
) |
Set the FM deemphasis for audio demodulation.
[in] | device | Device handle. |
[in] | deemphasis | Deemphasis in us. |
This function configures the receiver into a state determined by the mode parameter. All relevant configuration routines must have already been called. This function calls spAbort to end the previous measurement mode before attempting to configure the receiver. If any error occurs attempting to configure the new measurement state, the previous measurement mode will no longer be active.
[in] | device | Device handle. |
[in] | mode | New measurement mode. |
Retrieve the current device measurement mode.
[in] | device | Device handle. |
[in] | mode | Pointer to SpMode. |
SP_API SpStatus spAbort | ( | int | device | ) |
This function ends the current measurement mode and puts the device into the idle state. Any current measurements are completed and discarded and will not be accessible after this function returns.
[in] | device | Device handle. |
SP_API SpStatus spGetSweepParameters | ( | int | device, |
double * | actualRBW, | ||
double * | actualVBW, | ||
double * | actualStartFreq, | ||
double * | binSize, | ||
int * | sweepSize | ||
) |
Retrieves the sweep parameters for an active sweep measurement mode. This function should be called after a successful device configuration to retrieve the sweep characteristics.
[in] | device | Device handle. |
[out] | actualRBW | Returns the RBW being used in Hz. Can be NULL. |
[out] | actualVBW | Returns the VBW being used in Hz. Can be NULL. |
[out] | actualStartFreq | Returns the frequency of the first bin in Hz. Can be NULL. |
[out] | binSize | Returns the frequency spacing between each frequency bin in the sweep in Hz. Can be NULL. |
[out] | sweepSize | Returns the length of the sweep (number of frequency bins). Can be NULL. |
SP_API SpStatus spGetRealTimeParameters | ( | int | device, |
double * | actualRBW, | ||
int * | sweepSize, | ||
double * | actualStartFreq, | ||
double * | binSize, | ||
int * | frameWidth, | ||
int * | frameHeight, | ||
double * | poi | ||
) |
Retrieve the real-time measurement mode parameters for an active real-time configuration. This function is typically called after a successful device configuration to retrieve the real-time sweep and frame characteristics.
[in] | device | Device handle. |
[out] | actualRBW | Returns the RBW used in Hz. Can be NULL. |
[out] | sweepSize | Returns the number of frequency bins in the sweep. Can be NULL. |
[out] | actualStartFreq | Returns the frequency of the first bin in the sweep in Hz. Can be NULL. |
[out] | binSize | Frequency bin spacing in Hz. Can be NULL. |
[out] | frameWidth | The width of the real-time frame. Can be NULL. |
[out] | frameHeight | The height of the real-time frame. Can be NULL. |
[out] | poi | 100% probability of intercept of a signal given the current configuration. Can be NULL. |
SP_API SpStatus spGetIQParameters | ( | int | device, |
double * | sampleRate, | ||
double * | bandwidth | ||
) |
Retrieve the I/Q measurement mode parameters for an active I/Q stream. This function is called after a successful device configuration.
[in] | device | Device handle. |
[out] | sampleRate | The sample rate in Hz. Can be NULL. |
bandwidth | The bandwidth of the I/Q capture in Hz. Can be NULL. |
SP_API SpStatus spGetIQCorrection | ( | int | device, |
float * | scale | ||
) |
Retrieve the I/Q correction factor for an active I/Q stream. This function is called after a successful device configuration.
[in] | device | Device handle. |
[out] | scale | Amplitude correction used by the API to convert from full scale I/Q to amplitude corrected I/Q. The formulas for these conversions are in the I/Q Data Types section. |
SP_API SpStatus spIQSweepListGetCorrections | ( | int | device, |
float * | corrections | ||
) |
Retrieve the corrections used to convert full scale I/Q values to amplitude corrected I/Q values for the I/Q sweep list measurement. A correction is returned for each step configured. The device must be configured for I/Q sweep list measurements before calling this function.
[in] | device | Device handle. |
[out] | corrections | Pointer to an array. Array should have length >= number of steps configured for the I/Q sweep list measurement. A correction value will be returned for each step configured. |
SP_API SpStatus spGetSweep | ( | int | device, |
float * | sweepMin, | ||
float * | sweepMax, | ||
int64_t * | nsSinceEpoch | ||
) |
Perform a single sweep. Block until the sweep completes.
[in] | device | Device handle. |
[out] | sweepMin | Can be NULL. |
[out] | sweepMax | Can be NULL. |
[out] | nsSinceEpoch | Nanoseconds since epoch. Timestamp representing the end of the sweep. Can be NULL. |
SP_API SpStatus spGetRealTimeFrame | ( | int | device, |
float * | colorFrame, | ||
float * | alphaFrame, | ||
float * | sweepMin, | ||
float * | sweepMax, | ||
int * | frameCount, | ||
int64_t * | nsSinceEpoch | ||
) |
Retrieve a single real-time frame. See Real-Time Spectrum Analysis for more information.
[in] | device | Device handle. |
[out] | colorFrame | Pointer to memory for the frame. Must be (frameWidth * frameHeight) floats in size. Can be NULL. |
[out] | alphaFrame | Pointer to memory for the frame. Must be (frameWidth * frameHeight) floats in size. Can be NULL. |
[out] | sweepMin | Can be NULL. |
[out] | sweepMax | Can be NULL. |
[out] | frameCount | Unique integer which refers to a real-time frame and sweep. The frame count starts at zero following a device reconfigure and increments by one for each frame. |
[out] | nsSinceEpoch | Nanoseconds since epoch for the returned frame. For real-time mode, this value represents the time at the end of the real-time acquisition and processing of this given frame. It is approximate. Can be NULL. |
SP_API SpStatus spGetIQ | ( | int | device, |
void * | iqBuf, | ||
int | iqBufSize, | ||
double * | triggers, | ||
int | triggerBufSize, | ||
int64_t * | nsSinceEpoch, | ||
SpBool | purge, | ||
int * | sampleLoss, | ||
int * | samplesRemaining | ||
) |
Retrieve one block of I/Q data as specified by the user. This function blocks until the data requested is available.
[in] | device | Device handle. |
[out] | iqBuf | Pointer to user allocated buffer of complex values. The buffer size must be at least (iqBufSize * 2 * sizeof(dataTypeSelected)). Cannot be NULL. Data is returned as interleaved contiguous complex samples. For more information on the data returned and the selectable data types, see I/Q Data Types. |
[in] | iqBufSize | Specifies the number of I/Q samples to be retrieved. Must be greater than zero. |
[out] | triggers | Pointer to user-allocated array of doubles. The buffer must be at least triggerBufSize contiguous doubles. The pointer can also be NULL to indicate you do not wish to receive external trigger information. See I/Q Streaming section for more information on triggers. |
[in] | triggerBufSize | Specifies the size of the triggers array. If the triggers array is NULL, this value should be zero. |
[out] | nsSinceEpoch | Nanoseconds since epoch. The time of the first I/Q sample returned. Can be NULL. See GPS and Timestamps for more information. |
[in] | purge | When set to spTrue, any buffered I/Q data in the API is purged before returned beginning the I/Q block acquisition. |
[out] | sampleLoss | Set by the API when a sample loss condition occurs. If enough I/Q data has accumulated in the internal API circular buffer, the buffer is cleared and the sample loss flag is set. If purge is set to true, the sample flag will always be set to SP_FALSE. Can be NULL. |
[out] | samplesRemaining | Set by the API, returns the number of samples remaining in the I/Q circular buffer. Can be NULL. |
SP_API SpStatus spIQSweepListGetSweep | ( | int | device, |
void * | dst, | ||
int64_t * | timestamps | ||
) |
Perform an I/Q sweep. Blocks until the sweep is complete. Can only be called if no other I/Q sweeps are queued.
[in] | device | Device handle. |
[out] | dst | Pointer to memory allocated for sweep. The user must allocate this memory before calling this function. Must be large enough to contain all samples for all steps in a sweep. The memory must be contiguous. The samples in the sweep are placed contiguously into the array (step 1 samples follow step 0, step 2 follows step 1, etc). Samples are tightly packed. It is the responsibility of the user to properly index the arrays when finished. The array will be cast to the user-selected data type internally in the API. |
[out] | timestamps | Pointer to memory allocated for timestamps. The user must allocate this memory before calling these functions. Must be an array of steps int64_ts, where steps is the number of frequency steps in the sweep. When the sweep completes each timestamp in the array represents the time of the first sample at that frequency in the sweep. Can be NULL if you do not want timestamps. |
SP_API SpStatus spIQSweepListStartSweep | ( | int | device, |
int | pos, | ||
void * | dst, | ||
int64_t * | timestamps | ||
) |
Start an I/Q sweep at the given queue position. Up to 16 sweeps can be in queue.
[in] | device | Device handle. |
[in] | pos | Sweep queue position. Must be between [0,15]. |
[out] | dst | Pointer to memory allocated for sweep. The user must allocate this memory before calling this function. Must be large enough to contain all samples for all steps in a sweep. The memory must be contiguous. The samples in the sweep are placed contiguously into the array (step 1 samples follow step 0, step 2 follows step 1, etc). Samples are tightly packed. It is the responsibility of the user to properly index the arrays when finished. The array will be cast to the user-selected data type internally in the API. |
[out] | timestamps | Pointer to memory allocated for timestamps. The user must allocate this memory before calling these functions. Must be an array of steps int64_ts, where steps is the number of frequency steps in the sweep. When the sweep completes each timestamp in the array represents the time of the first sample at that frequency in the sweep. Can be NULL. |
SP_API SpStatus spIQSweepListFinishSweep | ( | int | device, |
int | pos | ||
) |
Finish an I/Q sweep at the given queue position. Blocks until the sweep is finished.
[in] | device | Device handle. |
[in] | pos | Sweep queue position. Must be between [0,15]. |
SP_API SpStatus spGetAudio | ( | int | device, |
float * | audio | ||
) |
If the device is configured to audio demodulation, use this function to retrieve the next 1000 audio samples. This function will block until the data is ready. Minor buffering of audio data is performed in the API, so it is necessary this function is called repeatedly if contiguous audio data is required. The values returned range between [-1.0, 1.0] representing full-scale audio. In FM mode, the audio values will scale with a change in IF bandwidth.
[in] | device | Device handle. |
[out] | audio | Pointer to array of 1000 32-bit floats. |
SP_API SpStatus spGetGPSInfo | ( | int | device, |
SpBool | refresh, | ||
SpBool * | updated, | ||
int64_t * | secSinceEpoch, | ||
double * | latitude, | ||
double * | longitude, | ||
double * | altitude, | ||
char * | nmea, | ||
int * | nmeaLen | ||
) |
Acquire the latest GPS information which includes a time stamp, location information, and NMEA sentences. The GPS info is updated once per second at the PPS interval. This function can be called while measurements are active. NMEA data can contain null values. When parsing, do not use the null delimiter to mark the end of the message, use the returned nmeaLen.
[in] | device | Device handle. |
[in] | refresh | When set to true and the device is not in a streaming mode, the API will request the latest GPS information. Otherwise the last retrieved data is returned. |
[out] | updated | Will be set to true if the NMEA data has been updated since the last time the user called this function. Can be set to NULL. |
[out] | secSinceEpoch | Number of seconds since epoch as reported by the GPS NMEA sentences. Last reported value by the GPS. If the GPS is not locked, this value will be set to zero. Can be NULL. |
[out] | latitude | Latitude in decimal degrees. If the GPS is not locked, this value will be set to zero. Can be NULL. |
[out] | longitude | Longitude in decimal degrees. If the GPS is not locked, this value will be set to zero. Can be NULL. |
[out] | altitude | Altitude in meters. If the GPS is not locked, this value will be set to zero. Can be NULL. |
[out] | nmea | Pointer to user-allocated array of char. The length of this array is specified by the nmeaLen parameter. Can be set to NULL. |
[in,out] | nmeaLen | Pointer to an integer. The integer will initially specify the length of the nmea buffer. If the nmea buffer is shorter than the NMEA sentences to be returned, the API will only copy over nmeaLen characters, including the null terminator. After the function returns, nmeaLen will be the length of the copied nmea data, including the null terminator. Can be set to NULL. If NULL, the nmea parameter is ignored. |
SP_API SpStatus spWriteToGPS | ( | int | device, |
const uint8_t * | mem, | ||
int | len | ||
) |
See Writing Messages to the GPS. Use this function to send messages to the internal u-blox M8 GPS. Messages provided are rounded/padded up to the next multiple of 4 bytes. The padded bytes are set to zero.
[in] | device | Device handle. |
[in] | mem | The message to send to the GPS. |
[in] | len | The length of the message in bytes. |
SP_API SpStatus spSetFanSetPoint | ( | int | device, |
float | setPoint | ||
) |
Specify the temperature of the device at which the internal fan attempts to maintain. The available temperature range is between [0-60] degrees. The fan uses a closed loop algorithm to reach the target temperature. Set to the maximum or minimum set point to force 0 or 100% fan speed.
This function must be called when the device is idle (no measurement mode active).
[in] | device | Device handle. |
[in] | setPoint | Temperature set point in Celcius. |
SP_API SpStatus spGetFanSettings | ( | int | device, |
float * | setPoint, | ||
float * | voltage | ||
) |
Get current fan temperature threshold and voltage.
[in] | device | Device handle. |
[out] | setPoint | Temperature set point in Celcius. Can be NULL. |
[out] | voltage | Voltage in V. Can be NULL. |
SP_API const char * spGetErrorString | ( | SpStatus | status | ) |
Retrieve a descriptive string of an SpStatus enumeration. Useful for debugging and diagnostic purposes.
[in] | status | Status code returned from any API function. |
SP_API const char * spGetAPIVersion | ( | ) |
Get the API version.
major.minor.revision
Ascii periods ('.') separate positive integers. Major/minor/revision are not guaranteed to be a single decimal digit. The string is null terminated. The string should not be modified or freed by the user. An example string is below?
['3' | '.' | '0' | '.' | '1' | '1' | '\0'] = "3.0.11"