-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibrary.cs
41 lines (33 loc) · 993 Bytes
/
Library.cs
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
using System;
using NordicSpaceLink.BladeRF.Imports;
namespace NordicSpaceLink.BladeRF;
public static class Library
{
private static LogLevel logLevel = LogLevel.Info;
public static bool IsLoaded => NativeMethods.Loaded;
public static Version Version
{
get
{
if (!IsLoaded)
throw new Exception("libbladeRF library was not loaded");
NativeMethods.version(out var version);
return new(version.major, version.minor, version.patch, version.describe);
}
}
public static LogLevel LogLevel
{
get => logLevel;
set
{
if (!IsLoaded)
throw new Exception("libbladeRF library was not loaded");
NativeMethods.log_set_verbosity(value);
logLevel = value;
}
}
}
public record struct Version(int Major, int Minor, int Patch, string Description)
{
public override readonly string ToString() => Description;
}