BB API
bb_api.h
Go to the documentation of this file.
1// Copyright (c).2014-2022, Signal Hound
2// For licensing information, please see the API license in the software_licenses folder
3
13#ifndef BB_API_H
14#define BB_API_H
15
16#if defined(_WIN32)
17 #ifdef BB_EXPORTS
18 #define BB_API __declspec(dllexport)
19 #else
20 #define BB_API __declspec(dllimport)
21 #endif
22
23 // bare minimum stdint typedef support
24 #if _MSC_VER < 1700 // For VS2010 or earlier
25 typedef signed char int8_t;
26 typedef short int16_t;
27 typedef int int32_t;
28 typedef long long int64_t;
29 typedef unsigned char uint8_t;
30 typedef unsigned short uint16_t;
31 typedef unsigned int uint32_t;
32 typedef unsigned long long uint64_t;
33 #else
34 #include <stdint.h>
35 #endif
36
37 #define BB_DEPRECATED(comment) __declspec(deprecated(comment))
38#else // Linux
39 #define BB_API __attribute__((visibility("default")))
40
41 #include <stdint.h>
42
43 #if defined(__GNUC__)
44 #define BB_DEPRECATED(comment) __attribute__((deprecated))
45 #else
46 #define BB_DEPRECATED(comment) comment
47 #endif
48#endif
49
51#define BB_TRUE (1)
53#define BB_FALSE (0)
54
56#define BB_DEVICE_NONE (0)
58#define BB_DEVICE_BB60A (1)
60#define BB_DEVICE_BB60C (2)
62#define BB_DEVICE_BB60D (3)
63
68#define BB_MAX_DEVICES (8)
69
74#define BB_MIN_FREQ (9.0e3)
79#define BB_MAX_FREQ (6.4e9)
80
82#define BB_MIN_SPAN (20.0)
84#define BB_MAX_SPAN (BB_MAX_FREQ - BB_MIN_FREQ)
85
87#define BB_MIN_RBW (0.602006912)
89#define BB_MAX_RBW (10100000.0)
90
92#define BB_MIN_SWEEP_TIME (0.00001) // 10us
94#define BB_MAX_SWEEP_TIME (1.0) // 1s
95
97#define BB_MIN_RT_RBW (2465.820313)
99#define BB_MAX_RT_RBW (631250.0)
101#define BB_MIN_RT_SPAN (200.0e3)
103#define BB60A_MAX_RT_SPAN (20.0e6)
105#define BB60C_MAX_RT_SPAN (27.0e6)
106
108#define BB_MIN_USB_VOLTAGE (4.4)
109
111#define BB_MAX_REFERENCE (20.0)
112
114#define BB_AUTO_ATTEN (-1)
116#define BB_MAX_ATTEN (3)
118#define BB_AUTO_GAIN (-1)
120#define BB_MAX_GAIN (3)
121
123#define BB_MIN_DECIMATION (1)
125#define BB_MAX_DECIMATION (8192)
126
128#define BB_IDLE (-1)
130#define BB_SWEEPING (0)
132#define BB_REAL_TIME (1)
134#define BB_STREAMING (4)
136#define BB_AUDIO_DEMOD (7)
138#define BB_TG_SWEEPING (8)
139
141#define BB_NO_SPUR_REJECT (0)
143#define BB_SPUR_REJECT (1)
144
146#define BB_LOG_SCALE (0)
148#define BB_LIN_SCALE (1)
150#define BB_LOG_FULL_SCALE (2)
152#define BB_LIN_FULL_SCALE (3)
153
155#define BB_RBW_SHAPE_NUTTALL (0)
157#define BB_RBW_SHAPE_FLATTOP (1)
159#define BB_RBW_SHAPE_CISPR (2)
160
162#define BB_MIN_AND_MAX (0)
164#define BB_AVERAGE (1)
165
167#define BB_LOG (0)
169#define BB_VOLTAGE (1)
171#define BB_POWER (2)
173#define BB_SAMPLE (3)
174
176#define BB_DEMOD_AM (0)
178#define BB_DEMOD_FM (1)
180#define BB_DEMOD_USB (2)
182#define BB_DEMOD_LSB (3)
184#define BB_DEMOD_CW (4)
185
187#define BB_STREAM_IQ (0x0)
189#define BB_DIRECT_RF (0x2)
191#define BB_TIME_STAMP (0x10)
192
194#define BB60C_PORT1_AC_COUPLED (0x00)
196#define BB60C_PORT1_DC_COUPLED (0x04)
199#define BB60C_PORT1_10MHZ_USE_INT (0x00)
203#define BB60C_PORT1_10MHZ_REF_OUT (0x100)
206#define BB60C_PORT1_10MHZ_REF_IN (0x8)
208#define BB60C_PORT1_OUT_LOGIC_LOW (0x14)
210#define BB60C_PORT1_OUT_LOGIC_HIGH (0x1C)
212#define BB60C_PORT2_OUT_LOGIC_LOW (0x00)
214#define BB60C_PORT2_OUT_LOGIC_HIGH (0x20)
217#define BB60C_PORT2_IN_TRIG_RISING_EDGE (0x40)
220#define BB60C_PORT2_IN_TRIG_FALLING_EDGE (0x60)
221
223#define BB60D_PORT1_DISABLED (0)
225#define BB60D_PORT1_10MHZ_REF_IN (1)
227#define BB60D_PORT2_DISABLED (0)
229#define BB60D_PORT2_10MHZ_REF_OUT (1)
232#define BB60D_PORT2_IN_TRIG_RISING_EDGE (2)
235#define BB60D_PORT2_IN_TRIG_FALLING_EDGE (3)
237#define BB60D_PORT2_OUT_LOGIC_LOW (4)
239#define BB60D_PORT2_OUT_LOGIC_HIGH (5)
241#define BB60D_PORT2_OUT_UART (6)
242
244#define BB60D_UART_BAUD_4_8K (0)
246#define BB60D_UART_BAUD_9_6K (1)
248#define BB60D_UART_BAUD_19_2K (2)
250#define BB60D_UART_BAUD_38_4K (3)
252#define BB60D_UART_BAUD_14_4K (4)
254#define BB60D_UART_BAUD_28_8K (5)
256#define BB60D_UART_BAUD_57_6K (6)
258#define BB60D_UART_BAUD_115_2K (7)
260#define BB60D_UART_BAUD_125K (8)
262#define BB60D_UART_BAUD_250K (9)
264#define BB60D_UART_BAUD_500K (10)
266#define BB60D_UART_BAUD_1000K (11)
267
269#define BB60D_MIN_UART_STATES (2)
271#define BB60D_MAX_UART_STATES (8)
272
274#define TG_THRU_0DB (0x1)
276#define TG_THRU_20DB (0x2)
277
279#define TG_REF_UNUSED (0)
281#define TG_REF_INTERNAL_OUT (1)
283#define TG_REF_EXTERNAL_IN (2)
284
288typedef struct bbIQPacket {
294 void *iqData;
314 int purge;
331 int sec;
336 int nano;
337} bbIQPacket;
338
344typedef enum bbStatus {
371
380
388 bbGPSErr = -12,
421
424
425 // Warnings/Messages
426
446
450typedef enum bbDataType {
456
460typedef enum bbPowerState {
466
467#ifdef __cplusplus
468extern "C" {
469#endif
470
490BB_API bbStatus bbGetSerialNumberList(int serialNumbers[BB_MAX_DEVICES], int *deviceCount);
491
517 int deviceTypes[BB_MAX_DEVICES],
518 int *deviceCount);
519
537BB_API bbStatus bbOpenDevice(int *device);
538
563BB_API bbStatus bbOpenDeviceBySerialNumber(int *device, int serialNumber);
564
575BB_API bbStatus bbCloseDevice(int device);
576
596BB_API bbStatus bbSetPowerState(int device, bbPowerState powerState);
597
610BB_API bbStatus bbGetPowerState(int device, bbPowerState *powerState);
611
625BB_API bbStatus bbPreset(int device);
626
636BB_API bbStatus bbPresetFull(int *device);
637
669BB_API bbStatus bbSelfCal(int device);
670
681BB_API bbStatus bbGetSerialNumber(int device, uint32_t *serialNumber);
682
696BB_API bbStatus bbGetDeviceType(int device, int *deviceType);
697
711BB_API bbStatus bbGetFirmwareVersion(int device, int *version);
712
730BB_API bbStatus bbGetDeviceDiagnostics(int device, float *temperature, float *usbVoltage, float *usbCurrent);
731
826BB_API bbStatus bbConfigureIO(int device, uint32_t port1, uint32_t port2);
827
852BB_API bbStatus bbSyncCPUtoGPS(int comPort, int baudRate);
853
869BB_API bbStatus bbSetUARTRate(int device, int rate);
870
902BB_API bbStatus bbEnableUARTSweeping(int device, const double *freqs, const uint8_t *data, int states);
903
917
964BB_API bbStatus bbEnableUARTStreaming(int device, const uint8_t *data, const uint32_t *counts, int states);
965
979
993BB_API bbStatus bbWriteUARTImm(int device, uint8_t data);
994
1010BB_API bbStatus bbConfigureRefLevel(int device, double refLevel);
1011
1042BB_API bbStatus bbConfigureGainAtten(int device, int gain, int atten);
1043
1071BB_API bbStatus bbConfigureCenterSpan(int device, double center, double span);
1072
1128BB_API bbStatus bbConfigureSweepCoupling(int device, double rbw, double vbw, double sweepTime,
1129 uint32_t rbwShape, uint32_t rejection);
1130
1157BB_API bbStatus bbConfigureAcquisition(int device, uint32_t detector, uint32_t scale);
1158
1182BB_API bbStatus bbConfigureProcUnits(int device, uint32_t units);
1183
1203BB_API bbStatus bbConfigureRealTime(int device, double frameScale, int frameRate);
1204
1223BB_API bbStatus bbConfigureRealTimeOverlap(int device, double advanceRate);
1224
1239BB_API bbStatus bbConfigureIQCenter(int device, double centerFreq);
1240
1265BB_API bbStatus bbConfigureIQ(int device, int downsampleFactor, double bandwidth);
1266
1277BB_API bbStatus bbConfigureIQDataType(int device, bbDataType dataType);
1278
1290
1322BB_API bbStatus bbConfigureDemod(int device, int modulationType, double freq, float IFBW,
1323 float audioLowPassFreq, float audioHighPassFreq, float FMDeemphasis);
1324
1345BB_API bbStatus bbInitiate(int device, uint32_t mode, uint32_t flag);
1346
1354BB_API bbStatus bbAbort(int device);
1355
1373BB_API bbStatus bbQueryTraceInfo(int device, uint32_t *traceLen, double *binSize, double *start);
1374
1389BB_API bbStatus bbQueryRealTimeInfo(int device, int *frameWidth, int *frameHeight);
1390
1402BB_API bbStatus bbQueryRealTimePoi(int device, double *poi);
1403
1417BB_API bbStatus bbQueryIQParameters(int device, double *sampleRate, double *bandwidth);
1418
1432BB_API bbStatus bbGetIQCorrection(int device, float *correction);
1433
1456BB_API bbStatus bbFetchTrace_32f(int device, int arraySize, float *traceMin, float *traceMax);
1457
1480BB_API bbStatus bbFetchTrace(int device, int arraySize, double *traceMin, double *traceMax);
1481
1510BB_API bbStatus bbFetchRealTimeFrame(int device, float *traceMin, float *traceMax, float *frame, float *alphaFrame);
1511
1533BB_API bbStatus bbGetIQ(int device, bbIQPacket *pkt);
1534
1584BB_API bbStatus bbGetIQUnpacked(int device, void *iqData, int iqCount, int *triggers,
1585 int triggerCount, int purge, int *dataRemaining,
1586 int *sampleLoss, int *sec, int *nano);
1587
1604BB_API bbStatus bbFetchAudio(int device, float *audio);
1605
1615BB_API bbStatus bbAttachTg(int device);
1616
1630BB_API bbStatus bbIsTgAttached(int device, bool *attached);
1631
1655BB_API bbStatus bbConfigTgSweep(int device, int sweepSize, bool highDynamicRange, bool passiveDevice);
1656
1678BB_API bbStatus bbStoreTgThru(int device, int flag);
1679
1694BB_API bbStatus bbSetTg(int device, double frequency, double amplitude);
1695
1715BB_API bbStatus bbGetTgFreqAmpl(int device, double *frequency, double *amplitude);
1716
1732BB_API bbStatus bbSetTgReference(int device, int reference);
1733
1743BB_API const char* bbGetAPIVersion();
1744
1750BB_API const char* bbGetProductID();
1751
1760BB_API const char* bbGetErrorString(bbStatus status);
1761
1762// Deprecated functions, use suggested alternatives
1763
1764// Use bbConfigureRefLevel instead
1765BB_API bbStatus bbConfigureLevel(int device, double ref, double atten);
1766// Use bbConfigureGainAtten instead
1767BB_API bbStatus bbConfigureGain(int device, int gain);
1768// Use bbQueryIQParameters instead
1769BB_API bbStatus bbQueryStreamInfo(int device, int *return_len, double *bandwidth, int *samples_per_sec);
1770
1771#ifdef __cplusplus
1772} // extern "C"
1773#endif
1774
1775// Deprecated macros, use alternatives where available
1776#define BB60_MIN_FREQ (BB_MIN_FREQ)
1777#define BB60_MAX_FREQ (BB_MAX_FREQ)
1778#define BB60_MAX_SPAN (BB_MAX_SPAN)
1779#define BB_MIN_BW (BB_MIN_RBW)
1780#define BB_MAX_BW (BB_MAX_RBW)
1781#define BB_MAX_ATTENUATION (30.0) // For deprecated bbConfigureLevel function
1782#define BB60C_MAX_GAIN (BB_MAX_GAIN)
1783#define BB_PORT1_INT_REF_OUT (0x00)
1784#define BB_PORT1_EXT_REF_IN (BB60C_PORT1_10MHZ_REF_IN)
1785#define BB_RAW_PIPE (BB_STREAMING)
1786#define BB_STREAM_IF (0x1) // No longer supported
1787// Use new device specific port 1 macros
1788#define BB_PORT1_AC_COUPLED (BB60C_PORT1_AC_COUPLED)
1789#define BB_PORT1_DC_COUPLED (BB60C_PORT1_DC_COUPLED)
1790#define BB_PORT1_10MHZ_USE_INT (BB60C_PORT1_10MHZ_USE_INT)
1791#define BB_PORT1_10MHZ_REF_OUT (BB60C_PORT1_10MHZ_REF_OUT)
1792#define BB_PORT1_10MHZ_REF_IN (BB60C_PORT1_10MHZ_REF_IN)
1793#define BB_PORT1_OUT_LOGIC_LOW (BB60C_PORT1_OUT_LOGIC_LOW)
1794#define BB_PORT1_OUT_LOGIC_HIGH (BB60C_PORT1_OUT_LOGIC_HIGH)
1795// Use new device specific port 2 macros
1796#define BB_PORT2_OUT_LOGIC_LOW (BB60C_PORT2_OUT_LOGIC_LOW)
1797#define BB_PORT2_OUT_LOGIC_HIGH (BB60C_PORT2_OUT_LOGIC_HIGH)
1798#define BB_PORT2_IN_TRIGGER_RISING_EDGE (BB60C_PORT2_IN_TRIG_RISING_EDGE)
1799#define BB_PORT2_IN_TRIGGER_FALLING_EDGE (BB60C_PORT2_IN_TRIG_FALLING_EDGE)
1800
1801#endif // BB_API_H
BB_API bbStatus bbConfigureIQTriggerSentinel(int sentinel)
bbDataType
Definition: bb_api.h:450
@ bbDataType32fc
Definition: bb_api.h:452
@ bbDataType16sc
Definition: bb_api.h:454
BB_API bbStatus bbDisableUARTStreaming(int device)
BB_API bbStatus bbSetTgReference(int device, int reference)
BB_API bbStatus bbAttachTg(int device)
bbPowerState
Definition: bb_api.h:460
@ bbPowerStateOn
Definition: bb_api.h:462
@ bbPowerStateStandby
Definition: bb_api.h:464
BB_API bbStatus bbConfigureGainAtten(int device, int gain, int atten)
BB_API bbStatus bbIsTgAttached(int device, bool *attached)
BB_API bbStatus bbOpenDeviceBySerialNumber(int *device, int serialNumber)
BB_API bbStatus bbDisableUARTSweeping(int device)
BB_API bbStatus bbConfigureIQ(int device, int downsampleFactor, double bandwidth)
BB_API bbStatus bbFetchTrace(int device, int arraySize, double *traceMin, double *traceMax)
BB_API bbStatus bbSetTg(int device, double frequency, double amplitude)
BB_API bbStatus bbGetSerialNumberList(int serialNumbers[BB_MAX_DEVICES], int *deviceCount)
BB_API bbStatus bbGetSerialNumberList2(int serialNumbers[BB_MAX_DEVICES], int deviceTypes[BB_MAX_DEVICES], int *deviceCount)
BB_API bbStatus bbSelfCal(int device)
BB_API bbStatus bbStoreTgThru(int device, int flag)
BB_API bbStatus bbConfigureProcUnits(int device, uint32_t units)
BB_API bbStatus bbGetIQCorrection(int device, float *correction)
BB_API bbStatus bbConfigureIQCenter(int device, double centerFreq)
BB_API bbStatus bbAbort(int device)
BB_API bbStatus bbConfigureAcquisition(int device, uint32_t detector, uint32_t scale)
BB_API bbStatus bbSyncCPUtoGPS(int comPort, int baudRate)
BB_API bbStatus bbQueryTraceInfo(int device, uint32_t *traceLen, double *binSize, double *start)
BB_API bbStatus bbConfigTgSweep(int device, int sweepSize, bool highDynamicRange, bool passiveDevice)
BB_API bbStatus bbEnableUARTStreaming(int device, const uint8_t *data, const uint32_t *counts, int states)
BB_API bbStatus bbConfigureSweepCoupling(int device, double rbw, double vbw, double sweepTime, uint32_t rbwShape, uint32_t rejection)
BB_API bbStatus bbConfigureCenterSpan(int device, double center, double span)
BB_API bbStatus bbGetSerialNumber(int device, uint32_t *serialNumber)
BB_API bbStatus bbGetTgFreqAmpl(int device, double *frequency, double *amplitude)
BB_API bbStatus bbInitiate(int device, uint32_t mode, uint32_t flag)
BB_API bbStatus bbConfigureRealTimeOverlap(int device, double advanceRate)
BB_API bbStatus bbGetIQ(int device, bbIQPacket *pkt)
BB_API bbStatus bbGetIQUnpacked(int device, void *iqData, int iqCount, int *triggers, int triggerCount, int purge, int *dataRemaining, int *sampleLoss, int *sec, int *nano)
BB_API bbStatus bbPresetFull(int *device)
BB_API bbStatus bbGetDeviceDiagnostics(int device, float *temperature, float *usbVoltage, float *usbCurrent)
BB_API const char * bbGetErrorString(bbStatus status)
BB_API bbStatus bbOpenDevice(int *device)
BB_API bbStatus bbConfigureIO(int device, uint32_t port1, uint32_t port2)
bbStatus
Definition: bb_api.h:344
@ bbGainNotSetErr
Definition: bb_api.h:390
@ bbAdjustedParameter
Definition: bb_api.h:428
@ bbGPSErr
Definition: bb_api.h:388
@ bbReferenceLevelErr
Definition: bb_api.h:348
@ bbAttenuationErr
Definition: bb_api.h:362
@ bbDeviceConnectionErr
Definition: bb_api.h:384
@ bbNoError
Definition: bb_api.h:423
@ bbDeviceNotConfiguredErr
Definition: bb_api.h:416
@ bbInvalidSweepTimeErr
Definition: bb_api.h:356
@ bbPacketFramingErr
Definition: bb_api.h:386
@ bbNoTriggerFound
Definition: bb_api.h:432
@ bbClampedToUpperLimit
Definition: bb_api.h:434
@ bbAllocationLimitErr
Definition: bb_api.h:403
@ bbBandwidthErr
Definition: bb_api.h:358
@ bbInvalidSpanErr
Definition: bb_api.h:366
@ bbNullPtrErr
Definition: bb_api.h:401
@ bbLibusbError
Definition: bb_api.h:375
@ bbTrackingGeneratorNotFound
Definition: bb_api.h:379
@ bbInvalidGainErr
Definition: bb_api.h:360
@ bbADCOverflow
Definition: bb_api.h:430
@ bbNotSupportedErr
Definition: bb_api.h:377
@ bbDataBreak
Definition: bb_api.h:440
@ bbUSBTimeoutErr
Definition: bb_api.h:382
@ bbInvalidModeErr
Definition: bb_api.h:346
@ bbDeviceNotOpenErr
Definition: bb_api.h:420
@ bbDeviceNotStreamingErr
Definition: bb_api.h:418
@ bbInvalidVideoUnitsErr
Definition: bb_api.h:350
@ bbUncalSweep
Definition: bb_api.h:442
@ bbInvalidDetectorErr
Definition: bb_api.h:370
@ bbInvalidParameterErr
Definition: bb_api.h:410
@ bbDeviceInvalidErr
Definition: bb_api.h:397
@ bbClampedToLowerLimit
Definition: bb_api.h:436
@ bbInvalidScaleErr
Definition: bb_api.h:368
@ bbBufferTooSmallErr
Definition: bb_api.h:399
@ bbUncalibratedDevice
Definition: bb_api.h:438
@ bbInvalidCalData
Definition: bb_api.h:444
@ bbInvalidFileSizeErr
Definition: bb_api.h:373
@ bbDeviceNotIdleErr
Definition: bb_api.h:395
@ bbDeviceAlreadyStreamingErr
Definition: bb_api.h:405
@ bbFrequencyRangeErr
Definition: bb_api.h:364
@ bbInvalidBandwidthTypeErr
Definition: bb_api.h:354
@ bbInvalidWindowErr
Definition: bb_api.h:352
BB_API bbStatus bbConfigureDemod(int device, int modulationType, double freq, float IFBW, float audioLowPassFreq, float audioHighPassFreq, float FMDeemphasis)
BB_API const char * bbGetAPIVersion()
BB_API bbStatus bbCloseDevice(int device)
BB_API bbStatus bbConfigureIQDataType(int device, bbDataType dataType)
BB_API bbStatus bbFetchAudio(int device, float *audio)
BB_API bbStatus bbQueryIQParameters(int device, double *sampleRate, double *bandwidth)
BB_API bbStatus bbFetchRealTimeFrame(int device, float *traceMin, float *traceMax, float *frame, float *alphaFrame)
BB_API bbStatus bbQueryRealTimeInfo(int device, int *frameWidth, int *frameHeight)
#define BB_MAX_DEVICES
Definition: bb_api.h:68
BB_API bbStatus bbGetFirmwareVersion(int device, int *version)
BB_API bbStatus bbQueryRealTimePoi(int device, double *poi)
BB_API bbStatus bbSetUARTRate(int device, int rate)
BB_API bbStatus bbPreset(int device)
BB_API const char * bbGetProductID()
BB_API bbStatus bbGetDeviceType(int device, int *deviceType)
BB_API bbStatus bbConfigureRefLevel(int device, double refLevel)
BB_API bbStatus bbFetchTrace_32f(int device, int arraySize, float *traceMin, float *traceMax)
BB_API bbStatus bbWriteUARTImm(int device, uint8_t data)
BB_API bbStatus bbEnableUARTSweeping(int device, const double *freqs, const uint8_t *data, int states)
BB_API bbStatus bbSetPowerState(int device, bbPowerState powerState)
BB_API bbStatus bbConfigureRealTime(int device, double frameScale, int frameRate)
BB_API bbStatus bbGetPowerState(int device, bbPowerState *powerState)
Definition: bb_api.h:288
int iqCount
Definition: bb_api.h:296
int triggerCount
Definition: bb_api.h:306
int dataRemaining
Definition: bb_api.h:316
int sec
Definition: bb_api.h:331
int * triggers
Definition: bb_api.h:304
int sampleLoss
Definition: bb_api.h:326
int purge
Definition: bb_api.h:314
int nano
Definition: bb_api.h:336
void * iqData
Definition: bb_api.h:294