diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..3e4ddd4
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,104 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: true
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+BreakBeforeBinaryOperators: None
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 90
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: false
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeCategories:
+ - Regex: '^"(gnuradio)/'
+ Priority: 1
+ - Regex: '^<(gnuradio)/'
+ Priority: 2
+ - Regex: '^<(boost)/'
+ Priority: 98
+ - Regex: '^<[a-z]*>$'
+ Priority: 99
+ - Regex: '^".*"$'
+ Priority: 0
+ - Regex: '.*'
+ Priority: 10
+
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 2
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Left
+ReflowComments: true
+SortIncludes: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 8
+UseTab: Never
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..6e66eb2
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,10 @@
+---
+Checks: '-*,misc-throw-by-value-catch-by-reference,misc-static-assert,readability-container-size-empty,modernize-use-override,modernize-make-unique,modernize-deprecated-headers,misc-unused-using-decls,misc-redundant-expression'
+# Not in here: modernize-use-emplace, since that basically broke all things it touched
+WarningsAsErrors: ''
+HeaderFilterRegex: '\.(cc|c|cpp|h|hpp)$'
+AnalyzeTemporaryDtors: false
+FormatStyle: file
+CheckOptions:
+...
+
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..afdc846
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,17 @@
+#
+# The following turn off LF->CRLF conversion for some files on Windows.
+# these conversions cause syntax errors on MinGW/MSYS. They should not
+# have any effect on non-Windows systems or on Cygwin. Any files that
+# required svn:eof-style=lf under subversion should be included here.
+#
+*.m4 -crlf
+*.ac -crlf
+*.scm -crlf
+#
+# In GNURadio 3.9, pybind11 compares hash values of headers and source
+# files against knowns values. Conversion of values to CRLF on checkout
+# break those checks so keep LF values when files are subject to said checks
+#
+*.h text eol=lf
+*.c text eol=lf
+*.cc text eol=lf
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..04d7b50
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+# editors
+[._]*.sw[a-p]
+
+# build dirs
+build/
diff --git a/AiS_TX.grc b/AiS_TX.grc
deleted file mode 100644
index a4cbe0c..0000000
--- a/AiS_TX.grc
+++ /dev/null
@@ -1,1369 +0,0 @@
-
-
- Fri Nov 14 14:27:09 2014
-
- options
-
- id
- top_block
-
-
- _enabled
- True
-
-
- title
-
-
-
- author
-
-
-
- description
-
-
-
- window_size
- 1280, 1024
-
-
- generate_options
- wx_gui
-
-
- category
- Custom
-
-
- run_options
- prompt
-
-
- run
- True
-
-
- max_nouts
- 0
-
-
- realtime_scheduling
-
-
-
- _coordinate
- (-1, 0)
-
-
- _rotation
- 0
-
-
-
- analog_sig_source_x
-
- id
- analog_sig_source_x_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- samp_rate
- samp_rate
-
-
- waveform
- analog.GR_SIN_WAVE
-
-
- freq
- -25000
-
-
- amp
- 1
-
-
- offset
- 0
-
-
- _coordinate
- (253, 184)
-
-
- _rotation
- 0
-
-
-
- blks2_selector
-
- id
- blks2_selector_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- num_inputs
- 3
-
-
- num_outputs
- 1
-
-
- input_index
- channel_select
-
-
- output_index
- 0
-
-
- vlen
- 1
-
-
- _coordinate
- (953, 164)
-
-
- _rotation
- 0
-
-
-
- variable
-
- id
- samp_rate
-
-
- _enabled
- True
-
-
- value
- 326531
-
-
- _coordinate
- (173, 0)
-
-
- _rotation
- 0
-
-
-
- variable
-
- id
- bit_rate
-
-
- _enabled
- True
-
-
- value
- 9600
-
-
- _coordinate
- (281, -1)
-
-
- _rotation
- 0
-
-
-
- digital_gmsk_mod
-
- id
- digital_gmsk_mod_0
-
-
- _enabled
- True
-
-
- samples_per_symbol
- int(samp_rate/bit_rate)
-
-
- bt
- 0.4
-
-
- verbose
- False
-
-
- log
- False
-
-
- _coordinate
- (254, 103)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_xx
-
- id
- blocks_multiply_xx_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- num_inputs
- 2
-
-
- vlen
- 1
-
-
- _coordinate
- (464, 148)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_const_vxx
-
- id
- blocks_multiply_const_vxx_0_1
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- const
- 0.9
-
-
- vlen
- 1
-
-
- _coordinate
- (681, 160)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_const_vxx
-
- id
- blocks_multiply_const_vxx_0_1_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- const
- 0.9
-
-
- vlen
- 1
-
-
- _coordinate
- (697, 376)
-
-
- _rotation
- 0
-
-
-
- blocks_add_xx
-
- id
- blocks_add_xx_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- num_inputs
- 2
-
-
- vlen
- 1
-
-
- _coordinate
- (803, 212)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_const_vxx
-
- id
- blocks_multiply_const_vxx_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- const
- 0.45
-
-
- vlen
- 1
-
-
- _coordinate
- (611, 208)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_const_vxx
-
- id
- blocks_multiply_const_vxx_0_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- const
- 0.45
-
-
- vlen
- 1
-
-
- _coordinate
- (605, 301)
-
-
- _rotation
- 0
-
-
-
- blocks_multiply_xx
-
- id
- blocks_multiply_xx_0_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- num_inputs
- 2
-
-
- vlen
- 1
-
-
- _coordinate
- (458, 364)
-
-
- _rotation
- 0
-
-
-
- digital_gmsk_mod
-
- id
- digital_gmsk_mod_0_0
-
-
- _enabled
- True
-
-
- samples_per_symbol
- int(samp_rate/bit_rate)
-
-
- bt
- 0.4
-
-
- verbose
- False
-
-
- log
- False
-
-
- _coordinate
- (249, 321)
-
-
- _rotation
- 0
-
-
-
- analog_sig_source_x
-
- id
- analog_sig_source_x_0_0
-
-
- _enabled
- True
-
-
- type
- complex
-
-
- samp_rate
- samp_rate
-
-
- waveform
- analog.GR_SIN_WAVE
-
-
- freq
- 25000
-
-
- amp
- 1
-
-
- offset
- 0
-
-
- _coordinate
- (250, 401)
-
-
- _rotation
- 0
-
-
-
- variable
-
- id
- channel_select
-
-
- _enabled
- True
-
-
- value
- 2
-
-
- _coordinate
- (368, -1)
-
-
- _rotation
- 0
-
-
-
- uhd_usrp_sink
-
- id
- uhd_usrp_sink_0
-
-
- _enabled
- True
-
-
- type
- fc32
-
-
- otw
-
-
-
- stream_args
-
-
-
- dev_addr
-
-
-
- sync
-
-
-
- clock_rate
- 0.0
-
-
- num_mboards
- 1
-
-
- clock_source0
-
-
-
- time_source0
-
-
-
- sd_spec0
-
-
-
- clock_source1
-
-
-
- time_source1
- gpsdo
-
-
- sd_spec1
-
-
-
- clock_source2
-
-
-
- time_source2
-
-
-
- sd_spec2
-
-
-
- clock_source3
-
-
-
- time_source3
-
-
-
- sd_spec3
-
-
-
- clock_source4
-
-
-
- time_source4
-
-
-
- sd_spec4
-
-
-
- clock_source5
-
-
-
- time_source5
-
-
-
- sd_spec5
-
-
-
- clock_source6
-
-
-
- time_source6
-
-
-
- sd_spec6
-
-
-
- clock_source7
-
-
-
- time_source7
-
-
-
- sd_spec7
-
-
-
- nchan
- 1
-
-
- samp_rate
- samp_rate
-
-
- center_freq0
- uhd.tune_request_t(162000000, 19000000)
-
-
- gain0
- 0
-
-
- ant0
- TX/RX
-
-
- bw0
- 0
-
-
- center_freq1
- 0
-
-
- gain1
- 0
-
-
- ant1
-
-
-
- bw1
- 0
-
-
- center_freq2
- 0
-
-
- gain2
- 0
-
-
- ant2
-
-
-
- bw2
- 0
-
-
- center_freq3
- 0
-
-
- gain3
- 0
-
-
- ant3
-
-
-
- bw3
- 0
-
-
- center_freq4
- 0
-
-
- gain4
- 0
-
-
- ant4
-
-
-
- bw4
- 0
-
-
- center_freq5
- 0
-
-
- gain5
- 0
-
-
- ant5
-
-
-
- bw5
- 0
-
-
- center_freq6
- 0
-
-
- gain6
- 0
-
-
- ant6
-
-
-
- bw6
- 0
-
-
- center_freq7
- 0
-
-
- gain7
- 0
-
-
- ant7
-
-
-
- bw7
- 0
-
-
- center_freq8
- 0
-
-
- gain8
- 0
-
-
- ant8
-
-
-
- bw8
- 0
-
-
- center_freq9
- 0
-
-
- gain9
- 0
-
-
- ant9
-
-
-
- bw9
- 0
-
-
- center_freq10
- 0
-
-
- gain10
- 0
-
-
- ant10
-
-
-
- bw10
- 0
-
-
- center_freq11
- 0
-
-
- gain11
- 0
-
-
- ant11
-
-
-
- bw11
- 0
-
-
- center_freq12
- 0
-
-
- gain12
- 0
-
-
- ant12
-
-
-
- bw12
- 0
-
-
- center_freq13
- 0
-
-
- gain13
- 0
-
-
- ant13
-
-
-
- bw13
- 0
-
-
- center_freq14
- 0
-
-
- gain14
- 0
-
-
- ant14
-
-
-
- bw14
- 0
-
-
- center_freq15
- 0
-
-
- gain15
- 0
-
-
- ant15
-
-
-
- bw15
- 0
-
-
- center_freq16
- 0
-
-
- gain16
- 0
-
-
- ant16
-
-
-
- bw16
- 0
-
-
- center_freq17
- 0
-
-
- gain17
- 0
-
-
- ant17
-
-
-
- bw17
- 0
-
-
- center_freq18
- 0
-
-
- gain18
- 0
-
-
- ant18
-
-
-
- bw18
- 0
-
-
- center_freq19
- 0
-
-
- gain19
- 0
-
-
- ant19
-
-
-
- bw19
- 0
-
-
- center_freq20
- 0
-
-
- gain20
- 0
-
-
- ant20
-
-
-
- bw20
- 0
-
-
- center_freq21
- 0
-
-
- gain21
- 0
-
-
- ant21
-
-
-
- bw21
- 0
-
-
- center_freq22
- 0
-
-
- gain22
- 0
-
-
- ant22
-
-
-
- bw22
- 0
-
-
- center_freq23
- 0
-
-
- gain23
- 0
-
-
- ant23
-
-
-
- bw23
- 0
-
-
- center_freq24
- 0
-
-
- gain24
- 0
-
-
- ant24
-
-
-
- bw24
- 0
-
-
- center_freq25
- 0
-
-
- gain25
- 0
-
-
- ant25
-
-
-
- bw25
- 0
-
-
- center_freq26
- 0
-
-
- gain26
- 0
-
-
- ant26
-
-
-
- bw26
- 0
-
-
- center_freq27
- 0
-
-
- gain27
- 0
-
-
- ant27
-
-
-
- bw27
- 0
-
-
- center_freq28
- 0
-
-
- gain28
- 0
-
-
- ant28
-
-
-
- bw28
- 0
-
-
- center_freq29
- 0
-
-
- gain29
- 0
-
-
- ant29
-
-
-
- bw29
- 0
-
-
- center_freq30
- 0
-
-
- gain30
- 0
-
-
- ant30
-
-
-
- bw30
- 0
-
-
- center_freq31
- 0
-
-
- gain31
- 0
-
-
- ant31
-
-
-
- bw31
- 0
-
-
- _coordinate
- (932, 305)
-
-
- _rotation
- 0
-
-
-
- AISTX_Build_Frame
-
- id
- AISTX_Build_Frame_0
-
-
- _enabled
- True
-
-
- sentence
- 000100000001101100011001110111011011110000000000000000000000011000111100111100100000101100100000101101000110011010001010010100010000000001000000000000000000000000000000
-
-
- repeat
- True
-
-
- enable_NRZI
- True
-
-
- _coordinate
- (0, 97)
-
-
- _rotation
- 0
-
-
-
- AISTX_Build_Frame
-
- id
- AISTX_Build_Frame_1
-
-
- _enabled
- True
-
-
- sentence
- 010100000001101100011001110111011011110000000000000001011110000000000000
-
-
- repeat
- True
-
-
- enable_NRZI
- True
-
-
- _coordinate
- (1, 317)
-
-
- _rotation
- 0
-
-
-
- digital_gmsk_mod_0
- blocks_multiply_xx_0
- 0
- 0
-
-
- analog_sig_source_x_0
- blocks_multiply_xx_0
- 0
- 1
-
-
- analog_sig_source_x_0_0
- blocks_multiply_xx_0_0
- 0
- 1
-
-
- digital_gmsk_mod_0_0
- blocks_multiply_xx_0_0
- 0
- 0
-
-
- blocks_multiply_xx_0_0
- blocks_multiply_const_vxx_0_0
- 0
- 0
-
-
- blocks_multiply_xx_0
- blocks_multiply_const_vxx_0_1
- 0
- 0
-
-
- blocks_multiply_xx_0
- blocks_multiply_const_vxx_0
- 0
- 0
-
-
- blks2_selector_0
- uhd_usrp_sink_0
- 0
- 0
-
-
- blocks_add_xx_0
- blks2_selector_0
- 0
- 2
-
-
- blocks_multiply_const_vxx_0_1
- blks2_selector_0
- 0
- 0
-
-
- blocks_multiply_const_vxx_0_1_0
- blks2_selector_0
- 0
- 1
-
-
- blocks_multiply_xx_0_0
- blocks_multiply_const_vxx_0_1_0
- 0
- 0
-
-
- blocks_multiply_const_vxx_0
- blocks_add_xx_0
- 0
- 0
-
-
- blocks_multiply_const_vxx_0_0
- blocks_add_xx_0
- 0
- 1
-
-
- AISTX_Build_Frame_0
- digital_gmsk_mod_0
- 0
- 0
-
-
- AISTX_Build_Frame_1
- digital_gmsk_mod_0_0
- 0
- 0
-
-
diff --git a/AiS_TX.py b/AiS_TX.py
deleted file mode 100755
index 5ea5deb..0000000
--- a/AiS_TX.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-#
-# This script is part of the AIS BlackToolkit.
-# AiS_TX.py implements a software-based AIS transmitter accordingly to specifications (ITU-R M.1371-4).
-#
-# A fully functional GnuRadio installation is required, including our AIS Frame Builder block, namely gr-aistx.
-#
-# Tested on:
-# GnuRadio 3.6.5.1
-# Debian 7.1.0 wheezy
-# GNU C++ version 4.7.3; Boost_104900
-# UHD_003.005.003-0-unknown
-# Ettus USRP B100 Version 2)
-#
-# Copyright 2013-2014 -- Embyte & Pastus
-#
-# This program 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 2
-# of the License, or (at your option) any later version.
-#
-# Usage example:
-# $ ./AIVDM_Encoder.py --type=1 --mmsi=970010000 --lat=45.6910 --long=9.7235 | xargs -IX ./AiS_TX.py --payload=X --channel=A
-#
-
-from gnuradio import blocks
-from gnuradio import digital
-from gnuradio import eng_notation
-from gnuradio import gr
-from gnuradio import uhd
-from gnuradio.eng_option import eng_option
-from gnuradio.gr import firdes
-from grc_gnuradio import wxgui as grc_wxgui
-from optparse import OptionParser
-import AISTX
-import time
-import wx
-
-class top_block(grc_wxgui.top_block_gui):
-
- def __init__(self, p, c, pw, ff, sr, br):
- grc_wxgui.top_block_gui.__init__(self, title="Top Block")
- _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
- self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
-
- ##################################################
- # Variables
- ##################################################
- self.samp_rate = samp_rate = sr
- self.channel_select = channel_select = c
- self.bit_rate = bit_rate = br
-
- ##################################################
- # Blocks
- ##################################################
- self.uhd_usrp_sink_0 = uhd.usrp_sink(
- device_addr="",
- stream_args=uhd.stream_args(
- cpu_format="fc32",
- channels=range(1),
- ),
- )
- self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
- self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request_t(161975000+50000*c,ff), 0)
- self.uhd_usrp_sink_0.set_gain(-10, 0)
- self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
- self.digital_gmsk_mod_0 = digital.gmsk_mod(
- samples_per_symbol=int(samp_rate/bit_rate),
- bt=0.4,
- verbose=False,
- log=False,
- )
- self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.9, ))
- self.AISTX_Build_Frame_0 = AISTX.Build_Frame(p, False, True)
-
- ##################################################
- # Connections
- ##################################################
- self.connect((self.AISTX_Build_Frame_0, 0), (self.digital_gmsk_mod_0, 0))
- self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
- self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0))
-
-
- def get_samp_rate(self):
- return self.samp_rate
-
- def set_samp_rate(self, samp_rate):
- self.samp_rate = samp_rate
- self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
-
- def get_channel_select(self):
- return self.channel_select
-
- def set_channel_select(self, channel_select):
- self.channel_select = channel_select
- self.analog_sig_source_x_0.set_frequency(-25000+50000*self.channel_select)
-
- def get_bit_rate(self):
- return self.bit_rate
-
- def set_bit_rate(self, bit_rate):
- self.bit_rate = bit_rate
-
-if __name__ == '__main__':
-
- desc="""GnuRadio-Based AIS Transmitter. Copyright Embyte & Pastus 2013-2014."""
-
- parser = OptionParser(option_class=eng_option, usage="%prog: [options]", description=desc)
-
- parser.add_option("--payload", help="""Specify the message payload to transmit
- (e.g., crafted via AIVDM_Encoder)""")
- parser.add_option("--channel", help="""Specify the AIS channel:
- - A: 161.975Mhz (87B)
- - B: 162.025Mhz (88B)""")
- parser.add_option("--power", help="""Specify the transmisson power, between -12dB and +12dB (default is -10dB)""", type="int", default = -10)
- parser.add_option("--filter_frequency", help="""Specify the filter frequency (default is 19MHz)""", type="int", default = 19000000)
- parser.add_option("--sampling_rate", help="""Specify the sampling rate (default is 326.531KHz)""", type="int", default = 326531)
- parser.add_option("--bit_rate", help="""Specify the bit rate (default is 9600 baud)""", type="int", default = 9600)
-
- (options, args) = parser.parse_args()
-
- if not options.payload:
- parser.error("Payload not specified: -h for help.")
-
- if not options.channel:
- parser.error("Channel not specified: -h for help.")
-
- if options.channel!="A" and options.channel!="B":
- parser.error("Channel accepts value A or B: -h for help")
-
- channel_ID = 0 if options.channel=="A" else 1
-
- tb = top_block(p=options.payload, c=channel_ID, pw=options.power, ff=options.filter_frequency, sr=options.sampling_rate, br=options.bit_rate)
- tb.Run(True)
-
diff --git a/gr-aistx/CMakeLists.txt b/CMakeLists.txt
similarity index 51%
rename from gr-aistx/CMakeLists.txt
rename to CMakeLists.txt
index 102755b..d887ac5 100644
--- a/gr-aistx/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
-# Copyright 2011,2012 Free Software Foundation, Inc.
+# Copyright 2011,2012,2014,2016,2018 Free Software Foundation, Inc.
#
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,112 +18,116 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-
########################################################################
# Project setup
########################################################################
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 3.8)
project(gr-AISTX CXX C)
-enable_testing()
-#select the release build type by default to get optimization flags
+option(ENABLE_TESTING "Enable/Build tests" OFF)
+if(ENABLE_TESTING)
+ enable_testing()
+endif(ENABLE_TESTING)
+
+# Install to PyBOMBS target prefix if defined
+if(DEFINED ENV{PYBOMBS_PREFIX})
+ set(CMAKE_INSTALL_PREFIX $ENV{PYBOMBS_PREFIX})
+ message(STATUS "PyBOMBS installed GNU Radio. Setting CMAKE_INSTALL_PREFIX to $ENV{PYBOMBS_PREFIX}")
+endif()
+
+# Select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+# Make sure our local CMake Modules path comes first
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+# Set the version information here
+set(VERSION_MAJOR 1)
+set(VERSION_API 0)
+set(VERSION_ABI 0)
+set(VERSION_PATCH git)
+
+cmake_policy(SET CMP0011 NEW)
+
+# Enable generation of compile_commands.json for code completion engines
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
########################################################################
# Compiler specific setup
########################################################################
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
endif()
-########################################################################
-# Find boost
-########################################################################
-if(UNIX AND EXISTS "/usr/lib64")
- list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
-endif(UNIX AND EXISTS "/usr/lib64")
-set(Boost_ADDITIONAL_VERSIONS
- "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
- "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
- "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
- "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
- "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
- "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
- "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
-)
-find_package(Boost "1.35" COMPONENTS filesystem system)
-
-if(NOT Boost_FOUND)
- message(FATAL_ERROR "Boost required to compile AISTX")
-endif()
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ SET(CMAKE_CXX_STANDARD 11)
+ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ SET(CMAKE_CXX_STANDARD 11)
+ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ SET(CMAKE_CXX_STANDARD 11)
+ELSE()
+ message(WARNING "C++ standard could not be set because compiler is not GNU, Clang or MSVC.")
+ENDIF()
+
+IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ SET(CMAKE_C_STANDARD 11)
+ELSEIF(CMAKE_C_COMPILER_ID MATCHES "Clang")
+ SET(CMAKE_C_STANDARD 11)
+ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ SET(CMAKE_C_STANDARD 11)
+ELSE()
+ message(WARNING "C standard could not be set because compiler is not GNU, Clang or MSVC.")
+ENDIF()
########################################################################
# Install directories
########################################################################
+find_package(Gnuradio "3.8" COMPONENTS fft filter blocks REQUIRED)
+include(GrVersion)
+
include(GrPlatform) #define LIB_SUFFIX
-set(GR_RUNTIME_DIR bin)
-set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
+
+if(NOT CMAKE_MODULES_DIR)
+ set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
+endif(NOT CMAKE_MODULES_DIR)
+
set(GR_INCLUDE_DIR include/AISTX)
-set(GR_DATA_DIR share)
+set(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/AISTX)
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
-set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
-set(GR_CONF_DIR etc)
set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
-set(GR_LIBEXEC_DIR libexec)
set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
-set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
########################################################################
-# Find gnuradio build dependencies
+# On Apple only, set install name and use rpath correctly, if not already set
########################################################################
-find_package(GnuradioRuntime)
-find_package(CppUnit)
-
-# To run a more advanced search for GNU Radio and it's components and
-# versions, use the following. Add any components required to the list
-# of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the
-# minimum API compatible version required.
-#
-# set(GR_REQUIRED_COMPONENTS CORE BLOCKS FILTER ...)
-# find_package(Gnuradio "version")
-
-
-if(NOT GNURADIO_RUNTIME_FOUND)
- message(FATAL_ERROR "GnuRadio Runtime required to compile AISTX")
-endif()
-
-if(NOT CPPUNIT_FOUND)
- message(FATAL_ERROR "CppUnit required to compile AISTX")
-endif()
+if(APPLE)
+ if(NOT CMAKE_INSTALL_NAME_DIR)
+ set(CMAKE_INSTALL_NAME_DIR
+ ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
+ PATH "Library Install Name Destination Directory" FORCE)
+ endif(NOT CMAKE_INSTALL_NAME_DIR)
+ if(NOT CMAKE_INSTALL_RPATH)
+ set(CMAKE_INSTALL_RPATH
+ ${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR} CACHE
+ PATH "Library Install RPath" FORCE)
+ endif(NOT CMAKE_INSTALL_RPATH)
+ if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
+ BOOL "Do Build Using Library Install RPath" FORCE)
+ endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
+endif(APPLE)
########################################################################
-# Setup the include and linker paths
+# Find gnuradio build dependencies
########################################################################
-include_directories(
- ${CMAKE_SOURCE_DIR}/include
- ${Boost_INCLUDE_DIRS}
- ${CPPUNIT_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/swig
-)
-
-link_directories(
- ${Boost_LIBRARY_DIRS}
- ${CPPUNIT_LIBRARY_DIRS}
- ${GNURADIO_RUNTIME_LIBRARY_DIRS}
-)
-
-# Set component parameters
-set(GR_AISTX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
-set(GR_AISTX_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
########################################################################
# Create uninstall target
@@ -136,13 +141,22 @@ add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
+
########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/AISTX)
add_subdirectory(lib)
+add_subdirectory(apps)
+add_subdirectory(docs)
add_subdirectory(swig)
add_subdirectory(python)
add_subdirectory(grc)
-add_subdirectory(apps)
-add_subdirectory(docs)
+
+########################################################################
+# Install cmake search helper for this library
+########################################################################
+
+install(FILES cmake/Modules/AISTXConfig.cmake
+ DESTINATION ${CMAKE_MODULES_DIR}/AISTX
+)
diff --git a/gr-aistx/GPL b/GPL
similarity index 100%
rename from gr-aistx/GPL
rename to GPL
diff --git a/README b/README
index 89994f5..03dc7a9 100644
--- a/README
+++ b/README
@@ -1,5 +1,11 @@
-Thanks for downloading the AIS BlackToolkit! This directory contains:
+This directory contains a custom block for GnuRadio we called AIS Frame Builder.
+It is part of the AIS BlackToolkit.
+
+This block serves as generator of AIS frames and implements the full AIS stack.
+It is composed of three main components covering respectively the
+application/presentation layers, the link layer and the physical layer,
+as defined in the protocol specification for AIS.
The AIS transmitter in form of GRC graph a1e4b54db83fb895a3c94493126bb318 AiS_TX.grc
The AIS transmitter in form of script kiddie script 52540b46f316ee460f4684a262132d36 AiS_TX.py
@@ -9,8 +15,16 @@ The AIS Frame Builder block for GnuRadio c8b7018386f64dd725fde119f406
A NMEA encoder (binary to ASCII) (C version) 2534dc06c21fe53f45bd2abab96bb6a7 unpacker.c
A NMEA encoder (Perl version by Gary C. Kessler) 52ab60db06525f2230bb4de3ee61a34b unpacker.pl
+$ mkdir build
+$ cd build
+$ cmake ../
+$ make
+$ sudo make install
-Remember to install GnuRadio and gr-aistx first. A short description is included in each file's header.
+Copyright 2013-2014 -- Embyte & Pastus
-Good luck!
+This program 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 2
+of the License, or (at your option) any later version.
diff --git a/AIVDM_Encoder.py b/apps/AIVDM_Encoder.py
similarity index 97%
rename from AIVDM_Encoder.py
rename to apps/AIVDM_Encoder.py
index b688c47..984f85a 100755
--- a/AIVDM_Encoder.py
+++ b/apps/AIVDM_Encoder.py
@@ -37,11 +37,11 @@ def compute_long_lat22 (__long, __lat):
_lat = '{0:b}'.format(int(round(__lat*600)) & 0b11111111111111111).rjust(17,'0')
return (_long, _lat)
-def encode_1(__mmsi, __speed, __long, __lat, __course, __ts):
+def encode_1(__mmsi, __status,__speed, __long, __lat, __course, __ts):
_type = '{0:b}'.format(1).rjust(6,'0') # 18
_repeat = "00" # repeat (directive to an AIS transceiver that this message should be rebroadcast.)
_mmsi = '{0:b}'.format(__mmsi).rjust(30,'0') # 30 bits (247320162)
- _status = '{0:b}'.format(15).rjust(4,'0') # status not defined
+ _status = '{0:b}'.format(__status).rjust(4,'0') # navigation status e.g. 0=Under way using engine, 1-At anchor, 5=Moored, 8=Sailing,15=undefined
_rot = '{0:b}'.format(128).rjust(8,'0') # rate of turn not defined
_speed = '{0:b}'.format(int(round(__speed*10))).rjust(10,'0') # Speed over ground is in 0.1-knot resolution from 0 to 102 knots. value 1023 indicates speed is not available, value 1022 indicates 102.2 knots or higher.
@@ -268,6 +268,7 @@ def main():
970010000 for SART device""",
default=247320162)
parser.add_option("--speed", help="18. Speed (knot), default = 0.1", default=0.1)
+ parser.add_option("--status", help="1. Navigation Status, default = 15 (undefined)", default=15)
parser.add_option("--long", help="18. Longitude, default = 9.72357833333333", default=9.72357833333333)
parser.add_option("--lat", help="18. Latitude, default = 45.6910166666667", default=45.6910166666667)
parser.add_option("--course", help="18. Course, default = 83.4", default=83.4)
@@ -309,7 +310,7 @@ def main():
payload = ""
if options.type == "1":
- payload = encode_1(int(options.mmsi), float(options.speed), float(options.long), float(options.lat), float(options.course), int(options.ts))
+ payload = encode_1(int(options.mmsi),int(options.status), float(options.speed), float(options.long), float(options.lat), float(options.course), int(options.ts))
elif options.type == "4":
payload = encode_4(int(options.mmsi), float(options.speed), float(options.long), float(options.lat), float(options.course), int(options.ts))
diff --git a/AIVDM_pre.pl b/apps/AIVDM_pre.pl
similarity index 100%
rename from AIVDM_pre.pl
rename to apps/AIVDM_pre.pl
diff --git a/gr-aistx/apps/CMakeLists.txt b/apps/CMakeLists.txt
similarity index 88%
rename from gr-aistx/apps/CMakeLists.txt
rename to apps/CMakeLists.txt
index c837d77..575ab26 100644
--- a/gr-aistx/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -1,6 +1,7 @@
# Copyright 2011 Free Software Foundation, Inc.
#
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/apps/unpacker.c b/apps/unpacker.c
new file mode 100644
index 0000000..ae2a102
--- /dev/null
+++ b/apps/unpacker.c
@@ -0,0 +1,93 @@
+/*
+
+This source code is part of the AIS BlackToolkit.
+Unpacker.c allows you to build a NMEA sentece out of its payload. Normally used in
+combination with AIVDM_Encoder.
+
+Copyright 2013-2014 -- Embyte & Pastus
+
+This program 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 2
+of the License, or (at your option) any later version.
+
+Usage example:
+$ ./AIVDM_Encoder.py --type=1 --vsize=30x10 | xargs -IA ./unpacker A 1 A
+
+*/
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+unsigned long unpack(char* buffer, int start, int length)
+{
+ unsigned long ret = 0;
+ for (int i = start; i < (start + length); i++) {
+ ret <<= 1;
+ ret |= (buffer[i] & 0x01);
+ }
+ return ret;
+}
+
+char nmea_checksum(std::string buffer)
+{
+ unsigned int i = 0;
+ char sum = 0x00;
+ if (buffer[0] == '!')
+ i++;
+ for (; i < buffer.length(); i++)
+ sum ^= buffer[i];
+ return sum;
+}
+
+
+int main(int argc, char* argv[])
+{
+
+
+ if (argc < 4) {
+ std::cout << "\nUsage: ./unpacker binary_string enable_nmea channel\n";
+ std::cout << "\nenable_nmea = 1 for full NMEA sentence, otherwise only payload "
+ "is printed\n";
+ std::cout << "channel = A/B\n\n";
+ return 0;
+ }
+
+ int i;
+ char asciidata[255];
+
+ int len = strlen(argv[1]);
+
+ int enable_nmea = (int)*argv[2] - 48;
+ char channel = *argv[3];
+ std::ostringstream d_payload;
+ d_payload.str("");
+
+ for (i = 0; i < len / 6; i++) {
+ asciidata[i] = unpack(argv[1], i * 6, 6);
+ if (asciidata[i] > 39)
+ asciidata[i] += 8;
+ asciidata[i] += 48;
+ }
+
+ if (enable_nmea)
+ d_payload << "!AIVDM,1,1,," << channel << ",";
+
+ for (int i = 0; i < len / 6; i++)
+ d_payload << asciidata[i];
+
+ if (enable_nmea) {
+ d_payload << ",0"; // number of bits to fill out 6-bit boundary
+ char checksum = nmea_checksum(std::string(d_payload.str()));
+ d_payload << "*" << std::setw(2) << std::setfill('0') << std::hex
+ << std::uppercase << int(checksum);
+ }
+
+ std::cout << std::string(d_payload.str()) << std::endl;
+ return 1;
+}
diff --git a/unpacker.pl b/apps/unpacker.pl
similarity index 95%
rename from unpacker.pl
rename to apps/unpacker.pl
index 409e93c..68339a8 100644
--- a/unpacker.pl
+++ b/apps/unpacker.pl
@@ -149,7 +149,7 @@ sub nmea_checksum
# Ensure that $sum is two upper-case hex digits
- $sum = sprintf ("%2X", $sum);
+ $sum = sprintf ("%02X", $sum);
return $sum;
}
diff --git a/cmake/Modules/AISTXConfig.cmake b/cmake/Modules/AISTXConfig.cmake
new file mode 100644
index 0000000..b51773a
--- /dev/null
+++ b/cmake/Modules/AISTXConfig.cmake
@@ -0,0 +1,31 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_AISTX AISTX)
+
+FIND_PATH(
+ AISTX_INCLUDE_DIRS
+ NAMES AISTX/api.h
+ HINTS $ENV{AISTX_DIR}/include
+ ${PC_AISTX_INCLUDEDIR}
+ PATHS ${CMAKE_INSTALL_PREFIX}/include
+ /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(
+ AISTX_LIBRARIES
+ NAMES gnuradio-AISTX
+ HINTS $ENV{AISTX_DIR}/lib
+ ${PC_AISTX_LIBDIR}
+ PATHS ${CMAKE_INSTALL_PREFIX}/lib
+ ${CMAKE_INSTALL_PREFIX}/lib64
+ /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+ )
+
+include("${CMAKE_CURRENT_LIST_DIR}/AISTXTarget.cmake")
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(AISTX DEFAULT_MSG AISTX_LIBRARIES AISTX_INCLUDE_DIRS)
+MARK_AS_ADVANCED(AISTX_LIBRARIES AISTX_INCLUDE_DIRS)
diff --git a/gr-aistx/cmake/Modules/CMakeParseArgumentsCopy.cmake b/cmake/Modules/CMakeParseArgumentsCopy.cmake
similarity index 99%
rename from gr-aistx/cmake/Modules/CMakeParseArgumentsCopy.cmake
rename to cmake/Modules/CMakeParseArgumentsCopy.cmake
index 7ce4c49..66016cb 100644
--- a/gr-aistx/cmake/Modules/CMakeParseArgumentsCopy.cmake
+++ b/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -58,7 +58,7 @@
# the new option.
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
-# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefore.
#=============================================================================
# Copyright 2010 Alexander Neundorf
diff --git a/gr-aistx/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake
similarity index 100%
rename from gr-aistx/cmake/Modules/FindCppUnit.cmake
rename to cmake/Modules/FindCppUnit.cmake
diff --git a/cmake/Modules/targetConfig.cmake.in b/cmake/Modules/targetConfig.cmake.in
new file mode 100644
index 0000000..79e4a28
--- /dev/null
+++ b/cmake/Modules/targetConfig.cmake.in
@@ -0,0 +1,26 @@
+# Copyright 2018 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+include(CMakeFindDependencyMacro)
+
+set(target_deps "@TARGET_DEPENDENCIES@")
+foreach(dep IN LISTS target_deps)
+ find_dependency(${dep})
+endforeach()
+include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")
diff --git a/gr-aistx/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
similarity index 100%
rename from gr-aistx/cmake/cmake_uninstall.cmake.in
rename to cmake/cmake_uninstall.cmake.in
diff --git a/gr-aistx/docs/CMakeLists.txt b/docs/CMakeLists.txt
similarity index 92%
rename from gr-aistx/docs/CMakeLists.txt
rename to docs/CMakeLists.txt
index f16fbf6..6d1a556 100644
--- a/gr-aistx/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,6 +1,7 @@
# Copyright 2011 Free Software Foundation, Inc.
#
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gr-aistx/docs/README.AISTX b/docs/README.AISTX
similarity index 100%
rename from gr-aistx/docs/README.AISTX
rename to docs/README.AISTX
diff --git a/gr-aistx/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt
similarity index 100%
rename from gr-aistx/docs/doxygen/CMakeLists.txt
rename to docs/doxygen/CMakeLists.txt
diff --git a/gr-aistx/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in
similarity index 100%
rename from gr-aistx/docs/doxygen/Doxyfile.in
rename to docs/doxygen/Doxyfile.in
diff --git a/gr-aistx/docs/doxygen/Doxyfile.swig_doc.in b/docs/doxygen/Doxyfile.swig_doc.in
similarity index 100%
rename from gr-aistx/docs/doxygen/Doxyfile.swig_doc.in
rename to docs/doxygen/Doxyfile.swig_doc.in
diff --git a/gr-aistx/docs/doxygen/doxyxml/__init__.py b/docs/doxygen/doxyxml/__init__.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/__init__.py
rename to docs/doxygen/doxyxml/__init__.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/base.py b/docs/doxygen/doxyxml/base.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/base.py
rename to docs/doxygen/doxyxml/base.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/doxyindex.py b/docs/doxygen/doxyxml/doxyindex.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/doxyindex.py
rename to docs/doxygen/doxyxml/doxyindex.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/generated/__init__.py b/docs/doxygen/doxyxml/generated/__init__.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/generated/__init__.py
rename to docs/doxygen/doxyxml/generated/__init__.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/generated/compound.py b/docs/doxygen/doxyxml/generated/compound.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/generated/compound.py
rename to docs/doxygen/doxyxml/generated/compound.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/generated/compoundsuper.py b/docs/doxygen/doxyxml/generated/compoundsuper.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/generated/compoundsuper.py
rename to docs/doxygen/doxyxml/generated/compoundsuper.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/generated/index.py b/docs/doxygen/doxyxml/generated/index.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/generated/index.py
rename to docs/doxygen/doxyxml/generated/index.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/generated/indexsuper.py b/docs/doxygen/doxyxml/generated/indexsuper.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/generated/indexsuper.py
rename to docs/doxygen/doxyxml/generated/indexsuper.py
diff --git a/gr-aistx/docs/doxygen/doxyxml/text.py b/docs/doxygen/doxyxml/text.py
similarity index 100%
rename from gr-aistx/docs/doxygen/doxyxml/text.py
rename to docs/doxygen/doxyxml/text.py
diff --git a/gr-aistx/docs/doxygen/other/group_defs.dox b/docs/doxygen/other/group_defs.dox
similarity index 100%
rename from gr-aistx/docs/doxygen/other/group_defs.dox
rename to docs/doxygen/other/group_defs.dox
diff --git a/gr-aistx/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox
similarity index 100%
rename from gr-aistx/docs/doxygen/other/main_page.dox
rename to docs/doxygen/other/main_page.dox
diff --git a/gr-aistx/docs/doxygen/swig_doc.py b/docs/doxygen/swig_doc.py
similarity index 100%
rename from gr-aistx/docs/doxygen/swig_doc.py
rename to docs/doxygen/swig_doc.py
diff --git a/examples/aistx_msg.grc b/examples/aistx_msg.grc
new file mode 100644
index 0000000..113b6fc
--- /dev/null
+++ b/examples/aistx_msg.grc
@@ -0,0 +1,900 @@
+options:
+ parameters:
+ author: ''
+ category: '[GRC Hier Blocks]'
+ cmake_opt: ''
+ comment: ''
+ copyright: ''
+ description: ''
+ gen_cmake: 'On'
+ gen_linking: dynamic
+ generate_options: no_gui
+ hier_block_src_path: '.:'
+ id: aistx_msg
+ max_nouts: '0'
+ output_language: python
+ placement: (0,0)
+ qt_qss_theme: ''
+ realtime_scheduling: ''
+ run: 'True'
+ run_command: '{python} -u {filename}'
+ run_options: run
+ sizing_mode: fixed
+ thread_safe_setters: ''
+ title: aistx_msg
+ window_size: ''
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [8, 12.0]
+ rotation: 0
+ state: enabled
+
+blocks:
+- name: bit_rate
+ id: variable
+ parameters:
+ comment: ''
+ value: '9600'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [281, 82]
+ rotation: 0
+ state: enabled
+- name: samp_rate
+ id: variable
+ parameters:
+ comment: ''
+ value: '1000000'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [282, 15]
+ rotation: 0
+ state: enabled
+- name: AISTX_Build_Frame_0
+ id: AISTX_Build_Frame
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ enable_NRZI: 'True'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ repeat: 'True'
+ tag: packet_len
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [152, 364]
+ rotation: 0
+ state: enabled
+- name: analog_sig_source_x_0
+ id: analog_sig_source_x
+ parameters:
+ affinity: ''
+ alias: ''
+ amp: '1'
+ comment: ''
+ freq: '-25000'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ offset: '0'
+ phase: '0'
+ samp_rate: samp_rate
+ type: complex
+ waveform: analog.GR_SIN_WAVE
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [459, 207]
+ rotation: 0
+ state: enabled
+- name: analog_sig_source_x_1
+ id: analog_sig_source_x
+ parameters:
+ affinity: ''
+ alias: ''
+ amp: '1'
+ comment: ''
+ freq: '25000'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ offset: '0'
+ phase: '0'
+ samp_rate: samp_rate
+ type: complex
+ waveform: analog.GR_SIN_WAVE
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [459, 477]
+ rotation: 0
+ state: enabled
+- name: blocks_add_xx_0
+ id: blocks_add_xx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ num_inputs: '2'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1105, 368]
+ rotation: 0
+ state: enabled
+- name: blocks_message_debug_0
+ id: blocks_message_debug
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [154, 567]
+ rotation: 0
+ state: disabled
+- name: blocks_message_strobe_0
+ id: blocks_message_strobe
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ msg: pmt.intern("010010000011101011110111001110011000100000000000000000100000001011001000001011000101000110100010010100001101011001111011000011111111111011100101110011100000000000000110")
+ period: '10000'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [153, 482]
+ rotation: 180
+ state: enabled
+- name: blocks_multiply_const_vxx_0
+ id: blocks_multiply_const_vxx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ const: '.45'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [893, 317]
+ rotation: 0
+ state: enabled
+- name: blocks_multiply_const_vxx_1
+ id: blocks_multiply_const_vxx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ const: '0.9'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [893, 205]
+ rotation: 0
+ state: enabled
+- name: blocks_multiply_const_vxx_2
+ id: blocks_multiply_const_vxx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ const: '.45'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [893, 445]
+ rotation: 0
+ state: enabled
+- name: blocks_multiply_const_vxx_3
+ id: blocks_multiply_const_vxx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ const: '0.9'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [893, 557]
+ rotation: 0
+ state: enabled
+- name: blocks_multiply_xx_0
+ id: blocks_multiply_xx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ num_inputs: '2'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [733, 251]
+ rotation: 0
+ state: enabled
+- name: blocks_multiply_xx_1
+ id: blocks_multiply_xx
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ num_inputs: '2'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [733, 489]
+ rotation: 0
+ state: enabled
+- name: blocks_selector_0
+ id: blocks_selector
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ enabled: 'True'
+ input_index: '1'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ num_inputs: '3'
+ num_outputs: '1'
+ output_index: '0'
+ showports: 'True'
+ type: complex
+ vlen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1243, 352]
+ rotation: 0
+ state: enabled
+- name: blocks_socket_pdu_0
+ id: blocks_socket_pdu
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ host: 0.0.0.0
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ mtu: '1472'
+ port: '23201'
+ tcp_no_delay: 'False'
+ type: UDP_SERVER
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [153, 237]
+ rotation: 180
+ state: disabled
+- name: digital_gmsk_mod_0
+ id: digital_gmsk_mod
+ parameters:
+ affinity: ''
+ alias: ''
+ bt: '0.4'
+ comment: ''
+ log: 'False'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ samples_per_symbol: int(samp_rate/bit_rate)
+ verbose: 'False'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [482, 372]
+ rotation: 0
+ state: enabled
+- name: osmosdr_sink_0
+ id: osmosdr_sink
+ parameters:
+ affinity: ''
+ alias: ''
+ ant0: ''
+ ant1: ''
+ ant10: ''
+ ant11: ''
+ ant12: ''
+ ant13: ''
+ ant14: ''
+ ant15: ''
+ ant16: ''
+ ant17: ''
+ ant18: ''
+ ant19: ''
+ ant2: ''
+ ant20: ''
+ ant21: ''
+ ant22: ''
+ ant23: ''
+ ant24: ''
+ ant25: ''
+ ant26: ''
+ ant27: ''
+ ant28: ''
+ ant29: ''
+ ant3: ''
+ ant30: ''
+ ant31: ''
+ ant4: ''
+ ant5: ''
+ ant6: ''
+ ant7: ''
+ ant8: ''
+ ant9: ''
+ args: bladerf=0,biastee=0
+ bb_gain0: '20'
+ bb_gain1: '20'
+ bb_gain10: '20'
+ bb_gain11: '20'
+ bb_gain12: '20'
+ bb_gain13: '20'
+ bb_gain14: '20'
+ bb_gain15: '20'
+ bb_gain16: '20'
+ bb_gain17: '20'
+ bb_gain18: '20'
+ bb_gain19: '20'
+ bb_gain2: '20'
+ bb_gain20: '20'
+ bb_gain21: '20'
+ bb_gain22: '20'
+ bb_gain23: '20'
+ bb_gain24: '20'
+ bb_gain25: '20'
+ bb_gain26: '20'
+ bb_gain27: '20'
+ bb_gain28: '20'
+ bb_gain29: '20'
+ bb_gain3: '20'
+ bb_gain30: '20'
+ bb_gain31: '20'
+ bb_gain4: '20'
+ bb_gain5: '20'
+ bb_gain6: '20'
+ bb_gain7: '20'
+ bb_gain8: '20'
+ bb_gain9: '20'
+ bw0: '0'
+ bw1: '0'
+ bw10: '0'
+ bw11: '0'
+ bw12: '0'
+ bw13: '0'
+ bw14: '0'
+ bw15: '0'
+ bw16: '0'
+ bw17: '0'
+ bw18: '0'
+ bw19: '0'
+ bw2: '0'
+ bw20: '0'
+ bw21: '0'
+ bw22: '0'
+ bw23: '0'
+ bw24: '0'
+ bw25: '0'
+ bw26: '0'
+ bw27: '0'
+ bw28: '0'
+ bw29: '0'
+ bw3: '0'
+ bw30: '0'
+ bw31: '0'
+ bw4: '0'
+ bw5: '0'
+ bw6: '0'
+ bw7: '0'
+ bw8: '0'
+ bw9: '0'
+ clock_source0: ''
+ clock_source1: ''
+ clock_source2: ''
+ clock_source3: ''
+ clock_source4: ''
+ clock_source5: ''
+ clock_source6: ''
+ clock_source7: ''
+ comment: ''
+ corr0: '0'
+ corr1: '0'
+ corr10: '0'
+ corr11: '0'
+ corr12: '0'
+ corr13: '0'
+ corr14: '0'
+ corr15: '0'
+ corr16: '0'
+ corr17: '0'
+ corr18: '0'
+ corr19: '0'
+ corr2: '0'
+ corr20: '0'
+ corr21: '0'
+ corr22: '0'
+ corr23: '0'
+ corr24: '0'
+ corr25: '0'
+ corr26: '0'
+ corr27: '0'
+ corr28: '0'
+ corr29: '0'
+ corr3: '0'
+ corr30: '0'
+ corr31: '0'
+ corr4: '0'
+ corr5: '0'
+ corr6: '0'
+ corr7: '0'
+ corr8: '0'
+ corr9: '0'
+ freq0: '162000000'
+ freq1: 100e6
+ freq10: 100e6
+ freq11: 100e6
+ freq12: 100e6
+ freq13: 100e6
+ freq14: 100e6
+ freq15: 100e6
+ freq16: 100e6
+ freq17: 100e6
+ freq18: 100e6
+ freq19: 100e6
+ freq2: 100e6
+ freq20: 100e6
+ freq21: 100e6
+ freq22: 100e6
+ freq23: 100e6
+ freq24: 100e6
+ freq25: 100e6
+ freq26: 100e6
+ freq27: 100e6
+ freq28: 100e6
+ freq29: 100e6
+ freq3: 100e6
+ freq30: 100e6
+ freq31: 100e6
+ freq4: 100e6
+ freq5: 100e6
+ freq6: 100e6
+ freq7: 100e6
+ freq8: 100e6
+ freq9: 100e6
+ gain0: '10'
+ gain1: '10'
+ gain10: '10'
+ gain11: '10'
+ gain12: '10'
+ gain13: '10'
+ gain14: '10'
+ gain15: '10'
+ gain16: '10'
+ gain17: '10'
+ gain18: '10'
+ gain19: '10'
+ gain2: '10'
+ gain20: '10'
+ gain21: '10'
+ gain22: '10'
+ gain23: '10'
+ gain24: '10'
+ gain25: '10'
+ gain26: '10'
+ gain27: '10'
+ gain28: '10'
+ gain29: '10'
+ gain3: '10'
+ gain30: '10'
+ gain31: '10'
+ gain4: '10'
+ gain5: '10'
+ gain6: '10'
+ gain7: '10'
+ gain8: '10'
+ gain9: '10'
+ if_gain0: '20'
+ if_gain1: '20'
+ if_gain10: '20'
+ if_gain11: '20'
+ if_gain12: '20'
+ if_gain13: '20'
+ if_gain14: '20'
+ if_gain15: '20'
+ if_gain16: '20'
+ if_gain17: '20'
+ if_gain18: '20'
+ if_gain19: '20'
+ if_gain2: '20'
+ if_gain20: '20'
+ if_gain21: '20'
+ if_gain22: '20'
+ if_gain23: '20'
+ if_gain24: '20'
+ if_gain25: '20'
+ if_gain26: '20'
+ if_gain27: '20'
+ if_gain28: '20'
+ if_gain29: '20'
+ if_gain3: '20'
+ if_gain30: '20'
+ if_gain31: '20'
+ if_gain4: '20'
+ if_gain5: '20'
+ if_gain6: '20'
+ if_gain7: '20'
+ if_gain8: '20'
+ if_gain9: '20'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ nchan: '1'
+ num_mboards: '1'
+ sample_rate: samp_rate
+ sync: sync
+ time_source0: ''
+ time_source1: ''
+ time_source2: ''
+ time_source3: ''
+ time_source4: ''
+ time_source5: ''
+ time_source6: ''
+ time_source7: ''
+ type: fc32
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1527, 121]
+ rotation: 0
+ state: enabled
+- name: uhd_usrp_sink_0
+ id: uhd_usrp_sink
+ parameters:
+ affinity: ''
+ alias: ''
+ ant0: TX/RX
+ ant1: TX/RX
+ ant10: TX/RX
+ ant11: TX/RX
+ ant12: TX/RX
+ ant13: TX/RX
+ ant14: TX/RX
+ ant15: TX/RX
+ ant16: TX/RX
+ ant17: TX/RX
+ ant18: TX/RX
+ ant19: TX/RX
+ ant2: TX/RX
+ ant20: TX/RX
+ ant21: TX/RX
+ ant22: TX/RX
+ ant23: TX/RX
+ ant24: TX/RX
+ ant25: TX/RX
+ ant26: TX/RX
+ ant27: TX/RX
+ ant28: TX/RX
+ ant29: TX/RX
+ ant3: TX/RX
+ ant30: TX/RX
+ ant31: TX/RX
+ ant4: TX/RX
+ ant5: TX/RX
+ ant6: TX/RX
+ ant7: TX/RX
+ ant8: TX/RX
+ ant9: TX/RX
+ bw0: '500000'
+ bw1: '0'
+ bw10: '0'
+ bw11: '0'
+ bw12: '0'
+ bw13: '0'
+ bw14: '0'
+ bw15: '0'
+ bw16: '0'
+ bw17: '0'
+ bw18: '0'
+ bw19: '0'
+ bw2: '0'
+ bw20: '0'
+ bw21: '0'
+ bw22: '0'
+ bw23: '0'
+ bw24: '0'
+ bw25: '0'
+ bw26: '0'
+ bw27: '0'
+ bw28: '0'
+ bw29: '0'
+ bw3: '0'
+ bw30: '0'
+ bw31: '0'
+ bw4: '0'
+ bw5: '0'
+ bw6: '0'
+ bw7: '0'
+ bw8: '0'
+ bw9: '0'
+ center_freq0: '162000000'
+ center_freq1: '0'
+ center_freq10: '0'
+ center_freq11: '0'
+ center_freq12: '0'
+ center_freq13: '0'
+ center_freq14: '0'
+ center_freq15: '0'
+ center_freq16: '0'
+ center_freq17: '0'
+ center_freq18: '0'
+ center_freq19: '0'
+ center_freq2: '0'
+ center_freq20: '0'
+ center_freq21: '0'
+ center_freq22: '0'
+ center_freq23: '0'
+ center_freq24: '0'
+ center_freq25: '0'
+ center_freq26: '0'
+ center_freq27: '0'
+ center_freq28: '0'
+ center_freq29: '0'
+ center_freq3: '0'
+ center_freq30: '0'
+ center_freq31: '0'
+ center_freq4: '0'
+ center_freq5: '0'
+ center_freq6: '0'
+ center_freq7: '0'
+ center_freq8: '0'
+ center_freq9: '0'
+ clock_rate: 0e0
+ clock_source0: ''
+ clock_source1: ''
+ clock_source2: ''
+ clock_source3: ''
+ clock_source4: ''
+ clock_source5: ''
+ clock_source6: ''
+ clock_source7: ''
+ comment: ''
+ dev_addr: '""'
+ dev_args: '""'
+ gain0: '0'
+ gain1: '0'
+ gain10: '0'
+ gain11: '0'
+ gain12: '0'
+ gain13: '0'
+ gain14: '0'
+ gain15: '0'
+ gain16: '0'
+ gain17: '0'
+ gain18: '0'
+ gain19: '0'
+ gain2: '0'
+ gain20: '0'
+ gain21: '0'
+ gain22: '0'
+ gain23: '0'
+ gain24: '0'
+ gain25: '0'
+ gain26: '0'
+ gain27: '0'
+ gain28: '0'
+ gain29: '0'
+ gain3: '0'
+ gain30: '0'
+ gain31: '0'
+ gain4: '0'
+ gain5: '0'
+ gain6: '0'
+ gain7: '0'
+ gain8: '0'
+ gain9: '0'
+ len_tag_name: ''
+ lo_export0: 'False'
+ lo_export1: 'False'
+ lo_export10: 'False'
+ lo_export11: 'False'
+ lo_export12: 'False'
+ lo_export13: 'False'
+ lo_export14: 'False'
+ lo_export15: 'False'
+ lo_export16: 'False'
+ lo_export17: 'False'
+ lo_export18: 'False'
+ lo_export19: 'False'
+ lo_export2: 'False'
+ lo_export20: 'False'
+ lo_export21: 'False'
+ lo_export22: 'False'
+ lo_export23: 'False'
+ lo_export24: 'False'
+ lo_export25: 'False'
+ lo_export26: 'False'
+ lo_export27: 'False'
+ lo_export28: 'False'
+ lo_export29: 'False'
+ lo_export3: 'False'
+ lo_export30: 'False'
+ lo_export31: 'False'
+ lo_export4: 'False'
+ lo_export5: 'False'
+ lo_export6: 'False'
+ lo_export7: 'False'
+ lo_export8: 'False'
+ lo_export9: 'False'
+ lo_source0: internal
+ lo_source1: internal
+ lo_source10: internal
+ lo_source11: internal
+ lo_source12: internal
+ lo_source13: internal
+ lo_source14: internal
+ lo_source15: internal
+ lo_source16: internal
+ lo_source17: internal
+ lo_source18: internal
+ lo_source19: internal
+ lo_source2: internal
+ lo_source20: internal
+ lo_source21: internal
+ lo_source22: internal
+ lo_source23: internal
+ lo_source24: internal
+ lo_source25: internal
+ lo_source26: internal
+ lo_source27: internal
+ lo_source28: internal
+ lo_source29: internal
+ lo_source3: internal
+ lo_source30: internal
+ lo_source31: internal
+ lo_source4: internal
+ lo_source5: internal
+ lo_source6: internal
+ lo_source7: internal
+ lo_source8: internal
+ lo_source9: internal
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ nchan: '1'
+ norm_gain0: 'False'
+ norm_gain1: 'False'
+ norm_gain10: 'False'
+ norm_gain11: 'False'
+ norm_gain12: 'False'
+ norm_gain13: 'False'
+ norm_gain14: 'False'
+ norm_gain15: 'False'
+ norm_gain16: 'False'
+ norm_gain17: 'False'
+ norm_gain18: 'False'
+ norm_gain19: 'False'
+ norm_gain2: 'False'
+ norm_gain20: 'False'
+ norm_gain21: 'False'
+ norm_gain22: 'False'
+ norm_gain23: 'False'
+ norm_gain24: 'False'
+ norm_gain25: 'False'
+ norm_gain26: 'False'
+ norm_gain27: 'False'
+ norm_gain28: 'False'
+ norm_gain29: 'False'
+ norm_gain3: 'False'
+ norm_gain30: 'False'
+ norm_gain31: 'False'
+ norm_gain4: 'False'
+ norm_gain5: 'False'
+ norm_gain6: 'False'
+ norm_gain7: 'False'
+ norm_gain8: 'False'
+ norm_gain9: 'False'
+ num_mboards: '1'
+ otw: ''
+ samp_rate: samp_rate
+ sd_spec0: ''
+ sd_spec1: ''
+ sd_spec2: ''
+ sd_spec3: ''
+ sd_spec4: ''
+ sd_spec5: ''
+ sd_spec6: ''
+ sd_spec7: ''
+ show_lo_controls: 'False'
+ stream_args: ''
+ stream_chans: '[]'
+ sync: sync
+ time_source0: ''
+ time_source1: ''
+ time_source2: ''
+ time_source3: ''
+ time_source4: ''
+ time_source5: ''
+ time_source6: ''
+ time_source7: ''
+ type: fc32
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1528, 332]
+ rotation: 0
+ state: disabled
+
+connections:
+- [AISTX_Build_Frame_0, '0', digital_gmsk_mod_0, '0']
+- [analog_sig_source_x_0, '0', blocks_multiply_xx_0, '0']
+- [analog_sig_source_x_1, '0', blocks_multiply_xx_1, '1']
+- [blocks_add_xx_0, '0', blocks_selector_0, '1']
+- [blocks_message_strobe_0, strobe, AISTX_Build_Frame_0, sentence]
+- [blocks_message_strobe_0, strobe, blocks_message_debug_0, print]
+- [blocks_multiply_const_vxx_0, '0', blocks_add_xx_0, '0']
+- [blocks_multiply_const_vxx_1, '0', blocks_selector_0, '0']
+- [blocks_multiply_const_vxx_2, '0', blocks_add_xx_0, '1']
+- [blocks_multiply_const_vxx_3, '0', blocks_selector_0, '2']
+- [blocks_multiply_xx_0, '0', blocks_multiply_const_vxx_0, '0']
+- [blocks_multiply_xx_0, '0', blocks_multiply_const_vxx_1, '0']
+- [blocks_multiply_xx_1, '0', blocks_multiply_const_vxx_2, '0']
+- [blocks_multiply_xx_1, '0', blocks_multiply_const_vxx_3, '0']
+- [blocks_selector_0, '0', osmosdr_sink_0, '0']
+- [blocks_selector_0, '0', uhd_usrp_sink_0, '0']
+- [blocks_socket_pdu_0, pdus, AISTX_Build_Frame_0, sentence]
+- [blocks_socket_pdu_0, pdus, blocks_message_debug_0, print]
+- [digital_gmsk_mod_0, '0', blocks_multiply_xx_0, '1']
+- [digital_gmsk_mod_0, '0', blocks_multiply_xx_1, '0']
+
+metadata:
+ file_format: 1
diff --git a/gr-aistx/README b/gr-aistx/README
deleted file mode 100644
index 31fb5ec..0000000
--- a/gr-aistx/README
+++ /dev/null
@@ -1,24 +0,0 @@
-
-This directory contains a custom block for GnuRadio we called AIS Frame Builder.
-It is part of the AIS BlackToolkit.
-
-This block serves as generator of AIS frames and implements the full AIS stack.
-It is composed of three main components covering respectively the
-application/presentation layers, the link layer and the physical layer,
-as defined in the protocol specification for AIS.
-
-Install as described in the official out-of-tree documentation, i.e.:
-
-$ mkdir build
-$ cd build
-$ cmake ../
-$ make
-$ sudo make install
-
-Copyright 2013-2014 -- Embyte & Pastus
-
-This program 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 2
-of the License, or (at your option) any later version.
-
diff --git a/gr-aistx/cmake/Modules/FindGnuradioRuntime.cmake b/gr-aistx/cmake/Modules/FindGnuradioRuntime.cmake
deleted file mode 100644
index 2833fb1..0000000
--- a/gr-aistx/cmake/Modules/FindGnuradioRuntime.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime)
-
-if(PC_GNURADIO_RUNTIME_FOUND)
- # look for include files
- FIND_PATH(
- GNURADIO_RUNTIME_INCLUDE_DIRS
- NAMES gnuradio/top_block.h
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
- ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS}
- ${CMAKE_INSTALL_PREFIX}/include
- PATHS /usr/local/include
- /usr/include
- )
-
- # look for libs
- FIND_LIBRARY(
- GNURADIO_RUNTIME_LIBRARIES
- NAMES gnuradio-runtime
- HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
- ${PC_GNURADIO_RUNTIME_LIBDIR}
- ${CMAKE_INSTALL_PREFIX}/lib/
- ${CMAKE_INSTALL_PREFIX}/lib64/
- PATHS /usr/local/lib
- /usr/local/lib64
- /usr/lib
- /usr/lib64
- )
-
- set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND})
-endif(PC_GNURADIO_RUNTIME_FOUND)
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
-MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
diff --git a/gr-aistx/cmake/Modules/GrMiscUtils.cmake b/gr-aistx/cmake/Modules/GrMiscUtils.cmake
deleted file mode 100644
index 9331d5d..0000000
--- a/gr-aistx/cmake/Modules/GrMiscUtils.cmake
+++ /dev/null
@@ -1,210 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
-
-########################################################################
-# Set global variable macro.
-# Used for subdirectories to export settings.
-# Example: include and library paths.
-########################################################################
-function(GR_SET_GLOBAL var)
- set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
-endfunction(GR_SET_GLOBAL)
-
-########################################################################
-# Set the pre-processor definition if the condition is true.
-# - def the pre-processor definition to set and condition name
-########################################################################
-function(GR_ADD_COND_DEF def)
- if(${def})
- add_definitions(-D${def})
- endif(${def})
-endfunction(GR_ADD_COND_DEF)
-
-########################################################################
-# Check for a header and conditionally set a compile define.
-# - hdr the relative path to the header file
-# - def the pre-processor definition to set
-########################################################################
-function(GR_CHECK_HDR_N_DEF hdr def)
- include(CheckIncludeFileCXX)
- CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
- GR_ADD_COND_DEF(${def})
-endfunction(GR_CHECK_HDR_N_DEF)
-
-########################################################################
-# Include subdirectory macro.
-# Sets the CMake directory variables,
-# includes the subdirectory CMakeLists.txt,
-# resets the CMake directory variables.
-#
-# This macro includes subdirectories rather than adding them
-# so that the subdirectory can affect variables in the level above.
-# This provides a work-around for the lack of convenience libraries.
-# This way a subdirectory can append to the list of library sources.
-########################################################################
-macro(GR_INCLUDE_SUBDIRECTORY subdir)
- #insert the current directories on the front of the list
- list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
- list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
-
- #set the current directories to the names of the subdirs
- set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
- set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
-
- #include the subdirectory CMakeLists to run it
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
-
- #reset the value of the current directories
- list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
- list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
-
- #pop the subdir names of the front of the list
- list(REMOVE_AT _cmake_source_dirs 0)
- list(REMOVE_AT _cmake_binary_dirs 0)
-endmacro(GR_INCLUDE_SUBDIRECTORY)
-
-########################################################################
-# Check if a compiler flag works and conditionally set a compile define.
-# - flag the compiler flag to check for
-# - have the variable to set with result
-########################################################################
-macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
- include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG(${flag} ${have})
- if(${have})
- add_definitions(${flag})
- endif(${have})
-endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
-
-########################################################################
-# Generates the .la libtool file
-# This appears to generate libtool files that cannot be used by auto*.
-# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
-# Notice: there is not COMPONENT option, these will not get distributed.
-########################################################################
-function(GR_LIBTOOL)
- if(NOT DEFINED GENERATE_LIBTOOL)
- set(GENERATE_LIBTOOL OFF) #disabled by default
- endif()
-
- if(GENERATE_LIBTOOL)
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
-
- find_program(LIBTOOL libtool)
- if(LIBTOOL)
- include(CMakeMacroLibtoolFile)
- CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
- endif(LIBTOOL)
- endif(GENERATE_LIBTOOL)
-
-endfunction(GR_LIBTOOL)
-
-########################################################################
-# Do standard things to the library target
-# - set target properties
-# - make install rules
-# Also handle gnuradio custom naming conventions w/ extras mode.
-########################################################################
-function(GR_LIBRARY_FOO target)
- #parse the arguments for component names
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
-
- #set additional target properties
- set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
-
- #install the generated files like so...
- install(TARGETS ${target}
- LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
- ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
- RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
- )
-
- #extras mode enabled automatically on linux
- if(NOT DEFINED LIBRARY_EXTRAS)
- set(LIBRARY_EXTRAS ${LINUX})
- endif()
-
- #special extras mode to enable alternative naming conventions
- if(LIBRARY_EXTRAS)
-
- #create .la file before changing props
- GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
-
- #give the library a special name with ultra-zero soversion
- set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
- set(target_name lib${target}-${LIBVER}.so.0.0.0)
-
- #custom command to generate symlinks
- add_custom_command(
- TARGET ${target}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
- COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
- )
-
- #and install the extra symlinks
- install(
- FILES
- ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
- ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
- DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
- )
-
- endif(LIBRARY_EXTRAS)
-endfunction(GR_LIBRARY_FOO)
-
-########################################################################
-# Create a dummy custom command that depends on other targets.
-# Usage:
-# GR_GEN_TARGET_DEPS(unique_name target_deps ...)
-# ADD_CUSTOM_COMMAND( ${target_deps})
-#
-# Custom command cant depend on targets, but can depend on executables,
-# and executables can depend on targets. So this is the process:
-########################################################################
-function(GR_GEN_TARGET_DEPS name var)
- file(
- WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
- "int main(void){return 0;}\n"
- )
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
- ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
- )
- add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
- if(ARGN)
- add_dependencies(${name} ${ARGN})
- endif(ARGN)
-
- if(CMAKE_CROSSCOMPILING)
- set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
- else()
- set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
- endif()
-endfunction(GR_GEN_TARGET_DEPS)
diff --git a/gr-aistx/cmake/Modules/GrPlatform.cmake b/gr-aistx/cmake/Modules/GrPlatform.cmake
deleted file mode 100644
index a2e4f3b..0000000
--- a/gr-aistx/cmake/Modules/GrPlatform.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
-
-########################################################################
-# Setup additional defines for OS types
-########################################################################
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(LINUX TRUE)
-endif()
-
-if(LINUX AND EXISTS "/etc/debian_version")
- set(DEBIAN TRUE)
-endif()
-
-if(LINUX AND EXISTS "/etc/redhat-release")
- set(REDHAT TRUE)
-endif()
-
-########################################################################
-# when the library suffix should be 64 (applies to redhat linux family)
-########################################################################
-if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
- set(LIB_SUFFIX 64)
-endif()
-set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/gr-aistx/cmake/Modules/GrPython.cmake b/gr-aistx/cmake/Modules/GrPython.cmake
deleted file mode 100644
index efdddf3..0000000
--- a/gr-aistx/cmake/Modules/GrPython.cmake
+++ /dev/null
@@ -1,227 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
-
-########################################################################
-# Setup the python interpreter:
-# This allows the user to specify a specific interpreter,
-# or finds the interpreter via the built-in cmake module.
-########################################################################
-#this allows the user to override PYTHON_EXECUTABLE
-if(PYTHON_EXECUTABLE)
-
- set(PYTHONINTERP_FOUND TRUE)
-
-#otherwise if not set, try to automatically find it
-else(PYTHON_EXECUTABLE)
-
- #use the built-in find script
- find_package(PythonInterp)
-
- #and if that fails use the find program routine
- if(NOT PYTHONINTERP_FOUND)
- find_program(PYTHON_EXECUTABLE NAMES python python2.7 python2.6 python2.5)
- if(PYTHON_EXECUTABLE)
- set(PYTHONINTERP_FOUND TRUE)
- endif(PYTHON_EXECUTABLE)
- endif(NOT PYTHONINTERP_FOUND)
-
-endif(PYTHON_EXECUTABLE)
-
-#make the path to the executable appear in the cmake gui
-set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
-
-#make sure we can use -B with python (introduced in 2.6)
-if(PYTHON_EXECUTABLE)
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -B -c ""
- OUTPUT_QUIET ERROR_QUIET
- RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
- )
- if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
- set(PYTHON_DASH_B "-B")
- endif()
-endif(PYTHON_EXECUTABLE)
-
-########################################################################
-# Check for the existence of a python module:
-# - desc a string description of the check
-# - mod the name of the module to import
-# - cmd an additional command to run
-# - have the result variable to set
-########################################################################
-macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
- message(STATUS "")
- message(STATUS "Python checking for ${desc}")
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "
-#########################################
-try: import ${mod}
-except: exit(-1)
-try: assert ${cmd}
-except: exit(-1)
-#########################################"
- RESULT_VARIABLE ${have}
- )
- if(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - found")
- set(${have} TRUE)
- else(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - not found")
- set(${have} FALSE)
- endif(${have} EQUAL 0)
-endmacro(GR_PYTHON_CHECK_MODULE)
-
-########################################################################
-# Sets the python installation directory GR_PYTHON_DIR
-########################################################################
-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
-from distutils import sysconfig
-print sysconfig.get_python_lib(plat_specific=True, prefix='')
-" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
-
-########################################################################
-# Create an always-built target with a unique name
-# Usage: GR_UNIQUE_TARGET( )
-########################################################################
-function(GR_UNIQUE_TARGET desc)
- file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
-print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
- OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
- add_custom_target(${_target} ALL DEPENDS ${ARGN})
-endfunction(GR_UNIQUE_TARGET)
-
-########################################################################
-# Install python sources (also builds and installs byte-compiled python)
-########################################################################
-function(GR_PYTHON_INSTALL)
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
-
- ####################################################################
- if(GR_PYTHON_INSTALL_FILES)
- ####################################################################
- install(${ARGN}) #installs regular python files
-
- #create a list of all generated files
- unset(pysrcfiles)
- unset(pycfiles)
- unset(pyofiles)
- foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
- get_filename_component(pyfile ${pyfile} ABSOLUTE)
- list(APPEND pysrcfiles ${pyfile})
-
- #determine if this file is in the source or binary directory
- file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
- string(LENGTH "${source_rel_path}" source_rel_path_len)
- file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
- string(LENGTH "${binary_rel_path}" binary_rel_path_len)
-
- #and set the generated path appropriately
- if(${source_rel_path_len} GREATER ${binary_rel_path_len})
- set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
- else()
- set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
- endif()
- list(APPEND pycfiles ${pygenfile}c)
- list(APPEND pyofiles ${pygenfile}o)
-
- #ensure generation path exists
- get_filename_component(pygen_path ${pygenfile} PATH)
- file(MAKE_DIRECTORY ${pygen_path})
-
- endforeach(pyfile)
-
- #the command to generate the pyc files
- add_custom_command(
- DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
- )
-
- #the command to generate the pyo files
- add_custom_command(
- DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
- COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
- )
-
- #create install rule and add generated files to target list
- set(python_install_gen_targets ${pycfiles} ${pyofiles})
- install(FILES ${python_install_gen_targets}
- DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
- COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
- )
-
-
- ####################################################################
- elseif(GR_PYTHON_INSTALL_PROGRAMS)
- ####################################################################
- file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
-
- foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
- get_filename_component(pyfile_name ${pyfile} NAME)
- get_filename_component(pyfile ${pyfile} ABSOLUTE)
- string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
- list(APPEND python_install_gen_targets ${pyexefile})
-
- get_filename_component(pyexefile_path ${pyexefile} PATH)
- file(MAKE_DIRECTORY ${pyexefile_path})
-
- add_custom_command(
- OUTPUT ${pyexefile} DEPENDS ${pyfile}
- COMMAND ${PYTHON_EXECUTABLE} -c
- \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
- COMMENT "Shebangin ${pyfile_name}"
- )
-
- #on windows, python files need an extension to execute
- get_filename_component(pyfile_ext ${pyfile} EXT)
- if(WIN32 AND NOT pyfile_ext)
- set(pyfile_name "${pyfile_name}.py")
- endif()
-
- install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
- DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
- COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
- )
- endforeach(pyfile)
-
- endif()
-
- GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
-
-endfunction(GR_PYTHON_INSTALL)
-
-########################################################################
-# Write the python helper script that generates byte code files
-########################################################################
-file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
-import sys, py_compile
-files = sys.argv[1:]
-srcs, gens = files[:len(files)/2], files[len(files)/2:]
-for src, gen in zip(srcs, gens):
- py_compile.compile(file=src, cfile=gen, doraise=True)
-")
diff --git a/gr-aistx/cmake/Modules/GrSwig.cmake b/gr-aistx/cmake/Modules/GrSwig.cmake
deleted file mode 100644
index 6ba5ee3..0000000
--- a/gr-aistx/cmake/Modules/GrSwig.cmake
+++ /dev/null
@@ -1,229 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_SWIG_CMAKE TRUE)
-
-include(GrPython)
-
-########################################################################
-# Builds a swig documentation file to be generated into python docstrings
-# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
-#
-# Set the following variable to specify extra dependent targets:
-# - GR_SWIG_DOCS_SOURCE_DEPS
-# - GR_SWIG_DOCS_TARGET_DEPS
-########################################################################
-function(GR_SWIG_MAKE_DOCS output_file)
- find_package(Doxygen)
- if(DOXYGEN_FOUND)
-
- #setup the input files variable list, quote formated
- set(input_files)
- unset(INPUT_PATHS)
- foreach(input_path ${ARGN})
- if (IS_DIRECTORY ${input_path}) #when input path is a directory
- file(GLOB input_path_h_files ${input_path}/*.h)
- else() #otherwise its just a file, no glob
- set(input_path_h_files ${input_path})
- endif()
- list(APPEND input_files ${input_path_h_files})
- set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
- endforeach(input_path)
-
- #determine the output directory
- get_filename_component(name ${output_file} NAME_WE)
- get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
- set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
- make_directory(${OUTPUT_DIRECTORY})
-
- #generate the Doxyfile used by doxygen
- configure_file(
- ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
- ${OUTPUT_DIRECTORY}/Doxyfile
- @ONLY)
-
- #Create a dummy custom command that depends on other targets
- include(GrMiscUtils)
- GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
-
- #call doxygen on the Doxyfile + input headers
- add_custom_command(
- OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
- DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
- COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
- COMMENT "Generating doxygen xml for ${name} docs"
- )
-
- #call the swig_doc script on the xml files
- add_custom_command(
- OUTPUT ${output_file}
- DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
- ${OUTPUT_DIRECTORY}/xml
- ${output_file}
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
- )
-
- else(DOXYGEN_FOUND)
- file(WRITE ${output_file} "\n") #no doxygen -> empty file
- endif(DOXYGEN_FOUND)
-endfunction(GR_SWIG_MAKE_DOCS)
-
-########################################################################
-# Build a swig target for the common gnuradio use case. Usage:
-# GR_SWIG_MAKE(target ifile ifile ifile...)
-#
-# Set the following variables before calling:
-# - GR_SWIG_FLAGS
-# - GR_SWIG_INCLUDE_DIRS
-# - GR_SWIG_LIBRARIES
-# - GR_SWIG_SOURCE_DEPS
-# - GR_SWIG_TARGET_DEPS
-# - GR_SWIG_DOC_FILE
-# - GR_SWIG_DOC_DIRS
-########################################################################
-macro(GR_SWIG_MAKE name)
- set(ifiles ${ARGN})
-
- #do swig doc generation if specified
- if (GR_SWIG_DOC_FILE)
- set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
- set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS})
- GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
- list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE})
- endif()
-
- #append additional include directories
- find_package(PythonLibs)
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
- list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
- list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
- list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
-
- #determine include dependencies for swig file
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE}
- ${CMAKE_BINARY_DIR}/get_swig_deps.py
- "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- )
-
- #Create a dummy custom command that depends on other targets
- include(GrMiscUtils)
- GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
- set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
- add_custom_command(
- OUTPUT ${tag_file}
- DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
- COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
- )
-
- #append the specified include directories
- include_directories(${GR_SWIG_INCLUDE_DIRS})
- list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
-
- #setup the swig flags with flags and include directories
- set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
- foreach(dir ${GR_SWIG_INCLUDE_DIRS})
- list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
- endforeach(dir)
-
- #set the C++ property on the swig .i file so it builds
- set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
-
- #setup the actual swig library target to be built
- include(UseSWIG)
- SWIG_ADD_MODULE(${name} python ${ifiles})
- SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
-
-endmacro(GR_SWIG_MAKE)
-
-########################################################################
-# Install swig targets generated by GR_SWIG_MAKE. Usage:
-# GR_SWIG_INSTALL(
-# TARGETS target target target...
-# [DESTINATION destination]
-# [COMPONENT component]
-# )
-########################################################################
-macro(GR_SWIG_INSTALL)
-
- include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
-
- foreach(name ${GR_SWIG_INSTALL_TARGETS})
- install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
- )
-
- include(GrPython)
- GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
- )
-
- GR_LIBTOOL(
- TARGET ${SWIG_MODULE_${name}_REAL_NAME}
- DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
- )
-
- endforeach(name)
-
-endmacro(GR_SWIG_INSTALL)
-
-########################################################################
-# Generate a python file that can determine swig dependencies.
-# Used by the make macro above to determine extra dependencies.
-# When you build C++, CMake figures out the header dependencies.
-# This code essentially performs that logic for swig includes.
-########################################################################
-file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
-
-import os, sys, re
-
-include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]')
-include_dirs = sys.argv[2].split(';')
-
-def get_swig_incs(file_path):
- file_contents = open(file_path, 'r').read()
- return include_matcher.findall(file_contents, re.MULTILINE)
-
-def get_swig_deps(file_path, level):
- deps = [file_path]
- if level == 0: return deps
- for inc_file in get_swig_incs(file_path):
- for inc_dir in include_dirs:
- inc_path = os.path.join(inc_dir, inc_file)
- if not os.path.exists(inc_path): continue
- deps.extend(get_swig_deps(inc_path, level-1))
- return deps
-
-if __name__ == '__main__':
- ifiles = sys.argv[1].split(';')
- deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
- #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
- print(';'.join(set(deps)))
-")
diff --git a/gr-aistx/cmake/Modules/GrTest.cmake b/gr-aistx/cmake/Modules/GrTest.cmake
deleted file mode 100644
index 6174c03..0000000
--- a/gr-aistx/cmake/Modules/GrTest.cmake
+++ /dev/null
@@ -1,133 +0,0 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-if(DEFINED __INCLUDED_GR_TEST_CMAKE)
- return()
-endif()
-set(__INCLUDED_GR_TEST_CMAKE TRUE)
-
-########################################################################
-# Add a unit test and setup the environment for a unit test.
-# Takes the same arguments as the ADD_TEST function.
-#
-# Before calling set the following variables:
-# GR_TEST_TARGET_DEPS - built targets for the library path
-# GR_TEST_LIBRARY_DIRS - directories for the library path
-# GR_TEST_PYTHON_DIRS - directories for the python path
-########################################################################
-function(GR_ADD_TEST test_name)
-
- if(WIN32)
- #Ensure that the build exe also appears in the PATH.
- list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
-
- #In the land of windows, all libraries must be in the PATH.
- #Since the dependent libraries are not yet installed,
- #we must manually set them in the PATH to run tests.
- #The following appends the path of a target dependency.
- foreach(target ${GR_TEST_TARGET_DEPS})
- get_target_property(location ${target} LOCATION)
- if(location)
- get_filename_component(path ${location} PATH)
- string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
- list(APPEND GR_TEST_LIBRARY_DIRS ${path})
- endif(location)
- endforeach(target)
-
- #SWIG generates the python library files into a subdirectory.
- #Therefore, we must append this subdirectory into PYTHONPATH.
- #Only do this for the python directories matching the following:
- foreach(pydir ${GR_TEST_PYTHON_DIRS})
- get_filename_component(name ${pydir} NAME)
- if(name MATCHES "^(swig|lib|src)$")
- list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
- endif()
- endforeach(pydir)
- endif(WIN32)
-
- file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
- file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
- file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
-
- set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
-
- #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
- #Replaced this add test + set environs code with the shell script generation.
- #Its nicer to be able to manually run the shell script to diagnose problems.
- #ADD_TEST(${ARGV})
- #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
-
- if(UNIX)
- set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
- #set both LD and DYLD paths to cover multiple UNIX OS library paths
- list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
- list(APPEND pypath "$PYTHONPATH")
-
- #replace list separator with the path separator
- string(REPLACE ";" ":" libpath "${libpath}")
- string(REPLACE ";" ":" pypath "${pypath}")
- list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}")
-
- #generate a bat file that sets the environment and runs the test
- find_program(SHELL sh)
- set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
- file(WRITE ${sh_file} "#!${SHELL}\n")
- #each line sets an environment variable
- foreach(environ ${environs})
- file(APPEND ${sh_file} "export ${environ}\n")
- endforeach(environ)
- #load the command to run with its arguments
- foreach(arg ${ARGN})
- file(APPEND ${sh_file} "${arg} ")
- endforeach(arg)
- file(APPEND ${sh_file} "\n")
-
- #make the shell file executable
- execute_process(COMMAND chmod +x ${sh_file})
-
- add_test(${test_name} ${SHELL} ${sh_file})
-
- endif(UNIX)
-
- if(WIN32)
- list(APPEND libpath ${DLL_PATHS} "%PATH%")
- list(APPEND pypath "%PYTHONPATH%")
-
- #replace list separator with the path separator (escaped)
- string(REPLACE ";" "\\;" libpath "${libpath}")
- string(REPLACE ";" "\\;" pypath "${pypath}")
- list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
-
- #generate a bat file that sets the environment and runs the test
- set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
- file(WRITE ${bat_file} "@echo off\n")
- #each line sets an environment variable
- foreach(environ ${environs})
- file(APPEND ${bat_file} "SET ${environ}\n")
- endforeach(environ)
- #load the command to run with its arguments
- foreach(arg ${ARGN})
- file(APPEND ${bat_file} "${arg} ")
- endforeach(arg)
- file(APPEND ${bat_file} "\n")
-
- add_test(${test_name} ${bat_file})
- endif(WIN32)
-
-endfunction(GR_ADD_TEST)
diff --git a/gr-aistx/grc/AISTX_Build_Frame.xml b/gr-aistx/grc/AISTX_Build_Frame.xml
deleted file mode 100644
index 61f7198..0000000
--- a/gr-aistx/grc/AISTX_Build_Frame.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- AIS Frame Builder
- AISTX_Build_Frame
- AISTX
- import AISTX
- AISTX.Build_Frame($sentence, $repeat, $enable_NRZI)
-
- Sentence
- sentence
- 010010000011101011110111001110011000100000000000000000100000001011001000001011000101000110100010010100001101011001111011000011111111111011100101110011100000000000000110
- string
-
-
- Repeat
- repeat
- True
- enum
-
-
-
-
- Enable_NRZI_Conversion
- enable_NRZI
- True
- enum
-
-
-
-
-
- out
- byte
-
-
diff --git a/gr-aistx/grc/AISTX_DebugME.xml b/gr-aistx/grc/AISTX_DebugME.xml
deleted file mode 100644
index 9dcdc31..0000000
--- a/gr-aistx/grc/AISTX_DebugME.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- DebugME
- AISTX_DebugME
- AISTX
- import AISTX
- AISTX.DebugME($type.size)
-
- Input Type
- type
- enum
-
-
-
-
-
- in
- $type
-
-
diff --git a/gr-aistx/grc/AISTX_nrz_to_nrzi.xml b/gr-aistx/grc/AISTX_nrz_to_nrzi.xml
deleted file mode 100644
index d2191bb..0000000
--- a/gr-aistx/grc/AISTX_nrz_to_nrzi.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- Nrz to nrzi
- AISTX_nrz_to_nrzi
- AISTX
- import AISTX
- AISTX.nrz_to_nrzi()
-
- in
- byte
-
-
- out
- byte
-
-
diff --git a/gr-aistx/lib/Build_Frame_impl.cc b/gr-aistx/lib/Build_Frame_impl.cc
deleted file mode 100644
index 2eb640c..0000000
--- a/gr-aistx/lib/Build_Frame_impl.cc
+++ /dev/null
@@ -1,469 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
- * This 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.
- *
- * This software 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 this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include
-#include "Build_Frame_impl.h"
-
-#include
-#include
-#include
-
-#define LEN_PREAMBLE 24
-#define LEN_START 8
-#define LEN_CRC 16
-#define LEN_FRAME_MAX 256
-
-#define PREAMBLE_MARK 101010101010101010101010 (24 bits)
-#define START_MARK 01111110 (8 bits)
-
-#define DEBUG 0
-
-namespace gr {
- namespace AISTX {
-
- Build_Frame::sptr
- Build_Frame::make(const char *sentence, bool repeat, bool enable_NRZI)
- {
- return gnuradio::get_initial_sptr
- (new Build_Frame_impl(sentence, repeat, enable_NRZI));
- }
-
- /*
- * The private constructor
- */
- Build_Frame_impl::Build_Frame_impl(const char *sentence, bool repeat, bool enable_NRZI)
- : gr::sync_block("Build_Frame",
- gr::io_signature::make(0, 0, 0),
- gr::io_signature::make(1, 1, sizeof(unsigned char))),
- d_repeat(repeat),
- d_enable_NRZI(enable_NRZI)
- {
- unsigned short REMAINDER_TO_EIGHT, PADDING_TO_EIGHT; // to pad the payload to a multiple of 8
-
- LEN_PAYLOAD = strlen(sentence);
- if (LEN_PAYLOAD>168)
- printf ("Frame padding disabled. Multiple packets.\n");
-
- // IMPORTANT
- REMAINDER_TO_EIGHT = LEN_PAYLOAD%8;
- if (REMAINDER_TO_EIGHT==0) {
- payload = (char *) malloc(LEN_PAYLOAD + LEN_CRC);
- // nb. It comes in in ASCII
- for (int i=0; i0){
-
- PADDING_TO_EIGHT = 8-REMAINDER_TO_EIGHT;
- payload = (char *) malloc(LEN_PAYLOAD + PADDING_TO_EIGHT + LEN_CRC);
-
- for (int i=0; i= sizeof(int) + 1
- // Write to the buffer backwards so that the binary representation
- // is in the correct order i.e. the LSB is on the far right
- // instead of the far left of the printed string
- char * Build_Frame_impl::int2bin(int a, char *buffer, int buf_size) {
- buffer += (buf_size - 1);
-
- for (int i = 31; i >= 0; i--) {
- *buffer-- = (a & 1) + '0';
-
- a >>= 1;
- }
-
- return buffer;
- }
-
- // staffing function
- int Build_Frame_impl::stuff (const char *in, char *out, int l_in)
- {
- int i=0, j=0, consecutives=0, l_out=0;
-
- while(i 39)
- ascii -= 8;
-
- /* if (DEBUG)*/
- /* printf ("\nAscii: orig=%d scaled=%d\n", orig_ascii, ascii);*/
-
- char binary[6];
- int y = 0;
-
- if (ascii==0)
- memset (binary, 0x0, 6);
- else
- while (ascii!=1) {
- if (ascii % 2 == 0)
- binary[y] = 0x0;
- else if (ascii % 2 == 1)
- binary[y] = 0x1;
- ascii /= 2;
- y++;
- }
-
- if (ascii==1) {
- binary[y] = 0x1;
- y++;
- }
-
- if(y < 6) { // fill in space
- for(; y < 6; y++)
- binary[y] = 0x0;
- }
-
- for(y = 0; y < 6; y++) // reverse*/
- ret[y] = binary[5 - y];
- ret[y]='\0';
-
- /* if (DEBUG)*/
- /* printf("Binary = %s, Ret = %s\n", binary, ret );*/
-
- }
-
- void Build_Frame_impl::nrz_to_nrzi(char *data, int length)
- {
- unsigned short d_prev_nrzi_bit = 0;
- unsigned short nrz_bit, nrzi_bit;
-
- for (int i = 0; i < length; i++)
- {
- nrz_bit = data[i];
-
- if(nrz_bit == 0)
- {
- nrzi_bit = d_prev_nrzi_bit ^ 1;
- }
- else
- {
- nrzi_bit = d_prev_nrzi_bit;
- }
-
- data[i] = nrzi_bit;
- d_prev_nrzi_bit = nrzi_bit;
- }
- }
-
- void Build_Frame_impl::reverse_bit_order(char *data, int length)
- {
- int tmp = 0;
- for(int i = 0; i < length/8; i++) {
- for(int j = 0; j < 4; j++) {
- tmp = data[i*8 + j];
- data[i*8 + j] = data[i*8 + 7-j];
- data[i*8 + 7-j] = tmp;
- }
- }
- }
-
- unsigned long Build_Frame_impl::unpack(char *buffer, int start, int length)
- {
- unsigned long ret = 0;
- for(int i = start; i < (start+length); i++) {
- ret <<= 1;
- ret |= (buffer[i] & 0x01);
- }
- return ret;
- }
-
- void Build_Frame_impl::compute_crc(char *buffer, char *ret, unsigned int len) // Calculates CRC-checksum from unpacked data
- {
- static const unsigned short crc_itu16_table[] =
- {
- 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
- 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
- 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
- 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
- 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
- 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
- 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
- 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
- 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
- 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
- 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
- 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
- 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
- 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
- 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
- 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
- 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
- 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
- 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
- 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
- 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
- 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
- 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
- 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
- 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
- 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
- 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
- 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
- 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
- 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
- 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
- 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
- };
-
- int crc=0xffff;
- int i = 0;
- char temp[8];
- int datalen = len/8;
-
-// // go to char (this can be optimized)
-// printf ("INPUT:");
-// for(int j=0;j> 8) ^ crc_itu16_table[(crc ^ data[i]) & 0xFF];
-
- crc=(crc & 0xFFFF)^0xFFFF;
-// printf("%X\n", crc);
-
- int2bin(crc, ret, 16);
-// printf ("CRC ASCII1 = %s\n", ret);
- //dump_buffer(ret, 16);
-
- reverse_bit_order (ret, 16); //revert crc bit in byte
-
- int2bin(crc, ret, 16);
- strncpy(temp,ret+8,8); //swap the two crc byte
- strncpy(ret+8,ret,8);
- strncpy(ret,temp,8);
-
- // back to binary
- for(int j=0;j<16;j++)
- ret[j]=ret[j]-0x30;
-
-// if (DEBUG) {
-// printf("CRC 2=\n");
-// dump_buffer(ret,16);
-// }
-}
-
- void Build_Frame_impl::byte_packing(char *input_frame, unsigned char *out_byte, unsigned int len) {
- for (int i = 0; i < len/8; i++) {
- char tmp[8];
- memcpy(tmp, &input_frame[i*8], 8);
- out_byte[i] = tmp[0]*128+tmp[1]*64+tmp[2]*32+tmp[3]*16+tmp[4]*8+tmp[5]*4+tmp[6]*2+tmp[7];
-
- //out_byte[i] = input_frame[i*8]*128+input_frame[i*8+1]*64+input_frame[i*8+2]*32+input_frame[i*8+3]*16+input_frame[i*8+4]*8+input_frame[i*8+5]*4+input_frame[i*8+6]*2+input_frame[i*8+7];
-// printf ("%X", out_byte[i]);
- }
-// printf("\n");
- }
-
- int
- Build_Frame_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- unsigned char *out = (unsigned char *) output_items[0];
-
-// B3co>HP00 P ;8 ;56 RD =Is3 w sU kP06 CRC
-// 010010000011101011110111001110011000100000000000000000 100000 001011001000 001011000101000110 100010010100 001101011001111011000011 111111 111011100101 110011100000000000000110 0011000010001111
-// printf("\nENCODING:\t%s\n", sentence);
-// printf("LEN_SENTENCE:\t%d\n", LEN_SENTENCE);
-// printf("LEN_PAYLOAD:\t%d\n", LEN_PAYLOAD);
-// printf("LEN_CRC:\t%d\n", LEN_CRC);
-
-// // payload encoding
-// char buffer[6];
-
-// for (int i=0; i %s \n", strlen(payload), i+1, sentence[i], payload);
-// }
-
-
-// // crc
-// char crc[16]; // 2 gnuradio bytes of CRC
-// char input_crc[LEN_PAYLOAD];
-// memcpy (input_crc, payload, LEN_PAYLOAD);
-// compute_crc (input_crc, crc, LEN_PAYLOAD);
-// memcpy (payload+LEN_PAYLOAD, crc, LEN_CRC);
-
- // reverse bits (payload + crc)
-// reverse_bit_order (payload, LEN_PAYLOAD+LEN_CRC);
-//// printf("Dump buffer after reverse + crc= ");
-//// dump_buffer(payload, LEN_PAYLOAD+LEN_CRC);
-
- // stuffing (payload + crc)
- if (LEN_PAYLOAD<=168) {
-
- char stuffed_payload[LEN_FRAME_MAX];
- int LEN_STUFFED_PAYLOAD = stuff (payload, stuffed_payload, LEN_PAYLOAD+LEN_CRC);
-
- //// frame generation /////
- char frame[LEN_FRAME_MAX];
- unsigned char byte_frame[LEN_FRAME_MAX/8]; //PASTA
- memset (frame, 0x0, LEN_FRAME_MAX);
-
- // headers
- memcpy (frame, "\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0", LEN_PREAMBLE);
- memcpy (frame+LEN_PREAMBLE, "\0\1\1\1\1\1\1\0", LEN_START);
- // payload + crc
- memcpy (frame+LEN_PREAMBLE+LEN_START, stuffed_payload, LEN_STUFFED_PAYLOAD);
- // trailer
- memcpy (frame+LEN_PREAMBLE+LEN_START+LEN_STUFFED_PAYLOAD, "\0\1\1\1\1\1\1\0", 8);
-
- // padding
- int LEN_PADDING = LEN_FRAME_MAX-(LEN_PREAMBLE+LEN_START+LEN_STUFFED_PAYLOAD+LEN_START);
- memset (frame+LEN_PREAMBLE+LEN_START+LEN_STUFFED_PAYLOAD+LEN_START, 0x0, LEN_PADDING);
- int len_frame_real = LEN_FRAME_MAX; // 256
-
- // NRZI Conversion
- nrz_to_nrzi (frame, len_frame_real);
- printf ("Sent Frame (NRZI enabled) = ");
-
- dump_buffer(frame, len_frame_real);
-
- // Binary conversion (to use with GMSK mod's byte_to_symb
- byte_packing(frame, byte_frame, len_frame_real);
-
- // output
- memcpy (out, byte_frame, len_frame_real/8);
- noutput_items = len_frame_real/8;
-
-
- }
- else {
-
- char stuffed_payload[1024];
- int LEN_STUFFED_PAYLOAD = stuff (payload, stuffed_payload, LEN_PAYLOAD+LEN_CRC);
-
- //// frame generation /////
- int LEN_FRAME = LEN_PREAMBLE + LEN_START*2 + LEN_STUFFED_PAYLOAD;
- char frame[LEN_FRAME];
- unsigned char byte_frame[LEN_FRAME/8]; //PASTA
- memset (frame, 0x0, LEN_FRAME);
-
- // headers
- memcpy (frame, "\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0", LEN_PREAMBLE);
- memcpy (frame+LEN_PREAMBLE, "\0\1\1\1\1\1\1\0", LEN_START);
- // payload + crc
- memcpy (frame+LEN_PREAMBLE+LEN_START, stuffed_payload, LEN_STUFFED_PAYLOAD);
- // trailer
- memcpy (frame+LEN_PREAMBLE+LEN_START+LEN_STUFFED_PAYLOAD, "\0\1\1\1\1\1\1\0", 8);
-
- int len_frame_real = LEN_FRAME;
-
- // NRZI Conversion
- nrz_to_nrzi (frame, len_frame_real);
- printf ("Sent Frame (NRZI enabled) = ");
-
- dump_buffer(frame, len_frame_real);
-
- // Binary conversion (to use with GMSK mod's byte_to_symb
- byte_packing(frame, byte_frame, len_frame_real);
-
- // output
- memcpy (out, byte_frame, len_frame_real/8);
- noutput_items = len_frame_real/8;
-
- }
-
-
- // some sleep here
-// int r = (int) rand() % 1000;
-// usleep(1000*r); // -6
- //sleep(1);
- usleep(100000);
-
- // Tell runtime system how many output items we produced.
- return noutput_items;
- }
-
- } /* namespace AISTX */
-} /* namespace gr */
-
diff --git a/gr-aistx/lib/Build_Frame_impl.h b/gr-aistx/lib/Build_Frame_impl.h
deleted file mode 100644
index 6a6648f..0000000
--- a/gr-aistx/lib/Build_Frame_impl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
- * This 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.
- *
- * This software 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 this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_AISTX_BUILD_FRAME_IMPL_H
-#define INCLUDED_AISTX_BUILD_FRAME_IMPL_H
-
-#include
-
-#define __VERSION 0.3
-
-namespace gr {
- namespace AISTX {
-
- class Build_Frame_impl : public Build_Frame
- {
- private:
- bool d_repeat;
- bool d_enable_NRZI;
- //char * d_sentence;
- char *payload; // [the 01 rapresentation of the sentence as taken from input]
- unsigned short LEN_SENTENCE;
- unsigned short LEN_PAYLOAD;
-
- public:
- Build_Frame_impl(const char *sentence, bool repeat, bool enable_NRZI);
- ~Build_Frame_impl();
-
- void dump_buffer(const char *b, int buffer_size);
- char * int2bin(int a, char *buffer, int buf_size);
- int stuff (const char *in, char *out, int l_in);
- void pack (int orig_ascii, char *ret, int bits_per_byte);
- void nrz_to_nrzi(char *data, int length);
- void reverse_bit_order(char *data, int length);
- unsigned long unpack(char *buffer, int start, int length);
- void compute_crc(char *buffer, char *ret, unsigned int len);
- void byte_packing(char *input_frame, unsigned char *out_byte, unsigned int len);
-
- // Where all the action really happens
- int work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
-
- } // namespace AISTX
-} // namespace gr
-
-#endif /* INCLUDED_AISTX_BUILD_FRAME_IMPL_H */
-
diff --git a/gr-aistx/lib/CMakeLists.txt b/gr-aistx/lib/CMakeLists.txt
deleted file mode 100644
index 64a6e1c..0000000
--- a/gr-aistx/lib/CMakeLists.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright 2011,2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# Setup library
-########################################################################
-include(GrPlatform) #define LIB_SUFFIX
-
-include_directories(${Boost_INCLUDE_DIR})
-link_directories(${Boost_LIBRARY_DIRS})
-list(APPEND AISTX_sources
- nrz_to_nrzi_impl.cc
- Build_Frame_impl.cc
- DebugME_impl.cc )
-
-add_library(gnuradio-AISTX SHARED ${AISTX_sources})
-target_link_libraries(gnuradio-AISTX ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
-set_target_properties(gnuradio-AISTX PROPERTIES DEFINE_SYMBOL "gnuradio_AISTX_EXPORTS")
-
-########################################################################
-# Install built library files
-########################################################################
-install(TARGETS gnuradio-AISTX
- LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
- ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
- RUNTIME DESTINATION bin # .dll file
-)
-
-########################################################################
-# Build and register unit test
-########################################################################
-include(GrTest)
-
-include_directories(${CPPUNIT_INCLUDE_DIRS})
-
-list(APPEND test_AISTX_sources
- ${CMAKE_CURRENT_SOURCE_DIR}/test_AISTX.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/qa_AISTX.cc
-)
-
-add_executable(test-AISTX ${test_AISTX_sources})
-
-target_link_libraries(
- test-AISTX
- ${GNURADIO_RUNTIME_LIBRARIES}
- ${Boost_LIBRARIES}
- ${CPPUNIT_LIBRARIES}
- gnuradio-AISTX
-)
-
-GR_ADD_TEST(test_AISTX test-AISTX)
diff --git a/gr-aistx/lib/DebugME_impl.cc b/gr-aistx/lib/DebugME_impl.cc
deleted file mode 100644
index 3d0681c..0000000
--- a/gr-aistx/lib/DebugME_impl.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
- * This 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.
- *
- * This software 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 this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include
-#include "DebugME_impl.h"
-#include
-
-namespace gr {
- namespace AISTX {
-
- DebugME::sptr
- DebugME::make(size_t itemsize)
- {
- return gnuradio::get_initial_sptr
- (new DebugME_impl(itemsize));
- }
-
- /*
- * The private constructor
- */
- DebugME_impl::DebugME_impl(size_t itemsize)
- : gr::block("DebugME",
- gr::io_signature::make(1, 1, itemsize),
- gr::io_signature::make(0, 0, 0)),
- d_itemsize(itemsize)
- {}
-
- /*
- * Our virtual destructor.
- */
- DebugME_impl::~DebugME_impl()
- {
- }
-
- void
- DebugME_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
- {
- /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
- }
-
- int
- DebugME_impl::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
-
- // char / byte
- if (d_itemsize == 1) {
- const unsigned char *in = (const unsigned char *) input_items[0];
- for(int i = 0; i
- // Tell runtime system how many input items we consumed on
- // each input stream.
- consume_each (noutput_items);
-
- // Tell runtime system how many output items we produced.
- return 0;
- }
-
- } /* namespace AISTX */
-} /* namespace gr */
-
diff --git a/gr-aistx/lib/nrz_to_nrzi_impl.cc b/gr-aistx/lib/nrz_to_nrzi_impl.cc
deleted file mode 100644
index 93934dc..0000000
--- a/gr-aistx/lib/nrz_to_nrzi_impl.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
- * This 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.
- *
- * This software 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 this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include
-#include "nrz_to_nrzi_impl.h"
-#include
-
-namespace gr {
- namespace AISTX {
-
- nrz_to_nrzi::sptr
- nrz_to_nrzi::make()
- {
- return gnuradio::get_initial_sptr
- (new nrz_to_nrzi_impl());
- }
-
- /*
- * The private constructor
- */
- nrz_to_nrzi_impl::nrz_to_nrzi_impl()
- : gr::block("nrz_to_nrzi",
- gr::io_signature::make(1, 1, sizeof(unsigned char)),
- gr::io_signature::make(1, 1, sizeof(unsigned char)))
- {}
-
- /*
- * Our virtual destructor.
- */
- nrz_to_nrzi_impl::~nrz_to_nrzi_impl()
- {
- }
-
- void
- nrz_to_nrzi_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
- {
- /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
- }
-
- int
- nrz_to_nrzi_impl::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
- unsigned char nrzi_bit;
- unsigned char nrz_bit;
- unsigned char d_prev_nrzi_bit = 0;
-
- for(int i = 0;i.
- *
+ *
* This 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.
- *
+ *
* This software 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 this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,39 +22,39 @@
#ifndef INCLUDED_AISTX_BUILD_FRAME_H
#define INCLUDED_AISTX_BUILD_FRAME_H
+#include
#include
-#include
namespace gr {
- namespace AISTX {
+namespace AISTX {
+
+/*!
+ * \brief Builds AIS Frame
+ * \ingroup AISTX
+ *
+ */
+class AISTX_API Build_Frame : virtual public gr::tagged_stream_block
+{
+public:
+ typedef boost::shared_ptr sptr;
/*!
- * \brief Builds AIS Frame
- * \ingroup AISTX
+ * \brief Builds an AIS Frame of 256 bytes.
+ *
+ * This module does, in order:
+ * 1. Payload (NMEA sentence) encoding (6 bits per ASCII)
+ * 2. CRC generation [16]
+ * 3. Reverse bit order (payload + crc)
+ * 4. Stuffing (payload + crc)
+ * 5. Headers (Preamble [24], Start [8], Trailer [8], 0x00 Padding)
+ * 6. NRZI conversion (enabled by default)
*
*/
- class AISTX_API Build_Frame : virtual public gr::sync_block
- {
- public:
- typedef boost::shared_ptr sptr;
-
- /*!
- * \brief Builds an AIS Frame of 256 bytes.
- *
- * This module does, in order:
- * 1. Payload (NMEA sentence) encoding (6 bits per ASCII)
- * 2. CRC generation [16]
- * 3. Reverse bit order (payload + crc)
- * 4. Stuffing (payload + crc)
- * 5. Headers (Preamble [24], Start [8], Trailer [8], 0x00 Padding)
- * 6. NRZI conversion (enabled by default)
- *
- */
- static sptr make(const char *sentence, bool repeat, bool enable_NRZI);
- };
-
- } // namespace AISTX
+ static sptr
+ make(bool repeat, bool enable_NRZI, const std::string& lengthtagname = "packet_len");
+};
+
+} // namespace AISTX
} // namespace gr
#endif /* INCLUDED_AISTX_BUILD_FRAME_H */
-
diff --git a/gr-aistx/include/AISTX/CMakeLists.txt b/include/AISTX/CMakeLists.txt
similarity index 86%
rename from gr-aistx/include/AISTX/CMakeLists.txt
rename to include/AISTX/CMakeLists.txt
index 257680e..cbba99f 100644
--- a/gr-aistx/include/AISTX/CMakeLists.txt
+++ b/include/AISTX/CMakeLists.txt
@@ -1,6 +1,7 @@
# Copyright 2011,2012 Free Software Foundation, Inc.
#
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,5 +25,6 @@ install(FILES
api.h
nrz_to_nrzi.h
Build_Frame.h
- DebugME.h DESTINATION include/AISTX
+ DebugME.h
+ DESTINATION include/AISTX
)
diff --git a/gr-aistx/include/AISTX/DebugME.h b/include/AISTX/DebugME.h
similarity index 67%
rename from gr-aistx/include/AISTX/DebugME.h
rename to include/AISTX/DebugME.h
index 310c57d..0abc7bf 100644
--- a/gr-aistx/include/AISTX/DebugME.h
+++ b/include/AISTX/DebugME.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
+ *
* This 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.
- *
+ *
* This software 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 this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,34 +22,32 @@
#ifndef INCLUDED_AISTX_DEBUGME_H
#define INCLUDED_AISTX_DEBUGME_H
-#include
#include
-
+#include
namespace gr {
- namespace AISTX {
+namespace AISTX {
+
+/*!
+ * \brief Print the incoming BYTE sequence
+ * \ingroup AISTX
+ *
+ */
+class AISTX_API DebugME : virtual public gr::block
+{
+public:
+ typedef boost::shared_ptr sptr;
/*!
- * \brief Print the incoming BYTE sequence
- * \ingroup AISTX
+ * \brief Print the incoming BYTE sequence as sequence of HEXs
*
+ * Goes through the incoming sequence (const char *in) and prints it in HEXs
*/
- class AISTX_API DebugME : virtual public gr::block
- {
- public:
- typedef boost::shared_ptr sptr;
-
- /*!
- * \brief Print the incoming BYTE sequence as sequence of HEXs
- *
- * Goes through the incoming sequence (const char *in) and prints it in HEXs
- */
- static sptr make(size_t itemsize);
- };
-
- } // namespace AISTX
+ static sptr make(size_t itemsize);
+};
+
+} // namespace AISTX
} // namespace gr
#endif /* INCLUDED_AISTX_DEBUGME_H */
-
diff --git a/gr-aistx/include/AISTX/api.h b/include/AISTX/api.h
similarity index 92%
rename from gr-aistx/include/AISTX/api.h
rename to include/AISTX/api.h
index 40308fd..0b4f8b1 100644
--- a/gr-aistx/include/AISTX/api.h
+++ b/include/AISTX/api.h
@@ -25,9 +25,9 @@
#include
#ifdef gnuradio_AISTX_EXPORTS
-# define AISTX_API __GR_ATTR_EXPORT
+#define AISTX_API __GR_ATTR_EXPORT
#else
-# define AISTX_API __GR_ATTR_IMPORT
+#define AISTX_API __GR_ATTR_IMPORT
#endif
#endif /* INCLUDED_AISTX_API_H */
diff --git a/gr-aistx/include/AISTX/nrz_to_nrzi.h b/include/AISTX/nrz_to_nrzi.h
similarity index 70%
rename from gr-aistx/include/AISTX/nrz_to_nrzi.h
rename to include/AISTX/nrz_to_nrzi.h
index 571fc26..437d396 100644
--- a/gr-aistx/include/AISTX/nrz_to_nrzi.h
+++ b/include/AISTX/nrz_to_nrzi.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
+ *
* This 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.
- *
+ *
* This software 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 this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -22,33 +22,33 @@
#ifndef INCLUDED_AISTX_NRZ_TO_NRZI_H
#define INCLUDED_AISTX_NRZ_TO_NRZI_H
-#include
#include
+#include
namespace gr {
- namespace AISTX {
+namespace AISTX {
+
+/*!
+ * \brief Convert from NRZ to NRZI
+ * \ingroup AISTX
+ *
+ */
+class AISTX_API nrz_to_nrzi : virtual public gr::block
+{
+public:
+ typedef boost::shared_ptr sptr;
/*!
* \brief Convert from NRZ to NRZI
- * \ingroup AISTX
+ *
+ * Convert a BYTE sequence from NRZ to NRZI. Note: This is also implemented in the
+ * Build_Frame component.
*
*/
- class AISTX_API nrz_to_nrzi : virtual public gr::block
- {
- public:
- typedef boost::shared_ptr sptr;
-
- /*!
- * \brief Convert from NRZ to NRZI
- *
- * Convert a BYTE sequence from NRZ to NRZI. Note: This is also implemented in the Build_Frame component.
- *
- */
- static sptr make();
- };
-
- } // namespace AISTX
+ static sptr make();
+};
+
+} // namespace AISTX
} // namespace gr
#endif /* INCLUDED_AISTX_NRZ_TO_NRZI_H */
-
diff --git a/lib/Build_Frame_impl.cc b/lib/Build_Frame_impl.cc
new file mode 100644
index 0000000..5ca351e
--- /dev/null
+++ b/lib/Build_Frame_impl.cc
@@ -0,0 +1,556 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "Build_Frame_impl.h"
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#define LEN_PREAMBLE 24
+#define LEN_START 8
+#define LEN_CRC 16
+#define LEN_FRAME_MAX 256
+
+#define PREAMBLE_MARK 101010101010101010101010(24 bits)
+#define START_MARK 01111110(8 bits)
+
+#define DEBUG 0
+
+namespace gr {
+namespace AISTX {
+
+Build_Frame::sptr
+Build_Frame::make(bool repeat, bool enable_NRZI, const std::string& tsb_tag_key)
+{
+ return gnuradio::get_initial_sptr(
+ new Build_Frame_impl(repeat, enable_NRZI, tsb_tag_key));
+}
+
+/*
+ * The private constructor
+ */
+Build_Frame_impl::Build_Frame_impl(bool repeat,
+ bool enable_NRZI,
+ const std::string& tsb_tag_key)
+ : gr::tagged_stream_block("Build_Frame",
+ gr::io_signature::make(0, 0, 0),
+ gr::io_signature::make(1, 1, sizeof(unsigned char)),
+ tsb_tag_key),
+ d_repeat(repeat),
+ d_repeat_cnt(0),
+ d_enable_NRZI(enable_NRZI),
+ d_itemsize(sizeof(unsigned char)),
+ d_curr_len(0)
+{
+ message_port_register_in(pmt::mp("sentence"));
+}
+
+
+void Build_Frame_impl::dump_buffer(const char* b, int buffer_size)
+{
+ int k = 0;
+ for (; k < buffer_size; k++)
+ printf("%d", b[k]);
+ printf("\n");
+}
+
+// buffer must have length >= sizeof(int) + 1
+// Write to the buffer backwards so that the binary representation
+// is in the correct order i.e. the LSB is on the far right
+// instead of the far left of the printed string
+char* Build_Frame_impl::int2bin(int a, char* buffer, int buf_size)
+{
+ buffer += (buf_size - 1);
+
+ for (int i = 31; i >= 0; i--) {
+ *buffer-- = (a & 1) + '0';
+
+ a >>= 1;
+ }
+
+ return buffer;
+}
+
+// stuffing function
+int Build_Frame_impl::stuff(const char* in, char* out, int l_in)
+{
+ int i = 0, j = 0, consecutives = 0, l_out = 0;
+
+ while (i < l_in) {
+
+ if (in[i] & 0x01)
+ consecutives++;
+ else
+ consecutives = 0;
+
+ out[j++] = in[i++];
+ l_out++;
+
+ if (consecutives == 5) {
+ out[j++] = 0x0;
+ l_out++;
+ consecutives = 0;
+ }
+ }
+ return l_out;
+}
+
+void Build_Frame_impl::pack(int orig_ascii, char* ret, int bits_per_byte)
+{
+ // go down to fit in 6 bits
+ int ascii = orig_ascii - 48;
+ if (ascii > 39)
+ ascii -= 8;
+
+ /* if (DEBUG)*/
+ /* printf ("\nAscii: orig=%d scaled=%d\n", orig_ascii, ascii);*/
+
+ char binary[6];
+ int y = 0;
+
+ if (ascii == 0)
+ memset(binary, 0x0, 6);
+ else
+ while (ascii != 1) {
+ if (ascii % 2 == 0)
+ binary[y] = 0x0;
+ else if (ascii % 2 == 1)
+ binary[y] = 0x1;
+ ascii /= 2;
+ y++;
+ }
+
+ if (ascii == 1) {
+ binary[y] = 0x1;
+ y++;
+ }
+
+ if (y < 6) { // fill in space
+ for (; y < 6; y++)
+ binary[y] = 0x0;
+ }
+
+ for (y = 0; y < 6; y++) // reverse*/
+ ret[y] = binary[5 - y];
+ ret[y] = '\0';
+
+ /* if (DEBUG)*/
+ /* printf("Binary = %s, Ret = %s\n", binary, ret );*/
+}
+
+void Build_Frame_impl::nrz_to_nrzi(char* data, int length)
+{
+ unsigned short d_prev_nrzi_bit = 0;
+ unsigned short nrz_bit, nrzi_bit;
+
+ for (int i = 0; i < length; i++) {
+ nrz_bit = data[i];
+
+ if (nrz_bit == 0) {
+ nrzi_bit = d_prev_nrzi_bit ^ 1;
+ } else {
+ nrzi_bit = d_prev_nrzi_bit;
+ }
+
+ data[i] = nrzi_bit;
+ d_prev_nrzi_bit = nrzi_bit;
+ }
+}
+
+void Build_Frame_impl::reverse_bit_order(char* data, int length)
+{
+ int tmp = 0;
+ for (int i = 0; i < length / 8; i++) {
+ for (int j = 0; j < 4; j++) {
+ tmp = data[i * 8 + j];
+ data[i * 8 + j] = data[i * 8 + 7 - j];
+ data[i * 8 + 7 - j] = tmp;
+ }
+ }
+}
+
+unsigned long Build_Frame_impl::unpack(char* buffer, int start, int length)
+{
+ unsigned long ret = 0;
+ for (int i = start; i < (start + length); i++) {
+ ret <<= 1;
+ ret |= (buffer[i] & 0x01);
+ }
+ return ret;
+}
+
+void Build_Frame_impl::compute_crc(
+ char* buffer,
+ char* ret,
+ unsigned int len) // Calculates CRC-checksum from unpacked data
+{
+ // clang-format off
+ static const unsigned short crc_itu16_table[] = {
+ 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
+ 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
+ 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
+ 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
+ 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
+ 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
+ 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
+ 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
+ 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
+ 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
+ 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
+ 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
+ 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
+ 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
+ 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
+ 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
+ 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
+ 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
+ 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
+ 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
+ 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
+ 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
+ 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
+ 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
+ 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
+ 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
+ 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
+ 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
+ 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
+ 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
+ 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
+ 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
+ };
+ // clang-format on
+
+ int crc = 0xffff;
+ int i = 0;
+ char temp[8];
+ int datalen = len / 8;
+
+ // // go to char (this can be optimized)
+ // printf ("INPUT:");
+ // for(int j=0;j> 8) ^ crc_itu16_table[(crc ^ data[i]) & 0xFF];
+
+ crc = (crc & 0xFFFF) ^ 0xFFFF;
+ // printf("%X\n", crc);
+
+ int2bin(crc, ret, 16);
+ // printf ("CRC ASCII1 = %s\n", ret);
+ // dump_buffer(ret, 16);
+
+ reverse_bit_order(ret, 16); // revert crc bit in byte
+
+ int2bin(crc, ret, 16);
+ strncpy(temp, ret + 8, 8); // swap the two crc byte
+ strncpy(ret + 8, ret, 8);
+ strncpy(ret, temp, 8);
+
+ // back to binary
+ for (int j = 0; j < 16; j++)
+ ret[j] = ret[j] - 0x30;
+
+ // if (DEBUG) {
+ // printf("CRC 2=\n");
+ // dump_buffer(ret,16);
+ // }
+}
+
+void Build_Frame_impl::byte_packing(char* input_frame,
+ unsigned char* out_byte,
+ unsigned int len)
+{
+ for (int i = 0; i < len / 8; i++) {
+ char tmp[8];
+ memcpy(tmp, &input_frame[i * 8], 8);
+ out_byte[i] = tmp[0] * 128 + tmp[1] * 64 + tmp[2] * 32 + tmp[3] * 16 +
+ tmp[4] * 8 + tmp[5] * 4 + tmp[6] * 2 + tmp[7];
+
+ // out_byte[i] =
+ // input_frame[i*8]*128+input_frame[i*8+1]*64+input_frame[i*8+2]*32+input_frame[i*8+3]*16+input_frame[i*8+4]*8+input_frame[i*8+5]*4+input_frame[i*8+6]*2+input_frame[i*8+7];
+ // printf ("%X", out_byte[i]);
+ }
+ // printf("\n");
+}
+
+int Build_Frame_impl::calculate_output_stream_length(const gr_vector_int& ninput_items)
+{
+ // straight copy from `pdu to tagged stream block`
+ if (d_curr_len == 0) {
+ pmt::pmt_t msg(delete_head_nowait(pmt::mp("sentence")));
+ if (msg.get() == NULL) {
+ return 0;
+ }
+
+ if (pmt::is_pair(msg)) {
+ d_curr_meta = pmt::car(msg);
+ d_curr_vect = pmt::cdr(msg);
+ // do not assume the length of PMT is in items (e.g.: from socket_pdu)
+ d_curr_len = pmt::blob_length(d_curr_vect) / d_itemsize;
+ } else if (pmt::is_symbol(msg)) {
+ // transform a symbol to a uniform vector
+ const std::string sym_str = symbol_to_string(msg);
+ d_curr_vect = pmt::init_u8vector(
+ sym_str.length(), reinterpret_cast(sym_str.c_str()));
+ d_curr_len = sym_str.length();
+ } else {
+ throw std::runtime_error(
+ "received a message type that hasn't been implemented");
+ }
+ }
+
+ return d_curr_len;
+}
+
+int Build_Frame_impl::work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items)
+{
+ // some direct copies in here from `pdu to tagged stream block` too
+ // sleep at the start, if we stop too quickly after the send, the send doesn't seem to
+ // happen
+ usleep(100000);
+
+ // if not set to repeat and we've sent a message we can exit
+ if (!d_repeat && d_repeat_cnt > 0) {
+ return WORK_DONE;
+ }
+
+ char* out = (char*)output_items[0];
+
+ if (d_curr_len == 0) {
+ return 0;
+ }
+
+ // work() should only be called if the current PDU fits entirely
+ // into the output buffer.
+ assert(noutput_items >= 0 && (unsigned int)noutput_items >= d_curr_len);
+
+ // Copy vector output
+ size_t nout = d_curr_len;
+ size_t io(0);
+ const uint8_t* ptr = (const uint8_t*)uniform_vector_elements(d_curr_vect, io);
+ memcpy(out, ptr, d_curr_len * d_itemsize);
+
+ // at this point we have the `sentence` stored in `out` and length in `nout`.
+ // printf("len: %ld; val: %s\n", nout, out);
+ // printf("buf len: %ld; in lenL %ld\n", noutput_items, ninput_items);
+ // TODO get a better understanding of noutput_items, set at 32768, but not entirely
+ // sure where/how had been under the impression this would be based on the
+ // calc length function but it does not seem related.
+ // going off the 32k, our output should always fit..
+
+ // char* d_sentence;
+ const char* sentence = out;
+ char* payload; // [the 01 rapresentation of the sentence as taken from input]
+ unsigned short LEN_SENTENCE;
+ unsigned short LEN_PAYLOAD;
+
+ unsigned short REMAINDER_TO_EIGHT,
+ PADDING_TO_EIGHT; // to pad the payload to a multiple of 8
+
+ LEN_PAYLOAD = strlen(sentence);
+ if (LEN_PAYLOAD > 168)
+ printf("Frame padding disabled. Multiple packets.\n");
+
+ // IMPORTANT
+ REMAINDER_TO_EIGHT = LEN_PAYLOAD % 8;
+ if (REMAINDER_TO_EIGHT == 0) {
+ payload = (char*)malloc(LEN_PAYLOAD + LEN_CRC);
+ // nb. It comes in in ASCII
+ for (int i = 0; i < LEN_PAYLOAD; i++)
+ payload[i] = sentence[i] - 48;
+ } else if (REMAINDER_TO_EIGHT > 0) {
+
+ PADDING_TO_EIGHT = 8 - REMAINDER_TO_EIGHT;
+ payload = (char*)malloc(LEN_PAYLOAD + PADDING_TO_EIGHT + LEN_CRC);
+
+ for (int i = 0; i < LEN_PAYLOAD; i++)
+ payload[i] = sentence[i] - 48;
+
+ printf("Detected a payload which is *not* multiple of 8 (%d bits). Padding with "
+ "%d bits to %d\n",
+ LEN_PAYLOAD,
+ PADDING_TO_EIGHT,
+ LEN_PAYLOAD + PADDING_TO_EIGHT);
+ memset(payload + LEN_PAYLOAD, 0x0, PADDING_TO_EIGHT);
+
+ LEN_PAYLOAD += PADDING_TO_EIGHT; // update PAYLOAD LENGHT
+ }
+
+ dump_buffer(payload, LEN_PAYLOAD);
+
+ // crc
+ char crc[16]; // 2 gnuradio bytes of CRC
+ char input_crc[LEN_PAYLOAD];
+ memcpy(input_crc, payload, LEN_PAYLOAD);
+ compute_crc(input_crc, crc, LEN_PAYLOAD);
+ memcpy(payload + LEN_PAYLOAD, crc, LEN_CRC);
+
+ // reverse
+ reverse_bit_order(payload, LEN_PAYLOAD + LEN_CRC);
+
+
+ // clang-format off
+ // B3co>HP00 P ;8 ;56 RD =Is3 w sU kP06 CRC
+ // 010010000011101011110111001110011000100000000000000000 100000 001011001000 001011000101000110 100010010100 001101011001111011000011 111111 111011100101 110011100000000000000110 0011000010001111
+ // clang-format on
+
+ // printf("\nENCODING:\t%s\n", sentence);
+ // printf("LEN_SENTENCE:\t%d\n", LEN_SENTENCE); printf("LEN_PAYLOAD:\t%d\n",
+ // LEN_PAYLOAD); printf("LEN_CRC:\t%d\n", LEN_CRC);
+
+ // // payload encoding
+ // char buffer[6];
+
+ // for (int i=0; i %s \n", strlen(payload), i+1, sentence[i], payload);
+ // }
+
+
+ // // crc
+ // char crc[16]; // 2 gnuradio bytes of CRC
+ // char input_crc[LEN_PAYLOAD];
+ // memcpy (input_crc, payload, LEN_PAYLOAD);
+ // compute_crc (input_crc, crc, LEN_PAYLOAD);
+ // memcpy (payload+LEN_PAYLOAD, crc, LEN_CRC);
+
+ // reverse bits (payload + crc)
+ // reverse_bit_order (payload, LEN_PAYLOAD+LEN_CRC);
+ //// printf("Dump buffer after reverse + crc= ");
+ //// dump_buffer(payload, LEN_PAYLOAD+LEN_CRC);
+
+ // stuffing (payload + crc)
+ if (LEN_PAYLOAD <= 168) {
+
+ char stuffed_payload[LEN_FRAME_MAX];
+ int LEN_STUFFED_PAYLOAD = stuff(payload, stuffed_payload, LEN_PAYLOAD + LEN_CRC);
+
+ //// frame generation /////
+ char frame[LEN_FRAME_MAX];
+ unsigned char byte_frame[LEN_FRAME_MAX / 8]; // PASTA
+ memset(frame, 0x0, LEN_FRAME_MAX);
+
+ // headers
+ memcpy(frame, "\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0", LEN_PREAMBLE);
+ memcpy(frame + LEN_PREAMBLE, "\0\1\1\1\1\1\1\0", LEN_START);
+ // payload + crc
+ memcpy(frame + LEN_PREAMBLE + LEN_START, stuffed_payload, LEN_STUFFED_PAYLOAD);
+ // trailer
+ memcpy(frame + LEN_PREAMBLE + LEN_START + LEN_STUFFED_PAYLOAD,
+ "\0\1\1\1\1\1\1\0",
+ 8);
+
+ // padding
+ int LEN_PADDING =
+ LEN_FRAME_MAX - (LEN_PREAMBLE + LEN_START + LEN_STUFFED_PAYLOAD + LEN_START);
+ memset(frame + LEN_PREAMBLE + LEN_START + LEN_STUFFED_PAYLOAD + LEN_START,
+ 0x0,
+ LEN_PADDING);
+ int len_frame_real = LEN_FRAME_MAX; // 256
+
+ // NRZI Conversion
+ nrz_to_nrzi(frame, len_frame_real);
+ printf("Sent Frame (NRZI enabled) = ");
+
+ dump_buffer(frame, len_frame_real);
+
+ // Binary conversion (to use with GMSK mod's byte_to_symb
+ byte_packing(frame, byte_frame, len_frame_real);
+
+ // output
+ memcpy(out, byte_frame, len_frame_real / 8);
+ noutput_items = len_frame_real / 8;
+
+
+ } else {
+
+ char stuffed_payload[1024];
+ int LEN_STUFFED_PAYLOAD = stuff(payload, stuffed_payload, LEN_PAYLOAD + LEN_CRC);
+
+ //// frame generation /////
+ int LEN_FRAME = LEN_PREAMBLE + LEN_START * 2 + LEN_STUFFED_PAYLOAD;
+ char frame[LEN_FRAME];
+ unsigned char byte_frame[LEN_FRAME / 8]; // PASTA
+ memset(frame, 0x0, LEN_FRAME);
+
+ // headers
+ memcpy(frame, "\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0\1\0", LEN_PREAMBLE);
+ memcpy(frame + LEN_PREAMBLE, "\0\1\1\1\1\1\1\0", LEN_START);
+ // payload + crc
+ memcpy(frame + LEN_PREAMBLE + LEN_START, stuffed_payload, LEN_STUFFED_PAYLOAD);
+ // trailer
+ memcpy(frame + LEN_PREAMBLE + LEN_START + LEN_STUFFED_PAYLOAD,
+ "\0\1\1\1\1\1\1\0",
+ 8);
+
+ int len_frame_real = LEN_FRAME;
+
+ // NRZI Conversion
+ nrz_to_nrzi(frame, len_frame_real);
+ printf("Sent Frame (NRZI enabled) = ");
+
+ dump_buffer(frame, len_frame_real);
+
+ // Binary conversion (to use with GMSK mod's byte_to_symb
+ byte_packing(frame, byte_frame, len_frame_real);
+
+ // output
+ memcpy(out, byte_frame, len_frame_real / 8);
+ noutput_items = len_frame_real / 8;
+ }
+
+ d_repeat_cnt++;
+ // Reset state
+ d_curr_len = 0;
+
+ // return nout;
+
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+
+} /* namespace AISTX */
+} /* namespace gr */
diff --git a/lib/Build_Frame_impl.h b/lib/Build_Frame_impl.h
new file mode 100644
index 0000000..ccb2c45
--- /dev/null
+++ b/lib/Build_Frame_impl.h
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_AISTX_BUILD_FRAME_IMPL_H
+#define INCLUDED_AISTX_BUILD_FRAME_IMPL_H
+
+#include
+
+#define __VERSION 0.3
+
+namespace gr {
+namespace AISTX {
+
+class Build_Frame_impl : public Build_Frame
+{
+private:
+ bool d_repeat;
+ unsigned long d_repeat_cnt;
+ bool d_enable_NRZI;
+ size_t d_itemsize;
+ pmt::pmt_t d_curr_meta;
+ pmt::pmt_t d_curr_vect;
+ size_t d_curr_len;
+
+public:
+ Build_Frame_impl(bool repeat,
+ bool enable_NRZI,
+ const std::string& lengthtagname = "packet_len");
+ ~Build_Frame_impl() override = default;
+
+ void dump_buffer(const char* b, int buffer_size);
+ char* int2bin(int a, char* buffer, int buf_size);
+ int stuff(const char* in, char* out, int l_in);
+ void pack(int orig_ascii, char* ret, int bits_per_byte);
+ void nrz_to_nrzi(char* data, int length);
+ void reverse_bit_order(char* data, int length);
+ unsigned long unpack(char* buffer, int start, int length);
+ void compute_crc(char* buffer, char* ret, unsigned int len);
+ void byte_packing(char* input_frame, unsigned char* out_byte, unsigned int len);
+
+ int calculate_output_stream_length(const gr_vector_int& ninput_items) override;
+
+ // Where all the action really happens
+ int work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) override;
+};
+
+} // namespace AISTX
+} // namespace gr
+
+#endif /* INCLUDED_AISTX_BUILD_FRAME_IMPL_H */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000..d262281
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,95 @@
+# Copyright 2011,2012,2016,2018,2019 Free Software Foundation, Inc.
+#
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup library
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+
+list(APPEND AISTX_sources
+ nrz_to_nrzi_impl.cc
+ Build_Frame_impl.cc
+ DebugME_impl.cc
+)
+
+set(AISTX_sources "${AISTX_sources}" PARENT_SCOPE)
+if(NOT AISTX_sources)
+ MESSAGE(STATUS "No C++ sources... skipping lib/")
+ return()
+endif(NOT AISTX_sources)
+
+add_library(gnuradio-AISTX SHARED ${AISTX_sources})
+target_link_libraries(gnuradio-AISTX gnuradio::gnuradio-runtime)
+target_include_directories(gnuradio-AISTX
+ PUBLIC $
+ PUBLIC $
+ )
+set_target_properties(gnuradio-AISTX PROPERTIES DEFINE_SYMBOL "gnuradio_AISTX_EXPORTS")
+
+if(APPLE)
+ set_target_properties(gnuradio-AISTX PROPERTIES
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+ )
+endif(APPLE)
+
+########################################################################
+# Install built library files
+########################################################################
+include(GrMiscUtils)
+GR_LIBRARY_FOO(gnuradio-AISTX)
+
+########################################################################
+# Print summary
+########################################################################
+message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
+
+########################################################################
+# Build and register unit test
+########################################################################
+if(ENABLE_TESTING)
+ find_package(CppUnit)
+
+ if(NOT CPPUNIT_FOUND)
+ message(FATAL_ERROR "CppUnit required to compile AISTX")
+ endif()
+
+ include(GrTest)
+
+ list(APPEND test_AISTX_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_AISTX.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_AISTX.cc
+ )
+
+ add_executable(test-AISTX ${test_AISTX_sources})
+
+ target_include_directories(test-AISTX
+ PUBLIC ${CPPUNIT_INCLUDE_DIRS}
+ )
+
+ target_link_libraries(
+ test-AISTX
+ ${GNURADIO_RUNTIME_LIBRARIES}
+ ${CPPUNIT_LIBRARIES}
+ gnuradio-AISTX
+ )
+
+ GR_ADD_TEST(test_AISTX test-AISTX)
+endif(ENABLE_TESTING)
diff --git a/lib/DebugME_impl.cc b/lib/DebugME_impl.cc
new file mode 100644
index 0000000..a7365f4
--- /dev/null
+++ b/lib/DebugME_impl.cc
@@ -0,0 +1,87 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "DebugME_impl.h"
+#include
+#include
+
+namespace gr {
+namespace AISTX {
+
+DebugME::sptr DebugME::make(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new DebugME_impl(itemsize));
+}
+
+/*
+ * The private constructor
+ */
+DebugME_impl::DebugME_impl(size_t itemsize)
+ : gr::block("DebugME",
+ gr::io_signature::make(1, 1, itemsize),
+ gr::io_signature::make(0, 0, 0)),
+ d_itemsize(itemsize)
+{
+}
+
+void DebugME_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required)
+{
+ /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
+}
+
+int DebugME_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items)
+{
+
+ // char / byte
+ if (d_itemsize == 1) {
+ const unsigned char* in = (const unsigned char*)input_items[0];
+ for (int i = 0; i < ninput_items[0]; ++i)
+ printf("\\x%.2X", in[i]);
+ }
+ // float
+ else if (d_itemsize == 4) {
+ const float* in = (const float*)input_items[0];
+ for (int i = 0; i < ninput_items[0]; ++i)
+ printf("\\%.0f", in[i]);
+ }
+ // complex
+ else
+ printf("Complexes not supported yet!");
+
+ std::cout << std::endl;
+
+ // Do <+signal processing+>
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+ consume_each(noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return 0;
+}
+
+} /* namespace AISTX */
+} /* namespace gr */
diff --git a/gr-aistx/lib/DebugME_impl.h b/lib/DebugME_impl.h
similarity index 63%
rename from gr-aistx/lib/DebugME_impl.h
rename to lib/DebugME_impl.h
index ae973cb..29ac581 100644
--- a/gr-aistx/lib/DebugME_impl.h
+++ b/lib/DebugME_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
+ *
* This 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.
- *
+ *
* This software 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 this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -24,28 +24,27 @@
#include
namespace gr {
- namespace AISTX {
+namespace AISTX {
- class DebugME_impl : public DebugME
- {
- private:
- size_t d_itemsize;
+class DebugME_impl : public DebugME
+{
+private:
+ size_t d_itemsize;
- public:
- DebugME_impl(size_t itemsize);
- ~DebugME_impl();
+public:
+ DebugME_impl(size_t itemsize);
+ ~DebugME_impl() override = default;
- // Where all the action really happens
- void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+ // Where all the action really happens
+ void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) override;
+};
- } // namespace AISTX
+} // namespace AISTX
} // namespace gr
#endif /* INCLUDED_AISTX_DEBUGME_IMPL_H */
-
diff --git a/lib/nrz_to_nrzi_impl.cc b/lib/nrz_to_nrzi_impl.cc
new file mode 100644
index 0000000..9b01f65
--- /dev/null
+++ b/lib/nrz_to_nrzi_impl.cc
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "nrz_to_nrzi_impl.h"
+#include
+#include
+
+namespace gr {
+namespace AISTX {
+
+nrz_to_nrzi::sptr nrz_to_nrzi::make()
+{
+ return gnuradio::get_initial_sptr(new nrz_to_nrzi_impl());
+}
+
+/*
+ * The private constructor
+ */
+nrz_to_nrzi_impl::nrz_to_nrzi_impl()
+ : gr::block("nrz_to_nrzi",
+ gr::io_signature::make(1, 1, sizeof(unsigned char)),
+ gr::io_signature::make(1, 1, sizeof(unsigned char)))
+{
+}
+
+void nrz_to_nrzi_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required)
+{
+ /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */
+}
+
+int nrz_to_nrzi_impl::general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items)
+{
+ const unsigned char* in = (const unsigned char*)input_items[0];
+ unsigned char* out = (unsigned char*)output_items[0];
+ unsigned char nrzi_bit;
+ unsigned char nrz_bit;
+ unsigned char d_prev_nrzi_bit = 0;
+
+ for (int i = 0; i < noutput_items; ++i)
+ printf("%d", in[i]);
+ printf("\n");
+
+ for (int i = 0; i < noutput_items; i++) {
+ nrz_bit = in[i];
+
+ if (nrz_bit == 0) {
+ nrzi_bit = d_prev_nrzi_bit ^ 1;
+ } else {
+ nrzi_bit = d_prev_nrzi_bit;
+ }
+ out[i] = nrzi_bit;
+ d_prev_nrzi_bit = nrzi_bit;
+ }
+
+ for (int i = 0; i < noutput_items; ++i)
+ printf("%d", out[i]);
+ printf("\n");
+
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+ consume_each(noutput_items);
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+
+} /* namespace AISTX */
+} /* namespace gr */
diff --git a/gr-aistx/lib/nrz_to_nrzi_impl.h b/lib/nrz_to_nrzi_impl.h
similarity index 63%
rename from gr-aistx/lib/nrz_to_nrzi_impl.h
rename to lib/nrz_to_nrzi_impl.h
index 6484f53..6382972 100644
--- a/gr-aistx/lib/nrz_to_nrzi_impl.h
+++ b/lib/nrz_to_nrzi_impl.h
@@ -1,17 +1,17 @@
/* -*- c++ -*- */
-/*
+/*
* Copyright 2013 <+YOU OR YOUR COMPANY+>.
- *
+ *
* This 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.
- *
+ *
* This software 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 this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -24,28 +24,27 @@
#include
namespace gr {
- namespace AISTX {
+namespace AISTX {
- class nrz_to_nrzi_impl : public nrz_to_nrzi
- {
- private:
- // Nothing to declare in this block.
+class nrz_to_nrzi_impl : public nrz_to_nrzi
+{
+private:
+ // Nothing to declare in this block.
- public:
- nrz_to_nrzi_impl();
- ~nrz_to_nrzi_impl();
+public:
+ nrz_to_nrzi_impl();
+ ~nrz_to_nrzi_impl() override = default;
- // Where all the action really happens
- void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+ // Where all the action really happens
+ void forecast(int noutput_items, gr_vector_int& ninput_items_required) override;
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- };
+ int general_work(int noutput_items,
+ gr_vector_int& ninput_items,
+ gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items) override;
+};
- } // namespace AISTX
+} // namespace AISTX
} // namespace gr
#endif /* INCLUDED_AISTX_NRZ_TO_NRZI_IMPL_H */
-
diff --git a/gr-aistx/lib/qa_AISTX.cc b/lib/qa_AISTX.cc
similarity index 89%
rename from gr-aistx/lib/qa_AISTX.cc
rename to lib/qa_AISTX.cc
index 1a101f1..c5b3aa2 100644
--- a/gr-aistx/lib/qa_AISTX.cc
+++ b/lib/qa_AISTX.cc
@@ -27,10 +27,9 @@
#include "qa_AISTX.h"
-CppUnit::TestSuite *
-qa_AISTX::suite()
+CppUnit::TestSuite* qa_AISTX::suite()
{
- CppUnit::TestSuite *s = new CppUnit::TestSuite("AISTX");
+ CppUnit::TestSuite* s = new CppUnit::TestSuite("AISTX");
- return s;
+ return s;
}
diff --git a/gr-aistx/lib/qa_AISTX.h b/lib/qa_AISTX.h
similarity index 90%
rename from gr-aistx/lib/qa_AISTX.h
rename to lib/qa_AISTX.h
index 8d23882..ba4270a 100644
--- a/gr-aistx/lib/qa_AISTX.h
+++ b/lib/qa_AISTX.h
@@ -30,9 +30,9 @@
class __GR_ATTR_EXPORT qa_AISTX
{
- public:
- //! return suite of tests for all of gr-filter directory
- static CppUnit::TestSuite *suite();
+public:
+ //! return suite of tests for all of gr-filter directory
+ static CppUnit::TestSuite* suite();
};
#endif /* _QA_AISTX_H_ */
diff --git a/gr-aistx/lib/test_AISTX.cc b/lib/test_AISTX.cc
similarity index 71%
rename from gr-aistx/lib/test_AISTX.cc
rename to lib/test_AISTX.cc
index 0546257..a4ff5d4 100644
--- a/gr-aistx/lib/test_AISTX.cc
+++ b/lib/test_AISTX.cc
@@ -23,21 +23,20 @@
#include
#include
-#include
#include "qa_AISTX.h"
+#include
#include
-int
-main (int argc, char **argv)
+int main(int argc, char** argv)
{
- CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(get_unittest_path("AISTX.xml").c_str());
- CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("AISTX.xml").c_str());
+ CppUnit::XmlOutputter* xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
- runner.addTest(qa_AISTX::suite());
- runner.setOutputter(xmlout);
+ runner.addTest(qa_AISTX::suite());
+ runner.setOutputter(xmlout);
- bool was_successful = runner.run("", false);
+ bool was_successful = runner.run("", false);
- return was_successful ? 0 : 1;
+ return was_successful ? 0 : 1;
}
diff --git a/gr-aistx/python/CMakeLists.txt b/python/CMakeLists.txt
similarity index 71%
rename from gr-aistx/python/CMakeLists.txt
rename to python/CMakeLists.txt
index b79d4bf..fd3b1ad 100644
--- a/gr-aistx/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -1,6 +1,7 @@
# Copyright 2011 Free Software Foundation, Inc.
#
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-AISTX
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,10 +38,12 @@ GR_PYTHON_INSTALL(
########################################################################
# Handle the unit tests
########################################################################
-include(GrTest)
+if(ENABLE_TESTING)
+ include(GrTest)
-set(GR_TEST_TARGET_DEPS gnuradio-AISTX)
-set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
-GR_ADD_TEST(qa_nrz_to_nrzi ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_nrz_to_nrzi.py)
-GR_ADD_TEST(qa_Build_Frame ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_Build_Frame.py)
-GR_ADD_TEST(qa_DebugME ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_DebugME.py)
+ set(GR_TEST_TARGET_DEPS gnuradio-AISTX)
+ set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
+ GR_ADD_TEST(qa_nrz_to_nrzi ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_nrz_to_nrzi.py)
+ GR_ADD_TEST(qa_Build_Frame ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_Build_Frame.py)
+ GR_ADD_TEST(qa_DebugME ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_DebugME.py)
+endif(ENABLE_TESTING)
diff --git a/gr-aistx/python/__init__.py b/python/__init__.py
similarity index 55%
rename from gr-aistx/python/__init__.py
rename to python/__init__.py
index c1d8e3f..46f0e46 100644
--- a/gr-aistx/python/__init__.py
+++ b/python/__init__.py
@@ -23,32 +23,13 @@
description here (python/__init__.py).
'''
-# ----------------------------------------------------------------
-# Temporary workaround for ticket:181 (swig+python problem)
-import sys
-_RTLD_GLOBAL = 0
+# import swig generated symbols into the satellites namespace
+# this would fail if we are being imported from the build dir
try:
- from dl import RTLD_GLOBAL as _RTLD_GLOBAL
+ from .AISTX_swig import *
except ImportError:
- try:
- from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
- except ImportError:
- pass
-
-if _RTLD_GLOBAL != 0:
- _dlopenflags = sys.getdlopenflags()
- sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
-# ----------------------------------------------------------------
-
-
-# import swig generated symbols into the AISTX namespace
-from AISTX_swig import *
+ from AISTX_swig import *
# import any pure python here
#
-# ----------------------------------------------------------------
-# Tail of workaround
-if _RTLD_GLOBAL != 0:
- sys.setdlopenflags(_dlopenflags) # Restore original flags
-# ----------------------------------------------------------------
diff --git a/gr-aistx/python/qa_Build_Frame.py b/python/qa_Build_Frame.py
similarity index 100%
rename from gr-aistx/python/qa_Build_Frame.py
rename to python/qa_Build_Frame.py
diff --git a/gr-aistx/python/qa_DebugME.py b/python/qa_DebugME.py
similarity index 100%
rename from gr-aistx/python/qa_DebugME.py
rename to python/qa_DebugME.py
diff --git a/gr-aistx/python/qa_nrz_to_nrzi.py b/python/qa_nrz_to_nrzi.py
similarity index 100%
rename from gr-aistx/python/qa_nrz_to_nrzi.py
rename to python/qa_nrz_to_nrzi.py
diff --git a/gr-aistx/swig/AISTX_swig.i b/swig/AISTX_swig.i
similarity index 100%
rename from gr-aistx/swig/AISTX_swig.i
rename to swig/AISTX_swig.i
diff --git a/gr-aistx/swig/CMakeLists.txt b/swig/CMakeLists.txt
similarity index 79%
rename from gr-aistx/swig/CMakeLists.txt
rename to swig/CMakeLists.txt
index 0a80154..2da2d31 100644
--- a/gr-aistx/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -18,24 +18,29 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Include swig generation macros
+# Check if there is C++ code at all
########################################################################
-find_package(SWIG)
-find_package(PythonLibs)
-if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
+if(NOT AISTX_sources)
+ MESSAGE(STATUS "No C++ sources... skipping swig/")
return()
-endif()
+endif(NOT AISTX_sources)
+
+########################################################################
+# Include swig generation macros
+########################################################################
+find_package(SWIG REQUIRED)
+find_package(PythonLibs REQUIRED)
include(GrSwig)
include(GrPython)
########################################################################
# Setup swig generation
########################################################################
-foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
- list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
-endforeach(incdir)
+set(GR_SWIG_INCLUDE_DIRS $)
+set(GR_SWIG_TARGET_DEPS gnuradio::runtime_swig)
set(GR_SWIG_LIBRARIES gnuradio-AISTX)
+
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/AISTX_swig_doc.i)
set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
diff --git a/unpacker.c b/unpacker.c
deleted file mode 100644
index 9d0e14b..0000000
--- a/unpacker.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-
-This source code is part of the AIS BlackToolkit.
-Unpacker.c allows you to build a NMEA sentece out of its payload. Normally used in combination with AIVDM_Encoder.
-
-Copyright 2013-2014 -- Embyte & Pastus
-
-This program 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 2
-of the License, or (at your option) any later version.
-
-Usage example:
-$ ./AIVDM_Encoder.py --type=1 --vsize=30x10 | xargs -IA ./unpacker A 1 A
-
-*/
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-unsigned long unpack(char *buffer, int start, int length)
-{
- unsigned long ret = 0;
- for(int i = start; i < (start+length); i++) {
- ret <<= 1;
- ret |= (buffer[i] & 0x01);
- }
- return ret;
-}
-
-char nmea_checksum(std::string buffer)
-{
- unsigned int i = 0;
- char sum = 0x00;
- if(buffer[0] == '!') i++;
- for(; i < buffer.length(); i++) sum ^= buffer[i];
- return sum;
-}
-
-
-int main(int argc, char *argv[]) {
-
-
- if (argc<4) {
- std::cout << "\nUsage: ./unpacker binary_string enable_nmea channel\n";
- std::cout << "\nenable_nmea = 1 for full NMEA sentence, otherwise only payload is printed\n";
- std::cout << "channel = A/B\n\n";
- return 0;
- }
-
- int i;
- char asciidata[255];
-
- int len = strlen(argv[1]);
-
- int enable_nmea = (int) *argv[2] - 48;
- char channel = *argv[3];
- std::ostringstream d_payload;
- d_payload.str("");
-
- for(i = 0; i < len/6; i++) {
- asciidata[i] = unpack(argv[1], i*6, 6);
- if(asciidata[i] > 39) asciidata[i] += 8;
- asciidata[i] += 48;
- }
-
- if (enable_nmea)
- d_payload << "!AIVDM,1,1,," << channel << ",";
-
- for(int i = 0; i < len/6; i++)
- d_payload << asciidata[i];
-
- if (enable_nmea) {
- d_payload << ",0"; //number of bits to fill out 6-bit boundary
- char checksum = nmea_checksum(std::string(d_payload.str()));
- d_payload << "*" << std::setw(2) << std::setfill('0') << std::hex << std::uppercase << int(checksum);
- }
-
- std::cout << std::string(d_payload.str()) << std::endl;
- return 1;
-}