Repository navigation
Expand file tree
/
Copy pathHackRF.m
More file actions
80 lines (67 loc) · 1.79 KB
/
Copy pathHackRF.m
File metadata and controls
80 lines (67 loc) · 1.79 KB
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
79
80
%Hackmat, a HackRF interface for MATLAB
%
%Mikko Laakso
%mikko.t.laakso@aalto.fi
%
%Aalto University, School of Electrical Engineering, Department of
%Signal Processing and Acoustics
%
%System object that interfaces the C MEX HackRF interface
%single char commands passed to c code:
%e - enumerate()
%s - stream()
classdef HackRF < matlab.System
properties %(Access = private)
%setuppassed = 'uninitialized';
SampleRate
BandWidth
CenterFrequency
LnaGain
VgaGain
end
methods
function obj = HackRF(varargin)
setProperties(obj,nargin,varargin{:});
end
function enumerate(~)
hackmat('e');
end
function printsettings(~)
hackmat('z');
end
end
methods(Access = protected)
function validatePropertiesImpl(obj)
if isempty(obj.VgaGain)
obj.VgaGain=0;
end
if isempty(obj.LnaGain)
obj.LnaGain=0;
end
if isempty(obj.SampleRate)
error('Property SampleRate needs to be specified');
end
if isempty(obj.SampleRate)
error('Property CenterFrequency needs to be specified');
end
end
function processTunedPropertiesImpl(obj)
end
function setupImpl(obj)
hackmat('d',obj.SampleRate,obj.CenterFrequency,obj.LnaGain,obj.VgaGain);
end
function [y] =stepImpl(varargin)
switch nargin
case 1
y=hackmat('r');
case 2
hackmat('t',varargin{2});
y=1;
end
end
function releaseImpl(~)
hackmat('c');
clear mex;
end
end
end