Skip to content

Commit

Permalink
Updated from Upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
geezer85 committed Jun 5, 2022
2 parents 5f6cd83 + e1c303a commit 20385b8
Show file tree
Hide file tree
Showing 44 changed files with 2,185 additions and 1,236 deletions.
29 changes: 21 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@
########################################################################

cmake_minimum_required(VERSION 3.2)
project(Trunk-Recorder CXX C)
project(Trunk-Recorder LANGUAGES CXX C VERSION "4.3.2")

configure_file(cmake.h.in "${PROJECT_SOURCE_DIR}/cmake.h" @ONLY)

# Define the two required variables before including
# the source code for watching a git repository.
set(PRE_CONFIGURE_FILE "git.cc.in")
set(POST_CONFIGURE_FILE "${CMAKE_CURRENT_BINARY_DIR}/git.cc")
include(git_watcher.cmake)

# Create a library out of the compiled post-configure file.
add_library(git ${POST_CONFIGURE_FILE})
target_include_directories(git PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(git check_git)

# Select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -218,7 +231,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-narrowing -fvisibility=hid

list(APPEND trunk_recorder_sources
trunk-recorder/recorders/recorder.cc
trunk-recorder/call.cc
trunk-recorder/call_impl.cc
trunk-recorder/formatter.cc
trunk-recorder/source.cc
trunk-recorder/call_conventional.cc
Expand All @@ -227,12 +240,12 @@ list(APPEND trunk_recorder_sources
trunk-recorder/systems/smartnet_parser.cc
trunk-recorder/systems/p25_parser.cc
trunk-recorder/systems/smartnet_decode.cc
trunk-recorder/systems/system.cc
trunk-recorder/recorders/debug_recorder.cc
trunk-recorder/recorders/sigmf_recorder.cc
trunk-recorder/systems/system_impl.cc
trunk-recorder/recorders/debug_recorder_impl.cc
trunk-recorder/recorders/sigmf_recorder_impl.cc
trunk-recorder/recorders/analog_recorder.cc
trunk-recorder/recorders/dmr_recorder.cc
trunk-recorder/recorders/p25_recorder.cc
trunk-recorder/recorders/dmr_recorder_impl.cc
trunk-recorder/recorders/p25_recorder_impl.cc
trunk-recorder/recorders/p25_recorder_fsk4_demod.cc
trunk-recorder/recorders/p25_recorder_qpsk_demod.cc
trunk-recorder/recorders/p25_recorder_decode.cc
Expand Down Expand Up @@ -324,7 +337,7 @@ add_subdirectory(plugins/simplestream)

add_executable(trunk-recorder trunk-recorder/main.cc ${trunk_recorder_sources})

target_link_libraries(trunk-recorder trunk_recorder_library gnuradio-op25_repeater ${CMAKE_DL_LIBS} 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} ${GNURADIO_OSMOSDR_LIBRARIES} ) # gRPC::grpc++_reflection protobuf::libprotobuf)
target_link_libraries(trunk-recorder git trunk_recorder_library gnuradio-op25_repeater ${CMAKE_DL_LIBS} 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} ${GNURADIO_OSMOSDR_LIBRARIES} ) # gRPC::grpc++_reflection protobuf::libprotobuf)

message(STATUS "All libraries:" ${GNURADIO_ALL_LIBRARIES})
if(NOT Gnuradio_VERSION VERSION_LESS "3.8")
Expand Down
10 changes: 10 additions & 0 deletions cmake.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD

#define PROJECT_NAME "Trunk-Recorder"
#define PROJECT_VER "4.3.2"
#define PROJECT_VER_MAJOR "4"
#define PROJECT_VER_MINOR "3"
#define PTOJECT_VER_PATCH "2"

#endif // INCLUDE_GUARD
10 changes: 10 additions & 0 deletions cmake.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD

#define PROJECT_NAME "@PROJECT_NAME@"
#define PROJECT_VER "@PROJECT_VERSION@"
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"

#endif // INCLUDE_GUARD
1 change: 1 addition & 0 deletions docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Here is a map of the different sections of the *config.json* file:
| digitalLevels | | 1 | number (1-16) | The amount of amplification that will be applied to the digital audio. |
| unitTagsFile | | | string | This is the filename of a CSV files that provides information about the unit tags. It allows a Unit ID to be assigned a name. This file should be located in the same directory as the trunk-recorder executable. The format is 2 columns, the first being the decimal number of the Unit ID, the second is the Unit Name, |
| recordUnknown | | true | **true** / **false** | Record talkgroups if they are not listed in the Talkgroups File. |
| recordUUVCalls | | true | **true** / **false** | [ P25 only ] Record Unit to Unit Voice calls. |
| hideEncrypted | | false | **true** / **false** | Hide encrypted talkgroups log entries |
| hideUnknownTalkgroups | | false | **true** / **false** | Hide unknown talkgroups log entries |
| minDuration | | 0<br />(which is disabled) | number | The minimum call duration in seconds (decimals allowed), calls below this number will have recordings deleted and will not be uploaded. |
Expand Down
40 changes: 38 additions & 2 deletions docs/INSTALL-MAC.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,47 @@
There are two main "package managers" used on MacOS: Homebrew and MacPorts. Trunk-recorder can be installed with dependencies from one or the other

## Using Homebrew
Tested on macOS Catalina 10.15.7 with the following packages:

- homebrew 3.4.10
- cmake 3.23.1
- gnuradio 3.9.3.0
- uhd 4.2.0.0
- pkgconfig 0.29.2
- cppunit 1.15.1
- openssl 3.0.3
- fdk-aac-encoder 1.0.2
- sox 14.4.2
- pybind11 2.9.2

### Install Homebrew
See [the Brew homepage](https://brew.sh) for more information.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```

### Install GNURadio and other dependencies
Install GNURadio, the OsmoSDR package for GNURadio, CMake, pkgconfig, cppunit, and openssl through Homebrew:
```bash
brew install gnuradio uhd gr-osmosdr cmake pkgconfig cppunit openssl fdk-aac-encoder sox
brew install gnuradio uhd cmake pkgconfig cppunit openssl fdk-aac-encoder sox pybind11
```
### Install the OsmoSDR Package for GNURadio
See the gr-osmosdr [homepage](https://osmocom.org/projects/gr-osmosdr/wiki/GrOsmoSDR) for more information.
```bash
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr
mkdir build && cd build
cmake ..
make -j
sudo make install
sudo update_dyld_shared_cache
```
At this point, proceed to the [build instructions](#building-trunk-recorder).

Note that you will need to provide the flag `-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl` to the invocation of `cmake` in the [Build Instructions](https://github.com/robotastic/trunk-recorder/wiki/Building-Trunk-Recorder) or you will receive an error from CMake about not finding libssl or a linking error from `make` about not having a library for `-lssl`:
```bash
cmake ../trunk-recorder -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl
```

## Using MacPorts
### These instructions should work on OS X 10.10, OS X 10.11, and macOS 10.12.

Expand Down Expand Up @@ -70,6 +96,16 @@ make
sudo make install
```

## Building Trunk Recorder
```bash
mkdir trunk-recorder && cd trunk-recorder
git clone https://github.com/robotastic/trunk-recorder.git source
mkdir build && cd build
cmake ../source -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl
make -j
sudo make install
```

## Configuring Trunk Recorder

The next step is to [configure Trunk Recorder](CONFIGURE.md) for the system you are trying to capture.
Expand Down
24 changes: 12 additions & 12 deletions docs/INSTALL-PI.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ This is a [good guide](https://desertbot.io/blog/headless-raspberry-pi-4-ssh-wif

The first step is to put the Raspberry Pi OS onto a MicroSD card. You will need to have a USB MicroSD card adaptor, so you can connect it to your computer. Either of these approaches should work:

- Download the [Raspbery OS Desktop](https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit)
- Use [Etcher](https://www.balena.io/etcher/) to burn it to a MicroSD card

OR

- get the [Pi Imager](https://www.raspberrypi.org/software/) which can download and burn an image.

- Download the [Raspberry Pi OS Lite](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit) image.
- [Install Raspberry Pi OS using Raspberry Pi Imager](https://www.raspberrypi.org/software/) which can download and burn the image above.

#### Setup for headless boot

Expand Down Expand Up @@ -62,7 +57,7 @@ sudo nano /etc/apt/sources.list
```
- and add this line to the end:
```
deb http://www.deb-multimedia.org/ buster main non-free
deb http://www.deb-multimedia.org/ bullseye main non-free
```
- Download the keys for the apt source and install them:
```bash
Expand All @@ -82,16 +77,20 @@ sudo apt -y install libssl-dev openssl curl git fdkaac sox libcurl3-gnutls libcu
Configure RTL-SDRs to load correctly:

```bash
sudo wget https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules /etc/udev/rules.d/20.rtlsdr.rules
sudo wget https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules ~/rtl-sdr.rules
sudo mv ~/rtl-sdr.rules /etc/udev/rules.d/20.rtlsdr.rules
```

You will need to restart for the rules to take effect. Logging out and logging back in will not be enough.

```bash
sudo shutdown -r now
```

Now go [Build](#build-trunk-recorder) Trunk Recorder!


***
## Ubuntu 20.04 Server (64-bit support!)
# Ubuntu 22.04 Server (64-bit support!)

Ubuntu has a very good [guide](https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview) on setting up Ubuntu Server to run on a Raspberry Pi. Follow this to get started.

Expand All @@ -102,7 +101,7 @@ sudo apt upgrade
```

```bash
sudo apt-get install -y apt-transport-https build-essential ca-certificates fdkaac git gnupg gnuradio gnuradio-dev gr-osmosdr libboost-all-dev libcurl4-openssl-dev libgmp-dev libhackrf-dev liborc-0.4-dev libpthread-stubs0-dev libssl-dev libuhd-dev libusb-dev pkg-config software-properties-common cmake sox
sudo apt install -y apt-transport-https build-essential ca-certificates fdkaac git gnupg gnuradio gnuradio-dev gr-osmosdr libboost-all-dev libcurl4-openssl-dev libgmp-dev libhackrf-dev liborc-0.4-dev libpthread-stubs0-dev libssl-dev libuhd-dev libusb-dev pkg-config software-properties-common cmake sox
```

If you are using a HackRF:
Expand All @@ -126,6 +125,7 @@ In order to keep your copy of the Trunk Recorder source code free of build artif
Assuming you are in the desired directory to place both trunk-recorder and trunk-build folders to, perform the following...

```bash
cd ~
mkdir trunk-build
git clone https://github.com/robotastic/trunk-recorder.git
cd trunk-build
Expand Down
56 changes: 56 additions & 0 deletions git.cc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <cstdlib>
#include <iostream>

#include "git.h"
#include "cmake.h"

const char *version = "version info:\n";

bool GitMetadata::Populated() {
return @GIT_RETRIEVED_STATE@;
}
bool GitMetadata::AnyUncommittedChanges() {
return @GIT_IS_DIRTY@;
}
std::string GitMetadata::AuthorName() {
return "@GIT_AUTHOR_NAME@";
}
std::string GitMetadata::AuthorEmail() {
return "@GIT_AUTHOR_EMAIL@";
}
std::string GitMetadata::CommitSHA1() {
return "@GIT_HEAD_SHA1@";
}
std::string GitMetadata::CommitDate() {
return "@GIT_COMMIT_DATE_ISO8601@";
}
std::string GitMetadata::CommitSubject() {
return "@GIT_COMMIT_SUBJECT@";
}
std::string GitMetadata::CommitBody() {
return "@GIT_COMMIT_BODY@";
}
std::string GitMetadata::Describe() {
return "@GIT_DESCRIBE@";
}
std::string GitMetadata::Branch() {
return "@GIT_BRANCH@";
}
void GitMetadata::VersionInfo() {
std::cout << PROJECT_NAME << ": " << PROJECT_VER << std::endl;

if(GitMetadata::Populated()) {
if(GitMetadata::AnyUncommittedChanges()) {
std::cerr << "\t" << "WARN: there were uncommitted changes at build-time." << std::endl;
}
std::cout << "\t" << "commit " << GitMetadata::CommitSHA1() << " (" << GitMetadata::Branch() << ")\n"
<< "\t" << "describe " << GitMetadata::Describe() << "\n"
<< "\t" << "Author: " << GitMetadata::AuthorName() << " <" << GitMetadata::AuthorEmail() << ">\n"
<< "\t" << "Date: " << GitMetadata::CommitDate() << "\n\n"
<< "\t" << GitMetadata::CommitSubject() << "\n" << GitMetadata::CommitBody() << std::endl;
}
else {
std::cerr << "WARN: failed to get the current git state. Is this a git repo?" << std::endl;
}
}

33 changes: 33 additions & 0 deletions git.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include <string>

class GitMetadata {
public:
// Is the metadata populated? We may not have metadata if
// there wasn't a .git directory (e.g. downloaded source
// code without revision history).
static bool Populated();

// Were there any uncommitted changes that won't be reflected
// in the CommitID?
static bool AnyUncommittedChanges();

// The commit author's name.
static std::string AuthorName();
// The commit author's email.
static std::string AuthorEmail();
// The commit SHA1.
static std::string CommitSHA1();
// The ISO8601 commit date.
static std::string CommitDate();
// The commit subject.
static std::string CommitSubject();
// The commit body.
static std::string CommitBody();
// The commit describe.
static std::string Describe();
// The symbolic reference tied to HEAD.
static std::string Branch();
// dump
static void VersionInfo();
};
Loading

0 comments on commit 20385b8

Please sign in to comment.