mirror of
https://github.com/30hours/blah2.git
synced 2024-11-18 12:33:58 +00:00
Fixed SDRplay API on Docker (run service on host)
This commit is contained in:
parent
0fb09ae062
commit
88897b862a
31 changed files with 39 additions and 1123 deletions
11
Dockerfile
11
Dockerfile
|
@ -3,14 +3,23 @@ MAINTAINER 30hours <nathan@30hours.dev>
|
|||
|
||||
WORKDIR blah2
|
||||
ADD lib lib
|
||||
RUN ls -lah && pwd
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y g++ make cmake libfftw3-dev liblapack-dev libopenblas-dev xz-utils libudev-dev libusb-1.0.0-dev sudo systemd doxygen graphviz
|
||||
RUN cd lib && tar xf armadillo-12.0.1.tar.xz && cd armadillo-12.0.1 && cmake . && make install
|
||||
RUN cd lib/sdrplay-3.0.7 && mkdir -p /etc/udev/rules.d && yes | ./install_lib.sh
|
||||
|
||||
RUN chmod +x /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run \
|
||||
&& /blah2/lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run --tar -xvf -C /blah2/lib/sdrplay-3.0.7 \
|
||||
&& cp /blah2/lib/sdrplay-3.0.7/x86_64/libsdrplay_api.so.3.07 /usr/local/lib/libsdrplay_api.so \
|
||||
&& cp /blah2/lib/sdrplay-3.0.7/x86_64/libsdrplay_api.so.3.07 /usr/local/lib/libsdrplay_api.so.3.07 \
|
||||
&& cp /blah2/lib/sdrplay-3.0.7/inc/* /usr/local/include \
|
||||
&& chmod 644 /usr/local/lib/libsdrplay_api.so /usr/local/lib/libsdrplay_api.so.3.07 \
|
||||
&& ldconfig
|
||||
|
||||
FROM blah2_env as blah2
|
||||
MAINTAINER 30hours <nathan@30hours.dev>
|
||||
|
||||
ADD . .
|
||||
RUN ls -lah /usr/local/include
|
||||
RUN rm -rf build && mkdir -p build && cd build && cmake .. && make
|
||||
RUN chmod +x bin/blah2
|
||||
|
|
13
README.md
13
README.md
|
@ -25,7 +25,7 @@ The build environment consists of a docker-compose.yml file running the followin
|
|||
|
||||
- Install docker and docker-compose on the host machine.
|
||||
- Clone this repository to some directory.
|
||||
- Install dependencies from Dockerfile.
|
||||
- Install SDRplay API to run service on host.
|
||||
- Edit the config.yml for desired processing parameters.
|
||||
- Run the docker-compose command.
|
||||
|
||||
|
@ -33,13 +33,11 @@ The build environment consists of a docker-compose.yml file running the followin
|
|||
git clone http://github.com/30hours/blah2
|
||||
cd blah2
|
||||
vim config/config.yml
|
||||
./lib/sdrplay-3.0.7/SDRplay_RSP_API-Linux-3.07.1.run --tar -xvf
|
||||
./lib/sdrplay-3.0.7/install.sh
|
||||
sudo mkdir /opt/blah2
|
||||
sudo chmod a+rw /opt/blah2
|
||||
|
||||
sudo docker-compose up -d blah2_frontend blah2_api
|
||||
mkdir build && cd build
|
||||
cmake .. && make && cd ..
|
||||
./bin/blah2 -c config/config.yml
|
||||
sudo docker-compose up -d
|
||||
```
|
||||
|
||||
The radar processing output is available on [http://localhost:49152](http://localhost:49152).
|
||||
|
@ -50,14 +48,13 @@ The radar processing output is available on [http://localhost:49152](http://loca
|
|||
|
||||
## Future Work
|
||||
|
||||
- The blah2 service can be built in Docker, except for the SDRplay API due to its dependence on *systemd*. This service needs to be built manually with *cmake* at present.
|
||||
- A CFAR detector has not yet been implemented.
|
||||
- Support for the HackRF and RTL-SDR using front-end mixer to sample 2 RF channels in 1 stream.
|
||||
- Occasional segmentation fault from a mutex issue.
|
||||
|
||||
## FAQ
|
||||
|
||||
- If the SDRplay RSPduo does not capture data, restart the API service using `sudo systemctl restart sdrplay.api`.
|
||||
- If the SDRplay RSPduo does not capture data, restart the API service (on the host) using `sudo systemctl restart sdrplay.api`.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ capture:
|
|||
fc: 204640000
|
||||
type: "RspDuo"
|
||||
replay:
|
||||
state: true
|
||||
state: false
|
||||
loop: true
|
||||
file: '/opt/blah2/replay/file.rspduo'
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
version: '3'
|
||||
|
||||
networks:
|
||||
nginx-web:
|
||||
blah2:
|
||||
external: true
|
||||
|
||||
services:
|
||||
|
@ -11,15 +11,17 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: blah2
|
||||
volumes:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
- /dev/shm:/dev/shm
|
||||
- /run/systemd/system:/run/systemd/system
|
||||
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
|
||||
- ~/blah2/replay:/blah2/replay
|
||||
- ./config:/blah2/config
|
||||
network_mode: host
|
||||
privileged: true
|
||||
command: /blah2/bin/blah2 -c config/config.yml
|
||||
command: >
|
||||
sh -c "/blah2/bin/blah2 -c config/config.yml"
|
||||
container_name: blah2
|
||||
|
||||
blah2_frontend:
|
||||
|
@ -30,12 +32,13 @@ services:
|
|||
volumes:
|
||||
- ./html:/usr/local/apache2/htdocs
|
||||
networks:
|
||||
- nginx-web
|
||||
- blah2
|
||||
container_name: blah2-web
|
||||
|
||||
blah2_api:
|
||||
restart: always
|
||||
build: ./api
|
||||
image: blah2_api
|
||||
ports:
|
||||
- 3000:8080
|
||||
network_mode: host
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
<title>blah2</title>
|
||||
|
||||
<!-- load lib js -->
|
||||
<script src="lib/bootstrap-5.2.3.min.js"></script>
|
||||
<script src="lib/plotly-2.20.0.min.js"></script>
|
||||
<script src="lib/jquery-3.6.4.min.js"></script>
|
||||
<script src="./lib/bootstrap-5.2.3.min.js"></script>
|
||||
<script src="./lib/plotly-2.20.0.min.js"></script>
|
||||
<script src="./lib/jquery-3.6.4.min.js"></script>
|
||||
|
||||
<!-- load lib css -->
|
||||
<link rel="stylesheet" href="lib/bootstrap-5.2.3.min.css">
|
||||
<link rel="stylesheet" href="./lib/bootstrap-5.2.3.min.css">
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
|
|
11
html/plot.js
11
html/plot.js
|
@ -3,6 +3,15 @@ var nRows = 3;
|
|||
var nCols = 3;
|
||||
var host = window.location.hostname;
|
||||
|
||||
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
|
||||
|
||||
var urlMap = ''
|
||||
if (isLocalHost) {
|
||||
urlMap = '//' + host + ':3000/map';
|
||||
} else {
|
||||
urlMap = '//' + host + '/api/map';
|
||||
}
|
||||
|
||||
var data = [
|
||||
{
|
||||
z: [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
|
||||
|
@ -49,7 +58,7 @@ var config = {
|
|||
Plotly.newPlot('ddmap', data, layout, config);
|
||||
|
||||
var intervalId = window.setInterval(function () {
|
||||
var apiData = $.getJSON('http://' + host + ':3000/map', function () { })
|
||||
var apiData = $.getJSON(urlMap, function () { })
|
||||
|
||||
.done(function (data) {
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="2500",MODE:="0666"
|
||||
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3000",MODE:="0666"
|
||||
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3010",MODE:="0666"
|
||||
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3020",MODE:="0666"
|
||||
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",ATTRS{idVendor}=="1df7",ATTRS{idProduct}=="3030",MODE:="0666"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,229 +0,0 @@
|
|||
#ifndef SDRPLAY_API_H
|
||||
#define SDRPLAY_API_H
|
||||
|
||||
#include "sdrplay_api_dev.h"
|
||||
#include "sdrplay_api_rx_channel.h"
|
||||
#include "sdrplay_api_callback.h"
|
||||
|
||||
#if defined(_M_X64) || defined(_M_IX86)
|
||||
#include "windows.h"
|
||||
#elif defined (__GNUC__)
|
||||
typedef void *HANDLE;
|
||||
#endif
|
||||
|
||||
#ifndef _SDRPLAY_DLL_QUALIFIER
|
||||
#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86))
|
||||
#define _SDRPLAY_DLL_QUALIFIER __declspec(dllimport)
|
||||
#elif defined(STATIC_LIB) || defined(__GNUC__)
|
||||
#define _SDRPLAY_DLL_QUALIFIER
|
||||
#endif
|
||||
#endif // _SDRPLAY_DLL_QUALIFIER
|
||||
|
||||
// Application code should check that it is compiled against the same API version
|
||||
// sdrplay_api_ApiVersion() returns the API version
|
||||
#define SDRPLAY_API_VERSION (float)(3.07)
|
||||
|
||||
// API Constants
|
||||
#define SDRPLAY_MAX_DEVICES (16)
|
||||
#define SDRPLAY_MAX_TUNERS_PER_DEVICE (2)
|
||||
|
||||
#define SDRPLAY_MAX_SER_NO_LEN (64)
|
||||
#define SDRPLAY_MAX_ROOT_NM_LEN (32)
|
||||
|
||||
#define SDRPLAY_RSP1_ID (1)
|
||||
#define SDRPLAY_RSP1A_ID (255)
|
||||
#define SDRPLAY_RSP2_ID (2)
|
||||
#define SDRPLAY_RSPduo_ID (3)
|
||||
#define SDRPLAY_RSPdx_ID (4)
|
||||
|
||||
// Enum types
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Success = 0,
|
||||
sdrplay_api_Fail = 1,
|
||||
sdrplay_api_InvalidParam = 2,
|
||||
sdrplay_api_OutOfRange = 3,
|
||||
sdrplay_api_GainUpdateError = 4,
|
||||
sdrplay_api_RfUpdateError = 5,
|
||||
sdrplay_api_FsUpdateError = 6,
|
||||
sdrplay_api_HwError = 7,
|
||||
sdrplay_api_AliasingError = 8,
|
||||
sdrplay_api_AlreadyInitialised = 9,
|
||||
sdrplay_api_NotInitialised = 10,
|
||||
sdrplay_api_NotEnabled = 11,
|
||||
sdrplay_api_HwVerError = 12,
|
||||
sdrplay_api_OutOfMemError = 13,
|
||||
sdrplay_api_ServiceNotResponding = 14,
|
||||
sdrplay_api_StartPending = 15,
|
||||
sdrplay_api_StopPending = 16,
|
||||
sdrplay_api_InvalidMode = 17,
|
||||
sdrplay_api_FailedVerification1 = 18,
|
||||
sdrplay_api_FailedVerification2 = 19,
|
||||
sdrplay_api_FailedVerification3 = 20,
|
||||
sdrplay_api_FailedVerification4 = 21,
|
||||
sdrplay_api_FailedVerification5 = 22,
|
||||
sdrplay_api_FailedVerification6 = 23,
|
||||
sdrplay_api_InvalidServiceVersion = 24
|
||||
} sdrplay_api_ErrT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Update_None = 0x00000000,
|
||||
|
||||
// Reasons for master only mode
|
||||
sdrplay_api_Update_Dev_Fs = 0x00000001,
|
||||
sdrplay_api_Update_Dev_Ppm = 0x00000002,
|
||||
sdrplay_api_Update_Dev_SyncUpdate = 0x00000004,
|
||||
sdrplay_api_Update_Dev_ResetFlags = 0x00000008,
|
||||
|
||||
sdrplay_api_Update_Rsp1a_BiasTControl = 0x00000010,
|
||||
sdrplay_api_Update_Rsp1a_RfNotchControl = 0x00000020,
|
||||
sdrplay_api_Update_Rsp1a_RfDabNotchControl = 0x00000040,
|
||||
|
||||
sdrplay_api_Update_Rsp2_BiasTControl = 0x00000080,
|
||||
sdrplay_api_Update_Rsp2_AmPortSelect = 0x00000100,
|
||||
sdrplay_api_Update_Rsp2_AntennaControl = 0x00000200,
|
||||
sdrplay_api_Update_Rsp2_RfNotchControl = 0x00000400,
|
||||
sdrplay_api_Update_Rsp2_ExtRefControl = 0x00000800,
|
||||
|
||||
sdrplay_api_Update_RspDuo_ExtRefControl = 0x00001000,
|
||||
|
||||
sdrplay_api_Update_Master_Spare_1 = 0x00002000,
|
||||
sdrplay_api_Update_Master_Spare_2 = 0x00004000,
|
||||
|
||||
// Reasons for master and slave mode
|
||||
// Note: sdrplay_api_Update_Tuner_Gr MUST be the first value defined in this section!
|
||||
sdrplay_api_Update_Tuner_Gr = 0x00008000,
|
||||
sdrplay_api_Update_Tuner_GrLimits = 0x00010000,
|
||||
sdrplay_api_Update_Tuner_Frf = 0x00020000,
|
||||
sdrplay_api_Update_Tuner_BwType = 0x00040000,
|
||||
sdrplay_api_Update_Tuner_IfType = 0x00080000,
|
||||
sdrplay_api_Update_Tuner_DcOffset = 0x00100000,
|
||||
sdrplay_api_Update_Tuner_LoMode = 0x00200000,
|
||||
|
||||
sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 0x00400000,
|
||||
sdrplay_api_Update_Ctrl_Decimation = 0x00800000,
|
||||
sdrplay_api_Update_Ctrl_Agc = 0x01000000,
|
||||
sdrplay_api_Update_Ctrl_AdsbMode = 0x02000000,
|
||||
sdrplay_api_Update_Ctrl_OverloadMsgAck = 0x04000000,
|
||||
|
||||
sdrplay_api_Update_RspDuo_BiasTControl = 0x08000000,
|
||||
sdrplay_api_Update_RspDuo_AmPortSelect = 0x10000000,
|
||||
sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 0x20000000,
|
||||
sdrplay_api_Update_RspDuo_RfNotchControl = 0x40000000,
|
||||
sdrplay_api_Update_RspDuo_RfDabNotchControl = 0x80000000,
|
||||
} sdrplay_api_ReasonForUpdateT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Update_Ext1_None = 0x00000000,
|
||||
|
||||
// Reasons for master only mode
|
||||
sdrplay_api_Update_RspDx_HdrEnable = 0x00000001,
|
||||
sdrplay_api_Update_RspDx_BiasTControl = 0x00000002,
|
||||
sdrplay_api_Update_RspDx_AntennaControl = 0x00000004,
|
||||
sdrplay_api_Update_RspDx_RfNotchControl = 0x00000008,
|
||||
sdrplay_api_Update_RspDx_RfDabNotchControl = 0x00000010,
|
||||
sdrplay_api_Update_RspDx_HdrBw = 0x00000020,
|
||||
|
||||
// Reasons for master and slave mode
|
||||
} sdrplay_api_ReasonForUpdateExtension1T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_DbgLvl_Disable = 0,
|
||||
sdrplay_api_DbgLvl_Verbose = 1,
|
||||
sdrplay_api_DbgLvl_Warning = 2,
|
||||
sdrplay_api_DbgLvl_Error = 3,
|
||||
sdrplay_api_DbgLvl_Message = 4,
|
||||
} sdrplay_api_DbgLvl_t;
|
||||
|
||||
// Device structure
|
||||
typedef struct
|
||||
{
|
||||
char SerNo[SDRPLAY_MAX_SER_NO_LEN];
|
||||
unsigned char hwVer;
|
||||
sdrplay_api_TunerSelectT tuner;
|
||||
sdrplay_api_RspDuoModeT rspDuoMode;
|
||||
double rspDuoSampleFreq;
|
||||
HANDLE dev;
|
||||
} sdrplay_api_DeviceT;
|
||||
|
||||
// Device parameter structure
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_DevParamsT *devParams;
|
||||
sdrplay_api_RxChannelParamsT *rxChannelA;
|
||||
sdrplay_api_RxChannelParamsT *rxChannelB;
|
||||
} sdrplay_api_DeviceParamsT;
|
||||
|
||||
// Extended error message structure
|
||||
typedef struct
|
||||
{
|
||||
char file[256];
|
||||
char function[256];
|
||||
int line;
|
||||
char message[1024];
|
||||
} sdrplay_api_ErrorInfoT;
|
||||
|
||||
// Comman API function types
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *apiVer);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *device);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *device);
|
||||
typedef const char* (*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT err);
|
||||
typedef sdrplay_api_ErrorInfoT* (*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *device);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void);
|
||||
|
||||
// Device API function types
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE dev, sdrplay_api_DbgLvl_t dbgLvl);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE dev);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE dev, sdrplay_api_TunerSelectT *tuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *currentSampleRate);
|
||||
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams,
|
||||
sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner,
|
||||
sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
|
||||
|
||||
// API function definitions
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Comman API function definitions
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Open(void);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Close(void);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_LockDeviceApi(void);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(void);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device);
|
||||
_SDRPLAY_DLL_QUALIFIER const char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT *device);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(void); // Must be called before sdrplay_api_SelectDevice()
|
||||
|
||||
// Device API function definitions
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate);
|
||||
_SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoMode(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams,
|
||||
sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner,
|
||||
sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //SDRPLAY_API_H
|
|
@ -1,78 +0,0 @@
|
|||
#ifndef SDRPLAY_API_CALLBACK_H
|
||||
#define SDRPLAY_API_CALLBACK_H
|
||||
|
||||
// Event callback enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Overload_Detected = 0,
|
||||
sdrplay_api_Overload_Corrected = 1,
|
||||
} sdrplay_api_PowerOverloadCbEventIdT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_MasterInitialised = 0,
|
||||
sdrplay_api_SlaveAttached = 1,
|
||||
sdrplay_api_SlaveDetached = 2,
|
||||
sdrplay_api_SlaveInitialised = 3,
|
||||
sdrplay_api_SlaveUninitialised = 4,
|
||||
sdrplay_api_MasterDllDisappeared = 5,
|
||||
sdrplay_api_SlaveDllDisappeared = 6,
|
||||
} sdrplay_api_RspDuoModeCbEventIdT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_GainChange = 0,
|
||||
sdrplay_api_PowerOverloadChange = 1,
|
||||
sdrplay_api_DeviceRemoved = 2,
|
||||
sdrplay_api_RspDuoModeChange = 3,
|
||||
} sdrplay_api_EventT;
|
||||
|
||||
// Event callback parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned int gRdB;
|
||||
unsigned int lnaGRdB;
|
||||
double currGain;
|
||||
} sdrplay_api_GainCbParamT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType;
|
||||
} sdrplay_api_PowerOverloadCbParamT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_RspDuoModeCbEventIdT modeChangeType;
|
||||
} sdrplay_api_RspDuoModeCbParamT;
|
||||
|
||||
// Event parameters overlay
|
||||
typedef union
|
||||
{
|
||||
sdrplay_api_GainCbParamT gainParams;
|
||||
sdrplay_api_PowerOverloadCbParamT powerOverloadParams;
|
||||
sdrplay_api_RspDuoModeCbParamT rspDuoModeParams;
|
||||
} sdrplay_api_EventParamsT;
|
||||
|
||||
// Stream callback parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned int firstSampleNum;
|
||||
int grChanged;
|
||||
int rfChanged;
|
||||
int fsChanged;
|
||||
unsigned int numSamples;
|
||||
} sdrplay_api_StreamCbParamsT;
|
||||
|
||||
// Callback function prototypes
|
||||
typedef void (*sdrplay_api_StreamCallback_t)(short *xi, short *xq, sdrplay_api_StreamCbParamsT *params, unsigned int numSamples, unsigned int reset, void *cbContext);
|
||||
typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT eventId, sdrplay_api_TunerSelectT tuner, sdrplay_api_EventParamsT *params, void *cbContext);
|
||||
|
||||
// Callback function struct
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_StreamCallback_t StreamACbFn;
|
||||
sdrplay_api_StreamCallback_t StreamBCbFn;
|
||||
sdrplay_api_EventCallback_t EventCbFn;
|
||||
} sdrplay_api_CallbackFnsT;
|
||||
|
||||
#endif //SDRPLAY_API_CALLBACK_H
|
|
@ -1,55 +0,0 @@
|
|||
#ifndef SDRPLAY_API_CONTROL_H
|
||||
#define SDRPLAY_API_CONTROL_H
|
||||
|
||||
// Control parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_AGC_DISABLE = 0,
|
||||
sdrplay_api_AGC_100HZ = 1,
|
||||
sdrplay_api_AGC_50HZ = 2,
|
||||
sdrplay_api_AGC_5HZ = 3,
|
||||
sdrplay_api_AGC_CTRL_EN = 4
|
||||
} sdrplay_api_AgcControlT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_ADSB_DECIMATION = 0,
|
||||
sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1,
|
||||
sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2,
|
||||
sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3
|
||||
} sdrplay_api_AdsbModeT;
|
||||
|
||||
// Control parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned char DCenable; // default: 1
|
||||
unsigned char IQenable; // default: 1
|
||||
} sdrplay_api_DcOffsetT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char enable; // default: 0
|
||||
unsigned char decimationFactor; // default: 1
|
||||
unsigned char wideBandSignal; // default: 0
|
||||
} sdrplay_api_DecimationT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_AgcControlT enable; // default: sdrplay_api_AGC_50HZ
|
||||
int setPoint_dBfs; // default: -60
|
||||
unsigned short attack_ms; // default: 0
|
||||
unsigned short decay_ms; // default: 0
|
||||
unsigned short decay_delay_ms; // default: 0
|
||||
unsigned short decay_threshold_dB; // default: 0
|
||||
int syncUpdate; // default: 0
|
||||
} sdrplay_api_AgcT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_DcOffsetT dcOffset;
|
||||
sdrplay_api_DecimationT decimation;
|
||||
sdrplay_api_AgcT agc;
|
||||
sdrplay_api_AdsbModeT adsbMode; //default: sdrplay_api_ADSB_DECIMATION
|
||||
} sdrplay_api_ControlParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_CONTROL_H
|
|
@ -1,51 +0,0 @@
|
|||
#ifndef SDRPLAY_API_DEV_H
|
||||
#define SDRPLAY_API_DEV_H
|
||||
|
||||
#include "sdrplay_api_rsp1a.h"
|
||||
#include "sdrplay_api_rsp2.h"
|
||||
#include "sdrplay_api_rspDuo.h"
|
||||
#include "sdrplay_api_rspDx.h"
|
||||
|
||||
// Dev parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_ISOCH = 0,
|
||||
sdrplay_api_BULK = 1
|
||||
} sdrplay_api_TransferModeT;
|
||||
|
||||
// Dev parameter structs
|
||||
typedef struct
|
||||
{
|
||||
double fsHz; // default: 2000000.0
|
||||
unsigned char syncUpdate; // default: 0
|
||||
unsigned char reCal; // default: 0
|
||||
} sdrplay_api_FsFreqT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int sampleNum; // default: 0
|
||||
unsigned int period; // default: 0
|
||||
} sdrplay_api_SyncUpdateT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char resetGainUpdate; // default: 0
|
||||
unsigned char resetRfUpdate; // default: 0
|
||||
unsigned char resetFsUpdate; // default: 0
|
||||
} sdrplay_api_ResetFlagsT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double ppm; // default: 0.0
|
||||
sdrplay_api_FsFreqT fsFreq;
|
||||
sdrplay_api_SyncUpdateT syncUpdate;
|
||||
sdrplay_api_ResetFlagsT resetFlags;
|
||||
sdrplay_api_TransferModeT mode; // default: sdrplay_api_ISOCH
|
||||
unsigned int samplesPerPkt; // default: 0 (output param)
|
||||
sdrplay_api_Rsp1aParamsT rsp1aParams;
|
||||
sdrplay_api_Rsp2ParamsT rsp2Params;
|
||||
sdrplay_api_RspDuoParamsT rspDuoParams;
|
||||
sdrplay_api_RspDxParamsT rspDxParams;
|
||||
} sdrplay_api_DevParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_DEV_H
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef SDRPLAY_API_RSP1A_H
|
||||
#define SDRPLAY_API_RSP1A_H
|
||||
|
||||
#define RSPIA_NUM_LNA_STATES 10
|
||||
#define RSPIA_NUM_LNA_STATES_AM 7
|
||||
#define RSPIA_NUM_LNA_STATES_LBAND 9
|
||||
|
||||
// RSP1A parameter enums
|
||||
|
||||
// RSP1A parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned char rfNotchEnable; // default: 0
|
||||
unsigned char rfDabNotchEnable; // default: 0
|
||||
} sdrplay_api_Rsp1aParamsT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char biasTEnable; // default: 0
|
||||
} sdrplay_api_Rsp1aTunerParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_RSP1A_H
|
|
@ -1,35 +0,0 @@
|
|||
#ifndef SDRPLAY_API_RSP2_H
|
||||
#define SDRPLAY_API_RSP2_H
|
||||
|
||||
#define RSPII_NUM_LNA_STATES 9
|
||||
#define RSPII_NUM_LNA_STATES_AMPORT 5
|
||||
#define RSPII_NUM_LNA_STATES_420MHZ 6
|
||||
|
||||
// RSP2 parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Rsp2_ANTENNA_A = 5,
|
||||
sdrplay_api_Rsp2_ANTENNA_B = 6,
|
||||
} sdrplay_api_Rsp2_AntennaSelectT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Rsp2_AMPORT_1 = 1,
|
||||
sdrplay_api_Rsp2_AMPORT_2 = 0,
|
||||
} sdrplay_api_Rsp2_AmPortSelectT;
|
||||
|
||||
// RSP2 parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned char extRefOutputEn; // default: 0
|
||||
} sdrplay_api_Rsp2ParamsT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char biasTEnable; // default: 0
|
||||
sdrplay_api_Rsp2_AmPortSelectT amPortSel; // default: sdrplay_api_Rsp2_AMPORT_2
|
||||
sdrplay_api_Rsp2_AntennaSelectT antennaSel; // default: sdrplay_api_Rsp2_ANTENNA_A
|
||||
unsigned char rfNotchEnable; // default: 0
|
||||
} sdrplay_api_Rsp2TunerParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_RSP2_H
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef SDRPLAY_API_RSPduo_H
|
||||
#define SDRPLAY_API_RSPduo_H
|
||||
|
||||
#define RSPDUO_NUM_LNA_STATES 10
|
||||
#define RSPDUO_NUM_LNA_STATES_AMPORT 5
|
||||
#define RSPDUO_NUM_LNA_STATES_AM 7
|
||||
#define RSPDUO_NUM_LNA_STATES_LBAND 9
|
||||
|
||||
// RSPduo parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_RspDuoMode_Unknown = 0,
|
||||
sdrplay_api_RspDuoMode_Single_Tuner = 1,
|
||||
sdrplay_api_RspDuoMode_Dual_Tuner = 2,
|
||||
sdrplay_api_RspDuoMode_Master = 4,
|
||||
sdrplay_api_RspDuoMode_Slave = 8,
|
||||
} sdrplay_api_RspDuoModeT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_RspDuo_AMPORT_1 = 1,
|
||||
sdrplay_api_RspDuo_AMPORT_2 = 0,
|
||||
} sdrplay_api_RspDuo_AmPortSelectT;
|
||||
|
||||
// RSPduo parameter structs
|
||||
typedef struct
|
||||
{
|
||||
int extRefOutputEn; // default: 0
|
||||
} sdrplay_api_RspDuoParamsT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char biasTEnable; // default: 0
|
||||
sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; // default: sdrplay_api_RspDuo_AMPORT_2
|
||||
unsigned char tuner1AmNotchEnable; // default: 0
|
||||
unsigned char rfNotchEnable; // default: 0
|
||||
unsigned char rfDabNotchEnable; // default: 0
|
||||
} sdrplay_api_RspDuoTunerParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_RSPduo_H
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef SDRPLAY_API_RSPDX_H
|
||||
#define SDRPLAY_API_RSPDX_H
|
||||
|
||||
#include "sdrplay_api_tuner.h"
|
||||
|
||||
#define RSPDX_NUM_LNA_STATES 28 // Number of LNA states in all bands (except where defined differently below)
|
||||
#define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 // Number of LNA states when using AM Port 2 between 0 and 12MHz
|
||||
#define RSPDX_NUM_LNA_STATES_AMPORT2_12_60 20 // Number of LNA states when using AM Port 2 between 12 and 60MHz
|
||||
#define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 // Number of LNA states in VHF and Band3
|
||||
#define RSPDX_NUM_LNA_STATES_420MHZ 21 // Number of LNA states in 420MHz band
|
||||
#define RSPDX_NUM_LNA_STATES_LBAND 19 // Number of LNA states in L-band
|
||||
#define RSPDX_NUM_LNA_STATES_DX 26 // Number of LNA states in DX path
|
||||
|
||||
// RSPdx parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_RspDx_ANTENNA_A = 0,
|
||||
sdrplay_api_RspDx_ANTENNA_B = 1,
|
||||
sdrplay_api_RspDx_ANTENNA_C = 2,
|
||||
} sdrplay_api_RspDx_AntennaSelectT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0,
|
||||
sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1,
|
||||
sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2,
|
||||
sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3,
|
||||
} sdrplay_api_RspDx_HdrModeBwT;
|
||||
|
||||
// RSPdx parameter structs
|
||||
typedef struct
|
||||
{
|
||||
unsigned char hdrEnable; // default: 0
|
||||
unsigned char biasTEnable; // default: 0
|
||||
sdrplay_api_RspDx_AntennaSelectT antennaSel; // default: sdrplay_api_RspDx_ANTENNA_A
|
||||
unsigned char rfNotchEnable; // default: 0
|
||||
unsigned char rfDabNotchEnable; // default: 0
|
||||
} sdrplay_api_RspDxParamsT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_RspDx_HdrModeBwT hdrBw; // default: sdrplay_api_RspDx_HDRMODE_BW_1_700
|
||||
} sdrplay_api_RspDxTunerParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_RSPDX_H
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef SDRPLAY_API_RX_CHANNEL_H
|
||||
#define SDRPLAY_API_RX_CHANNEL_H
|
||||
|
||||
#include "sdrplay_api_tuner.h"
|
||||
#include "sdrplay_api_control.h"
|
||||
#include "sdrplay_api_rsp1a.h"
|
||||
#include "sdrplay_api_rsp2.h"
|
||||
#include "sdrplay_api_rspDuo.h"
|
||||
#include "sdrplay_api_rspDx.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_TunerParamsT tunerParams;
|
||||
sdrplay_api_ControlParamsT ctrlParams;
|
||||
sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams;
|
||||
sdrplay_api_Rsp2TunerParamsT rsp2TunerParams;
|
||||
sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams;
|
||||
sdrplay_api_RspDxTunerParamsT rspDxTunerParams;
|
||||
} sdrplay_api_RxChannelParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_RX_CHANNEL_H
|
|
@ -1,93 +0,0 @@
|
|||
#ifndef SDRPLAY_API_TUNER_H
|
||||
#define SDRPLAY_API_TUNER_H
|
||||
|
||||
#define MAX_BB_GR (59)
|
||||
|
||||
// Tuner parameter enums
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_BW_Undefined = 0,
|
||||
sdrplay_api_BW_0_200 = 200,
|
||||
sdrplay_api_BW_0_300 = 300,
|
||||
sdrplay_api_BW_0_600 = 600,
|
||||
sdrplay_api_BW_1_536 = 1536,
|
||||
sdrplay_api_BW_5_000 = 5000,
|
||||
sdrplay_api_BW_6_000 = 6000,
|
||||
sdrplay_api_BW_7_000 = 7000,
|
||||
sdrplay_api_BW_8_000 = 8000
|
||||
} sdrplay_api_Bw_MHzT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_IF_Undefined = -1,
|
||||
sdrplay_api_IF_Zero = 0,
|
||||
sdrplay_api_IF_0_450 = 450,
|
||||
sdrplay_api_IF_1_620 = 1620,
|
||||
sdrplay_api_IF_2_048 = 2048
|
||||
} sdrplay_api_If_kHzT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_LO_Undefined = 0,
|
||||
sdrplay_api_LO_Auto = 1,
|
||||
sdrplay_api_LO_120MHz = 2,
|
||||
sdrplay_api_LO_144MHz = 3,
|
||||
sdrplay_api_LO_168MHz = 4
|
||||
} sdrplay_api_LoModeT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_EXTENDED_MIN_GR = 0,
|
||||
sdrplay_api_NORMAL_MIN_GR = 20
|
||||
} sdrplay_api_MinGainReductionT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sdrplay_api_Tuner_Neither = 0,
|
||||
sdrplay_api_Tuner_A = 1,
|
||||
sdrplay_api_Tuner_B = 2,
|
||||
sdrplay_api_Tuner_Both = 3,
|
||||
} sdrplay_api_TunerSelectT;
|
||||
|
||||
// Tuner parameter structs
|
||||
typedef struct
|
||||
{
|
||||
float curr;
|
||||
float max;
|
||||
float min;
|
||||
} sdrplay_api_GainValuesT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int gRdB; // default: 50
|
||||
unsigned char LNAstate; // default: 0
|
||||
unsigned char syncUpdate; // default: 0
|
||||
sdrplay_api_MinGainReductionT minGr; // default: sdrplay_api_NORMAL_MIN_GR
|
||||
sdrplay_api_GainValuesT gainVals; // output parameter
|
||||
} sdrplay_api_GainT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double rfHz; // default: 200000000.0
|
||||
unsigned char syncUpdate; // default: 0
|
||||
} sdrplay_api_RfFreqT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char dcCal; // default: 3 (Periodic mode)
|
||||
unsigned char speedUp; // default: 0 (No speedup)
|
||||
int trackTime; // default: 1 (=> time in uSec = (72 * 3 * trackTime) / 24e6 = 9uSec)
|
||||
int refreshRateTime; // default: 2048 (=> time in uSec = (72 * 3 * refreshRateTime) / 24e6 = 18432uSec)
|
||||
} sdrplay_api_DcOffsetTunerT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sdrplay_api_Bw_MHzT bwType; // default: sdrplay_api_BW_0_200
|
||||
sdrplay_api_If_kHzT ifType; // default: sdrplay_api_IF_Zero
|
||||
sdrplay_api_LoModeT loMode; // default: sdrplay_api_LO_Auto
|
||||
sdrplay_api_GainT gain;
|
||||
sdrplay_api_RfFreqT rfFreq;
|
||||
sdrplay_api_DcOffsetTunerT dcOffsetTuner;
|
||||
} sdrplay_api_TunerParamsT;
|
||||
|
||||
#endif //SDRPLAY_API_TUNER_H
|
|
@ -1,181 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
VERS="3.07"
|
||||
MAJVERS="3"
|
||||
|
||||
echo "Installing SDRplay RSP API library ${VERS}..."
|
||||
read -p "Press RETURN to view the license agreement" ret
|
||||
|
||||
#more sdrplay_license.txt
|
||||
|
||||
while true; do
|
||||
echo "Press y and RETURN to accept the license agreement and continue with"
|
||||
read -p "the installation, or press n and RETURN to exit the installer [y/n] " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer y or n";;
|
||||
esac
|
||||
done
|
||||
|
||||
ARCH=`uname -m`
|
||||
OSDIST="Unknown"
|
||||
|
||||
if [ -f "/etc/os-release" ]; then
|
||||
OSDIST=`sed '1q;d' /etc/os-release`
|
||||
echo "DISTRIBUTION ${OSDIST}"
|
||||
case "$OSDIST" in
|
||||
*Alpine*)
|
||||
ARCH="Alpine64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "Architecture: ${ARCH}"
|
||||
echo "API Version: ${VERS}"
|
||||
|
||||
if [ "${ARCH}" != "x86_64" ]; then
|
||||
if [ "${ARCH}" != "i386" ]; then
|
||||
if [ "${ARCH}" != "i686" ]; then
|
||||
if [ "${ARCH}" != "Alpine64" ]; then
|
||||
echo "The architecture on this device (${ARCH}) is not currently supported."
|
||||
echo "Please contact software@sdrplay.com for details on platform support."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "If not installing as root, you will be prompted for your password"
|
||||
echo "for sudo access to the /usr/local area..."
|
||||
sudo mkdir -p /usr/local/lib >> /dev/null 2>&1
|
||||
echo "The rest of the installation will continue with root permission..."
|
||||
|
||||
if [ -d "/etc/udev/rules.d" ]; then
|
||||
echo -n "Udev rules directory found, adding rules..."
|
||||
sudo cp -f 66-mirics.rules /etc/udev/rules.d/66-mirics.rules
|
||||
sudo chmod 644 /etc/udev/rules.d/66-mirics.rules
|
||||
echo "Done"
|
||||
else
|
||||
echo " "
|
||||
echo "ERROR: udev rules directory not found, add udev support and run the"
|
||||
echo "installer again. udev support can be added by running..."
|
||||
echo "sudo apt install libudev-dev"
|
||||
echo " "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TYPE="LOCAL"
|
||||
if [ -d "/usr/local/lib" ]; then
|
||||
if [ -d "/usr/local/include" ]; then
|
||||
if [ -d "/usr/local/bin" ]; then
|
||||
echo "Installing files into /usr/local/... (/lib, /bin, /include)"
|
||||
INSTALLLIBDIR="/usr/local/lib"
|
||||
INSTALLINCDIR="/usr/local/include"
|
||||
INSTALLBINDIR="/usr/local/bin"
|
||||
else
|
||||
TYPE="USR"
|
||||
fi
|
||||
else
|
||||
TYPE="USR"
|
||||
fi
|
||||
else
|
||||
TYPE="USR"
|
||||
fi
|
||||
|
||||
if [ "${TYPE}" != "LOCAL" ]; then
|
||||
echo "Installing files into /usr/... (/lib, /bin, /include)"
|
||||
INSTALLLIBDIR="/usr/lib"
|
||||
INSTALLINCDIR="/usr/include"
|
||||
INSTALLBINDIR="/usr/bin"
|
||||
fi
|
||||
|
||||
echo -n "Installing ${INSTALLLIBDIR}/libsdrplay_api.so.${VERS}..."
|
||||
sudo rm -f ${INSTALLLIBDIR}/libsdrplay_api.so.${VERS}
|
||||
sudo cp -f ${ARCH}/libsdrplay_api.so.${VERS} ${INSTALLLIBDIR}/.
|
||||
sudo chmod 644 ${INSTALLLIBDIR}/libsdrplay_api.so.${VERS}
|
||||
sudo rm -f ${INSTALLLIBDIR}/libsdrplay_api.so.${MAJVERS}
|
||||
sudo ln -s ${INSTALLLIBDIR}/libsdrplay_api.so.${VERS} ${INSTALLLIBDIR}/libsdrplay_api.so.${MAJVERS}
|
||||
sudo rm -f ${INSTALLLIBDIR}/libsdrplay_api.so
|
||||
sudo ln -s ${INSTALLLIBDIR}/libsdrplay_api.so.${MAJVERS} ${INSTALLLIBDIR}/libsdrplay_api.so
|
||||
echo "Done"
|
||||
|
||||
echo -n "Installing header files in ${INSTALLINCDIR}..."
|
||||
sudo cp -f inc/sdrplay_api*.h ${INSTALLINCDIR}/.
|
||||
sudo chmod 644 ${INSTALLINCDIR}/sdrplay_api*.h
|
||||
echo "Done"
|
||||
|
||||
echo -n "Installing API Service in ${INSTALLBINDIR}..."
|
||||
sudo cp -f ${ARCH}/sdrplay_apiService ${INSTALLBINDIR}/sdrplay_apiService
|
||||
sudo chmod 755 ${INSTALLBINDIR}/sdrplay_apiService
|
||||
echo "Done"
|
||||
|
||||
echo -n "Installing Service scripts and starting daemon..."
|
||||
if [ -d "/etc/systemd/system" ]; then
|
||||
SRVTYPE="systemd"
|
||||
if [ "${TYPE}" != "LOCAL" ]; then
|
||||
sudo cp -f scripts/sdrplay.service.usr /etc/systemd/system/sdrplay.service
|
||||
else
|
||||
sudo cp -f scripts/sdrplay.service.local /etc/systemd/system/sdrplay.service
|
||||
fi
|
||||
sudo chmod 644 /etc/systemd/system/sdrplay.service
|
||||
sudo systemctl start sdrplay
|
||||
sudo systemctl enable sdrplay
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart sdrplay
|
||||
else
|
||||
SRVTYPE="initd"
|
||||
if [ "${TYPE}" != "LOCAL" ]; then
|
||||
sudo cp -f scripts/sdrplayService_usr /etc/init.d/sdrplayService
|
||||
else
|
||||
sudo cp -f scripts/sdrplayService_local /etc/init.d/sdrplayService
|
||||
fi
|
||||
sudo chmod 755 /etc/init.d/sdrplayService
|
||||
sudo update-rc.d sdrplayService defaults
|
||||
sudo service sdrplayService start
|
||||
fi
|
||||
|
||||
sudo ldconfig
|
||||
|
||||
echo "Done"
|
||||
|
||||
echo " "
|
||||
echo "Service has been installed and started. This device should be rebooted"
|
||||
echo "before the service is used. After the installation script finishes,"
|
||||
echo "reboot this device."
|
||||
|
||||
echo " "
|
||||
echo "To start and stop the API service, use the following commands..."
|
||||
echo " "
|
||||
if [ "${SRVTYPE}" != "systemd" ]; then
|
||||
echo "sudo service sdrplayService start"
|
||||
echo "sudo service sdrplayService stop"
|
||||
else
|
||||
echo "sudo systemctl start sdrplay"
|
||||
echo "sudo systemctl stop sdrplay"
|
||||
fi
|
||||
echo " "
|
||||
echo "SDRplay API ${VERS} Installation Finished"
|
||||
echo " "
|
||||
while true; do
|
||||
echo "Would you like to add SDRplay USB IDs to the local database for easier"
|
||||
read -p "identification in applications such as lsusb? [y/n] " yn
|
||||
case $yn in
|
||||
[Yy]* ) break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer y or n";;
|
||||
esac
|
||||
done
|
||||
sudo cp scripts/sdrplay_usbids.sh ${INSTALLBINDIR}/.
|
||||
sudo chmod 755 ${INSTALLBINDIR}/sdrplay_usbids.sh
|
||||
sudo cp scripts/sdrplay_ids.txt ${INSTALLBINDIR}/.
|
||||
sudo chmod 644 ${INSTALLBINDIR}/sdrplay_ids.txt
|
||||
${INSTALLBINDIR}/sdrplay_usbids.sh
|
||||
|
||||
echo "SDRplay IDs added. Try typing lsusb with an SDRplay device connected."
|
||||
echo "If the USB IDs get updated from the central reprository, just type"
|
||||
echo "the following command to add the SDRplay devices again..."
|
||||
echo " "
|
||||
echo "sdrplay_usbids.sh"
|
||||
echo " "
|
||||
echo "Installation Finished"
|
|
@ -1,15 +0,0 @@
|
|||
[Unit]
|
||||
Description=SDRplay API Service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/sdrplay_apiService
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
[Unit]
|
||||
Description=SDRplay API Service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
User=root
|
||||
ExecStart=/usr/bin/sdrplay_apiService
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sdrplayServicedaemon
|
||||
# Required-Start: $local_fs $network $syslog
|
||||
# Required-Stop: $local_fs $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: sdrplay_apiService
|
||||
# Description: Service for SDRplay API
|
||||
### END INIT INFO
|
||||
|
||||
NAME="sdrplay_apiService"
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
APPDIR="/"
|
||||
APPBIN="/usr/local/bin/sdrplay_apiService"
|
||||
APPARGS=""
|
||||
|
||||
# Include functions
|
||||
set -e
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
start() {
|
||||
printf "Starting '$NAME'... "
|
||||
start-stop-daemon --start --background --make-pidfile --pidfile /var/run/$NAME.pid --chdir "$APPDIR" --exec "$APPBIN" -- $APPARGS || true
|
||||
printf "done\n"
|
||||
}
|
||||
|
||||
#We need this function to ensure the whole process tree will be killed
|
||||
killtree() {
|
||||
local _pid=$1
|
||||
local _sig=${2-TERM}
|
||||
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
|
||||
killtree ${_child} ${_sig}
|
||||
done
|
||||
kill -${_sig} ${_pid}
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping '$NAME'... "
|
||||
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || \
|
||||
while test -d /proc/$(cat /var/run/$NAME.pid); do
|
||||
killtree $(cat /var/run/$NAME.pid) 15
|
||||
sleep 0.5
|
||||
done
|
||||
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || rm /var/run/$NAME.pid
|
||||
printf "done\n"
|
||||
}
|
||||
|
||||
status() {
|
||||
status_of_proc -p /var/run/$NAME.pid "" $NAME && exit 0 || exit $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sdrplayServicedaemon
|
||||
# Required-Start: $local_fs $network $syslog
|
||||
# Required-Stop: $local_fs $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: sdrplay_apiService
|
||||
# Description: Service for SDRplay API
|
||||
### END INIT INFO
|
||||
|
||||
NAME="sdrplay_apiService"
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
APPDIR="/"
|
||||
APPBIN="/usr/bin/sdrplay_apiService"
|
||||
APPARGS=""
|
||||
|
||||
# Include functions
|
||||
set -e
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
start() {
|
||||
printf "Starting '$NAME'... "
|
||||
start-stop-daemon --start --background --make-pidfile --pidfile /var/run/$NAME.pid --chdir "$APPDIR" --exec "$APPBIN" -- $APPARGS || true
|
||||
printf "done\n"
|
||||
}
|
||||
|
||||
#We need this function to ensure the whole process tree will be killed
|
||||
killtree() {
|
||||
local _pid=$1
|
||||
local _sig=${2-TERM}
|
||||
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
|
||||
killtree ${_child} ${_sig}
|
||||
done
|
||||
kill -${_sig} ${_pid}
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping '$NAME'... "
|
||||
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || \
|
||||
while test -d /proc/$(cat /var/run/$NAME.pid); do
|
||||
killtree $(cat /var/run/$NAME.pid) 15
|
||||
sleep 0.5
|
||||
done
|
||||
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || rm /var/run/$NAME.pid
|
||||
printf "done\n"
|
||||
}
|
||||
|
||||
status() {
|
||||
status_of_proc -p /var/run/$NAME.pid "" $NAME && exit 0 || exit $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# SDRplay USB IDs
|
||||
1df7 SDRplay
|
||||
2500 RSP1
|
||||
3000 RSP1A
|
||||
3010 RSP2/RSP2pro
|
||||
3020 RSPduo
|
||||
3030 RSPdx
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo "This script will add the SDRplay IDs to the local USB database"
|
||||
echo "and will require sudo permissions. Enter your password if prompted"
|
||||
echo " "
|
||||
if [ -f "/var/lib/usbutils/usb.ids" ]; then
|
||||
if grep -q SDRplay /var/lib/usbutils/usb.ids; then
|
||||
echo "Database already contains SDRplay devices"
|
||||
exit 0
|
||||
else
|
||||
sudo cp -f /var/lib/usbutils/usb.ids /var/lib/usbutils/usb.ids.bak
|
||||
echo "cat /usr/local/bin/sdrplay_ids.txt /var/lib/usbutils/usb.ids.bak > /var/lib/usbutils/usb.ids" | sudo bash
|
||||
echo "Now when you type lsusb you will see the correct SDRplay device type"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "No USB database found. Exiting..."
|
||||
exit 1
|
||||
fi
|
|
@ -1,42 +0,0 @@
|
|||
Press space when prompted with --More-- to read the license agreement.
|
||||
|
||||
SDRplay Limited
|
||||
END USER LICENCE AGREEMENT
|
||||
|
||||
The SDRplay software (“Product”) you are about to install, run and/or use is licensed by SDRplay Limited, a company registered in England (No. 09035244), whose registered office is 21 Lenten Street ALTON Hampshire GU34 1HG UK(“SDRplay”), and is subject to the following licence terms (“Licence”).
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
By proceeding to install, run and/or use the Product, you confirm that you accept and agree to be bound by the terms of this Licence. If you do not agree to any of the terms of this Licence, SDRplay is unwilling to provide access to the Product to you and you should not proceed further and may not use the Product.
|
||||
|
||||
1. Licence To Use The Product.
|
||||
|
||||
1.1 Grant of Licence.
|
||||
Subject to the terms and conditions of this License, SDRplay hereby grants to you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable license to reproduce, publicly display, publicly perform, create Derivative works, incorporate in other products sublicense, and distribute the Product in Object form.
|
||||
|
||||
|
||||
1.2 Restrictions. You may not: modify, disassemble, decompile or reverse engineer the Product, except to the extent specifically authorised under applicable law notwithstanding contractual prohibition
|
||||
|
||||
1.3. Redistribution. You may reproduce and distribute copies of the Product in any medium, without modifications, in Object form, provided that you meet the following conditions:
|
||||
1. You must give any other recipients of the Product or Derivative Works a copy of this License; and
|
||||
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
3. Any Derivative Works that You distribute must include a readable statement that the Copyright in the Product is owned by and licensed by SDRplay. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the statement, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
|
||||
1.3 Open Source Software. The Product may contain code, commonly referred to as open source software, which is distributed under any of the many known variations of open source licence terms, including terms which allow the free distribution and modification of the relevant software’s source code and/or which require all distributors to make such source code freely available upon request, including any contributions or modifications made by such distributor (collectively, “Open Source Software”). To the extent that the Product contains any Open Source Software, that element only is licensed to you pursuant to the relevant licence terms of the applicable third party licensor (“Open Source Licence Terms”) and not pursuant to this Licence, and you accept and agree to be bound by such terms. A copy of the Open Source Licence Terms will be made available upon request.
|
||||
|
||||
2. Confidentiality Obligations. You acknowledge that the Product contains confidential, proprietary and trade secret information belonging to SDRplay and you agree to hold such information, and any other confidential or proprietary information of SDRplay (collectively, "Confidential Information") in strict confidence and agree not to disclose any Confidential Information to any third party. You will have no obligation to maintain the confidentiality of any information which: (a) is or becomes publicly available without breach of this Licence; (b) is rightfully received by you from a third party without an obligation of confidentiality and without breach of this Licence; (c) is required to be disclosed by law or regulation or by court order; or (d) has been approved for release by written permission of SDRplay.
|
||||
|
||||
3. Ownership. You acknowledge and agree that SDRplay or its third party licensors (including in particular Mirics Limited) own all rights, title and interest in and to the Product and all modifications, enhancements and derivative works SDRplay may develop to or from the Product and any and all intellectual property rights in all of the foregoing. You agree not to use any of SDRplay’s or Mirics’ trademarks or other business names included in the Product for any purpose. You acknowledge that, except as expressly set out in this Licence, nothing in this Licence will give you rights in respect of any intellectual property rights owned by SDRplay or its licensors. All intellectual property rights and other rights of SDRplay and its licensors which are not expressly granted to you by this Licence are reserved.
|
||||
|
||||
4. Limited Warranty. SDRplay warrants that the Product will, under normal operating conditions, operate substantially in accordance with SDRplay’ published specification for the Product. SDRplay does not represent or warrant that: (a) the use of the Product will be secure, timely, uninterrupted or error-free or compatible in combination with any other hardware, software, system or data; (b) the Product will meet your expectations; (c) errors or defects in the Product will be corrected; or that (d) the Product is free of viruses or other harmful components. SDRplay makes no representation and gives no warranty in respect of any Open Source Software component of the Product.
|
||||
|
||||
Except as expressly set out in this Licence, no implied conditions, warranties or other terms, including any implied terms relating to satisfactory quality or fitness for any purpose, will apply to the Product and, to the maximum extent permitted by applicable law, are excluded by SDRplay.
|
||||
|
||||
5. SDRplay’ Liability. Nothing in this Licence will limit or exclude SDRplay’ liability to you: (a) for death or personal injury caused by SDRplay’ negligence; (b) for fraud; (c) for breach of any obligations implied by section 12 of the Sale of Goods Act 1979 or section 2 of the Supply of Goods and Services Act 1982; or (d) for any other liability that may not, under applicable law, be limited or excluded. Subject to this, in no event will SDRplay be liable to you for any indirect or consequential losses, or for any loss of profit, revenue, contracts, data, goodwill or other similar losses, and any liability SDRplay does have for losses you suffer arising under or in connection with this Licence and/or the Product is strictly limited to losses that were reasonably foreseeable.
|
||||
|
||||
6. Data. The Product may, without further notification, transmit the serial number of an SDRplay device using the Product to an SDRplay server. No personal information, including but not limited to information about the computer running the Product or its location will be gathered or transmitted as part of this process.
|
||||
|
||||
7. General. You may not transfer or assign any or all of your rights and/or obligations under this Licence. All notices given by you to SDRplay must be given in writing to SDRplay’ registered office address. If SDRplay fails to enforce any of our rights, that does not result in a waiver of that right. If any provision of these terms and conditions is found to be unenforceable, all other provisions shall remain unaffected. The terms of this Licence may not be varied except with SDRplay’ express written consent. The terms of this Licence represent the entire agreement between you and SDRplay in relation to the subject matter of this Licence. The terms of this Licence shall be governed by English law and you agree that any claim you may have against SDRplay arising under or in connection with this Licence and/or the Product may only be dealt with by the English courts, provided that, if you are a consumer: (a) and you live in a part of the United Kingdom other than England, the applicable law of that part of the United Kingdom will govern and any claim may be brought by you before the courts there; or (b) you live in another member state of the European Union, any claim may be brought by you before the courts there.
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue