### Perform an immediate segmented I/Q capture Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_segmented.html Configures the device for a single-segment immediate trigger capture and retrieves the I/Q data. This example is specific to SM200B and SM435B hardware. ```cpp // SM200B/SM435B only. // This example demonstrates setting up a single immediate triggered I/Q capture // using the 160MHz I/Q capture capabilities of the SM200B/SM435B. This examples uses the // convenience function for completing the capture. See the "imm_manual" example for a full // example. #include "sm_api.h" #include void sm_example_segmented_iq_imm_simple() { // Number of I/Q samples, 50 million, 1/5th of a second const int CAPTURE_LEN = 50e6; int handle = -1; SmStatus status = smOpenDevice(&handle); if(status != smNoError) { // Unable to open device const char *errStr = smGetErrorString(status); return; } // Verify device has segmented I/Q capture capability SmDeviceType deviceType; smGetDeviceInfo(handle, &deviceType, 0); if(deviceType != smDeviceTypeSM200B && deviceType != smDeviceTypeSM435B) { // Invalid device type smCloseDevice(handle); return; } // Set device reference level, maximum expected input signal status = smSetRefLevel(handle, 0.0); // Configure the 160MHz capture status = smSetSegIQDataType(handle, smDataType32fc); status = smSetSegIQCenterFreq(handle, 2.45e9); // Setup a single segment capture status = smSetSegIQSegmentCount(handle, 1); status = smSetSegIQSegment(handle, 0, smTriggerTypeImm, 0, CAPTURE_LEN, 0.0); status = smConfigure(handle, smModeIQSegmentedCapture); if(status != smNoError) { // Unable to configure device const char *errStr = smGetErrorString(status); return; } // 2 floats for each I/Q sample std::vector buf(CAPTURE_LEN * 2); int64_t nsSinceEpoch = 0; SmBool timedOut = smFalse; // This example uses the convenience function for completing the capture. // See the manual example for performing the full sequence of capture functions. // Immediate triggered acquisitions can't time out, so we ignore the timeout. status = smSegIQCaptureFull(handle, 0, buf.data(), 0, CAPTURE_LEN, &nsSinceEpoch, &timedOut); // Do something with data smAbort(handle); smCloseDevice(handle); } ``` -------------------------------- ### Configure and Stream I/Q Data Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Demonstrates the workflow for opening a device, configuring I/Q parameters, and streaming data into a buffer. ```cpp // Configure the device for I/Q streaming and stream for a period of time // This example assumes a USB 3.0 SM device. #include #include #include #include "sm_api.h" void sm_example_iq_stream() { int handle = -1; SmStatus status = smNoError; // Uncomment this to open a USB SM device status = smOpenDevice(&handle); // Uncomment this to open a networked SM device with a default network config //status = smOpenNetworkedDevice(&handle, SM_ADDR_ANY, SM_DEFAULT_ADDR, SM_DEFAULT_PORT); // Check open status if(status != smNoError) { printf("Unable to open device\n"); exit(-1); } // Configure the receiver for IQ acquisition smSetRefLevel(handle, -20.0); // -20 dBm reference level smSetIQCenterFreq(handle, 900.0e6); // 900MHz center frequency smSetIQBaseSampleRate(handle, smIQStreamSampleRateNative); // Use native 50MS/s base sample rate. smSetIQSampleRate(handle, 2); // 50 / 2 = 25MS/s IQ smSetIQBandwidth(handle, smTrue, 20.0e6); // 20MHz of bandwidth smSetIQDataType(handle, smDataType32fc); // Initialize the receiver with the above settings status = smConfigure(handle, smModeIQ); if(status != smNoError) { printf("Unable to configure device\n"); printf("%s\n", smGetErrorString(status)); smCloseDevice(handle); exit(-1); } // Query the receiver IQ stream characteristics // Should match what we set earlier double actualSampleRate, actualBandwidth; smGetIQParameters(handle, &actualSampleRate, &actualBandwidth); // Allocate memory for complex sample, IQ pairs interleaved int bufLen = 16384; std::vector iqBuf(bufLen * 2); // Let's acquire 5 second worth of data int samplesNeeded = 5 * (int)actualSampleRate; while(samplesNeeded > 0) { // Notice the purge parameter is set to false, so that each time // the get IQ function is called, the next contiguous block of data // is returned. smGetIQ(handle, &iqBuf[0], bufLen, 0, 0, 0, smFalse, 0, 0); // Process/store data here // Data is interleaved 32-bit complex values // Need bufLen less samples samplesNeeded -= bufLen; } // Finished smCloseDevice(handle); } ``` -------------------------------- ### Calculate Frequency for Sweep Elements Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sweep_mode.html Formula to determine the frequency of a specific element in a sweep array using start frequency and bin size. ```text Frequency of N'th element in sweep = StartFreq + N * BinSize ``` -------------------------------- ### Configure and Retrieve Real-Time Spectrum Data Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/real_time.html Demonstrates the full workflow for initializing a device, configuring real-time parameters, and retrieving sweep and frame data. ```cpp #include #include #include "sm_api.h" static void checkStatus(SmStatus status) { if(status > 0) { // Warning printf("Warning: %s\n", smGetErrorString(status)); return; } else if(status < 0) { // Error printf("Error: %s\n", smGetErrorString(status)); exit(-1); } } void sm_example_real_time() { int handle = -1; SmStatus status = smNoError; // Uncomment this to open a USB SM device status = smOpenDevice(&handle); // Uncomment this to open a networked SM device with a default network config //status = smOpenNetworkedDevice(&handle, SM_ADDR_ANY, SM_DEFAULT_ADDR, SM_DEFAULT_PORT); // Check open status checkStatus(status); // Configure the measurement smSetRefLevel(handle, -20.0); // -20dBm reference level smSetRealTimeCenterSpan(handle, 2.45e9, 160.0e6); // 160MHz span at 2.45GHz center freq smSetRealTimeRBW(handle, 30.0e3); // 30kHz min RBW with Nuttall window smSetRealTimeDetector(handle, smDetectorMinMax); smSetRealTimeScale(handle, smScaleLog, -20.0, 100.0); // On the frame, ref of -20, 100dB height smSetRealTimeWindow(handle, smWindowNutall); // Initialize the measurement status = smConfigure(handle, smModeRealTime); checkStatus(status); // Get the configured measurement parameters as reported by the receiver double actualRBW, actualStart, binSize, poi; int sweepSize, frameWidth, frameHeight; smGetRealTimeParameters(handle, &actualRBW, &sweepSize, &actualStart, &binSize, &frameWidth, &frameHeight, &poi); // Create memory for our sweep and frame float *sweep = new float[sweepSize]; float *frame = new float[frameWidth * frameHeight]; // Retrieve a series of sweeps/frames for(int i = 0; i < 100; i++) { // Retrieve just the color frame and max sweep. smGetRealTimeFrame(handle, frame, nullptr, nullptr, sweep, nullptr, nullptr); // Do something with data here } // Done with the device smAbort(handle); smCloseDevice(handle); // Clean up delete [] sweep; delete [] frame; } ``` -------------------------------- ### Configure and Perform a Single Sweep Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sweep_mode.html Demonstrates initializing a device, configuring sweep parameters, and retrieving sweep data. ```cpp // Configure the device for sweeps and perform a single sweep. #include #include #include #include "sm_api.h" void sm_example_sweep() { int handle = -1; SmStatus status = smNoError; // Uncomment this to open a USB SM device status = smOpenDevice(&handle); // Uncomment this to open a networked SM device with a default network config //status = smOpenNetworkedDevice(&handle, SM_ADDR_ANY, SM_DEFAULT_ADDR, SM_DEFAULT_PORT); // Check open status if(status != smNoError) { printf("Unable to open device\n"); exit(-1); } // Configure the sweep smSetRefLevel(handle, -20.0); // -20dBm reference level smSetSweepCenterSpan(handle, 2.45e9, 100.0e6); // ISM band smSetSweepCoupling(handle, 10.0e3, 10.0e3, 0.001); // 10kHz rbw/vbw, 1ms acquisition smSetSweepDetector(handle, smDetectorAverage, smVideoPower); // average power detector smSetSweepScale(handle, smScaleLog); // return sweep in dBm smSetSweepWindow(handle, smWindowFlatTop); smSetSweepSpurReject(handle, smFalse); // No software spur reject // Initialize the device for sweep measurement mode status = smConfigure(handle, smModeSweeping); if(status != smNoError) { printf("Unable to configure device\n"); printf("%s\n", smGetErrorString(status)); smCloseDevice(handle); exit(-1); } // Get the configured sweep parameters as reported by the receiver double actualRBW, actualVBW, actualStartFreq, binSize; int sweepSize; smGetSweepParameters(handle, &actualRBW, &actualVBW, &actualStartFreq, &binSize, &sweepSize); // Create memory for our sweep std::vector sweep(sweepSize); // Get sweep, ignore the min sweep and the sweep time status = smGetSweep(handle, nullptr, sweep.data(), nullptr); if(status != smNoError) { printf("Sweep status: %s\n", smGetErrorString(status)); } // Done with the device smCloseDevice(handle); } ``` -------------------------------- ### Retrieve VRT Context and Data Packets in C++ Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_v_r_t.html Demonstrates the workflow for opening a networked device, configuring VRT streaming parameters, allocating memory, and fetching context and data packets. ```cpp /* * Get a VRT Context packet from a Signal Hound SM Series device followed by a block of 1000 Signal Data packets * */ #include "sm_api.h" #include "sm_api_vrt.h" #pragma comment(lib, "sm_api") void getVRTPackets() { // Set up device int device = -1; //SmStatus status = smOpenDevice(&device); // USB SmStatus status = smOpenNetworkedDevice(&device, SM_ADDR_ANY, SM_DEFAULT_ADDR, SM_DEFAULT_PORT); // Networked if(status != smNoError) { // Could not open Sm Series device } // Set IQ parameters smSetIQCenterFreq(device, 3.0e9); smSetIQSampleRate(device, 2); smSetIQBandwidth(device, smTrue, 20.0e6); smSetRefLevel(device, -20); // Set VRt parameters smSetVrtStreamID(device, 1); smSetVrtPacketSize(device, 16384); // Configure status = smConfigure(device, smModeIQStreaming); // VRT mode if(status != smNoError) { // Could not configure SM Series device } // Allocate memory uint32_t contextWordCount; status = smGetVrtContextPktSize(device, &contextWordCount); if(status != smNoError) { // Could not get context packet size } const int dataPacketCount = 1000; uint16_t samplesPerPkt; uint32_t dataWordCount; status = smGetVrtPacketSize(device, &samplesPerPkt, &dataWordCount); if(status != smNoError) { // Could not get data packet size and word count } uint32_t wordCount = contextWordCount + dataWordCount * dataPacketCount; uint32_t *words = new uint32_t[wordCount]; uint32_t *curr = words; // Get context packet uint32_t actualContextWordCount; status = smGetVrtContextPkt(device, curr, &actualContextWordCount); if(status != smNoError) { // Could not get context packet } if(actualContextWordCount != contextWordCount) { // Context packet is not the expected size } curr += contextWordCount; // Get data packets uint32_t actualDataWordCount; status = smGetVrtPackets(device, curr, &actualDataWordCount, dataPacketCount, smFalse); if(status != smNoError) { // Could not get data packets } if(actualDataWordCount != dataWordCount * dataPacketCount) { // Block of data packets is not the expected size } smCloseDevice(device); if(words) delete[] words; } ``` -------------------------------- ### smGetIQ Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Retrieves I/Q samples from the device. ```APIDOC ## smGetIQ ### Description Retrieves a block of I/Q samples from the device buffer. ### Signature `SmStatus smGetIQ(int device, void *iqBuf, int iqBufSize, double *triggers, int triggerBufSize, int64_t *nsSinceEpoch, SmBool purge, int *sampleLoss, int *samplesRemaining)` ``` -------------------------------- ### smIQSweepListGetSweep Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_sweep_list.html Executes the configured I/Q sweep list and retrieves the data. ```APIDOC ## smIQSweepListGetSweep ### Description Performs the I/Q sweep list capture and populates the provided buffer with the resulting data and timestamps. ### Signature `SmStatus smIQSweepListGetSweep(int device, void *dst, int64_t *timestamps)` ### Parameters - **device** (int) - The device handle. - **dst** (void*) - Pointer to the memory buffer to store the I/Q data. - **timestamps** (int64_t*) - Pointer to an array to store the timestamps for each step. ``` -------------------------------- ### Real-Time Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring real-time analysis parameters. ```c SM_API SmStatus smSetRealTimeCenterSpan(int device, double centerFreqHz, double spanHz); ``` ```c SM_API SmStatus smSetRealTimeRBW(int device, double rbw); ``` ```c SM_API SmStatus smSetRealTimeDetector(int device, SmDetector detector); ``` ```c SM_API SmStatus smSetRealTimeScale(int device, SmScale scale, double frameRef, double frameScale); ``` ```c SM_API SmStatus smSetRealTimeWindow(int device, SmWindowType window); ``` -------------------------------- ### smConfigure Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Configures the device mode. ```APIDOC ## smConfigure ### Description Applies the current settings to the device for a specific mode (e.g., I/Q streaming). ### Signature `SmStatus smConfigure(int device, SmMode mode)` ``` -------------------------------- ### IQ Streaming Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring IQ data streaming parameters. ```c SM_API SmStatus smSetIQBaseSampleRate(int device, SmIQStreamSampleRate sampleRate); ``` ```c SM_API SmStatus smSetIQDataType(int device, SmDataType dataType); ``` ```c SM_API SmStatus smSetIQCenterFreq(int device, double centerFreqHz); ``` ```c SM_API SmStatus smGetIQCenterFreq(int device, double *centerFreqHz); ``` ```c SM_API SmStatus smSetIQSampleRate(int device, int decimation); ``` ```c SM_API SmStatus smSetIQBandwidth(int device, SmBool enableSoftwareFilter, double bandwidth); ``` ```c SM_API SmStatus smSetIQExtTriggerEdge(int device, SmTriggerEdge edge); ``` ```c SM_API SmStatus smSetIQTriggerSentinel(double sentinelValue); ``` ```c SM_API SmStatus smSetIQQueueSize(int device, float ms); ``` -------------------------------- ### smGetDeviceList Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Enumerates all connected Signal Hound devices. ```APIDOC ## smGetDeviceList ### Description Retrieves a list of serial numbers for all currently connected devices. ### Signature `SmStatus smGetDeviceList(int *serials, int *deviceCount)` ``` -------------------------------- ### smOpenDevice Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Opens a connection to a Signal Hound SM device. ```APIDOC ## smOpenDevice ### Description Opens a connection to a Signal Hound SM device and returns a device handle. ### Signature `SmStatus smOpenDevice(int *device)` ``` -------------------------------- ### smOpenDevice Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Opens a USB SM device. ```APIDOC ## smOpenDevice ### Description Opens a connection to a USB SM device. ### Signature `SmStatus smOpenDevice(int *device)` ``` -------------------------------- ### SM API Structures Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Data structures for GPIO steps and device diagnostics. ```c typedef struct SmGPIOStep { double freq; uint8_t mask; } SmGPIOStep; ``` ```c typedef struct SmDeviceDiagnostics { float voltage; float currentInput; float currentOCXO; float current58; float tempFPGAInternal; float tempFPGANear; float tempOCXO; float tempVCO; float tempRFBoardLO; float tempPowerSupply; } SmDeviceDiagnostics; ``` -------------------------------- ### Device Management Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for discovering, opening, and closing SM devices. ```c SM_API SmStatus smGetDeviceList(int *serials, int *deviceCount); ``` ```c SM_API SmStatus smGetDeviceList2(int *serials, SmDeviceType *deviceTypes, int *deviceCount); ``` ```c SM_API SmStatus smOpenDevice(int *device); ``` ```c SM_API SmStatus smOpenDeviceBySerial(int *device, int serialNumber); ``` ```c SM_API SmStatus smOpenNetworkedDevice(int *device, const char *hostAddr, const char *deviceAddr, uint16_t port); ``` ```c SM_API SmStatus smCloseDevice(int device); ``` -------------------------------- ### smGetIQParameters Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Queries the current I/Q stream characteristics. ```APIDOC ## smGetIQParameters ### Description Returns the actual sample rate and bandwidth currently configured for the I/Q stream. ### Signature `SmStatus smGetIQParameters(int device, double *sampleRate, double *bandwidth)` ``` -------------------------------- ### Device Configuration Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for setting device parameters such as attenuation, reference levels, and preselector state. ```APIDOC ## smSetAttenuator ### Description Sets the hardware attenuator value. ### Parameters - **device** (int) - Device handle - **atten** (int) - Attenuation value in dB ## smSetRefLevel ### Description Sets the reference level for the device. ### Parameters - **device** (int) - Device handle - **refLevel** (double) - Reference level in dBm ``` -------------------------------- ### Hardware Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for controlling power states, attenuators, reference levels, and GPIO settings. ```c SM_API SmStatus smSetPowerState(int device, SmPowerState powerState); SM_API SmStatus smGetPowerState(int device, SmPowerState *powerState); SM_API SmStatus smSetAttenuator(int device, int atten); SM_API SmStatus smGetAttenuator(int device, int *atten); SM_API SmStatus smSetRefLevel(int device, double refLevel); SM_API SmStatus smGetRefLevel(int device, double *refLevel); SM_API SmStatus smSetPreselector(int device, SmBool enabled); SM_API SmStatus smGetPreselector(int device, SmBool *enabled); SM_API SmStatus smSetGPIOState(int device, SmGPIOState lowerState, SmGPIOState upperState); SM_API SmStatus smGetGPIOState(int device, SmGPIOState *lowerState, SmGPIOState *upperState); SM_API SmStatus smWriteGPIOImm(int device, uint8_t data); SM_API SmStatus smReadGPIOImm(int device, uint8_t *data); SM_API SmStatus smWriteSPI(int device, uint32_t data, int byteCount); SM_API SmStatus smSetGPIOSweepDisabled(int device); SM_API SmStatus smSetGPIOSweep(int device, SmGPIOStep *steps, int stepCount); SM_API SmStatus smSetGPIOSwitchingDisabled(int device); SM_API SmStatus smSetGPIOSwitching(int device, uint8_t *gpio, uint32_t *counts, int gpioSteps); SM_API SmStatus smSetExternalReference(int device, SmBool enabled); SM_API SmStatus smGetExternalReference(int device, SmBool *enabled); SM_API SmStatus smSetReference(int device, SmReference reference); SM_API SmStatus smGetReference(int device, SmReference *reference); ``` -------------------------------- ### smOpenDeviceBySerial Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Opens a connection to a specific Signal Hound device using its serial number. ```APIDOC ## smOpenDeviceBySerial ### Description Initializes a connection to a device identified by its serial number. ### Signature `SmStatus smOpenDeviceBySerial(int *device, int serialNumber)` ``` -------------------------------- ### Audio Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring audio demodulation parameters. ```c SM_API SmStatus smSetAudioCenterFreq(int device, double centerFreqHz); ``` ```c SM_API SmStatus smSetAudioType(int device, SmAudioType audioType); ``` ```c SM_API SmStatus smSetAudioFilters(int device, double ifBandwidth, double audioLpf, double audioHpf); ``` ```c SM_API SmStatus smSetAudioFMDeemphasis(int device, double deemphasis); ``` -------------------------------- ### smStartSweep Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Initiates a sweep operation on the specified device. ```APIDOC ## smStartSweep ### Description Starts a sweep at the specified position. ### Signature `SmStatus smStartSweep(int device, int pos)` ``` -------------------------------- ### Network Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for managing network-connected devices. ```c SM_API SmStatus smBroadcastNetworkConfig(const char *hostAddr, const char *deviceAddr, uint16_t port, SmBool nonVolatile); ``` ```c SM_API SmStatus smNetworkConfigGetDeviceList(int *serials, int *deviceCount); ``` ```c SM_API SmStatus smNetworkConfigOpenDevice(int *device, int serialNumber); ``` ```c SM_API SmStatus smNetworkConfigCloseDevice(int device); ``` ```c SM_API SmStatus smNetworkConfigGetMAC(int device, char *mac); ``` ```c SM_API SmStatus smNetworkConfigSetIP(int device, const char *addr, SmBool nonVolatile); ``` ```c SM_API SmStatus smNetworkConfigGetIP(int device, char *addr); ``` ```c SM_API SmStatus smNetworkConfigSetPort(int device, int port, SmBool nonVolatile); ``` ```c SM_API SmStatus smNetworkConfigGetPort(int device, int *port); ``` -------------------------------- ### smNetworkConfigOpenDevice Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Opens a network-connected device by serial number. ```APIDOC ## smNetworkConfigOpenDevice ### Description Attempts to open a connection to a network device using its serial number. ### Signature SmStatus smNetworkConfigOpenDevice(int *device, int serialNumber); ``` -------------------------------- ### smGetGPIOState Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current state of the GPIO. ```APIDOC ## smGetGPIOState ### Signature `SmStatus smGetGPIOState(int device, SmGPIOState *lowerState, SmGPIOState *upperState)` ``` -------------------------------- ### smOpenNetworkedDevice Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Opens a connection to a networked Signal Hound device. ```APIDOC ## smOpenNetworkedDevice ### Description Establishes a connection to a networked device using the provided host and device addresses. ### Signature SmStatus smOpenNetworkedDevice(int *device, const char *hostAddr, const char *deviceAddr, uint16_t port) ``` -------------------------------- ### IQ Sweep List Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring IQ sweep list parameters. ```c SM_API SmStatus smSetIQSweepListDataType(int device, SmDataType dataType); ``` ```c SM_API SmStatus smSetIQSweepListCorrected(int device, SmBool corrected); ``` ```c SM_API SmStatus smSetIQSweepListSteps(int device, int steps); ``` ```c SM_API SmStatus smGetIQSweepListSteps(int device, int *steps); ``` ```c SM_API SmStatus smSetIQSweepListFreq(int device, int step, double freq); ``` ```c SM_API SmStatus smSetIQSweepListRef(int device, int step, double level); ``` ```c SM_API SmStatus smSetIQSweepListAtten(int device, int step, int atten); ``` ```c SM_API SmStatus smSetIQSweepListSampleCount(int device, int step, uint32_t samples); ``` -------------------------------- ### IQ Full Band Configuration and Acquisition Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring and acquiring full-band IQ data. ```c SM_API SmStatus smSetIQFullBandAtten(int device, int atten); ``` ```c SM_API SmStatus smSetIQFullBandCorrected(int device, SmBool corrected); ``` ```c SM_API SmStatus smSetIQFullBandSamples(int device, int samples); ``` ```c SM_API SmStatus smSetIQFullBandTriggerType(int device, SmTriggerType triggerType); ``` ```c SM_API SmStatus smSetIQFullBandVideoTrigger(int device, double triggerLevel); ``` ```c SM_API SmStatus smSetIQFullBandTriggerTimeout(int device, double triggerTimeout); ``` ```c SM_API SmStatus smGetIQFullBand(int device, float *iq, int freq); ``` ```c SM_API SmStatus smGetIQFullBandSweep(int device, float *iq, int startIndex, int stepSize, int steps); ``` -------------------------------- ### Device Management Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for discovering, opening, and closing SM series devices. ```APIDOC ## smGetDeviceList ### Description Retrieves a list of connected device serial numbers. ### Parameters - **serials** (int*) - Output array for serial numbers - **deviceCount** (int*) - Output for number of devices found ## smOpenDevice ### Description Opens a connection to a specific device. ### Parameters - **device** (int*) - Output handle for the opened device ``` -------------------------------- ### smGetDeviceInfo Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves information about the connected device. ```APIDOC ## smGetDeviceInfo ### Description Retrieves the device type and serial number for a given device handle. ### Signature `SmStatus smGetDeviceInfo(int device, SmDeviceType *deviceType, int *serialNumber)` ``` -------------------------------- ### smSetIQBandwidth Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Configures the I/Q bandwidth. ```APIDOC ## smSetIQBandwidth ### Description Sets the bandwidth for I/Q acquisition and enables/disables the software filter. ### Signature `SmStatus smSetIQBandwidth(int device, SmBool enableSoftwareFilter, double bandwidth)` ``` -------------------------------- ### Segmented IQ Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring segmented IQ capture parameters. ```c SM_API SmStatus smSetSegIQDataType(int device, SmDataType dataType); ``` ```c SM_API SmStatus smSetSegIQCenterFreq(int device, double centerFreqHz); ``` ```c SM_API SmStatus smSetSegIQVideoTrigger(int device, double triggerLevel, SmTriggerEdge triggerEdge); ``` ```c SM_API SmStatus smSetSegIQExtTrigger(int device, SmTriggerEdge extTriggerEdge); ``` ```c SM_API SmStatus smSetSegIQFMTParams(int device, int fftSize, const double *frequencies, const double *ampls, int count); ``` ```c SM_API SmStatus smSetSegIQSegmentCount(int device, int segmentCount); ``` ```c SM_API SmStatus smSetSegIQSegment(int device, int segment, SmTriggerType triggerType, int preTrigger, int captureSize, double timeoutSeconds); ``` -------------------------------- ### smSetGPIOSwitching Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Configures GPIO switching parameters. ```APIDOC ## smSetGPIOSwitching ### Signature `SmStatus smSetGPIOSwitching(int device, uint8_t *gpio, uint32_t *counts, int gpioSteps)` ``` -------------------------------- ### smGetRefLevel Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current reference level. ```APIDOC ## smGetRefLevel ### Signature `SmStatus smGetRefLevel(int device, double *refLevel)` ``` -------------------------------- ### smSegIQCaptureFull Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_segmented.html Performs a full segmented I/Q capture operation. ```APIDOC ## smSegIQCaptureFull ### Description Performs a full segmented I/Q capture. This is a convenience function that handles the capture sequence for a specific segment. ### Signature SmStatus smSegIQCaptureFull(int device, int capture, void *iq, int offset, int len, int64_t *nsSinceEpoch, SmBool *timedOut) ### Parameters - **device** (int) - The device handle. - **capture** (int) - The capture index. - **iq** (void*) - Pointer to the buffer to store I/Q data. - **offset** (int) - Offset in the buffer. - **len** (int) - Number of samples to capture. - **nsSinceEpoch** (int64_t*) - Pointer to store the timestamp of the capture. - **timedOut** (SmBool*) - Pointer to store the timeout status. ``` -------------------------------- ### smGetAPIVersion Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current API version string. ```APIDOC ## smGetAPIVersion ### Description Returns a string representing the current version of the SM API. ### Signature const char* smGetAPIVersion(); ``` -------------------------------- ### Deprecated API Functions and Macros Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Legacy functions and macros that are deprecated. ```c SM_DEPRECATED("smSetIQUSBQueueSize has been deprecated, use smSetIQQueueSize") SM_API SmStatus smSetIQUSBQueueSize(int device, float ms); ``` ```c #define SM200A_AUTO_ATTEN (SM_AUTO_ATTEN) #define SM200A_MAX_ATTEN (SM_MAX_ATTEN) #define SM200A_MAX_REF_LEVEL (SM_MAX_REF_LEVEL) #define SM200A_MAX_SWEEP_QUEUE_SZ (SM_MAX_SWEEP_QUEUE_SZ) #define SM200A_MIN_FREQ (SM200_MIN_FREQ) #define SM200A_MAX_FREQ (SM200_MAX_FREQ) #define SM200A_MAX_IQ_DECIMATION (SM_MAX_IQ_DECIMATION) #define SM200A_PRESELECTOR_MAX_FREQ (SM_PRESELECTOR_MAX_FREQ) #define SM200A_FAST_SWEEP_MIN_RBW (SM_FAST_SWEEP_MIN_RBW) #define SM200A_RTSA_MIN_SPAN (SM_REAL_TIME_MIN_SPAN) ``` -------------------------------- ### smGetSweep Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sweep_mode.html Retrieves the sweep data from the device. ```APIDOC ## smGetSweep ### Description Acquires a single sweep from the device. ### Signature `SmStatus smGetSweep(int device, float *sweepMin, float *sweepMax, int64_t *nsSinceEpoch)` ``` -------------------------------- ### Diagnostics Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for retrieving device health, temperature, and power information. ```APIDOC ## smGetDeviceDiagnostics ### Description Retrieves basic diagnostic information including voltage, current, and temperature. ### Parameters - **device** (int) - Device handle - **voltage** (float*) - Output voltage - **current** (float*) - Output current - **temperature** (float*) - Output temperature ## smGetFullDeviceDiagnostics ### Description Retrieves comprehensive diagnostic data structure. ### Parameters - **device** (int) - Device handle - **diagnostics** (SmDeviceDiagnostics*) - Output structure containing detailed diagnostic metrics ``` -------------------------------- ### Calculate Sample Power from 32-bit Complex Floats Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/index.html Calculate the power in dBm for a single I/Q sample represented as 32-bit complex floats. ```C Sample Power (dBm) = 10.0 * log10(re*re + im*im); ``` -------------------------------- ### smGetRealTimeParameters Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/real_time.html Retrieves the current real-time measurement parameters. ```APIDOC ## smGetRealTimeParameters ### Description Returns the actual parameters currently in use by the receiver for real-time mode. ### Signature `SmStatus smGetRealTimeParameters(int device, double *actualRBW, int *sweepSize, double *actualStartFreq, double *binSize, int *frameWidth, int *frameHeight, double *poi)` ### Parameters - **device** (int) - The device handle. - **actualRBW** (double*) - Pointer to store the actual RBW. - **sweepSize** (int*) - Pointer to store the sweep size. - **actualStartFreq** (double*) - Pointer to store the actual start frequency. - **binSize** (double*) - Pointer to store the bin size. - **frameWidth** (int*) - Pointer to store the frame width. - **frameHeight** (int*) - Pointer to store the frame height. - **poi** (double*) - Pointer to store the probability of intercept. ``` -------------------------------- ### smGetIQ Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves IQ data from the device. ```APIDOC ## smGetIQ ### Description Retrieves IQ data, trigger information, and status from the device. ### Signature SmStatus smGetIQ(int device, void *iqBuf, int iqBufSize, double *triggers, int triggerBufSize, int64_t *nsSinceEpoch, SmBool purge, int *sampleLoss, int *samplesRemaining); ``` -------------------------------- ### smGetDeviceList2 Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves a list of connected devices, their serial numbers, and types. ```APIDOC ## smGetDeviceList2 ### Description Retrieves a list of connected devices, their serial numbers, and types. ### Signature `SmStatus smGetDeviceList2(int *serials, SmDeviceType *deviceTypes, int *deviceCount)` ``` -------------------------------- ### smSetRealTimeWindow Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/real_time.html Sets the windowing function for real-time measurements. ```APIDOC ## smSetRealTimeWindow ### Description Sets the window function used for real-time FFT processing. ### Signature `SmStatus smSetRealTimeWindow(int device, SmWindowType window)` ### Parameters - **device** (int) - The device handle. - **window** (SmWindowType) - The window type (e.g., smWindowNutall). ``` -------------------------------- ### smGetSFPDiagnostics Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves SFP diagnostic data including temperature, voltage, and power levels. ```APIDOC ## smGetSFPDiagnostics ### Signature `SmStatus smGetSFPDiagnostics(int device, float *temp, float *voltage, float *txPower, float *rxPower)` ``` -------------------------------- ### smGetAPIVersion Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current version of the API. ```APIDOC ## smGetAPIVersion ### Description Returns a string representing the current API version. ### Signature `const char * smGetAPIVersion()` ``` -------------------------------- ### Audio and GPS Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for audio retrieval and GPS device management. ```c SM_API SmStatus smGetAudio(int device, float *audio); ``` ```c SM_API SmStatus smGetGPSInfo(int device, SmBool refresh, SmBool *updated, int64_t *secSinceEpoch, double *latitude, double *longitude, double *altitude, char *nmea, int *nmeaLen); ``` ```c SM_API SmStatus smWriteToGPS(int device, const uint8_t *mem, int len); ``` ```c SM_API SmStatus smSetGPSPlatformModel(int device, SmGPSPlatformModel platformModel); ``` -------------------------------- ### Device Information and Diagnostics Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions to retrieve device metadata, firmware versions, and diagnostic data. ```c SM_API SmStatus smPreset(int device); SM_API SmStatus smPresetSerial(int serialNumber); SM_API SmStatus smNetworkedSpeedTest(int device, double durationSeconds, double *bytesPerSecond); SM_API SmStatus smGetDeviceInfo(int device, SmDeviceType *deviceType, int *serialNumber); SM_API SmStatus smGetFirmwareVersion(int device, int *major, int *minor, int *revision); SM_API SmStatus smHasIFOutput(int device, SmBool *present); SM_API SmStatus smGetDeviceDiagnostics(int device, float *voltage, float *current, float *temperature); SM_API SmStatus smGetFullDeviceDiagnostics(int device, SmDeviceDiagnostics *diagnostics); SM_API SmStatus smGetSFPDiagnostics(int device, float *temp, float *voltage, float *txPower, float *rxPower); ``` -------------------------------- ### smFinishSweep Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Completes a sweep operation and retrieves the resulting data. ```APIDOC ## smFinishSweep ### Description Finalizes the sweep and returns the minimum and maximum values along with the timestamp. ### Signature `SmStatus smFinishSweep(int device, int pos, float *sweepMin, float *sweepMax, int64_t *nsSinceEpoch)` ``` -------------------------------- ### Device Control and Status Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html General functions for device mode configuration, status, and data retrieval. ```c SM_API SmStatus smConfigure(int device, SmMode mode); ``` ```c SM_API SmStatus smGetCurrentMode(int device, SmMode *mode); ``` ```c SM_API SmStatus smAbort(int device); ``` ```c SM_API SmStatus smGetSweepParameters(int device, double *actualRBW, double *actualVBW, double *actualStartFreq, double *binSize, int *sweepSize); ``` ```c SM_API SmStatus smGetRealTimeParameters(int device, double *actualRBW, int *sweepSize, double *actualStartFreq, double *binSize, int *frameWidth, int *frameHeight, double *poi); ``` ```c SM_API SmStatus smGetIQParameters(int device, double *sampleRate, double *bandwidth); ``` ```c SM_API SmStatus smGetIQCorrection(int device, float *scale); ``` ```c SM_API SmStatus smIQSweepListGetCorrections(int device, float *corrections); ``` ```c SM_API SmStatus smSegIQGetMaxCaptures(int device, int *maxCaptures); ``` ```c SM_API SmStatus smGetSweep(int device, float *sweepMin, float *sweepMax, int64_t *nsSinceEpoch); ``` -------------------------------- ### Device Maintenance and Utility Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for fan control, calibration dates, and general device information. ```c SM_API SmStatus smSetFanThreshold(int device, int temp); ``` ```c SM_API SmStatus smGetFanThreshold(int device, int *temp); ``` ```c SM_API SmStatus smSetIFOutput(int device, double frequency); ``` ```c SM_API SmStatus smGetCalDate(int device, uint64_t *lastCalDate); ``` ```c SM_API const char* smGetAPIVersion(); ``` ```c SM_API const char* smGetErrorString(SmStatus status); ``` -------------------------------- ### Convert 16-bit Complex Shorts to Corrected I/Q Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/index.html Convert 16-bit complex short data to corrected float values for power measurement. ```C float re32f = ((float)re16s / 32768.0); float im32f = ((float)im16s / 32768.0); re32f *= correction; im32f *= correction; Sample Power (dBm) = 10.0 * log10(re32f*re32f + im32f*im32f); ``` -------------------------------- ### smGetDeviceDiagnostics Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves diagnostic information including voltage, current, and temperature for the specified device. ```APIDOC ## smGetDeviceDiagnostics ### Description Retrieves the current diagnostic metrics for a connected device. ### Signature `SmStatus smGetDeviceDiagnostics(int device, float *voltage, float *current, float *temperature)` ``` -------------------------------- ### Sweep Configuration Functions Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for configuring sweep parameters such as speed, frequency range, coupling, and detectors. ```c SM_API SmStatus smSetSweepSpeed(int device, SmSweepSpeed sweepSpeed); ``` ```c SM_API SmStatus smSetSweepCenterSpan(int device, double centerFreqHz, double spanHz); ``` ```c SM_API SmStatus smSetSweepStartStop(int device, double startFreqHz, double stopFreqHz); ``` ```c SM_API SmStatus smSetSweepCoupling(int device, double rbw, double vbw, double sweepTime); ``` ```c SM_API SmStatus smSetSweepDetector(int device, SmDetector detector, SmVideoUnits videoUnits); ``` ```c SM_API SmStatus smSetSweepScale(int device, SmScale scale); ``` ```c SM_API SmStatus smSetSweepWindow(int device, SmWindowType window); ``` ```c SM_API SmStatus smSetSweepSpurReject(int device, SmBool spurRejectEnabled); ``` -------------------------------- ### smCloseDevice Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Closes the connection to the device. ```APIDOC ## smCloseDevice ### Description Closes the connection to the specified device. ### Signature `SmStatus smCloseDevice(int device)` ``` -------------------------------- ### smGetVrtPacketSize Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api__vrt_8h_source.html Retrieves the current VRT packet size configuration. ```APIDOC ## smGetVrtPacketSize ### Description Retrieves the current VRT packet size configuration. ### Signature SmStatus smGetVrtPacketSize(int device, uint16_t *samplesPerPkt, uint32_t *wordCount) ### Parameters - **device** (int) - The device handle. - **samplesPerPkt** (uint16_t*) - Pointer to store the samples per packet. - **wordCount** (uint32_t*) - Pointer to store the word count. ``` -------------------------------- ### smGetRealTimeFrame Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/real_time.html Retrieves the latest real-time frame and sweep data from the device. ```APIDOC ## smGetRealTimeFrame ### Description Retrieves the current color frame and sweep data from the device buffer. ### Signature `SmStatus smGetRealTimeFrame(int device, float *colorFrame, float *alphaFrame, float *sweepMin, float *sweepMax, int *frameCount, int64_t *nsSinceEpoch)` ### Parameters - **device** (int) - The device handle. - **colorFrame** (float*) - Pointer to buffer for color frame data. - **alphaFrame** (float*) - Pointer to buffer for alpha frame data. - **sweepMin** (float*) - Pointer to buffer for minimum sweep data. - **sweepMax** (float*) - Pointer to buffer for maximum sweep data. - **frameCount** (int*) - Pointer to store the frame count. - **nsSinceEpoch** (int64_t*) - Pointer to store the timestamp in nanoseconds. ``` -------------------------------- ### smGetGPSState Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current state of the GPS module. ```APIDOC ## smGetGPSState ### Signature `SmStatus smGetGPSState(int device, SmGPSState *GPSState)` ``` -------------------------------- ### smSetIQSweepListRef Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_sweep_list.html Sets the reference level for a specific frequency step. ```APIDOC ## smSetIQSweepListRef ### Description Sets the reference level (in dBm) for a specific frequency step in the sweep list. ### Signature `SmStatus smSetIQSweepListRef(int device, int step, double level)` ### Parameters - **device** (int) - The device handle. - **step** (int) - The index of the frequency step. - **level** (double) - The reference level in dBm. ``` -------------------------------- ### smSetIQSweepListRef Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Sets the reference level for a specific step in the IQ sweep list. ```APIDOC ## smSetIQSweepListRef ### Description Sets the reference level for a specific step in the IQ sweep list. ### Signature `SmStatus smSetIQSweepListRef(int device, int step, double level)` ``` -------------------------------- ### smGetFanThreshold Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Retrieves the current fan temperature threshold. ```APIDOC ## smGetFanThreshold ### Signature `SmStatus smGetFanThreshold(int device, int *temp)` ``` -------------------------------- ### smGetVrtContextPkt Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api__vrt_8h.html Retrieves one VRT context packet. ```APIDOC ## smGetVrtContextPkt ### Description Retrieve one VRT context packet. ### Parameters - **device** (int) - Required - Device handle. - **words** (uint32_t *) - Required - User allocated buffer. - **wordCount** (uint32_t *) - Required - Number of words written to the words buffer. ``` -------------------------------- ### Real-Time and IQ Data Acquisition Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sm__api_8h_source.html Functions for retrieving real-time frames and IQ data from the device. ```c SM_API SmStatus smGetRealTimeFrame(int device, float *colorFrame, float *alphaFrame, float *sweepMin, float *sweepMax, int *frameCount, int64_t *nsSinceEpoch); ``` ```c SM_API SmStatus smGetIQ(int device, void *iqBuf, int iqBufSize, double *triggers, int triggerBufSize, int64_t *nsSinceEpoch, SmBool purge, int *sampleLoss, int *samplesRemaining); ``` -------------------------------- ### smSetIQDataType Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/iq_streaming.html Sets the data type for I/Q samples. ```APIDOC ## smSetIQDataType ### Description Configures the data type for the I/Q stream. ### Signature `SmStatus smSetIQDataType(int device, SmDataType dataType)` ``` -------------------------------- ### smSetSweepSpurReject Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sweep_mode.html Enables or disables software spur rejection. ```APIDOC ## smSetSweepSpurReject ### Description Configures whether software spur rejection is enabled. ### Signature `SmStatus smSetSweepSpurReject(int device, SmBool spurRejectEnabled)` ``` -------------------------------- ### smSetSweepWindow Source: https://signalhound.com/sigdownloads/SDK/online_docs/sm_api/sweep_mode.html Sets the window function for the sweep. ```APIDOC ## smSetSweepWindow ### Description Sets the windowing function used during sweep processing. ### Signature `SmStatus smSetSweepWindow(int device, SmWindowType window)` ```