forked from cho45/hackrf-sweep-webusb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
171 lines (158 loc) · 5.74 KB
/
index.html
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>HackRF Sweep Mode WebUSB</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,500,700,400italic|Material+Icons">
<link rel="stylesheet" href="https://unpkg.com/vue-material/dist/vue-material.min.css">
<link rel="stylesheet" href="https://unpkg.com/vue-material/dist/theme/default.css">
<script src="hackrf.js"></script>
<script src="utils.js"></script>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-material"></script>
<script src="script.js" type="module"></script>
<style>
html, body {
margin: 0;
padding: 0;
}
#app {
display: flex;
}
.actions {
padding: 10px;
width: 17em;
}
.canvas-container {
flex-grow: 1;
background: #000;
}
#fft,
#waterfall {
width: 100%;
height: 100%;
}
.form {
}
.md-checkbox {
display: flex;
}
.axis {
position: absolute;
top: 0;
font-weight: bold;
font-size: 16px;
color: #fff;
border-style: solid;
border-width: 0 0 0 2px;
border-color: #f33;
padding: 0 2px;
}
.axis.right {
border-width: 0 2px 0 0;
}
</style>
</head>
<body>
<div id="app">
<div class="actions">
<div style="margin-left: -8px">
<template v-if="!connected">
<md-button class="md-raised md-primary" v-on:click="connect" v-if="!connected">connect</md-button>
</template>
<template v-if="connected">
<md-button class="md-raised md-primary" v-on:click="start" v-if="!running">start</md-button>
<md-button class="md-raised" v-on:click="stop" v-if="running">stop</md-button>
<md-button class="" v-on:click="disconnect" v-if="connected">disconnect</md-button>
</template>
<div class="md-caption" style="margin: 0 8px">{{metrics.sweepPerSec.toFixed(1)}} sweep/sec {{(metrics.bytesPerSec/1e6).toFixed(1)}} MB/sec</div>
</div>
<div class="form">
<md-field>
<label>Start Frequency</label>
<md-input v-model="range.start" type="number" step="1" min="1" max="6000" required :disabled="running"></md-input>
<span class="md-suffix">MHz</span>
</md-field>
<md-field>
<label>End Frequency</label>
<md-input v-model="range.stop" type="number" step="1" min="1" max="6000" required :disabled="running"></md-input>
<span class="md-suffix">MHz</span>
</md-field>
<md-field>
<label>FFT Size</label>
<!--
<md-input v-model="range.fftSize" type="number" step="1" required :disabled="running"></md-input>
-->
<md-select v-model="range.fftSize">
<md-option value="8">8</md-option>
<md-option value="16">16</md-option>
<md-option value="32">32</md-option>
<md-option value="64">64</md-option>
<md-option value="128">128</md-option>
<md-option value="256">256</md-option>
<md-option value="512">512</md-option>
<md-option value="1024">1024</md-option>
<md-option value="2048">2048</md-option>
<md-option value="4096">4096</md-option>
<md-option value="8192">8192</md-option>
</md-select>
</md-field>
<md-divider></md-divider>
<md-field>
<label>LNA Gain (IF)</label>
<md-input v-model="options.lnaGain" type="number" step="8" max="40" min="0" required></md-input>
<span class="md-suffix">dB</span>
</md-field>
<md-field>
<label>VGA Gain (Baseband)</label>
<md-input v-model="options.vgaGain" type="number" step="2" max="62" min="0" required></md-input>
<span class="md-suffix">dB</span>
</md-field>
<md-checkbox v-model="options.ampEnabled">RF Amp (14dB)</md-checkbox>
<md-checkbox v-model="options.antennaEnabled">Antenna Port Power</md-checkbox>
</div>
<span class="md-body-2">
{{ info.boardName }} (id:{{ info.boardId }})<br>
{{ info.firmwareVersion }}
</span>
<div v-on:click="showInfo=true">
<md-icon>info</md-icon>
</div>
<md-snackbar :md-active.sync="snackbar.show" md-persistent>
{{ snackbar.message }}
</md-snackbar>
<md-dialog-alert :md-active.sync="alert.show" :md-title="alert.title" :md-content="alert.content"></md-dialog-alert>
<md-dialog :md-active.sync="showInfo">
<md-dialog-title>About</md-dialog-title>
<md-dialog-content>
<p>HackRF Sweep WebUSB</p>
<p>Repo: <a href="https://github.com/cho45/hackrf-sweep-webusb">github.com/cho45/hackrf-sweep-webusb</a></p>
<p>Author: <a href="https://www.lowreal.net">cho45 <[email protected]></a></p>
<span class="md-subheading">Links</span>
<ul>
<li><a href="https://greatscottgadgets.com/hackrf/">HackRF</a> (<a href="https://github.com/mossmann/hackrf/">github</a>)</li>
</ul>
</md-dialog-content>
<md-dialog-actions>
<md-button class="md-primary" @click="showInfo = false">Close</md-button>
</md-dialog-actions>
</md-dialog>
</div>
<div class="canvas-container">
<div style="width: 100%; height: 70vh; position: relative">
<canvas id="waterfall" ref="waterfall"></canvas>
</div>
<div style="width: 100%; height: 30vh; position: relative">
<canvas id="fft" ref="fft"></canvas>
<div class="axis" style="left: 0% ">{{labelFor(0)}}</div>
<div class="axis" style="left: 25% ">{{labelFor(0.25)}}</div>
<div class="axis" style="left: 50% ">{{labelFor(0.5)}}</div>
<div class="axis" style="left: 75%">{{labelFor(0.75)}}</div>
<div class="axis right" style="right: 0%">{{labelFor(1)}}</div>
<div class="axis" ref="currentHover" style="top: 20px; left: 75%">{{currentHover}}</div>
</div>
</div>
</div>
</body>
</html>