Several minor improvements

* Improve CI testing
* Fix compilation warnings
* Bump up version
This commit is contained in:
Manolis Surligas 2018-01-19 22:20:19 +02:00
parent f8df9c2824
commit de05c3f1c4
11 changed files with 3182 additions and 2084 deletions

View File

@ -7,6 +7,14 @@ test:
script: script:
- mkdir -p build - mkdir -p build
- cd build - cd build
- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr ..
- make - make
- make install
- ldconfig
- python -c "import satnogs"
- rm -rf *
- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINCLUDE_DEBUG_BLOCKS=OFF -DCMAKE_INSTALL_PREFIX=/usr ..
- make
- make install
- ldconfig
- python -c "import satnogs"

View File

@ -48,7 +48,7 @@ list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Set the version information here # Set the version information here
set(VERSION_INFO_MAJOR_VERSION 1) set(VERSION_INFO_MAJOR_VERSION 1)
set(VERSION_INFO_API_COMPAT 2) set(VERSION_INFO_API_COMPAT 2)
set(VERSION_INFO_MINOR_VERSION 2) set(VERSION_INFO_MINOR_VERSION 3)
set(VERSION_INFO_MAINT_VERSION git) set(VERSION_INFO_MAINT_VERSION git)
######################################################################## ########################################################################

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
/* /*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
* *
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/> * Copyright (C) 2016,2018 Libre Space Foundation <http://librespacefoundation.org/>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -24,6 +24,8 @@
#include <satnogs/utils.h> #include <satnogs/utils.h>
#include <satnogs/log.h> #include <satnogs/log.h>
#include <limits.h> #include <limits.h>
#include <stdint.h>
#include <string>
namespace gr namespace gr
{ {
@ -37,8 +39,10 @@ namespace gr
const size_t AX25_MAX_FRAME_LEN = 256; const size_t AX25_MAX_FRAME_LEN = 256;
const uint8_t AX25_SYNC_FLAG = 0x7E; const uint8_t AX25_SYNC_FLAG = 0x7E;
const uint8_t AX25_CALLSIGN_MAX_LEN = 6; const uint8_t AX25_CALLSIGN_MAX_LEN = 6;
const float AX25_SYNC_FLAG_MAP[8] = {-1, 1, 1, 1, 1, 1, 1, -1}; const float AX25_SYNC_FLAG_MAP[8] =
const uint8_t AX25_SYNC_FLAG_MAP_BIN[8] = {0, 1, 1, 1, 1, 1, 1, 0}; { -1, 1, 1, 1, 1, 1, 1, -1 };
const uint8_t AX25_SYNC_FLAG_MAP_BIN[8] =
{ 0, 1, 1, 1, 1, 1, 1, 0 };
/** /**
* AX.25 Frame types * AX.25 Frame types
*/ */
@ -52,14 +56,12 @@ namespace gr
typedef enum typedef enum
{ {
AX25_ENC_FAIL, AX25_ENC_FAIL, AX25_ENC_OK
AX25_ENC_OK
} ax25_encode_status_t; } ax25_encode_status_t;
typedef enum typedef enum
{ {
AX25_DEC_FAIL, AX25_DEC_FAIL, AX25_DEC_OK
AX25_DEC_OK
} ax25_decode_status_t; } ax25_decode_status_t;
typedef struct typedef struct
@ -215,6 +217,12 @@ namespace gr
* *
* @param buffer_len the length of the input buffer. * @param buffer_len the length of the input buffer.
* *
* @param preamble_len the number of consecutive AX.25 flags that will
* be placed in the preamble. This preamble will be NOT bit-stuffed.
*
* @param postamble_len the number of consecutive AX.25 flags that will
* be placed in the postamble. This postamble will be NOT bit-stuffed.
*
* @return the resulting status of the encoding * @return the resulting status of the encoding
*/ */
static inline ax25_encode_status_t static inline ax25_encode_status_t
@ -291,6 +299,12 @@ namespace gr
* *
* @param buffer_len the length of the input buffer. * @param buffer_len the length of the input buffer.
* *
* @param preamble_len the number of consecutive AX.25 flags that will
* be placed in the preamble. This preamble will be NOT bit-stuffed.
*
* @param postamble_len the number of consecutive AX.25 flags that will
* be placed in the postamble. This postamble will be NOT bit-stuffed.
*
* @return the resulting status of the encoding * @return the resulting status of the encoding
*/ */
static inline ax25_encode_status_t static inline ax25_encode_status_t
@ -335,8 +349,8 @@ namespace gr
} }
static inline ax25_decode_status_t static inline ax25_decode_status_t
ax25_decode (uint8_t *out, size_t *out_len, ax25_decode (uint8_t *out, size_t *out_len, const uint8_t *ax25_frame,
const uint8_t *ax25_frame, size_t len) size_t len)
{ {
size_t i; size_t i;
size_t frame_start = UINT_MAX; size_t frame_start = UINT_MAX;
@ -349,17 +363,16 @@ namespace gr
uint16_t fcs; uint16_t fcs;
uint16_t recv_fcs; uint16_t recv_fcs;
/* Start searching for the SYNC flag */ /* Start searching for the SYNC flag */
for (i = 0; i < len - sizeof(AX25_SYNC_FLAG_MAP_BIN); i++) { for (i = 0; i < len - sizeof(AX25_SYNC_FLAG_MAP_BIN); i++) {
res = (AX25_SYNC_FLAG_MAP_BIN[0] ^ ax25_frame[i]) | res = (AX25_SYNC_FLAG_MAP_BIN[0] ^ ax25_frame[i])
(AX25_SYNC_FLAG_MAP_BIN[1] ^ ax25_frame[i + 1]) | | (AX25_SYNC_FLAG_MAP_BIN[1] ^ ax25_frame[i + 1])
(AX25_SYNC_FLAG_MAP_BIN[2] ^ ax25_frame[i + 2]) | | (AX25_SYNC_FLAG_MAP_BIN[2] ^ ax25_frame[i + 2])
(AX25_SYNC_FLAG_MAP_BIN[3] ^ ax25_frame[i + 3]) | | (AX25_SYNC_FLAG_MAP_BIN[3] ^ ax25_frame[i + 3])
(AX25_SYNC_FLAG_MAP_BIN[4] ^ ax25_frame[i + 4]) | | (AX25_SYNC_FLAG_MAP_BIN[4] ^ ax25_frame[i + 4])
(AX25_SYNC_FLAG_MAP_BIN[5] ^ ax25_frame[i + 5]) | | (AX25_SYNC_FLAG_MAP_BIN[5] ^ ax25_frame[i + 5])
(AX25_SYNC_FLAG_MAP_BIN[6] ^ ax25_frame[i + 6]) | | (AX25_SYNC_FLAG_MAP_BIN[6] ^ ax25_frame[i + 6])
(AX25_SYNC_FLAG_MAP_BIN[7] ^ ax25_frame[i + 7]); | (AX25_SYNC_FLAG_MAP_BIN[7] ^ ax25_frame[i + 7]);
/* Found it! */ /* Found it! */
if (res == 0) { if (res == 0) {
frame_start = i; frame_start = i;
@ -375,14 +388,14 @@ namespace gr
for (i = frame_start + sizeof(AX25_SYNC_FLAG_MAP_BIN); for (i = frame_start + sizeof(AX25_SYNC_FLAG_MAP_BIN);
i < len - sizeof(AX25_SYNC_FLAG_MAP_BIN) + 1; i++) { i < len - sizeof(AX25_SYNC_FLAG_MAP_BIN) + 1; i++) {
/* Check if we reached the frame end */ /* Check if we reached the frame end */
res = (AX25_SYNC_FLAG_MAP_BIN[0] ^ ax25_frame[i]) | res = (AX25_SYNC_FLAG_MAP_BIN[0] ^ ax25_frame[i])
(AX25_SYNC_FLAG_MAP_BIN[1] ^ ax25_frame[i + 1]) | | (AX25_SYNC_FLAG_MAP_BIN[1] ^ ax25_frame[i + 1])
(AX25_SYNC_FLAG_MAP_BIN[2] ^ ax25_frame[i + 2]) | | (AX25_SYNC_FLAG_MAP_BIN[2] ^ ax25_frame[i + 2])
(AX25_SYNC_FLAG_MAP_BIN[3] ^ ax25_frame[i + 3]) | | (AX25_SYNC_FLAG_MAP_BIN[3] ^ ax25_frame[i + 3])
(AX25_SYNC_FLAG_MAP_BIN[4] ^ ax25_frame[i + 4]) | | (AX25_SYNC_FLAG_MAP_BIN[4] ^ ax25_frame[i + 4])
(AX25_SYNC_FLAG_MAP_BIN[5] ^ ax25_frame[i + 5]) | | (AX25_SYNC_FLAG_MAP_BIN[5] ^ ax25_frame[i + 5])
(AX25_SYNC_FLAG_MAP_BIN[6] ^ ax25_frame[i + 6]) | | (AX25_SYNC_FLAG_MAP_BIN[6] ^ ax25_frame[i + 6])
(AX25_SYNC_FLAG_MAP_BIN[7] ^ ax25_frame[i + 7]); | (AX25_SYNC_FLAG_MAP_BIN[7] ^ ax25_frame[i + 7]);
/* Found it! */ /* Found it! */
if (res == 0) { if (res == 0) {
frame_stop = i; frame_stop = i;
@ -436,6 +449,4 @@ namespace gr
} // namespace gr } // namespace gr
#endif /* INCLUDE_SATNOGS_AX25_H_ */ #endif /* INCLUDE_SATNOGS_AX25_H_ */

View File

@ -44,14 +44,14 @@ namespace gr
/*! /*!
* *
* @param filename the OGG audio file path * @param filename the OGG audio file path
* @param number of channels of the OGG stream. If the actual OGG stream * @param channels number of channels of the OGG stream.
* contains a different number of channels than specified an exception * If the actual OGG stream contains a different number of channels
* is raised * than specified an exception is raised
* @param repeat if set to true, when EOF is reached the block * @param repeat if set to true, when EOF is reached the block
* will continue to output samples from the beginning of the OGG file. * will continue to output samples from the beginning of the OGG file.
*/ */
static sptr static sptr
make (const std::string& filename, size_t channels = 1, make (const std::string& filename, int channels = 1,
bool repeat = false); bool repeat = false);
}; };

View File

@ -47,12 +47,12 @@ namespace gr
* *
* @param addr the address of the interface to listen at * @param addr the address of the interface to listen at
* @param port the TCP port to listen or connect * @param port the TCP port to listen or connect
* @param serve_mode If set to yes this block, act as a rigctl server. * @param server_mode If set to yes this block, act as a rigctl server.
* Otherwise as a rigctl client * Otherwise as a rigctl client
* @param interval_ms The interval in milliseconds at which the client * @param interval_ms The interval in milliseconds at which the client
* request the frequency from the rigctl * request the frequency from the rigctl
* @param mtu the maximum MTU * @param mtu the maximum MTU
* @return * @return shared pointer of the block
*/ */
static sptr static sptr
make (const std::string& addr, uint16_t port, bool server_mode, make (const std::string& addr, uint16_t port, bool server_mode,

View File

@ -77,19 +77,18 @@ namespace gr
* delivered at the sink block out-of-sync causing the frame transmission * delivered at the sink block out-of-sync causing the frame transmission
* to terminate sooner. * to terminate sooner.
* *
* @param ax25_dest_addr the destination AX.25 address
* @param ax25_dest_ssid the destination AX.25 SSID
* @param ax25_src_addr the source AX.25 address
* @param ax25_src_ssid the source AX.25 SSID
*
*/ */
static sptr static sptr
make (const std::vector<uint8_t>& preamble, make (const std::vector<uint8_t>& preamble,
const std::vector<uint8_t>& sync_word, const std::vector<uint8_t>& sync_word, bool append_crc,
bool append_crc, bool whitening, bool manchester, bool msb_first, bool ax25_format,
bool whitening, const std::string& ax25_dest_addr, uint8_t ax25_dest_ssid,
bool manchester, const std::string& ax25_src_addr, uint8_t ax25_src_ssid,
bool msb_first,
bool ax25_format,
const std::string& ax25_dest_addr,
uint8_t ax25_dest_ssid,
const std::string& ax25_src_addr,
uint8_t ax25_src_ssid,
size_t settling_samples); size_t settling_samples);
}; };

View File

@ -36,7 +36,7 @@ namespace gr {
namespace satnogs { namespace satnogs {
ogg_source::sptr ogg_source::sptr
ogg_source::make (const std::string& filename, size_t channels, bool repeat) ogg_source::make (const std::string& filename, int channels, bool repeat)
{ {
return gnuradio::get_initial_sptr ( return gnuradio::get_initial_sptr (
new ogg_source_impl (filename, channels, repeat)); new ogg_source_impl (filename, channels, repeat));
@ -46,7 +46,7 @@ namespace gr {
* The private constructor * The private constructor
*/ */
ogg_source_impl::ogg_source_impl (const std::string& filename, ogg_source_impl::ogg_source_impl (const std::string& filename,
size_t channels, bool repeat) : int channels, bool repeat) :
gr::sync_block ( gr::sync_block (
"ogg_source", gr::io_signature::make (0, 0, 0), "ogg_source", gr::io_signature::make (0, 0, 0),
gr::io_signature::make (channels, channels, sizeof(float))), gr::io_signature::make (channels, channels, sizeof(float))),
@ -102,12 +102,13 @@ namespace gr {
long int ret; long int ret;
int section = 0; int section = 0;
int available = (noutput_items / d_channels); int available = (noutput_items / d_channels);
int available_samples = 0;
int produced = 0; int produced = 0;
ret = ov_read (&d_ogvorb_f, (char *)d_in_buffer, ret = ov_read (&d_ogvorb_f, (char *)d_in_buffer,
available * sizeof(int16_t), available * sizeof(int16_t),
0, sizeof(int16_t), 1, &section); 0, sizeof(int16_t), 1, &section);
if(ret < sizeof(int16_t)) { if(ret <= 0) {
/* /*
* If return value is EOF and the repeat mode is set seek back to the * If return value is EOF and the repeat mode is set seek back to the
* start of the ogg stream * start of the ogg stream
@ -122,12 +123,13 @@ namespace gr {
return WORK_DONE; return WORK_DONE;
} }
available_samples = ret / sizeof(int16_t);
/* Convert to float the signed-short audio samples */ /* Convert to float the signed-short audio samples */
volk_16i_s32f_convert_32f (d_out_buffer, d_in_buffer, 2 << 15, volk_16i_s32f_convert_32f (d_out_buffer, d_in_buffer, 2 << 15,
ret / sizeof(int16_t)); available_samples);
/* De-interleave the available channels */ /* De-interleave the available channels */
for(int i = 0; i < ret / sizeof(int16_t); i += d_channels, produced++) { for(int i = 0; i < available_samples; i += d_channels, produced++) {
for(int chan = 0; chan < d_channels; chan++){ for(int chan = 0; chan < d_channels; chan++){
((float *)output_items[chan])[produced] = d_out_buffer[i * d_channels + chan]; ((float *)output_items[chan])[produced] = d_out_buffer[i * d_channels + chan];
} }

View File

@ -33,7 +33,7 @@ namespace gr
class ogg_source_impl : public ogg_source class ogg_source_impl : public ogg_source
{ {
private: private:
const size_t d_channels; const int d_channels;
const bool d_repeat; const bool d_repeat;
OggVorbis_File d_ogvorb_f; OggVorbis_File d_ogvorb_f;
@ -41,7 +41,7 @@ namespace gr
float *d_out_buffer; float *d_out_buffer;
public: public:
ogg_source_impl (const std::string& filename, size_t channels, ogg_source_impl (const std::string& filename, int channels,
bool repeat); bool repeat);
~ogg_source_impl (); ~ogg_source_impl ();