|
14 | 14 | import javax.swing.DefaultComboBoxModel; |
15 | 15 |
|
16 | 16 | import martin.tempest.core.TSDRLibrary; |
| 17 | +import martin.tempest.core.TSDRLibrary.SYNC_DIRECTION; |
17 | 18 | import martin.tempest.core.exceptions.TSDRException; |
18 | 19 | import martin.tempest.sources.TSDRSource; |
19 | 20 |
|
|
29 | 30 | import javax.swing.JCheckBox; |
30 | 31 |
|
31 | 32 | public class Main implements TSDRLibrary.FrameReadyCallback { |
| 33 | + |
| 34 | + private static final int SYNC_AMOUNT = 10; |
32 | 35 |
|
33 | 36 | private JFrame frmTempestSdr; |
34 | 37 | private JTextField textArgs; |
@@ -215,6 +218,42 @@ public void actionPerformed(ActionEvent arg0) { |
215 | 218 | chckbxInvertedColours.setBounds(568, 141, 159, 25); |
216 | 219 | frmTempestSdr.getContentPane().add(chckbxInvertedColours); |
217 | 220 |
|
| 221 | + JButton btnUp = new JButton("Up"); |
| 222 | + btnUp.addActionListener(new ActionListener() { |
| 223 | + public void actionPerformed(ActionEvent arg0) { |
| 224 | + mSdrlib.sync(SYNC_AMOUNT, SYNC_DIRECTION.UP); |
| 225 | + } |
| 226 | + }); |
| 227 | + btnUp.setBounds(608, 186, 78, 25); |
| 228 | + frmTempestSdr.getContentPane().add(btnUp); |
| 229 | + |
| 230 | + JButton btnLeft = new JButton("Left"); |
| 231 | + btnLeft.addActionListener(new ActionListener() { |
| 232 | + public void actionPerformed(ActionEvent e) { |
| 233 | + mSdrlib.sync(SYNC_AMOUNT, SYNC_DIRECTION.LEFT); |
| 234 | + } |
| 235 | + }); |
| 236 | + btnLeft.setBounds(568, 211, 65, 25); |
| 237 | + frmTempestSdr.getContentPane().add(btnLeft); |
| 238 | + |
| 239 | + JButton btnRight = new JButton("Right"); |
| 240 | + btnRight.addActionListener(new ActionListener() { |
| 241 | + public void actionPerformed(ActionEvent e) { |
| 242 | + mSdrlib.sync(SYNC_AMOUNT, SYNC_DIRECTION.RIGHT); |
| 243 | + } |
| 244 | + }); |
| 245 | + btnRight.setBounds(662, 211, 65, 25); |
| 246 | + frmTempestSdr.getContentPane().add(btnRight); |
| 247 | + |
| 248 | + JButton btnDown = new JButton("Down"); |
| 249 | + btnDown.addActionListener(new ActionListener() { |
| 250 | + public void actionPerformed(ActionEvent e) { |
| 251 | + mSdrlib.sync(SYNC_AMOUNT, SYNC_DIRECTION.DOWN); |
| 252 | + } |
| 253 | + }); |
| 254 | + btnDown.setBounds(608, 237, 78, 25); |
| 255 | + frmTempestSdr.getContentPane().add(btnDown); |
| 256 | + |
218 | 257 | onVideoModeSelected(videomodes[0]); |
219 | 258 | } |
220 | 259 |
|
@@ -257,20 +296,14 @@ public void run() { |
257 | 296 | displayException(frmTempestSdr, e); |
258 | 297 | return; |
259 | 298 | } |
260 | | - |
261 | | - new Thread() { |
262 | | - public void run() { |
263 | | - try { |
264 | | - mSdrlib.startAsync(src, (Integer) spWidth.getValue(), (Integer) spHeight.getValue(), Double.parseDouble(spFramerate.getValue().toString())); |
265 | | - } catch (TSDRException e1) { |
266 | | - btnStartStop.setText("Start"); |
267 | | - displayException(frmTempestSdr, e1); |
268 | | - } |
269 | | - |
270 | | - }; |
271 | | - }.start(); |
272 | | - |
273 | | - |
| 299 | + |
| 300 | + try { |
| 301 | + mSdrlib.startAsync(src, (Integer) spWidth.getValue(), (Integer) spHeight.getValue(), Double.parseDouble(spFramerate.getValue().toString())); |
| 302 | + } catch (TSDRException e1) { |
| 303 | + displayException(frmTempestSdr, e1); |
| 304 | + btnStartStop.setText("Start"); |
| 305 | + } |
| 306 | + |
274 | 307 | btnStartStop.setText("Stop"); |
275 | 308 | } |
276 | 309 |
|
|
0 commit comments