Skip to content

Commit

Permalink
changes needed to compile
Browse files Browse the repository at this point in the history
  • Loading branch information
rosecitytransit committed Mar 25, 2021
1 parent 7569c98 commit 031ffcc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 41 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ endif()
########################################################################
# Find build dependencies
########################################################################
find_package(GnuradioUHD)
find_package(GrOsmoSDR)
find_package(LibHackRF)
find_package(UHD)
find_package(OpenSSL REQUIRED)
find_package(CURL REQUIRED)

Expand Down Expand Up @@ -171,8 +168,6 @@ link_directories(
${Boost_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
${GROSMOSDR_LIBRARIES_DIRS}
${GNURADIO_UHD_LIBRARIES_DIRS}
${UHD_LIBRARIES_DIRS}
${OPENSSL_ROOT_DIR}/lib
)

Expand Down Expand Up @@ -240,7 +235,7 @@ target_compile_options(

add_executable(recorder ${trunk_recorder_sources})

target_link_libraries(recorder ssl crypto ${CURL_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_DIGITAL_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} ${GNURADIO_AUDIO_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GROSMOSDR_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder)
target_link_libraries(recorder ssl crypto ${CURL_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_DIGITAL_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} ${GNURADIO_AUDIO_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GROSMOSDR_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder)
message(STATUS "All libraries:" ${GNURADIO_ALL_LIBRARIES})
if(NOT Gnuradio_VERSION VERSION_LESS "3.8")
target_link_libraries(recorder
Expand Down
13 changes: 6 additions & 7 deletions trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#include <gnuradio/message.h>
#include <gnuradio/msg_queue.h>
#include <gnuradio/top_block.h>
#include <gnuradio/uhd/usrp_source.h>

using namespace std;
namespace logging = boost::log;
Expand Down Expand Up @@ -860,7 +859,7 @@ void current_system_status(TrunkMessage message, System *sys) {
void unit_registration(string unit_script, string shortName, long unit) {
unit_affiliations[unit] = 0;

if (unit_script.length() != 0) {
if ((unit_script.length() != 0) && (unit != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li on &", unit_script.c_str(), shortName.c_str(), unit);
int rc = system(shell_command);
Expand All @@ -876,15 +875,15 @@ void unit_deregistration(string unit_script, string shortName, long unit) {

unit_affiliations[unit] = -1;

if (unit_script.length() != 0) {
if ((unit_script.length() != 0) && (unit != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li off &", unit_script.c_str(), shortName.c_str(), unit);
int rc = system(shell_command);
}
}

void unit_ack(string unit_script, string shortName, long unit) {
if (unit_script.length() != 0) {
if ((unit_script.length() != 0) && (unit != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li ackresp &", unit_script.c_str(), shortName.c_str(), unit);
int rc = system(shell_command);
Expand All @@ -894,7 +893,7 @@ void unit_ack(string unit_script, string shortName, long unit) {
void group_affiliation(string unit_script, string shortName, long unit, long talkgroup) {
unit_affiliations[unit] = talkgroup;

if (unit_script.length() != 0) {
if ((unit_script.length() != 0) && (unit != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li join %li &", unit_script.c_str(), shortName.c_str(), unit, talkgroup);
int rc = system(shell_command);
Expand All @@ -914,7 +913,7 @@ void handle_call(TrunkMessage message, System *sys) {

unit_affiliations[message.source] = message.talkgroup;

if (sys->get_unit_script().length() != 0) {
if ((sys->get_unit_script().length() != 0) && (message.source != 0)) {
char shell_command[200];
sprintf(shell_command, "%s %s %li call %li &", sys->get_unit_script().c_str(), sys->get_short_name().c_str(), message.source, message.talkgroup);
int rc = system(shell_command);
Expand Down Expand Up @@ -1461,7 +1460,7 @@ int main(int argc, char **argv) {
if (config.log_file) {
logging::add_file_log(
keywords::file_name = "logs/%m-%d-%Y_%H%M_%2N.log",
keywords::format = "[%TimeStamp%]: %Message%",
keywords::format = "[%TimeStamp%] (%Severity%) %Message%",
keywords::rotation_size = 10 * 1024 * 1024,
keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),
keywords::auto_flush = true);
Expand Down
23 changes: 0 additions & 23 deletions trunk-recorder/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ void Source::set_antenna(std::string ant) {
BOOST_LOG_TRIVIAL(info) << "Setting antenna to [" << cast_to_osmo_sptr(source_block)->get_antenna() << "]";
}

if (driver == "usrp") {
BOOST_LOG_TRIVIAL(info) << "Setting antenna to [" << antenna << "]";
cast_to_usrp_sptr(source_block)->set_antenna(antenna, 0);
}
}

std::string Source::get_antenna() {
Expand Down Expand Up @@ -194,10 +190,6 @@ void Source::set_gain(int r) {
BOOST_LOG_TRIVIAL(info) << "Gain set to: " << cast_to_osmo_sptr(source_block)->get_gain();
}

if (driver == "usrp") {
gain = r;
cast_to_usrp_sptr(source_block)->set_gain(gain);
}
}

int Source::get_gain() {
Expand Down Expand Up @@ -564,21 +556,6 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C
source_block = osmo_src;
}

if (driver == "usrp") {
gr::uhd::usrp_source::sptr usrp_src;
usrp_src = gr::uhd::usrp_source::make(device, uhd::stream_args_t("fc32"));

BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE USRP (UHD)";

BOOST_LOG_TRIVIAL(info) << "Setting sample rate to: " << FormatSamplingRate(rate);
usrp_src->set_samp_rate(rate);
actual_rate = usrp_src->get_samp_rate();
BOOST_LOG_TRIVIAL(info) << "Actual sample rate: " << FormatSamplingRate(actual_rate);
BOOST_LOG_TRIVIAL(info) << "Tuning to " << FormatFreq(center + error);
usrp_src->set_center_freq(center + error, 0);

source_block = usrp_src;
}
}

std::vector<Recorder *> Source::get_recorders() {
Expand Down
5 changes: 0 additions & 5 deletions trunk-recorder/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "config.h"
#include <gnuradio/basic_block.h>
#include <gnuradio/top_block.h>
#include <gnuradio/uhd/usrp_source.h>
#include <iostream>
#include <numeric>
#include <osmosdr/source.h>
Expand Down Expand Up @@ -119,10 +118,6 @@ class Source {
return boost::dynamic_pointer_cast<osmosdr::source, gr::basic_block>(p);
}

inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p) {
return boost::dynamic_pointer_cast<gr::uhd::usrp_source, gr::basic_block>(p);
}

std::vector<Recorder *> get_recorders();
};
#endif

0 comments on commit 031ffcc

Please sign in to comment.