File: ModulesC.cpp

package info (click to toggle)
soapysdr 0.8.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: cpp: 5,378; ansic: 471; python: 311; sh: 21; makefile: 18
file content (78 lines) | stat: -rw-r--r-- 1,732 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 2014-2020 Josh Blum
// SPDX-License-Identifier: BSL-1.0

#include "ErrorHelpers.hpp"
#include "TypeHelpers.hpp"
#include <SoapySDR/Modules.h>
#include <SoapySDR/Modules.hpp>
#include <cstdlib>
#include <cstring>

extern "C" {

const char *SoapySDR_getRootPath(void)
{
    static const std::string root = SoapySDR::getRootPath();
    return root.c_str();
}

char **SoapySDR_listSearchPaths(size_t *length)
{
    __SOAPY_SDR_C_TRY
    return toStrArray(SoapySDR::listSearchPaths(), length);
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

char **SoapySDR_listModules(size_t *length)
{
    __SOAPY_SDR_C_TRY
    return toStrArray(SoapySDR::listModules(), length);
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

char **SoapySDR_listModulesPath(const char *path, size_t *length)
{
    __SOAPY_SDR_C_TRY
    return toStrArray(SoapySDR::listModules(path), length);
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

char *SoapySDR_loadModule(const char *path)
{
    __SOAPY_SDR_C_TRY
    return toCString(SoapySDR::loadModule(path));
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

SoapySDRKwargs SoapySDR_getLoaderResult(const char *path)
{
    __SOAPY_SDR_C_TRY
    return toKwargs(SoapySDR::getLoaderResult(path));
    __SOAPY_SDR_C_CATCH_RET(toKwargs(SoapySDR::Kwargs()));
}

char *SoapySDR_getModuleVersion(const char *path)
{
    __SOAPY_SDR_C_TRY
    return toCString(SoapySDR::getModuleVersion(path));
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

char *SoapySDR_unloadModule(const char *path)
{
    __SOAPY_SDR_C_TRY
    return toCString(SoapySDR::unloadModule(path));
    __SOAPY_SDR_C_CATCH_RET(nullptr);
}

void SoapySDR_loadModules(void)
{
    SoapySDR::loadModules();
}

void SoapySDR_unloadModules(void)
{
    SoapySDR::unloadModules();
}

}