Skip to content

Commit

Permalink
Release/new call mgmt (#817)
Browse files Browse the repository at this point in the history
* Group ID Check in Transmission Sink

* last voice update

* Update main.cc

* Update call.h

* Update call.h

* debug

* Update p25_recorder_decode.cc

* accurate time diff on writes

* Update transmission_sink.cc

* Update transmission_sink.cc

* additional group id spot

* Update transmission_sink.cc

* no Forecasts!

* Revert "no Forecasts!"

This reverts commit eca65e5.

* let it rip

* Update transmission_sink.cc

* Update transmission_sink.cc

* removed record_more stuff

* better dbug

* Update main.cc

* Update main.cc

* fixed loop

* fix grp compare for smartnet and p25

* Update call_impl.cc

* Update transmission_sink.cc

* Update transmission_sink.cc

* Update p25_recorder_decode.cc

* Update main.cc

* print out state of recorder during group mismatch

* Update transmission_sink.cc

* count Termination tooo

* Update transmission_sink.cc

* Update main.cc

* Update main.cc

* Update main.cc

* Update main.cc

* Update main.cc

* Update main.cc

* Update transmission_sink.cc

* Update main.cc

* Update main.cc

* refining the messages

* Switching back to processing UPDATEs as UPDATEs

* Update p25p1_fdma.cc

* Update transmission_sink.cc

* I am going to totally forget to set this back

* Update main.cc

* different messages

* Update main.cc

* Update main.cc

* upgrades

* Update main.cc

* Update transmission_sink.cc

* might clear the buffer of blocks on stop

* Update p25_recorder_impl.cc

* not clean

* adding latency manager

* only start recording when the correct group ID is seen

* Ignore TG Mismatch

If Recorder gets a mismatched TG it will ignore til end of the transmission

* Latency measurements

seems to break when you have the tags go through a lot of downsampling

* slight fixes

* new FSK4

* different

* cleaned up

* Update p25_recorder_decode.cc

* not having Updates start Calls

* or maybe we should do updates

* update FLL Band Edge

* backed out most of the debugging

* clean up for compiling

* Update p25p2_tdma.cc

* Config Option to turn on/off new calls from UPDATE
  • Loading branch information
robotastic committed May 27, 2023
1 parent 15bed14 commit 6d68897
Show file tree
Hide file tree
Showing 50 changed files with 1,489 additions and 376 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ list(APPEND trunk_recorder_sources
trunk-recorder/call_concluder/call_concluder.cc

lib/lfsr/lfsr.cxx
lib/gr-latency/latency_probe.cc
lib/gr-latency/latency_tagger.cc
lib/gr-latency-manager/lib/latency_manager_impl.cc
lib/gr-latency-manager/lib/tag_to_msg_impl.cc
trunk-recorder/gr_blocks/freq_xlating_fft_filter.cc
trunk-recorder/gr_blocks/transmission_sink.cc
trunk-recorder/gr_blocks/decoders/fsync_decode.cc
Expand Down Expand Up @@ -334,7 +338,7 @@ add_subdirectory(plugins/rdioscanner_uploader)

add_subdirectory(plugins/simplestream)

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

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)

Expand Down
4 changes: 2 additions & 2 deletions docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ Here is a map of the different sections of the *config.json* file:
| debugRecorder | | true | **true** / **false** | Will attach a debug recorder to each Source. The debug recorder will allow you to examine the channel of a call be recorded. There is a single Recorder per Source. It will monitor a recording and when it is done, it will monitor the next recording started. The information is sent over a network connection and can be viewed using the `udp-debug.grc` graph in GnuRadio Companion |
| debugRecorderPort | | 1234 | number | The network port that the Debug Recorders will start on. For each Source an additional Debug Recorder will be added and the port used will be one higher than the last one. For example the ports for a system with 3 Sources would be: 1234, 12345, 1236. |
| debugRecorderAddress | | "127.0.0.1" | string | The network address of the computer that will be monitoring the Debug Recorders. UDP packets will be sent from Trunk Recorder to this computer. The default is *"127.0.0.1"* which is the address used for monitoring on the same computer as Trunk Recorder. |
| audioStreaming | | false | **true** / **false** | whether or not to enable the audio streaming callbacks for plugins. |

| audioStreaming | | false | **true** / **false** | Whether or not to enable the audio streaming callbacks for plugins. |
| newCallFromUpdate | | true | **true** / **false** | Allow for UPDATE trunking messages to start a new Call, in addition to GRANT messages. This may result in more Calls with no transmisions, and use more Recorders. The flipside is that it may catch parts of a Call that would have otherwise been missed. Turn this off if you are running out of Recorders. |


#### Source Object
Expand Down
2 changes: 2 additions & 0 deletions docs/notes/CALL-HANDLING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Use [Mermaid Live](https://mermaid.live/) to edit the charts.

```mermaid
flowchart TD
A[Control Channel] -->|GRANT| B["handle_call_grant()"]
Expand Down
15 changes: 15 additions & 0 deletions lib/gr-latency-manager/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2011,2012 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-latency_manager
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

########################################################################
# Install public header files
########################################################################
install(FILES
api.h
DESTINATION include/gnuradio/latency_manager
)
22 changes: 22 additions & 0 deletions lib/gr-latency-manager/include/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2011 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-latency_manager
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/

#ifndef INCLUDED_LATENCY_MANAGER_API_H
#define INCLUDED_LATENCY_MANAGER_API_H

#include <gnuradio/attributes.h>

#ifdef gnuradio_latency_manager_EXPORTS
#define LATENCY_MANAGER_API __GR_ATTR_EXPORT
#else
#define LATENCY_MANAGER_API __GR_ATTR_IMPORT
#endif

#endif /* INCLUDED_LATENCY_MANAGER_API_H */
47 changes: 47 additions & 0 deletions lib/gr-latency-manager/include/latency_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Derek Kozel.
*
* 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_LATENCY_MANAGER_LATENCY_MANAGER_H
#define INCLUDED_LATENCY_MANAGER_LATENCY_MANAGER_H

#include "./api.h"
#include <gnuradio/sync_block.h>

namespace gr {
namespace latency_manager {

/*!
* \brief <+description of block+>
* \ingroup latency_manager
*
*/
class LATENCY_MANAGER_API latency_manager : virtual public gr::sync_block
{
public:
typedef std::shared_ptr<latency_manager> sptr;

static sptr make(int max_tags_in_flight, int tag_interval, int itemsize);
};

} // namespace latency_manager
} // namespace gr

#endif /* INCLUDED_LATENCY_MANAGER_LATENCY_MANAGER_H */

74 changes: 74 additions & 0 deletions lib/gr-latency-manager/include/tag_to_msg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Derek Kozel.
*
* 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_LATENCY_MANAGER_TAG_TO_MSG_H
#define INCLUDED_LATENCY_MANAGER_TAG_TO_MSG_H

#include "./api.h"
#include <gnuradio/sync_block.h>

namespace gr {
namespace latency_manager {

/*!
* \brief <+description of block+>
* \ingroup latency_manager
*
*/
class LATENCY_MANAGER_API tag_to_msg : virtual public gr::sync_block
{
public:
typedef std::shared_ptr<tag_to_msg> sptr;

static sptr make(size_t sizeof_stream_item,
const std::string& name,
const std::string& key_filter = "");

/*!
* \brief Returns a vector of tag_t items as of the last call to
* work.
*/
virtual std::vector<tag_t> current_tags() = 0;

/*!
* \brief Return the total number of tags in the tag queue.
*/
virtual int num_tags() = 0;

/*!
* \brief Set the display of tags to stdout on/off.
*/
virtual void set_display(bool d) = 0;

/*!
* \brief Set a new key to filter with.
*/
virtual void set_key_filter(const std::string& key_filter) = 0;

/*!
* \brief Get the current filter key.
*/
virtual std::string key_filter() const = 0;
};
} // namespace latency_manager
} // namespace gr

#endif /* INCLUDED_LATENCY_MANAGER_TAG_TO_MSG_H */

48 changes: 48 additions & 0 deletions lib/gr-latency-manager/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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-latency_manager
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

########################################################################
# Setup library
########################################################################
include(GrPlatform) #define LIB_SUFFIX
list(APPEND latency_manager_sources
tag_to_msg_impl.cc
latency_manager_impl.cc
)

set(latency_manager_sources "${latency_manager_sources}" PARENT_SCOPE)
if(NOT latency_manager_sources)
MESSAGE(STATUS "No C++ sources... skipping lib/")
return()
endif(NOT latency_manager_sources)

add_library(gnuradio-latency_manager SHARED ${latency_manager_sources})
target_link_libraries(gnuradio-latency_manager gnuradio::gnuradio-runtime)
target_include_directories(gnuradio-latency_manager
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC $<INSTALL_INTERFACE:include>
)
set_target_properties(gnuradio-latency_manager PROPERTIES DEFINE_SYMBOL "gnuradio_latency_manager_EXPORTS")

if(APPLE)
set_target_properties(gnuradio-latency_manager PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
)
endif(APPLE)

########################################################################
# Install built library files
########################################################################
include(GrMiscUtils)
GR_LIBRARY_FOO(gnuradio-latency_manager)

########################################################################
# Print summary
########################################################################
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
94 changes: 94 additions & 0 deletions lib/gr-latency-manager/lib/latency_manager_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Derek Kozel.
*
* 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 <gnuradio/io_signature.h>
#include "latency_manager_impl.h"
#include <boost/thread/thread.hpp>

namespace gr {
namespace latency_manager {

latency_manager::sptr
latency_manager::make(int max_tags_in_flight, int tag_interval, int itemsize)
{
return gnuradio::get_initial_sptr
(new latency_manager_impl(max_tags_in_flight, tag_interval, itemsize));
}

void latency_manager_impl::add_token(pmt::pmt_t msg)
{
d_tokens++;
//std::cout << "Tokens: " << d_tokens << " : Added one\n";
}

latency_manager_impl::latency_manager_impl(int max_tags_in_flight, int tag_interval, int itemsize)
: gr::sync_block("latency_manager",
gr::io_signature::make(1, 1, itemsize),
gr::io_signature::make(1, 1, itemsize)),
d_itemsize(itemsize),
d_tag_interval(tag_interval),
d_tag_phase(0)
{
d_tokens = max_tags_in_flight;
message_port_register_in(pmt::mp("token"));
set_msg_handler(pmt::mp("token"), [this](pmt::pmt_t msg) { this->add_token(msg); });
d_tag.key = pmt::intern("latency_strobe");
d_tag.srcid = alias_pmt();

}

latency_manager_impl::~latency_manager_impl()
{
}

int
latency_manager_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const char *in = (const char*) input_items[0];
char *out = (char *) output_items[0];

int copy_count = std::min(noutput_items, d_tag_phase + d_tokens * d_tag_interval);
std::memcpy(out, in, copy_count * d_itemsize);
//std::cout << "Copied: " << copy_count << "\n";
int tag_loc = d_tag_phase;
while (tag_loc < copy_count) {

d_tag.offset = nitems_written(0) + tag_loc;
d_tag.value = pmt::from_long(tag_loc);
//std::cout << "Add Tag: " << tag_loc << " nitems_written: " << nitems_written(0) << "\n";
add_item_tag(0,d_tag);
tag_loc += d_tag_interval;
d_tokens--;
}
d_tag_phase = tag_loc - copy_count;
if(copy_count == 0) {
boost::this_thread::sleep(boost::posix_time::microseconds(long(100)));
}
return copy_count;
}
} /* namespace latency_manager */
} /* namespace gr */

55 changes: 55 additions & 0 deletions lib/gr-latency-manager/lib/latency_manager_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Derek Kozel.
*
* 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_LATENCY_MANAGER_LATENCY_MANAGER_IMPL_H
#define INCLUDED_LATENCY_MANAGER_LATENCY_MANAGER_IMPL_H

#include "../include/latency_manager.h"

namespace gr {
namespace latency_manager {

class latency_manager_impl : public latency_manager
{
private:
int d_tokens;
void add_token(pmt::pmt_t tag);
int d_itemsize;
int d_tag_interval;
int d_tag_phase;
tag_t d_tag;

public:
latency_manager_impl(int max_tags_in_flight, int tag_interval, int itemsize);
~latency_manager_impl();

// 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 latency_manager
} // namespace gr

#endif /* INCLUDED_LATENCY_MANAGER_LATENCY_MANAGER_IMPL_H */

Loading

0 comments on commit 6d68897

Please sign in to comment.