The G66WSB API SDK is implemented as a dynamic library (libg66wsbapi.so) for 32-bit i386 and 64-bit x86_64 platforms. It provides object-oriented and non-object-oriented interfaces to control the G66WSB device. This document describes the non-object-oriented interface. The libg66wsbapi.so library exports several functions which makes it possible to control G66WSB receivers.
The API is not fully thread-safe so preferably it should be used in single-threaded applications. It can be used in multi-threaded applications as well, but with some care: One G66WSB receiver can be controlled from a single user thread only.
A C/C++ header file g66wsbapi.h is a part of the SDK.
The lib66wsbapi.so library can be loaded to the application using the dlopen function of dynamic linking loader (link with -ldl).
After the library is loaded, it is necessary to get addresses of exported functions.
When the API is no longer required in the memory, the dlclose function can be used to unload the API. Before the dlclose is called, all the handles to G66WSB devices returned by the OpenDevice function must be closed by the CloseDevice function, otherwise the application can be placed into an unpredictable state.
The following source code shows how to load the API.
#include <stdio.h> #include <dlfcn.h> #include "g66wsbapi.h" G66WSB_OPEN_DEVICE OpenDevice; G66WSB_CLOSE_DEVICE CloseDevice; void *API; int main(void) { //Loading the API API=dlopen("libg66wsbapi.so",RTLD_LAZY); if(API!=NULL) { //Retrieving addresses of used API functions OpenDevice=(G66WSB_OPEN_DEVICE)dlsym(API,"OpenDevice"); CloseDevice=(G66WSB_CLOSE_DEVICE)dlsym(API,"CloseDevice"); //Here place code that uses the API dlclose(API); } else { //If the dlopen fails printf("Failed to load libg66wsbapi.so.\n"); } return 0; }
The G66WSB API provides the GetDeviceList function which returns list of locally available G66WSB devices which can be opened by the OpenDevice function.
The following source code produces a list of serial numbers for the available G66WSB devices.
#include <stdio.h> #include <stdint.h> #include <dlfcn.h> #include <stdlib.h> #include <errno.h> #include "g66wsbapi.h" G66WSB_GET_DEVICE_LIST GetDeviceList; G66WSB_FREE_DEVICE_LIST FreeDeviceList; void *API; int main(void) { uint32_t Count,i; G66WSB_DEVICE_INFO *DeviceList; //Loading the API API=dlopen("libg66wsbapi.so",RTLD_LAZY); if(API!=NULL) { //Retrieving address of the GetDeviceList function GetDeviceList=(G66WSB_GET_DEVICE_LIST)dlsym(API,"GetDeviceList"); FreeDeviceList=(G66WSB_FREE_DEVICE_LIST)dlsym(API,"FreeDeviceList"); //Retrieving information about available devices if(GetDeviceList(&DeviceList,&Count)) { if(Count!=0) { printf("Available G66WSB devices count=%d:\n",Count); for(i=0;i<Count;i++) { printf("%d. SN: %s\n",i,DeviceList[i].SerialNumber); } FreeDeviceList(DeviceList); } else { printf("No available G66WSB device found.\n"); } } else { printf("GetDeviceList failed with error %d\n",errno); } dlclose(API); } else { printf("Failed to load libg66wsbapi.so. %s\n",dlerror()); } printf("Press enter to exit\n"); getchar(); return 0; }
The G66WSB device has to be opened before it can be controlled. The API provides the OpenDevice function to open the device.
The following source code shows how to open the first available G66WSB device.
#include <stdio.h> #include <dlfcn.h> #include <errno.h> #include "g66wsbapi.h" G66WSB_OPEN_DEVICE OpenDevice; G66WSB_CLOSE_DEVICE CloseDevice; void *API; int main(void) { int32_t hDevice; //Loading the API API=dlopen("libg66wsbapi.so",RTLD_LAZY); if(API!=NULL) { //Retrieving addresses of the OpenDevice and CloseDevice API functions OpenDevice=(G66WSB_OPEN_DEVICE)dlsym(API,"OpenDevice"); CloseDevice=(G66WSB_CLOSE_DEVICE)dlsym(API,"CloseDevice"); //Opening the first available G66WSB device using predefined G66WSB_OPEN_FIRST constant hDevice=OpenDevice(G66WSB_OPEN_FIRST); if(hDevice>=0) { //Here place code that works with the open G66WSB device //Closing handle to opened G66WSB device CloseDevice(hDevice); } else { printf("OpenDevice failed with error %d\n",errno); } dlclose(API); } else { //If the dlopen fails printf("Failed to load libg66wsbapi.so. %s\n",dlerror()); } return 0; }
The GetDeviceList function returns information about the locally available G66WSB devices which can be opened.
C/C++ declaration
int GetDeviceList(G66WSB_DEVICE_INFO **DeviceList,uint32_t *Count);
Address retrieval
G66WSB_GET_DEVICE_LIST GetDeviceList=(G66WSB_GET_DEVICE_LIST)dlsym(API,"GetDeviceList");
Parameters
DeviceList[out] Pointer to a variable which receives a pointer to an array of G66WSB_DEVICE_INFO structures to be filled with information about available G66WSB devices. The number of the structures in the array is equal to the number of available G66WSB devices.When the array is no longer required, use the FreeDeviceList function, to free the used memory.
If no available G66WSB device is found, the received value is equal to NULL.
Count[in] Pointer to a variable which receives the number of available G66WSB devices.
Return value
If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, check errno.
The FreeDeviceList function frees the memory previously allocated by the GetDeviceList function.
C/C++ declaration
void FreeDeviceList(G66WSB_DEVICE_INFO *DeviceList);
Address retrieval
G66WSB_FREE_DEVICE_LIST GetDeviceList=(G66WSB_FREE_DEVICE_LIST)dlsym(API,"FreeDeviceList");
Parameters
DeviceList[out] Pointer to an array of G66WSB_DEVICE_INFO structures provided by the GetDeviceList function.This parameter can be NULL, in this case the function does nothing.
No return value
OpenDevice
Opens the G66WSB device by its serial number.
C/C++ declaration
int32_t OpenDevice(const char *SerialNumber);Address retrieval
G66WSB_OPEN_DEVICE OpenDevice=(G66WSB_OPEN_DEVICE)dlsym(API,"OpenDevice");Parameters
SerialNumber[in] Pointer to a null-terminated string which specifies the serial number of the G66WSB device to open. One of the following values can be used instead of the serial number:
Value Meaning G66WSB_OPEN_FIRST This function opens the first available G66WSB device. G66WSB_OPEN_DEMO This function opens a demo G66WSB device. This allows developers to work with the API without a physical G66WSB device. Return value
If the function succeeds, the return value is a handle to the specified G66WSB device. This handle can only be used with functions of G66WSB API.
If the function fails, the return value is negative. To get extended error information, check errno.Remarks
The OpenDevice function can be called from any user thread, the returned handle can only be used in the same thread, otherwise the application can enter an unpredictable state.
Use the CloseDevice function to close the G66WSB device handle returned by the OpenDevice function.
CloseDevice
Closes the G66WSB device.
C/C++ declaration
int CloseDevice(int32_t hDevice);Address retrieval
G66WSB_CLOSE_DEVICE CloseDevice=(G66WSB_CLOSE_DEVICE)dlsym(API,"CloseDevice");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
IsDeviceConnected
Checks whether the device is still connected to the computer.
C/C++ declaration
int IsDeviceConnected(int32_t hDevice,int *Connected);Address retrieval
G66WSB_IS_DEVICE_CONNECTED IsDeviceConnected=(G66WSB_IS_DEVICE_CONNECTED)dlsym(API,"IsDeviceConnected");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Connected[out] Pointer to a variable which receives the current connection status. If the received value is non-zero, the device is still connected and available. If the device is disconnected, the received value is zero.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
If it is determined that the device is disconnected, the corresponding device handle is no longer usable, so it should be closed using the CloseDevice function.
GetDeviceInfo
Retrieves information about the G66WSB device.
C/C++ declaration
int GetDeviceInfo(int32_t hDevice,G66WSB_DEVICE_INFO *Info);Address retrieval
G66WSB_GET_DEVICE_INFO GetDeviceInfo=(G66WSB_GET_DEVICE_INFO)dlsym(API,"GetDeviceInfo");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Info[out] Pointer to the G66WSB_DEVICE_INFO structure to be filled with information about the device. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetLED
Sets the front panel LED flashing mode of the G66WSB device.
C/C++ declaration
int SetLED(int32_t hDevice,uint32_t LEDMode);Address retrieval
G66WSB_SET_LED SetLED=(G66WSB_SET_LED)dlsym(API,"SetLED");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.LEDMode[in] Specifies the front panel LED flashing mode, which can be one of the following:
Value Meaning G66WSB_FRONT_PANEL_LED_MODE_DIAG Diagnostic flashing. G66WSB_FRONT_PANEL_LED_MODE_ON Always on. G66WSB_FRONT_PANEL_LED_MODE_OFF Always off. Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetLED function to determine the current flashing mode of the front panel LED.
A complete list of the diagnostic flashing patterns and their meaning is as follows:
No. Pattern Description Mode 1
Off No power 2
Fading No connection to a computer 3
Two short flashes USB connected, radio off 4
One short flash followed by a long one USB connected, radio on, ready 5
Two short flashes followed by a long one USB connected, driver not installed 6
Three short flashes USB connected, driver installed, application not running
GetLED
Determines the current flashing mode of device's front panel LED.
C/C++ declaration
int GetLED(uint32_t hDevice,uint32_t *LEDMode);Address retrieval
G66WSB_GET_LED GetLED=(G66WSB_GET_LED)dlsym(API,"GetLED");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.LEDMode[out] Pointer to a variable which receives the current flashing mode of device's front panel LED. For a list of possible values, see SetLED. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetPower
Turns the G66WSB device on or off.
C/C++ declaration
int SetPower(int32_t hDevice,int Power);Address retrieval
G66WSB_SET_POWER SetPower=(G66WSB_SET_POWER)dlsym(API,"SetPower");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Power[in] Specifies whether to turn on or off the device. If this parameter is non-zero the device is turned on, if it is zero the device is turned off.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
If SetPower turns the device off, all the running streams are stopped.
Use the GetPower function to determine the current power state of the device.
GetPower
The GetPower function determines whether the device is turned on or off.
C/C++ declaration
int GetPower(int32_t hDevice,int *Power);Address retrieval
G66WSB_GET_POWER GetPower=(G66WSB_GET_POWER)dlsym(API,"GetPower");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Power[out] Pointer to a variable which receives the current power state of the device. If it is non-zero, the device is turned on. If it is zero the device is turned off. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetDeviceState
Retrieves the current state of the G66WSB device, like internal temperatures, error state, data transfer counters.
C/C++ declaration
int GetDeviceState(int32_t hDevice,G66WSB_DEVICE_STATE *State);Address retrieval
G66WSB_GET_DEVICE_STATE GetDeviceState=(G66WSB_GET_DEVICE_STATE)dlsym(API,"GetDeviceState");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.State[out] Pointer to a G66WSB_DEVICE_STATE structure to be filled with the current device state. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetBuiltInTest
Enables or disables the test signal at the receiver's input, which allows testing of the entire signal and processing path.
C/C++ declaration
int SetBuiltInTest(int32_t hDevice,int Enabled);Address retrieval
G66WSB_SET_BUILT_IN_TEST SetBuiltInTest=(G66WSB_SET_BUILT_IN_TEST)dlsym(API,"SetBuiltInTest");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Enabled[in] Specifies whether to enable or disable the built-in test. If this parameter is non-zero, the test signal is enabled. If the parameter is zero, the test signal is disabled.Test signal parameters:
Frequency Level 152 MHz ± 5 MHz -34 dBm ± 3 dB Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetBuiltInTest
Retrieves information about whether the test signal is enabled or not.
C/C++ declaration
int GetBuiltInTest(int32_t hDevice,int *Enabled);Address retrieval
G66WSB_GET_BUILT_IN_TEST GetBuiltInTest=(G66WSB_GET_BUILT_IN_TEST)dlsym(API,"GetBuiltInTest");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Enabled[out] Pointer to a variable which receives information about the test signal state. If it is non-zero, test signal is enabled, if it is zero, test signal is not enabled. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetAttenuator
Sets the input attenuator.
C/C++ declaration
int SetAttenuator(int32_t hDevice,uint32_t Attenuator);Address retrieval
G66WSB_SET_ATTENUATOR SetAttenuator=(G66WSB_SET_ATTENUATOR)dlsym(API,"SetAttenuator");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Attenuator[in] Value that specifies the attenuation level in dB. Possible values are: 0, 3, 6, 9, 12, 15, 18, 21. If the value is not from this list, the SetAttenuator function rounds the value to the nearest lower one.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetAttenuator function to determine the current setting of the attenuator.
GetAttenuator
Retrieves the current setting of the attenuator.
C/C++ declaration
int GetAttenuator(int32_t hDevice,uint32_t *Attenuator);Address retrieval
G66WSB_GET_ATTENUATOR GetAttenuator=(G66WSB_GET_ATTENUATOR)dlsym(API,"GetAttenuator");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Attenuator[out] Pointer to a variable which receives the current attenuation level. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetPreamplifier
Enables or disables the RF input preamplifier.
C/C++ declaration
int SetPreamplifier(int32_t hDevice,int Preamp);Address retrieval
G66WSB_SET_PREAMPLIFIER SetPreamplifier=(G66WSB_SET_PREAMPLIFIER)dlsym(API,"SetPreamplifier");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Preamp[in] Specifies whether to enable or disable the RF preamplifier. If this parameter is non-zero, the preamplifier is enabled. If the parameter is zero, the preamplifier is disabled.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetPreamplifier function to determine the current state of the preamplifier.
GetPreamplifier
Retrieves the current state of the RF input preamplifier.
C/C++ declaration
int GetPreamplifier(int32_t hDevice,int *Preamp);Address retrieval
G66WSB_GET_PREAMPLIFIER GetPreamplifier=(G66WSB_GET_PREAMPLIFIER)dlsym(API,"GetPreamplifier");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Preamp[out] Pointer to a variable which receives the current state of the preamplifier. The value is non-zero if the preamplifier is enabled and zero if it is disabled. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetADCNoiseBlanker
Enables or disables the noise blanker on the ADC stream.
C/C++ declaration
int SetADCNoiseBlanker(int32_t hDevice,int Enabled);Address retrieval
G66WSB_SET_ADC_NOISE_BLANKER SetADCNoiseBlanker=(G66WSB_SET_ADC_NOISE_BLANKER)dlsym(API,"SetADCNoiseBlanker");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Enabled[in] Specifies whether to enable or disable the noise blanker. If this parameter is non-zero, the noise blanker is enabled. If the parameter is zero, the noise blanker is disabled.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetADCNoiseBlanker function to determine the current state of the noise blanker.
GetADCNoiseBlanker
Retrieves the current ADC noise blanker state.
C/C++ declaration
int GetADCNoiseBlanker(int32_t hDevice,int *Enabled);Address retrieval
G66WSB_GET_ADC_NOISE_BLANKER GetADCNoiseBlanker=(G66WSB_GET_ADC_NOISE_BLANKER)dlsym(API,"GetADCNoiseBlanker");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Enabled[out] Pointer to a variable which receives the current state of the noise blanker. The value is non-zero if noise blanker is enabled and zero if it is disabled. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetADCNoiseBlankerThreshold
Specifies the ADC noise blanker threshold.
C/C++ declaration
int SetADCNoiseBlankerThreshold(int32_t hDevice,uint16_t Threshold);Address retrieval
G66WSB_SET_ADC_NOISE_BLANKER_THRESHOLD SetADCNoiseBlankerThreshold= (G66WSB_SET_ADC_NOISE_BLANKER_THRESHOLD)dlsym(API,"SetADCNoiseBlankerThreshold");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Threshold[in] Specifies the maximum acceptable input signal. The maximum possible value of threshold is 32767, in this case the noise blanker has no effect even if it is enabled using the SetADCNoiseBlanker function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetADCNoiseBlankerThreshold function to retrieve the current threshold of the noise blanker.
GetADCNoiseBlankerThreshold
Determines the ADC noise blanker threshold.
C/C++ declaration
int GetADCNoiseBlankerThreshold(int32_t hDevice,uint16_t *Threshold);Address retrieval
G66WSB_GET_ADC_NOISE_BLANKER_THRESHOLD GetADCNoiseBlankerThreshold= (G66WSB_GET_ADC_NOISE_BLANKER_THRESHOLD)dlsym(API,"GetADCNoiseBlankerThreshold");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Threshold[out] Pointer to a variable which receives the threshold of ADC noise blanker. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetBandwidth
Sets bandwidth of the demodulator filter for all the DDC channels. The bandwidth is the same for all the DDC channels.
C/C++ declaration
int SetBandwidth(int32_t hDevice,uint32_t Bandwidth);Address retrieval
G66WSB_SET_BANDWIDTH SetBandwidth=(G66WSB_SET_BANDWIDTH)dlsym(API,"SetBandwidth");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Bandwidth[in] Specifies the new bandwidth of the demodulator filters in Hz. Possible values range from 1 to 250000 Hz.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetBandwidth
Retrieves the current demodulator filter bandwidth.
C/C++ declaration
int GetBandwidth(int32_t hDevice,uint32_t *Bandwidth);Address retrieval
G66WSB_GET_BANDWIDTH GetBandwidth=(G66WSB_GET_BANDWIDTH)dlsym(API,"GetBandwidth");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Bandwidth[out] Pointer to a variable which receives the current demodulator filter bandwidth. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
CreateDDC
Creates the digital down-converter (DDC) channel. The DDC makes the down-conversion of the signal produced by the ADC and subsequently other signal processing like FM demodulation, audio filtering, etc.
C/C++ declaration
int CreateDDC(int32_t hDevice,uint32_t *DDCId);Address retrieval
G66WSB_CREATE_DDC CreateDDC=(G66WSB_CREATE_DDC)dlsym(API,"CreateDDC");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[out] Pointer to a variable which receives the identification number of a newly created DDC channel. The value of the identification number can vary from 0 to one less than value of the MaxDDCCount member of the G66WSB_DEVICE_INFO structure. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The maximum number of DDC channels which can be created with the CreateDDC function, is determined by the MaxDDCCount member of the G66WSB_DEVICE_INFO structure.
Parameters of the digital down-converter are fixed. Sampling rate of produced I/Q signal is 312.5 kHz and the usable bandwidth is 250 kHz.
Use the DeleteDDC function to delete the DDC channel created by CreateDDC.
DeleteDDC
Deletes the DDC channel previously created by the CreateDDC function.
C/C++ declaration
int DeleteDDC(int32_t hDevice,uint32_t DDCId);Address retrieval
G66WSB_DELETE_DDC DeleteDDC=(G66WSB_DELETE_DDC)dlsym(API,"DeleteDDC");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
StartDDC
Starts DDC streaming.
C/C++ declaration
int StartDDC(int32_t hDevice,uint32_t DDCId,uint32_t SampleSetsPerBuffer);Address retrieval
G66WSB_START_DDC StartDDC=(G66WSB_START_DDC)dlsym(API,"StartDDC");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.SampleSetsPerBuffer[in] This parameter specifies the number of I/Q sample sets in each buffer passed to the DDCStreamCallback callback function. The value of the SampleSetsPerBuffer has to be a multiple of 64, otherwise the function rounds it up to the nearest multiple of 64. If it is zero, the StartDDC function fails.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The G66WSB device has to be turned on using the SetPower function before StartDDC is used otherwise StartDDC fails.
If the DDC streaming is already running before use of StartDDC, StartDDC fails.
Use the StopDDC function to stop streaming in the given DDC channel.
Decreasing the value of the SampleSetsPerBuffer parameter decreases latency and may increase CPU usage. Increasing the value of the SampleSetsPerBuffer parameter increases latency and may decrease CPU usage.
StopDDC
Stops DDC streaming.
C/C++ declaration
int StopDDC(int32_t hDevice,uint32_t DDCId);Address retrieval
G66WSB_STOP_DDC StopDDC=(G66WSB_STOP_DDC)dlsym(API,"StopDDC");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
If streaming is not active in the given DDC channel, StopDDC does nothing.
The DDCStreamCallback callback function is not called after StopDDC returns.
The StopDDC function also stops the corresponding audio streaming.
SetChannel
Tunes the DDC to the specified sonobuoy channel.
C/C++ declaration
int SetChannel(int32_t hDevice,uint32_t DDCId,uint32_t Channel);Address retrieval
G66WSB_SET_CHANNEL SetChannel=(G66WSB_SET_CHANNEL)dlsym(API,"SetChannel");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Channel[in] Specifies sonobuoy channel. The value can vary from 1 to 99.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetChannel function to determine currently tuned sonobuoy channel and its frequency for the specified DDC.
GetChannel
Retrieves currently tuned sonobuoy channel number and its frequency for the specified DDC.
C/C++ declaration
int GetChannel(int32_t hDevice,uint32_t DDCId,uint32_t *Channel,uint32_t *Frequency);Address retrieval
G66WSB_GET_CHANNEL GetChannel=(G66WSB_GET_CHANNEL)dlsym(API,"GetChannel");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Channel[out] Pointer to a variable that receives the number of currently tuned sonobuoy channel. This parameter can be NULL if the application does not require this information.Frequency[out] Pointer to a variable that receives the frequency [in Hz] of currently tuned sonobuoy channel. This parameter can be NULL if the application does not require this information.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetChannelFrequency
Retrieves frequency of the specified sonobuoy channel.
C/C++ declaration
int GetChannelFrequency(int32_t hDevice,uint32_t Channel,uint32_t *Frequency);Address retrieval
G66WSB_GET_CHANNEL_FREQUENCY GetChannelFrequency=(G66WSB_GET_CHANNEL_FREQUENCY)dlsym(API,"GetChannelFrequency");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Channel[in] Specifies the number of sonobuoy channel. The value can vary from 1 to 99.Frequency[out] Pointer to a variable that receives the frequency [in Hz] of the specified sonobuoy channel. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetSignalLevel
Determines the current RF signal level for the given DDC channel.
C/C++ declaration
int GetSignalLevel(int32_t hDevice,uint32_t DDCId,float *Peak,float *RMS);Address retrieval
G66WSB_GET_SIGNAL_LEVEL GetSignalLevel=(G66WSB_GET_SIGNAL_LEVEL)dlsym(API,"GetSignalLevel");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Peak[out] Pointer to a variable which receives the current signal level (peak) in Volts. This parameter can be NULL if the application does not require this information.RMS[out] Pointer to a variable which receives the current signal level (RMS) in Volts. This parameter can be NULL if the application does not require this information.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
DDC streaming has to be active (started using the StartDDC function) before calling of GetSignalLevel, otherwise the returned peak and RMS signal level values are invalid.
The signal level is evaluated for each buffer produced by the DDC. Buffer size (signal level evaluation rate) is given by the SampleSetsPerBuffer parameter of the StartDDC function.
The DDCStreamCallback callback function provides the signal level for each buffer passed to the callback, i.e. for each buffer used in the signal level evaluation. This provides a way to get the signal level from each processed buffer without the need to poll it using GetSignalLevel.
To convert RMS signal level in Volts to power in dBm use the following formulas:
P[W] = (VRMS)2 / R = (VRMS)2 / 50
P[dBm]= 10 * log10( P[W] * 1000 )
Where VRMS is the RMS signal level in Volts obtained by GetSignalLevel, R is the G66WSB receiver input impedance (50 Ω), P[W] is power in Watts and P[dBm] is power in dBm and 1000 is conversion coefficient W -> mW.
The following example shows how to obtain the current signal level in dBm from the DDC channel:
#include <stdio.h> #include <math.h> int32_t hDevice; //Handle to G66WSB device returned by the OpenDevice function uint32_t DDCId; //Identifier of the DDC channel created by the CreateDDC function: CreateDDC(hDevice,&DDCId) float P_dBm,V_RMS; GetSignalLevel(hDevice,DDCId,NULL,&V_RMS); P_dBm=10.0*log10(V_RMS*V_RMS*(1000.0/50.0)); printf("Current signal level [RMS]: %.1f dBm\n",P_dBm);
SetAudioSampleRate
Sets the output audio sample rate for all DDC channels.
C/C++ declaration
int SetAudioSampleRate(int32_t hDevice,uint32_t SampleRateIndex);Address retrieval
G66WSB_SET_AUDIO_SAMPLE_RATE SetAudioSampleRate=(G66WSB_SET_AUDIO_SAMPLE_RATE)dlsym(API,"SetAudioSampleRate");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.SampleRateIndex[in] Specifies the audio sample rate index which can be one of the following:
Value Audio sample rate G66WSB_AUDIO_SAMPLE_RATE_48000 48 kHz G66WSB_AUDIO_SAMPLE_RATE_64000 64 kHz G66WSB_AUDIO_SAMPLE_RATE_96000 96 kHz G66WSB_AUDIO_SAMPLE_RATE_128000 128 kHz G66WSB_AUDIO_SAMPLE_RATE_192000 192 kHz Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The DDC streaming must not be running when calling SetAudioSampleRate on any DDC channel. In other words, all DDC streams started with the StartDDC function must be stopped using the StopDDC function before calling SetAudioSampleRate, otherwise SetAudioSampleRate fails.
Use the GetAudioSampleRate function to determine the current audio sample rate and the corresponding sample rate index.
GetAudioSampleRate
Retrieves the current audio sample rate and the corresponding sample rate index.
C/C++ declaration
int GetAudioSampleRate(int32_t hDevice,uint32_t *SampleRateIndex,uint32_t *SampleRate);Address retrieval
G66WSB_GET_AUDIO_SAMPLE_RATE GetAudioSampleRate=(G66WSB_GET_AUDIO_SAMPLE_RATE)dlsym(hAPI,"GetAudioSampleRate");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.SampleRateIndex[out] Pointer to a variable which receives the current audio sample rate index. This parameter can be NULL if the application does not require this information.SampleRate[out] Pointer to a variable which receives the current audio sample rate in Hz. This parameter can be NULL if the application does not require this information.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
StartAudio
Starts audio streaming for the given channel.
C/C++ declaration
int StartAudio(int32_t hDevice,uint32_t DDCId,uint32_t SamplesPerBuffer);Address retrieval
G66WSB_START_AUDIO StartAudio=(G66WSB_START_AUDIO)dlsym(API,"StartAudio");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.SamplesPerBuffer[in] Specifies the number of samples in each buffer passed to the AudioStreamCallback callback function. The value has to be a multiple of 64 greater than zero. If it is zero, the StartAudio function fails. If it is not a multiple of 64, the function rounds it up to nearest multiple of 64.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Before StartAudio is used, the G66WSB device has to be turned on using the SetPower function and DDC streaming has to be started using the StartDDC function, otherwise StartAudio fails.
If the audio streaming for the given DDC channel is already running, StartAudio fails.
Use the StopAudio function to stop audio streaming.
Decreasing the value of the SamplesPerBuffer parameter decreases latency and may increase CPU usage. Increasing the value of the SamplesPerBuffer parameter increases latency and may decrease CPU usage.
StopAudio
Stops audio streaming for the given channel.
C/C++ declaration
int StopAudio(int32_t hDevice,uint32_t DDCId);Address retrieval
G66WSB_STOP_AUDIO StopAudio=(G66WSB_STOP_AUDIO)dlsym(API,"StopAudio");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
If audio streaming is not active, StopAudio does nothing.
The AudioStreamCallback callback function is not called after StopAudio returns.
SetAudioGain
Sets fixed audio gain for the given channel.
C/C++ declaration
int SetAudioGain(int32_t hDevice,uint32_t DDCId,double Gain);Address retrieval
G66WSB_SET_AUDIO_GAIN SetAudioGain=(G66WSB_SET_AUDIO_GAIN)dlsym(API,"SetAudioGain");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Gain[in] Specifies a new fixed audio gain in dB.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetAudioGain function to retrieve the current audio gain.
GetAudioGain
Retrieves the current fixed audio gain for the given channel.
C/C++ declaration
int GetAudioGain(int32_t hDevice,uint32_t DDCId,double *Gain);Address retrieval
G66WSB_GET_AUDIO_GAIN GetAudioGain=(G66WSB_GET_AUDIO_GAIN)dlsym(API,"GetAudioGain");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Gain[out] Pointer to a variable that receives the current fixed gain in dB. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetAudioFilter
Enables or disables the audio filter for the given channel.
C/C++ declaration
int SetAudioFilter(int32_t hDevice,uint32_t DDCId,int Enabled);Address retrieval
G66WSB_SET_AUDIO_FILTER SetAudioFilter=(G66WSB_SET_AUDIO_FILTER)dlsym(API,"SetAudioFilter");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Enabled[in] Specifies whether to enable or disable the audio filter. If this parameter is non-zero, the filter is enabled. If the parameter is zero, the filter is disabled.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetAudioFiler function to retrieve the current state of the audio filter.
GetAudioFilter
Retrieves the current state of the audio filter for the given channel.
C/C++ declaration
int GetAudioFilter(int32_t hDevice,uint32_t DDCId,int *Enabled);Address retrieval
G66WSB_GET_AUDIO_FILTER GetAudioFilter=(G66WSB_GET_AUDIO_FILTER)dlsym(API,"GetAudioFilter");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Enabled[out] Pointer to a variable which receives the current state of the audio filter. The value is non-zero if the filter is enabled and zero if it is disabled. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetAudioFilterParams
Sets the parameters of the audio filter for the given channel.
C/C++ declaration
int SetAudioFilterParams(int32_t hDevice,uint32_t DDCId,uint32_t CutOffLow,uint32_t CutOffHigh,double Deemphasis);Address retrieval
G66WSB_SET_AUDIO_FILTER_PARAMS SetAudioFilterParams=(G66WSB_SET_AUDIO_FILTER_PARAMS)dlsym(API,"SetAudioFilterParams");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.CutOffLow[in] Specifies the cut-off low frequency of the filter in Hz. This is the start frequency of the filter's passband, it can range from 0 to 31999 Hz. The value has to be less than the cut-off high frequency specified by the CutOffHigh parameter.CutOffHigh[in] Specifies the cut-off high frequency of the filter in Hz. This is the end frequency of the filter's passband, it can range from 1 to 32000 Hz. The value has to be greater than the cut-off low frequency specified by the CutOffLow parameter.Deemphasis[in] Specifies the de-emphasis of the filter in dB per octave. De-emphasis starts at the cut-off low frequency of the filter. This value can range from -9.9 to 0.0 dB/octave. Zero means that de-emphasis is disabled.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Use the GetAudioFilerParams function to retrieve the current parameters of the audio filter.
GetAudioFilterParams
Retrieves the current parameters of the audio filter for the given channel.
C/C++ declaration
int GetAudioFilterParams(int32_t hDevice,uint32_t DDCId,uint32_t *CutOffLow,uint32_t *CutOffHigh,double *Deemphasis);Address retrieval
G66WSB_GET_AUDIO_FILTER_PARAMS GetAudioFilterParams=(G66WSB_GET_AUDIO_FILTER_PARAMS)dlsym(API,"GetAudioFilterParams");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.CutOffLow[out] Pointer to a variable which receives the current cut-off low frequency of the filter. This parameter can be NULL if the application does not require this information.CutOffHigh[out] Pointer to a variable which receives the current cut-off high frequency of the filter. This parameter can be NULL if the application does not require this information.Deemphasis[out] Pointer to a variable which receives the current de-emphasis setting of the filter. This parameter can be NULL if the application does not require this information.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetAudioFilterLength
Specifies the audio filter length for the given channel. The audio filter is implemented as an FIR filter. This function specifies the number of coefficients used in the filtration procedure.
C/C++ declaration
int SetAudioFilterLength(int32_t hDevice,uint32_t DDCId,uint32_t Length);Address retrieval
G66WSB_SET_AUDIO_FILTER_LENGTH SetAudioFilterLength=(G66WSB_SET_AUDIO_FILTER_LENGTH)dlsym(API,"SetAudioFilterLength");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Length[in] Specifies the length of the audio filter. The value has to be a multiple of 8, greater than or equal to 64 and less than or equal to 32768. If it is not a multiple of 8, the function rounds it up to nearest multiple of 8.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
Audio streaming in the given DDC channel has to be idle (streaming is not started using the StartAudio function) when calling the SetAudioFilterLength function, otherwise it fails.
Increasing the filter length increases the filter steepness and may increase CPU usage.
Use the GetAudioFilterLength function to determine the current length of the audio filter.
GetAudioFilterLength
Retrieves the current audio filter length for the given channel.
C/C++ declaration
int GetAudioFilterLength(int32_t hDevice,uint32_t DDCId,uint32_t *Length);Address retrieval
G66WSB_GET_AUDIO_FILTER_LENGTH GetAudioFilterLength=(G66WSB_GET_AUDIO_FILTER_LENGTH)dlsym(API,"GetAudioFilterLength");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Length[out] Pointer to a variable which receives the current length of the audio filter. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetVolume
Sets the audio volume for the given channel.
C/C++ declaration
int SetVolume(int32_t hDevice,uint32_t DDCId,uint8_t Volume);Address retrieval
G66WSB_SET_VOLUME SetVolume=(G66WSB_SET_VOLUME)dlsym(API,"SetVolume");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Volume[in] Specifies the new volume. The value can vary from 0 to 31, where 31 means maximum volume.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetVolume
Retrieve the current volume for the given channel.
C/C++ declaration
int GetVolume(int32_t hDevice,uint32_t DDCId,uint8_t *Volume);Address retrieval
G66WSB_GET_VOLUME GetVolume=(G66WSB_GET_VOLUME)dlsym(API,"GetVolume");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Volume[out] Pointer to a variable which receives the current volume. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
SetMute
Mutes or unmutes the audio.
C/C++ declaration
int SetMute(int32_t hDevice,uint32_t DDCId,int Mute);Address retrieval
G66WSB_SET_MUTE SetMute=(G66WSB_SET_MUTE)dlsym(API,"SetMute");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Mute[in] Specifies whether to mute or unmute audio. If this parameter is non-zero, the audio is muted. If the parameter is zero, the audio is unmuted.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
GetMute
Retrieves the current mute state for the given channel.
C/C++ declaration
int GetMute(int32_t hDevice,uint32_t DDCId,int *Mute);Address retrieval
G66WSB_GET_MUTE GetMute=(G66WSB_GET_MUTE)dlsym(API,"GetMute");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.DDCId[in] Identification number of the DDC channel created by the CreateDDC function.Mute[out] Pointer to a variable which receives the current mute state. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.
StartChannelActivity
Starts monitoring sonobuoy channels activity - signal levels of all the channels at once.
C/C++ declaration
int StartChannelActivity(int32_t hDevice,uint16_t Interval);Address retrieval
G66WSB_START_CHANNEL_ACTIVITY StartChannelActivity=(G66WSB_START_CHANNEL_ACTIVITY)dlsym(API,"StartChannelActivity");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Interval[in] Specifies the time interval in milliseconds for how often the signal levels are measured and sent to the application calling the ChannelActivityCallback callback function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The G66WSB device has to be turned on using the SetPower function before use of StartChannelActivity, otherwise the StartChannelActivity function fails.
Too low a value of the Interval parameter can dramatically increase data flow through USB which could cause failure of active streaming.
Use the StopChannelActivity function to stop the channels activity monitoring.
StopChannelActivity
Stops monitoring sonobuoy channels activity previously started by the StartChannelActivity function.
C/C++ declaration
int StopChannelActivity(int32_t hDevice);Address retrieval
G66WSB_STOP_CHANNEL_ACTIVY StopChannelActivity=(G66WSB_STOP_CHANNEL_ACTIVITY)dlsym(API,"StopChannelActivity");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The ChannelActivityCallback callback function is not called when StopChannelActivity returns.
GetSpectrumCompensation
Determines the compensation value for the frequency spectrum computed from the DDC signal. It is used to convert relative amplitudes in dB to absolutes ones in dBm.
C/C++ declaration
int GetSpectrumCompensation(int32_t hDevice,uint32_t Channel,float *Value);Address retrieval
G66WSB_GET_SPECTRUM_COMPENSATION GetSpectrumCompensation=(G66WSB_GET_SPECTRUM_COMPENSATION)dlsym(API,"GetSpectrumCompensation");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Channel[in] Specifies sonobuoy channel to retrieve the compensation value for. It can vary from 1 to 99.Value[out] Pointer to a variable which receives compensation value for the specified sonobuoy channel. This parameter cannot be NULL.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
The following example shows how to use the GetSpectrumCompensation function in DDCStreamCallback callback function:
//Let the following is prototype of a function which computes FFT from I/Q signal stored in //the buffer pointed to be the Input parameter. Result is stored in complex form in the buffer //pointed to by the Output parameter. Size of the FFT is given be the Size parameter. //The example uses 2048 bins FFT. void FFT(float *Output,const float *Input,int Size); int32_t hDevice; //handle to G66WSB device uint32_t DDCId; //Identifier of the DDC channel created by the CreateDDC function: CreateDDC(hDevice,&DDCId) uint32_t SonobuoyChannel; float FFTBuffer[2*2048]; //Buffer for FFT result float Compensation; //Spectrum compensation value G66WSB_CALLBACKS Callbacks; //Structure which contains pointer to callback functions Code before... //Retrieve sonobuoy channel that the specified DDC is tuned to GetChannel(hDevice,DDCId,&SonobuoyChannel,NULL); //Retrieve spectrum compensation value GetSpectrumCompensation(hDevice,SonobuoyChannel,&Compensation); //Compensation value have to be updated after change of the sonobuoy channel of the given DDC //Set callback function for DDC streaming //Pointers to callback function which should not be called by the API have to be set to NULL. Callbacks.DDCStreamCallback=MyDDCStreamCallback; //Start DDC streaming //The SampleSetsPerBuffer parameter is set to 2048 which is size of the FFT to simplify //the example. StartDDC(hDevice,DDCId,2048); Code after... void MyDDCStreamCallback(uint32_t DDCId,const float *Buffer,uint32_t Count,float Peak,float RMS,uintptr_t UserData) { uint32_t i; //Compute FFT FFT(FFTBuffer,Buffer,2048); //Converts complex FFT result to dB for(i=0;i<2048;i++) { FFTBuffer[i]=(float)(10.0*log10(FFTBuffer[i*2]*FFTBuffer[i*2]+FFTBuffer[i*2+1]*FFTBuffer[i*2+1])); } //Apply compensation value to get amplitudes in dBm for(i=0;i<2048;i++) { FFTBuffer[i]+=Compensation; } //now the FFTBuffer contains amplitudes in dBm }
SetCallbacks
Registers user-defined functions as callback functions called by the API.
C/C++ declaration
int SetCallbacks(int32_t hDevice,CONST G66WSB_CALLBACKS *Callbacks,uintptr_t UserData);Address retrieval
G66WSB_SET_CALLBACKS SetCallbacks=(G66WSB_SET_CALLBACKS)dlsym(API,"SetCallbacks");Parameters
hDevice[in] Handle to G66WSB device returned by the OpenDevice function.Callbacks[in] Pointer to a G66WSB_CALLBACKS structure which contains pointers to the user-defined functions to be registered as callback functions.UserData[in] Specifies a user-defined value which is passed to callback functions.Return value
If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, check errno.Remarks
If the application does not require that the API calls some callback function, set the related member of the G66WSB_CALLBACKS structure to NULL.
If the value of the Callbacks parameter is NULL, all the callback functions are unregistered, the API will not call any callback function.
Structures
G66WSB_DEVICE_INFO
Contains information about the G66WSB device.
C/C++ declaration
#pragma pack(push,1) typedef struct { char DevicePath[256]; uint8_t InterfaceType; char SerialNumber[9]; uint16_t HWVersion; uint16_t FWVersion[3]; uint8_t EEPROMVersion; uint32_t MaxDDCCount; uint32_t Flags; } G66WSB_DEVICE_INFO; #pragma pack(pop)Members
DevicePathThe device system path in a null-terminated string.InterfaceTypeDevice interface type. The value can be one of the following:
Value Meaning G66WSB_INTERFACE_TYPE_PCIE The device is connected to the computer via PCI express. G66WSB_INTERFACE_TYPE_USB2 The device is connected to the computer via USB that is not capable of USB3 speeds. The receiver works in limited mode and it is not usable. G66WSB_INTERFACE_TYPE_USB3 The device is connected to the computer via USB3. G66WSB_INTERFACE_TYPE_DEMO Demo G66WSB device. SerialNumberSerial number in null-terminated string.HWVersionVersion of the hardware.FWVersion[3]Version of the firmwares.EEPROMVersionEEPROM structure version.MaxDDCCountMaximum number of DDC channels which can be created by the CreateDDC function per single device.FlagsReserved for future use.
G66WSB_DEVICE_STATE
Contains information about the device state.
C/C++ declaration
#pragma pack(push,1) typedef struct { uint32_t Flags; int32_t Temperatures[3]; uint32_t FanRPM; uint64_t DataTransferred; uint64_t DataLost; } G66WSB_DEVICE_STATE; #pragma pack(pop)Members
FlagsA set of bits flags. This member can be a combination of the following flags:
Value Meaning G66WSB_DEVICE_STATE_HIGH_TEMPERATURE Critical temperature is detected and the device is turned off automatically. In this case the application should call SetPower to turn off explicitly. TemperaturesInternal device's temperatures in °C. If temperature is not available or it is unknown the value is equal to G66WSB_TEMPERATURE_UNKNOWN.FanRPMDevice's fan rotations per minute. Zero value means the fan is off.DataTransferredTotal number of bytes transferred from/to device since it has been open.DataLostTotal number of bytes lost. A non-zero value can indicate an unreliable USB connection or connection with insufficient data throughput.
G66WSB_CALLBACKS
Contains pointers to user-defined functions to be registered as callback functions.
Each callback function is called in context of the thread created by the API. If some shared data are accessed inside callback functions, it is recommended to use a mutual-exclusion synchronization method. The application should not call any G66WSB API function from the inside of callback functions, otherwise the function fails. The only exception is the GetSpectrumCompensation function which can be called from the inside of callback functions.
C/C++ declaration
#pragma pack(push,1) typedef struct { G66WSB_DDC_STREAM_CALLBACK DDCStreamCallback; G66WSB_AUDIO_STREAM_CALLBACK AudioStreamCallback; G66WSB_CHANNEL_ACTIVITY_CALLBACK ChannelActivityCallback } G66WSB_CALLBACKS; #pragma pack(pop)Members
Pointer to a user-defined function to be registered as a DDC stream callback. It is called by the API to pass I/Q samples from DDC to the application. The DDC streaming can be started using the StartDDC function.
C/C++ declaration
void DDCStreamCallback(uint32_t DDCId,const float *Buffer,uint32_t Count,float SlevelPeak,float SlevelRMS,uintptr_t UserData);Parameters
DDCIdSpecifies the identification number of the DDC channel. See CreateDDC.BufferPointer to the buffer which contains I/Q sample sets from DDC. Sample rate is 312.5 kHz, usable bandwidth is 250 kHz. Sample is 32-bit IEEE float from the range of -1.0 to 1.0. One I/Q sample set consists of two samples, I and Q.CountSpecifies the number of I/Q sample sets in the buffer pointed to by the Buffer parameter. This value is equal to value of the SampleSetsPerBuffer parameter of the StartDDC function.SlevelPeakSpecifies the peak signal level in Volts evaluated from samples stored in the buffer pointed to by the Buffer parameter.SlevelRMSSpecifies the RMS signal level in Volts evaluated from samples stored in the buffer pointed to by the Buffer parameter. For detailed information on how to convert RMS signal level to dBm, see the remarks of the GetSignalLevel function.UserDataUser-defined data. It is a value passed to the SetCallbacks function as the UserData parameter.Pointer to a user-defined function to be registered as an audio stream callback. It is called by the API to pass audio samples to the application. The audio streaming can be started using the StartAudio function. The callback is invoked three times for each audio buffer (see the description of the Stage parameter).
C/C++ declaration
void AudioStreamCallback(uint32_t DDCId,uint32_t Stage,const float *Buffer,uint32_t Count,uintptr_t UserData);Parameters
DDCIdSpecifies the identification number of the DDC channel. See CreateDDC.StageSpecifies the stage of audio samples stored in the buffer pointed to by the Buffer parameter. The value of this parameter can be one of the following:
Value Meaning G66WSB_AUDIO_STREAM_CALLBACK_STAGE_0 The buffer contains audio samples affected by the audio gain (see SetAudioGain). G66WSB_AUDIO_STREAM_CALLBACK_STAGE_1 The buffer contains audio samples affected by the audio gain and audio filter (see SetAudioGain and SetAudioFilter). G66WSB_AUDIO_STREAM_CALLBACK_STAGE_2 The buffer contains audio samples affected by the audio gain, audio filter and volume (see SetAudioGain, SetAudioFilter, SetVolume and SetMute). BufferPointer to the buffer which contains samples of the audio signal. The audio signal is mono (single channel), the sample rate is specified by the SetAudioSampleRate function, each sample is 32-bit IEEE float from the range of -1.0 to 1.0.CountSpecifies the number of samples stored in the buffer pointed to by the Buffer parameter. This value is equal to the value of the SamplesPerBuffer parameter of the StartAudio function.UserDataUser-defined data. It is a value passed to the SetCallbacks function as the UserData parameter.Pointer to a user-defined function to be registered as a channel activity callback. It is called by the API to pass measured signal levels of all the sonobuoy channels to the application at once. Channels activity monitoring is started using the StartChannelActivity function.
C/C++ declaration
void ChannelActivityCallback(const float *RMS,const float *dBm,uint16_t ADCLevel,uintptr_t UserData);Parameters
RMSPointer to the array which contains measured signal levels of the all the sonobuoy channels in volts. The array consists of 99 elements, the first element in the array (RMS[0]) contains signal level of the sonobuoy channel 1, the second elements (RMS[1]) contains signal level of the sonobuoy channel 2, etc.dBmPointer to the array which contains measured signal levels of the all the sonobuoy channels in dBm. The array consists of 99 elements, the first element in the array (dBm[0]) contains signal level of the sonobuoy channel 1, the second elements (dBm[1]) contains signal level of the sonobuoy channel 2, etc.ADCLevelSpecifies the maximum amplitude of ADC signal. Measurement of the maximum is started at the end of the previous calling of the this callback up to the current one. The possible value ranges from 0 to 32767. The value 32767 means ADC clipping.UserDataUser-defined data. It is a value passed to the SetCallbacks function as the UserData parameter.
Table
Sonobuoy channels
Channel Frequency Channel Frequency Channel Frequency 1 162.250 MHz 34 136.750 MHz 67 149.125 MHz 2 163.000 MHz 35 137.125 MHz 68 149.500 MHz 3 163.750 MHz 36 137.500 MHz 69 149.875 MHz 4 164.500 MHz 37 137.875 MHz 70 150.250 MHz 5 165.250 MHz 38 138.250 MHz 71 150.625 MHz 6 166.000 MHz 39 138.625 MHz 72 151.000 MHz 7 166.750 MHz 40 139.000 MHz 73 151.375 MHz 8 167.500 MHz 41 139.375 MHz 74 151.750 MHz 9 168.250 MHz 42 139.750 MHz 75 152.125 MHz 10 169.000 MHz 43 140.125 MHz 76 152.500 MHz 11 169.750 MHz 44 140.500 MHz 77 152.875 MHz 12 170.500 MHz 45 140.875 MHz 78 153.250 MHz 13 171.250 MHz 46 141.250 MHz 79 153.625 MHz 14 172.000 MHz 47 141.625 MHz 80 154.000 MHz 15 172.750 MHz 48 142.000 MHz 81 154.375 MHz 16 173.500 MHz 49 142.375 MHz 82 154.750 MHz 17 162.625 MHz 50 142.750 MHz 83 155.125 MHz 18 163.375 MHz 51 143.125 MHz 84 155.500 MHz 19 164.125 MHz 52 143.500 MHz 85 155.875 MHz 20 164.875 MHz 53 143.875 MHz 86 156.250 MHz 21 165.625 MHz 54 144.250 MHz 87 156.625 MHz 22 166.375 MHz 55 144.625 MHz 88 157.000 MHz 23 167.125 MHz 56 145.000 MHz 89 157.375 MHz 24 167.875 MHz 57 145.375 MHz 90 157.750 MHz 25 168.625 MHz 58 145.750 MHz 91 158.125 MHz 26 169.375 MHz 59 146.125 MHz 92 158.500 MHz 27 170.125 MHz 60 146.500 MHz 93 158.875 MHz 28 170.875 MHz 61 146.875 MHz 94 159.250 MHz 29 171.625 MHz 62 147.250 MHz 95 159.625 MHz 30 172.375 MHz 63 147.625 MHz 96 160.000 MHz 31 173.125 MHz 64 148.000 MHz 97 160.375 MHz 32 136.000 MHz 65 148.375 MHz 98 160.750 MHz 33 136.375 MHz 66 148.750 MHz 99 161.125 MHz