discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Ctrlport to remote my variable


From: Jimmy Andrianto
Subject: [Discuss-gnuradio] Ctrlport to remote my variable
Date: Sat, 10 Nov 2018 12:12:37 +0700

Hi all,

I found the example of ctrlport in folder gnuradio-3.7.13.4/gr-blocks/examples/ctrlport. I has try to learn from usrp_source_controller.py and simple_copy_controller.py i am not Python programmer but with try both files i can learn what the meaning of that code, and i have some question about that:
- its possible if ctrlport is use to remote my variable on gnu block? If possible, how to do that?
- on simple_copy_controller.py the input port 'en' is can remote by ctrlport to enable/disable. My question is, why the name of the block is 'copy0' (please see my bellow for the code)? Where i can know the block nickname so i can use it with ctrlport?

simple_copy_controller.py code:

#!/usr/bin/env python

import sys
import pmt
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient

args = sys.argv
if(len(args) < 4):
    sys.stderr.write('Not enough arguments: simple_copy_controller.py <host> <port> [true|false]\n\n')
    sys.exit(1)

hostname = args[1]
portnum = int(args[2])
msg = args[3].lower()
argv = [None, hostname, portnum]
radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift')
radio = radiosys.client

if(msg == 'true'):
    radio.postMessage('copy0', 'en', pmt.PMT_T)
elif(msg == 'false'):
    radio.postMessage('copy0', 'en', pmt.PMT_F)
else:
    sys.stderr.write('Unrecognized message: must be true or false.\n\n')
    sys.exit(1)

many thanks


best regards,

Jimmy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]