Reputation: 607
I am writing a gnuradio sink block for custom SDR hardware. When the gnuradio program is closed, I need to make sure that the power amplifiers are disabled (as they draw quite a bit of power and produce a lot of heat). I tried doing this with a class destructor thinking it would be called upon program termination, however it was not. Does gnuradio provide a way to run cleanup upon program termination?
Upvotes: 2
Views: 853
Reputation: 484
Example of overriding in Python: if you insert a Python block, add the stop
method like so:
class blk(gr.sync_block):
def __init__(self):
# omitted...
def work(self):
# omitted...
def stop(self):
print "do stopping work here"
return True
Notes:
stop
does not run for blocks that lack inputs and outputs.Upvotes: 1
Reputation: 36442
You could overload the stop
method of the gr::block
base class. It's meant for exactly that!
Upvotes: 2