Skip to content
Snippets Groups Projects
Commit 2de6ec84 authored by Daniel Meißner's avatar Daniel Meißner Committed by Daniel Meißner
Browse files

let's make file capturing happening

parent b86f2851
No related branches found
No related tags found
No related merge requests found
# SU aka Spectrum Usage
## Usage
### Environment variables
There are environment variables available to define configuration
parameters during start:
```
SU_DUMP_FILE_PATH=/home/user/su/dump_file.iq
```
## Requirements
### Software
......
# -*- coding: utf-8 -*-
import os
import logging
import osmosdr
......@@ -26,7 +27,7 @@ class FileSink(gr.top_block):
):
gr.top_block.__init__(self, "file_sink_block")
self.file_path = dump_file
self.file_path = str(dump_file)
self.samp_rate = samp_rate
self.freq = freq
self.capture_time = capture_time
......@@ -45,10 +46,11 @@ class FileSink(gr.top_block):
"""
Capture samples to dump file.
"""
tb = top_block()
tb.start()
tb.stop()
tb.wait()
logging.info("Start '%s' capture." % self.file_path)
self.start()
self.wait()
logging.info("Capture '%s' done." % self.file_path)
def get_file_path(self):
return self.file_path
......@@ -86,13 +88,13 @@ class FileSink(gr.top_block):
# configure additional blocks
self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex*1, \
int(self.samp_rate)*self.capture_time)
self.blocks_file_meta_sink_0 = blocks.file_meta_sink(
gr.sizeof_gr_complex*1, \
self.file_path, \
self.samp_rate, \
1, \
blocks.GR_FILE_FLOAT, \
True, 1000000, "", False)
self.blocks_file_meta_sink_0 = blocks.file_meta_sink( \
gr.sizeof_gr_complex*1, \
self.file_path, \
self.samp_rate, \
1, \
blocks.GR_FILE_FLOAT, \
True, 1000000, "", False)
self.blocks_file_meta_sink_0.set_unbuffered(False)
# connect blocks
self.connect((self.blocks_head_0, 0), (self.blocks_file_meta_sink_0, 0))
......
......@@ -5,6 +5,7 @@ import os
import logging
import datetime
import re
import threading
from PyQt5 import QtCore, QtGui, QtWidgets, uic
......@@ -81,6 +82,8 @@ class SuGui(QtWidgets.QMainWindow):
options['device']
)
file_sink.capture()
def stop_button(self):
......@@ -231,6 +234,9 @@ class SuGui(QtWidgets.QMainWindow):
return {radio_button: value}
def _set_default_dump_file_path(self):
"""
Set default dump file path.
"""
if "SU_DUMP_FILE_PATH" in os.environ:
self.lineEdit_dump_file.setText(os.environ['SU_DUMP_FILE_PATH'])
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment