|
From: | zakaria Bouhanna |
Subject: | [Discuss-gnuradio] Vector Source controlled by probe signal |
Date: | Tue, 11 Dec 2018 11:09:12 +0000 |
Hello,
I'm working on a GRC project and currently stuck with creating a custom Vector Source bloc. I want this Vector Source to reset Tags generation
everytime it receives "1" from a probe. The sequence generated by Vector Source is a 128-bit pseudo radom code. image1 in attachement shows the
Hier custom bloc which generates "Vector_Genator_C.py". I'm thinking of modifying Vector_Genator_C.py to include the probe signal
in an if-statement and play with.stop,.wait and.stop
but I honestly don't know how to do it. The input of the probe is shown in image2, the generated sequence in image3 and the desired result in image4.
Vector_Genator_C.py file is: # -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Vector_Genator_C
# Author: zaki
# Description: zzz
# Generated: Tue Dec 11 10:49:22 2018
##################################################
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
import threading
import time
class Vector_Genator_C(gr.hier_block2):
def __init__(self,
parameter_0=0):
gr.hier_block2.__init__(
self,
"Vector_Genator_C",
gr.io_signature(1,
1, gr.sizeof_char*1),
gr.io_signature(1,
1, gr.sizeof_gr_complex*1),
)
##################################################
# Parameters
##################################################
self.parameter_0
= parameter_0
##################################################
# Variables
##################################################
self.samp_rate
= samp_rate = 75e3
self.probe_control
= probe_control = 0
##################################################
# Blocks
##################################################
def _probe_control_probe():
while True:
val = self.bloc_probe_control.level()
try:
self.set_probe_control(val)
except AttributeError:
pass
time.sleep(1.0 / (2e6))
_probe_control_thread = threading.Thread(target=_probe_control_probe)
_probe_control_thread.daemon = True
_probe_control_thread.start()
self.blocks_vector_source_x_0
= blocks.vector_source_c(parameter_0, True,
1, [])
self.bloc_probe_control
= blocks.probe_signal_b()
##################################################
# Connections
##################################################
self.connect((self.blocks_vector_source_x_0,
0), (self,
0))
self.connect((self,
0), (self.bloc_probe_control,
0))
def get_parameter_0(self):
return self.parameter_0
def set_parameter_0(self,
parameter_0):
self.parameter_0
= parameter_0
self.blocks_vector_source_x_0.set_data(self.parameter_0, [])
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self,
samp_rate):
self.samp_rate
= samp_rate
def get_probe_control(self):
return self.probe_control
def set_probe_control(self,
probe_control):
self.probe_control
= probe_control
|
image4.jpeg
Description: image4.jpeg
image3.jpeg
Description: image3.jpeg
image2.jpeg
Description: image2.jpeg
image1.jpeg
Description: image1.jpeg
[Prev in Thread] | Current Thread | [Next in Thread] |