aboutsummaryrefslogtreecommitdiffstats
path: root/python/misc_utils/hier_block.py
blob: 0dc9c78f0f166f71ea2492d4c39d0c0d0b776b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# @file
# @author (C) 2016 by Piotr Krysik <ptrkrysik@gmail.com>
# @section LICENSE
#
# Gr-gsm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Gr-gsm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gr-gsm; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#

from gnuradio import gr
from distutils.version import LooseVersion as version

#class created to solve incompatibility of reginstration of message inputs
#that was introduced in gnuradio 3.7.9

class hier_block(gr.hier_block2):
    def message_port_register_hier_in(self, port_id):
        if version(gr.version()) >= version('3.7.9'):
            super(hier_block, self).message_port_register_hier_in(port_id)
        else:
            super(hier_block, self).message_port_register_hier_out(port_id)

    def message_port_register_hier_out(self, port_id):
        if version(gr.version()) >= version('3.7.9'):
            super(hier_block, self).message_port_register_hier_out(port_id)
        else:
            super(hier_block, self).message_port_register_hier_in(port_id)