summaryrefslogtreecommitdiff
path: root/Radio/Utils/TestAirSpyHF/main.swift
blob: 8166f2bea7dcb70a81c771df40dfa50a714d75b1 (plain) (blame)
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
//
//  main.swift
//  TestAirSpyHF
//
//  Created by Jacky Jack on 01/11/2024.
//

import Foundation
import libairspyhf

print("Version \(software_version)")
var libersion:airspyhf_lib_version_t = airspyhf_lib_version_t()

airspyhf_lib_version(&libersion)
print("libairspyhf \(libersion.major_version).\(libersion.minor_version).\(libersion.revision)")

let ndev = airspyhf_list_devices(nil, 0)
print("Found \(ndev) AirSpyHF devices")
if ndev < 0 {
    exit(0)
}

for i in 0..<ndev {
    let serialPtr: UnsafeMutablePointer<UInt64> = .allocate(capacity: 1)
    airspyhf_list_devices(serialPtr, i+1)
    
    print("Device \(i): \(serialPtr.pointee)")
}