fix build chain

This commit is contained in:
Christoph Honal 2020-02-12 06:02:06 +01:00
parent f1972406d2
commit 32b54f4eb4
20 changed files with 781 additions and 21 deletions

View File

@ -1,2 +1,3 @@
scripts/
config/
config/
data/

3
.gitignore vendored
View File

@ -1 +1,2 @@
.env
.env
data/

View File

@ -1,4 +1,4 @@
# Secure temp download stage
# Private temp download stage
FROM ubuntu:18.04 as intermediate
ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin
@ -23,8 +23,11 @@ ARG PROP_DIR_SDR
ARG PROP_DIR_DECODER
WORKDIR /app
RUN git clone https://github.com/MOVE-II/move2radio.git && \
cd move2radio && git checkout 6fcbae73359b0618312d222148aba07799a43a47 && git reset --hard && cd .. && \
git clone git@${PROP_SERVER}:${PROP_DIR_SDR}/ldpc.git move2radio-prop/ldpc && \
git clone git@${PROP_SERVER}:${PROP_DIR_SDR}/gr-ccsds.git move2radio-prop/gr-ccsds
cd move2radio-prop/ldpc && git checkout 940e8f96ccae831c7d3ad6b9497710696cd7f324 && git reset --hard && cd ../.. && \
git clone git@${PROP_SERVER}:${PROP_DIR_SDR}/gr-ccsds.git move2radio-prop/gr-ccsds && \
cd move2radio-prop/gr-ccsds && git checkout 5777e4176fe381327fe6cf55b7ec0dfe3c63b3f6 && git reset --hard && cd ../..
# Build stage
FROM ubuntu:18.04
@ -32,7 +35,10 @@ ENV DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin
# Setup build deps
RUN apt-get update && \
apt-get -y install build-essential git cmake python2.7 python-pip wget autoconf unzip libtool-bin pkgconf && \
apt-get -y install build-essential git cmake autoconf unzip libtool-bin pkgconf libssl-dev \
python2.7 python-pip python-mako socat libcppunit-dev swig uuid-dev \
python-mako python-numpy python-wxgtk3.0 python-sphinx python-cheetah libzmq3-dev \
libcomedi-dev libqt4-opengl-dev python-qt4 libqwt-dev libsdl1.2-dev python-gtk2 python-lxml python-sip-dev && \
rm -rf /var/lib/apt/lists/*
# Copy sources from download stage
@ -40,8 +46,19 @@ COPY --from=intermediate /app /app
# Build sources
WORKDIR /app/move2radio
COPY build/CMakeLists.txt /app/move2radio/CMakeLists.txt
RUN mkdir build && cd build && \
cmake -DAPPIMAGE=OFF -DLDPC_OFFLINE=ON -DGR_CCSDS_OFFLINE=ON -DOFFLINE_DEPENDENCY_PATH=/app/move2radio-prop .. && \
make build_gr_ccsds
cmake -DAPPIMAGE=OFF -DCONDA_ENV=OFF -DLDPC_OFFLINE=ON -DGR_CCSDS_OFFLINE=ON -DOFFLINE_DEPENDENCY_PATH=/app/move2radio-prop .. && \
make move2radio
ENTRYPOINT ["/bin/bash"]
# Install binaries
COPY build/blocks/* /app/move2radio/build/prefix/usr/share/gnuradio/grc/blocks/
RUN chmod 644 /app/move2radio/build/prefix/usr/share/gnuradio/grc/blocks/*.xml && \
cp -a build/prefix/usr/. /usr/ && \
ldconfig
# Entrypoint
COPY build/fakeserver/* /app/fakeserver/
COPY build/run.sh /app/run.sh
RUN chmod +x /app/run.sh
ENTRYPOINT ["/app/run.sh"]

166
build/CMakeLists.txt Normal file
View File

@ -0,0 +1,166 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(move2radio
LANGUAGES C
DESCRIPTION "Portable Version of the MOVE-II groundstation")
INCLUDE(ExternalProject)
IF(UNIX AND NOT APPLE)
SET(LINUX TRUE)
ENDIF()
INCLUDE(cmake/options.cmake)
INCLUDE(cmake/system_deps.cmake)
INCLUDE(cmake/build_autotools.cmake)
INCLUDE(cmake/build_cmake.cmake)
INCLUDE(cmake/build_meson.cmake)
SET(DEPS_PATH "${CMAKE_CURRENT_BINARY_DIR}/deps")
SET(BUILD_PATH "${CMAKE_CURRENT_BINARY_DIR}/build")
SET(PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/prefix")
FILE(MAKE_DIRECTORY ${DEPS_PATH}/src)
SET(ENV{PKG_CONFIG_PATH} ${PREFIX_PATH}/usr/lib/pkgconfig)
SET(PKG_CONFIG_PATH ENV{PKG_CONFIG_PATH})
## Custom target deps makes sure all sources are there
ADD_CUSTOM_TARGET(deps)
IF(NOT ${NO_DOWNLOAD})
ADD_CUSTOM_TARGET(download)
ADD_DEPENDENCIES(deps download)
ENDIF()
## move2deps.cmake contains all sources
INCLUDE(cmake/dependency.cmake)
INCLUDE(cmake/move2deps.cmake)
ADD_CUSTOM_TARGET(delete_prefix
${CMAKE_COMMAND} -E remove_directory ${PREFIX_PATH})
ADD_CUSTOM_TARGET(prefix
${CMAKE_COMMAND} -E make_directory ${PREFIX_PATH}/usr/share
COMMAND echo \"CFLAGS=-I${PREFIX_PATH}/usr/include\\nLDFLAGS=\\\"-L${PREFIX_PATH}/usr/lib -Wl,-rpath=${PREFIX_PATH}/usr/lib\\\"\\n\" > ${PREFIX_PATH}/config.site
COMMAND rm -f ${PREFIX_PATH}/usr/lib/libuuid.*
COMMAND find / -not -path \"${CMAKE_CURRENT_BINARY_DIR}/*\" -name \"libuuid*.so*\" -exec ln -sf {} ${PREFIX_PATH}/usr/lib/libuuid.so \\\\; 2>/dev/null || [ -e ${PREFIX_PATH}/usr/lib/libuuid.so ])
### Anaconda deploys a portable python + pygtk,numpy,pyqt ###
INCLUDE(cmake/anaconda.cmake)
INCLUDE(ProcessorCount)
PROCESSORCOUNT(N)
FIND_PROGRAM(MAKE make)
FIND_PROGRAM(MESON meson)
FIND_PROGRAM(NINJA ninja)
### Build all sources ###
# Boost and ldpc Build is more complicated. Moved to own file
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/ldpc.cmake)
MOVEII_BUILD_AUTOTOOLS(fftw EXTRA_OPTIONS --enable-threads --enable-float)
MOVEII_BUILD_AUTOTOOLS(gsl)
MOVEII_BUILD_AUTOTOOLS(libiconv)
MOVEII_BUILD_AUTOTOOLS(rtl-sdr)
MOVEII_BUILD_AUTOTOOLS(gmp)
MOVEII_BUILD_AUTOTOOLS(rxvt-unicode EXTRA_OPTIONS --disable-perl --enable-xft CONFIG_SITE ON)
MOVEII_BUILD_AUTOTOOLS(ntl NO_DEFAULT ON SOURCE_SUFFIX "/src" COPY_SOURCE ON
EXTRA_OPTIONS NTL_GMP_LIP=on SHARED=on NATIVE=off DEF_PREFIX=${PREFIX_PATH}/usr)
MOVEII_BUILD_AUTOTOOLS(ncurses)
MOVEII_BUILD_CMAKE(airspy)
MOVEII_BUILD_CMAKE(gr-osmosdr)
MOVEII_BUILD_CMAKE(curl EXTRA_OPTIONS -DCMAKE_USE_OPENSSL=ON)
MOVEII_BUILD_CMAKE(curlpp)
MOVEII_BUILD_CMAKE(gr-ccsds)
MOVEII_BUILD_CMAKE(gr-iqbal)
MOVEII_BUILD_CMAKE(libosmosdr)
MOVEII_BUILD_CMAKE(bladerf EXTRA_OPTIONS -DINSTALL_UDEV_RULES=OFF)
MOVEII_BUILD_CMAKE(libmirisdr)
MOVEII_BUILD_CMAKE(soapysdr)
MOVEII_BUILD_CMAKE(hackrf SOURCE_SUFFIX "/host/")
MOVEII_BUILD_CMAKE(gr-fcdproplus)
MOVEII_BUILD_CMAKE(freesrp)
MOVEII_BUILD_CMAKE(libuhd EXTRA_OPTIONS -DENABLE_E100=ON -DENABLE_E300=ON -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF -DENABLE_UTILS=OFF SOURCE_SUFFIX "/host")
MOVEII_BUILD_CMAKE(gnuradio EXTRA_OPTIONS
-DENABLE_INTERNAL_VOLK=ON
-DENABLE_DEFAULT=OFF
-DENABLE_VOLK=ON
-DENABLE_GNURADIO_RUNTIME=ON
-DENABLE_PYTHON=ON
-DENABLE_GR_AUDIO=ON
-DENABLE_GR_BLOCKS=ON
-DENABLE_GR_FILTER=ON
-DENABLE_GR_FFT=ON
-DENABLE_GR_UHD=OFF
-DENABLE_GR_FCD=OFF
-DENABLE_GR_ANALOG=ON
-DENABLE_GR_WAVELET=ON
-DENABLE_GRC=ON
-DENABLE_GR_QTGUI=ON
-DENABLE_GR_DIGITAL=ON)
ADD_DEPENDENCIES(build_gnuradio build_boost build_gsl build_fftw build_libiconv)
MOVEII_BUILD_AUTOTOOLS(fec NO_AUTORECONF ON NO_INSTALL ON)
## fec is to dumb to properly install:
ADD_CUSTOM_COMMAND(OUTPUT ${PREFIX_PATH}/usr/lib/libfec.so
COMMAND ${CMAKE_COMMAND} -E copy ${FEC_SOURCE}/fec.h ${PREFIX_PATH}/usr/include/fec.h
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_PATH}/fec/libfec.a ${PREFIX_PATH}/usr/lib/libfec.a
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_PATH}/fec/libfec.so ${PREFIX_PATH}/usr/lib/libfec.so
DEPENDS build_fec
)
ADD_CUSTOM_TARGET(install_fec
DEPENDS ${PREFIX_PATH}/usr/lib/libfec.so)
## Get the dependencies between the sources right:
ADD_DEPENDENCIES(build_gr_osmosdr build_gnuradio)
ADD_DEPENDENCIES(build_ntl build_gmp)
ADD_DEPENDENCIES(build_curlpp build_curl)
ADD_DEPENDENCIES(install_fec prefix)
ADD_DEPENDENCIES(build_gr_ccsds install_fec build_gnuradio build_ldpc build_curlpp)
ADD_DEPENDENCIES(build_gr_fcdproplus build_gnuradio)
ADD_CUSTOM_TARGET(move2radio)
ADD_DEPENDENCIES(move2radio build_gr_ccsds build_gr_osmosdr)
ADD_DEPENDENCIES(build_libuhd build_boost build_ncurses)
ADD_DEPENDENCIES(build_hackrf build_fftw)
ADD_DEPENDENCIES(build_freesrp build_boost)
ADD_DEPENDENCIES(build_rxvt_unicode build_ncurses)
IF(APPIMAGE)
ADD_EXECUTABLE(AppRun AppDir/AppRun.c)
SET(APPDIR ${CMAKE_CURRENT_BINARY_DIR}/AppDir)
FILE(MAKE_DIRECTORY ${APPDIR})
IF(EXISTS ${APPDIR})
FILE(REMOVE_RECURSE ${APPDIR})
ENDIF()
ADD_CUSTOM_COMMAND(OUTPUT ${APPDIR}/AppRun
COMMAND cp -r ${PREFIX_PATH} ${APPDIR}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APPDIR}/usr/include
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APPDIR}/usr/pkgs
COMMAND ${CMAKE_COMMAND} -E remove_directory ${APPDIR}/usr/ssl
COMMAND rm -rf ${APPDIR}/usr/lib/libuuid.so*
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/AppDir ${APPDIR}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/AppRun ${APPDIR}/AppRun
DEPENDS AppRun move2radio build_rxvt_unicode)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/AppRun
COMMAND chmod +x ${DEPS_PATH}/src/appimagetool-x86_64.AppImage
COMMAND ${DEPS_PATH}/src/appimagetool-x86_64.AppImage --appimage-extract
DEPENDS appimagetool)
ADD_CUSTOM_TARGET(appimagetool_extract
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/AppRun)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Gnuradio_Companion-x86_64.AppImage
COMMAND env ARCH=x86_64 ${CMAKE_CURRENT_BINARY_DIR}/squashfs-root/AppRun ${APPDIR}
DEPENDS appimagetool_extract ${APPDIR}/AppRun)
ADD_CUSTOM_TARGET(appimage_build
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Gnuradio_Companion-x86_64.AppImage)
ADD_DEPENDENCIES(appimage appimage_build)
ENDIF()

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<block>
<name>LDPC Decoder (CCSDS)</name>
<key>ccsds_ldpc_decoder</key>
<category>CCSDS/Channelcoding</category>
<import>import ccsds</import>
<make>ccsds.ldpc_decoder($par_file, $systype.fcn, $puncttype.fcn, $num_punct, tuple($punct_pos))</make>
<param>
<name>Paritycheck matrix</name>
<key>par_file</key>
<type>file_open</type>
</param>
<param>
<name>Systematic</name>
<key>systype</key>
<value>ccsds.LDPC_SYS_FRONT</value>
<type>enum</type>
<option>
<name>None</name>
<key>sys_none</key>
<opt>fcn:ccsds.LDPC_SYS_NONE</opt>
</option>
<option>
<name>Front</name>
<key>sys_front</key>
<opt>fcn:ccsds.LDPC_SYS_FRONT</opt>
</option>
<option>
<name>Back</name>
<key>sys_back</key>
<opt>fcn:ccsds.LDPC_SYS_BACK</opt>
</option>
</param>
<param>
<name>Puncturing position</name>
<key>puncttype</key>
<value>ccsds.LDPC_PUNCT_NONE</value>
<type>enum</type>
<option>
<name>None</name>
<key>punct_none</key>
<opt>fcn:ccsds.LDPC_PUNCT_NONE</opt>
</option>
<option>
<name>Front</name>
<key>punct_front</key>
<opt>fcn:ccsds.LDPC_PUNCT_FRONT</opt>
</option>
<option>
<name>Back</name>
<key>punct_back</key>
<opt>fcn:ccsds.LDPC_PUNCT_BACK</opt>
</option>
<option>
<name>Custom</name>
<key>punct_custom</key>
<opt>fcn:ccsds.LDPC_PUNCT_CUSTOM</opt>
</option>
</param>
<param>
<name>Number of punctures</name>
<key>num_punct</key>
<value>0</value>
<type>int</type>
</param>
<param>
<name>Custom puncturing positions</name>
<key>punct_pos</key>
<value>[]</value>
<type>int_vector</type>
</param>
<check>$num_punct >= 0</check>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
</block>

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<block>
<name>LDPC Encoder (CCSDS)</name>
<key>ccsds_ldpc_encoder</key>
<category>CCSDS/Channelcoding</category>
<import>import ccsds</import>
<make>ccsds.ldpc_encoder($gen_file, $systype.fcn, $puncttype.fcn, $num_punct, tuple($punct_pos))</make>
<param>
<name>Generator matrix</name>
<key>gen_file</key>
<type>file_open</type>
</param>
<param>
<name>Systematic</name>
<key>systype</key>
<value>ccsds.LDPC_SYS_FRONT</value>
<type>enum</type>
<option>
<name>None</name>
<key>sys_none</key>
<opt>fcn:ccsds.LDPC_SYS_NONE</opt>
</option>
<option>
<name>Front</name>
<key>sys_front</key>
<opt>fcn:ccsds.LDPC_SYS_FRONT</opt>
</option>
<option>
<name>Back</name>
<key>sys_back</key>
<opt>fcn:ccsds.LDPC_SYS_BACK</opt>
</option>
</param>
<param>
<name>Puncturing position</name>
<key>puncttype</key>
<value>ccsds.LDPC_PUNCT_NONE</value>
<type>enum</type>
<option>
<name>None</name>
<key>punct_none</key>
<opt>fcn:ccsds.LDPC_PUNCT_NONE</opt>
</option>
<option>
<name>Front</name>
<key>punct_front</key>
<opt>fcn:ccsds.LDPC_PUNCT_FRONT</opt>
</option>
<option>
<name>Back</name>
<key>punct_back</key>
<opt>fcn:ccsds.LDPC_PUNCT_BACK</opt>
</option>
<option>
<name>Custom</name>
<key>punct_custom</key>
<opt>fcn:ccsds.LDPC_PUNCT_CUSTOM</opt>
</option>
</param>
<param>
<name>Number of punctures</name>
<key>num_punct</key>
<value>0</value>
<type>int</type>
</param>
<param>
<name>Custom puncturing positions</name>
<key>punct_pos</key>
<value>[]</value>
<type>int_vector</type>
</param>
<check>$num_punct >= 0</check>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
</block>

View File

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<block>
<name>message_info</name>
<key>ccsds_message_info</key>
<category>[ccsds]</category>
<import>import ccsds</import>
<make>ccsds.message_info($prefix, $mode)</make>
<param>
<name>Prefix</name>
<key>prefix</key>
<value>"Message info: "</value>
</param>
<param>
<name>Mode</name>
<key>mode</key>
<value>10</value>
<type>enum</type>
<option>
<name>Silent</name>
<key>0</key>
<opt>fcn:0</opt>
</option>
<option>
<name>Compact</name>
<key>10</key>
<opt>fcn:10</opt>
</option>
<option>
<name>Full</name>
<key>20</key>
<opt>fcn:20</opt>
</option>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<doc>
Print out messages with a timestamp.
Prefix: String that will be written before the data line(s)
Modes:
- Silent: Do not write anything
- Compact: Write one line summary of the message
- Full: Write full content of the message
</doc>
</block>

View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<block>
<name>Output rate counter</name>
<key>ccsds_output_counter_cc</key>
<category>[ccsds]</category>
<import>import ccsds</import>
<make>ccsds.output_counter_cc($block_length)</make>
<param>
<name>Block size</name>
<key>block_length</key>
<value>1024</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>complex</type>
</sink>
<source>
<name>in_cpy</name>
<type>complex</type>
<optional>1</optional>
</source>
<source>
<name>out</name>
<type>message</type>
<optional>1</optional>
</source>
<doc>
Copies the input complex intput to the (optional) output.
Counts the number of copied samples and emits a "block_out" message everytime 'Block size' samples have been copied.
This block is intendet to enable limiting the number of samples queueing up before a transmitter. So far the only block capable of using this messages is the udp_source_rate_idle block.
</doc>
</block>

View File

@ -0,0 +1,56 @@
<?xml version="1.0"?>
<block>
<name>Pseudo (De)randomiser with Softbits (CCSDS)</name>
<key>ccsds_randomiser_softbits</key>
<category>CCSDS/Telemetry</category>
<import>import ccsds</import>
<make>ccsds.randomiser_softbits($poly,$seed)</make>
<param>
<name>Generating Polynimoal</name>
<key>poly</key>
<value>0x95</value>
<type>int</type>
</param>
<param>
<name>Seed</name>
<key>seed</key>
<value>0xFF</value>
<type>int</type>
</param>
<check>$poly >= 0</check>
<check>$poly &lt; 256</check>
<check>$seed >= 0</check>
<check>$seed &lt; 256</check>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
<doc>
Pseudo (De)randomiser
Combines the input frame with a pseudo random sequence by XOR operation. A one
in the PRN sequence will invert the softbit, a zero will copy it untouched. The
pseudo random sequence is generated by an 8-bit linear feedback shift register
(LFSR) as defined in ECSS.
The pseudo random sequence can be modified by the generating polygon as well as
shifted by choosing a different initial seed state.
poly: Polynomial that defines the network of the 8 shift registers. The MSB
encodes whether the last shift register (which is used for the output) should be
used to generate the new input while the LSB encodes whether the first shift
register (that holds the input bit of the last step should be used to generate
the output. Or in ECSS definition: The MSB holds the coefficient for x^0 up to
the LSB which holds coefficient x^7. x^8 is not encoded as it is always set (due
to the fact that this is a maximum length 8 bit shift register). The default
value is 0x95 which corresponds to the randomiser defined in ECSS with the
polynomial representation x^8+x^7+x^5+x^3+x^0.
seed: Initial state of the shift registers. MSB corresponds to the last register
(which will be the output on the next step). Default to all ones as defined in
ECSS.
</doc>
</block>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<block>
<name>Send Nanolink Frames to REST</name>
<key>ccsds_send_nanolink</key>
<category>[ccsds]</category>
<import>import ccsds</import>
<make>ccsds.send_nanolink($url)</make>
<param>
<name>Url</name>
<key>url</key>
<value>"localhost:8082"</value>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
</block>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<block>
<name>Softbit PDU to Hardbyte PDU</name>
<key>ccsds_soft_to_hard_message</key>
<category>[ccsds]/Conversion</category>
<import>import ccsds</import>
<make>ccsds.soft_to_hard_message()</make>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
<doc>Convert PDU with softbit payload to PDU with hardbits (compacted to bytes) payload.</doc>
</block>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<block>
<name>Softbit Message Sink</name>
<key>ccsds_softbit_msg_sink_f</key>
<category>CCSDS/Conversion</category>
<import>import ccsds</import>
<make>ccsds.softbit_msg_sink_f($frame_len)</make>
<param>
<name>Frame length</name>
<key>frame_len</key>
<value>40</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>float</type>
</sink>
<source>
<name>out</name>
<type>message</type>
</source>
<doc>
Softbit message sink
Copies portions of Frame length softbits from the input stream to a softbit message.
Frame length: Length of a frame in (soft)bits.
</doc>
</block>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<block>
<name>Softbit Message Source</name>
<key>ccsds_softbit_msg_source_f</key>
<category>CCSDS/Conversion</category>
<import>import ccsds</import>
<make>ccsds.softbit_msg_source_f($frame_len)</make>
<param>
<name>Frame length</name>
<key>frame_len</key>
<value>40</value>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>float</type>
</source>
<doc>
Softbit message source
Copies the floats contained in the incomming Softbit messages to the output stream.
Frame length: Length of a frame in (soft)bits.
</doc>
</block>

View File

@ -0,0 +1,100 @@
<?xml version="1.0"?>
<block>
<name>Rate controled UDP source with idle frames</name>
<key>ccsds_udp_source_rate_idle_b</key>
<category>[ccsds]</category>
<throttle>1</throttle>
<import>import ccsds</import>
<make>ccsds.udp_source_rate_idle_b($host_recv, $port_recv, $host_ctl, $port_ctl, $max_frame_length, $block_len, $num_blocks_floating, $idle_pattern)</make>
<param>
<name>Hostname (data)</name>
<key>host_recv</key>
<value>'localhost'</value>
<type>string</type>
</param>
<param>
<name>Port (data)</name>
<key>port_recv</key>
<type>int</type>
</param>
<param>
<name>Hostname (control)</name>
<key>host_ctl</key>
<value>'localhost'</value>
<type>string</type>
</param>
<param>
<name>Port (control)</name>
<key>port_ctl</key>
<type>int</type>
</param>
<param>
<name>Max Frame length (Bytes)</name>
<key>max_frame_length</key>
<value>1024</value>
<type>int</type>
</param>
<param>
<name>Block size (Bytes)</name>
<key>block_len</key>
<value>1024</value>
<type>int</type>
</param>
<param>
<name>Num. blocks floating</name>
<key>num_blocks_floating</key>
<value>10</value>
<type>int</type>
</param>
<param>
<name>Idle pattern</name>
<key>idle_pattern</key>
<value>[0x00, 0xFF,]*12</value>
<type>raw</type>
</param>
<check>$port_recv &gt; 0</check>
<check>$port_ctl &gt; 0</check>
<check>$max_frame_length &gt; 0</check>
<check>$block_len &gt; 0</check>
<check>$num_blocks_floating &gt; 0</check>
<sink>
<name>in</name>
<type>message</type>
</sink>
<source>
<name>out</name>
<type>byte</type>
</source>
<doc>
UDP source with rate control and idle pattern insertion
This block will keep 'Num. blocks floating' blocks of 'Block size' bytes in the downstream processing. It receives "block_out" messages from a downstream block to be notified once a block has left the processing chain at that block and a new one should be inserted by the source.
It receives datagrams of a maximum size of 'Max Frame length' Bytes over the UDP socket listening to the data hostname and port and buffers them internally. If the internal buffer holds more data than what could be send out in 1 block, it sends a control datagram with the 's' Byte (encoded in ASCII) to the control hostname and port. Once the buffer contains less data than required to fill a complete block, it will send a 'g' Byte (encoded in ASCII) to the control hostname and port.
If a new block has to be send out and there is not enough data in the internal buffer to complete the block, (multiple) copies of the idle patterns are inserted at the back of the buffer.
If an element in the buffer does not completely fit into the current block to be send it is split, such that the rest of the element is send as first item of the next block.
The only block so far that provides the "block_out" message is the output_counter block.
'Hostname (data)' and 'Port (data)':
Hostname and port for the UDP socket on which the data arrives and is stored in the internal buffer. The block will bind to this socket (UDP Server).
'Hostname (control)' and 'Port (control)':
Target hostname and port for the control datagrams 's' and 'g'. The block will only send to this socket, but not bind to it (UDP Client).
'Max Frame length':
Maximum frame (datagram) length in Bytes that can be received over the data socket. This value is only used for buffer allocation.
'Block size':
Number of bytes that constitute one data block. The value entered here must correspond to the block size parameter of the downstream block that provides the "block_out" messages or the flowgrapg between the two blocks will fill up, or run empty over time.
'Num. blocks floating':
Number of data blocks that should be in the flowgraph at the same time.
'Idle pattern':
Python vector of Bytes that form the idle pattern. Everytime a new data block has to be send out and there is not enough data in the internal buffer to fill this data block, one or multiple copies of the idle pattern are added to the end of the internal buffer in order to be able to complete the data block transmission. If transmitted, the idle pattern is always transmitted completely.
</doc>
</block>

View File

@ -0,0 +1,64 @@
from sys import argv
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
import json
class FakeServer(BaseHTTPRequestHandler):
def _set_response(self, code=200):
self.send_response(code)
self.send_header('Content-type', 'application/json')
self.end_headers()
def do_GET(self):
logging.info("GET request, Path: %s\n", str(self.path))
code = 404
reponse = '{}'
if self.path == "/session":
code = 200
response = '{"session":"15700771d1262b8e"}'
self._set_response(code=code)
self.wfile.write(response.encode('utf-8'))
def do_POST(self):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
logging.info("POST request, Path: %s\nBody:\n%s\n",
str(self.path), post_data.decode('utf-8'))
code = 404
response = '{}'
if self.path == '/nanolink':
data = json.loads(post_data.decode('utf-8'))
logging.info("DATA: " + data['nanolink_frame'])
global frames
frames.write(data['nanolink_frame'] + '\n')
frames.flush()
code = 200
self._set_response(code=code)
self.wfile.write(response.encode('utf-8'))
def run(server_class=HTTPServer, handler_class=FakeServer, port=8000):
logging.basicConfig(level=logging.INFO)
server_address = ('', port)
httpd = server_class(server_address, handler_class)
logging.info('Starting httpd...\n')
try:
httpd.serve_forever()
except KeyboardInterrupt:
pass
httpd.server_close()
logging.info('Stopping httpd...\n')
if __name__ == '__main__':
file = '/app/data/output/frames.txt'
if len(argv) > 1:
file = argv[1]
with open(file, "a") as frames:
frames.write('\n')
run()

7
build/run.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
mkdir -p /app/data/output
touch /app/data/output/frames.txt
python3 /app/fakeserver/server.py &
gnuradio-companion

View File

@ -1,12 +0,0 @@
version: '3'
services:
move2:
build:
context: .
args:
- PROP_SERVER
- PROP_SERVER_USER
- PROP_SERVER_KEY
- PROP_DIR_SDR
- PROP_DIR_DECODER

View File

@ -3,4 +3,7 @@
cd "${0%/*}/.."
source ./config/config.sh
export PROP_SERVER_KEY=$(cat ./config/id_rsa)
docker-compose build
docker build \
--build-arg PROP_SERVER --build-arg PROP_SERVER_USER --build-arg PROP_SERVER_KEY \
--build-arg PROP_DIR_SDR --build-arg PROP_DIR_DECODER -t move2docker-dev .

9
scripts/buildx.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
cd "${0%/*}/.."
source ./config/config.sh
export PROP_SERVER_KEY=$(cat ./config/id_rsa)
docker buildx build --platform linux/arm/v7 \
--build-arg PROP_SERVER --build-arg PROP_SERVER_USER --build-arg PROP_SERVER_KEY \
--build-arg PROP_DIR_SDR --build-arg PROP_DIR_DECODER -t move2docker:latest .

3
scripts/run.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker run -it --rm -v ./data:/app/data:rw --env DISPLAY=host.docker.internal:0.0 move2docker-dev