Skip to content

Commit b703e3b

Browse files
version used on kcmscanner.ddns.net
1 parent bd93f8e commit b703e3b

File tree

8 files changed

+38
-64
lines changed

8 files changed

+38
-64
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ sys_*/
44
junk/
55
tester/
66
fake/
7-
2015/
8-
2016/
7+
logs/
8+
2???/
99
wmata/
1010
CMakeFiles/
1111
build/

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ endif()
103103
#find_package(LibRTLSDR)
104104
#find_package(LibMiriSDR)
105105
#find_package(LibbladeRF)
106-
find_package(GnuradioUHD)
106+
##find_package(GnuradioUHD)
107107
find_package(GrOsmoSDR)
108-
find_package(LibHackRF)
109-
find_package(UHD)
108+
##find_package(LibHackRF)
109+
##find_package(UHD)
110110
find_package(OpenSSL REQUIRED)
111111

112112
if(NOT GNURADIO_RUNTIME_FOUND)
@@ -169,8 +169,8 @@ link_directories(
169169
${Boost_LIBRARY_DIRS}
170170
${GNURADIO_RUNTIME_LIBRARY_DIRS}
171171
${GROSMOSDR_LIBRARIES_DIRS}
172-
${GNURADIO_UHD_LIBRARIES_DIRS}
173-
${UHD_LIBRARIES_DIRS}
172+
## ${GNURADIO_UHD_LIBRARIES_DIRS}
173+
## ${UHD_LIBRARIES_DIRS}
174174
${OPENSSL_ROOT_DIR}/lib
175175
)
176176

@@ -220,4 +220,4 @@ list(APPEND trunk_recorder_sources
220220

221221
add_executable(recorder ${trunk_recorder_sources})
222222

223-
target_link_libraries(recorder ssl crypto ${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} ${Boost_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder)
223+
target_link_libraries(recorder ssl crypto ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_DIGITAL_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} ${GNURADIO_AUDIO_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GROSMOSDR_LIBRARIES} ${Boost_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder)

encode.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#! /bin/bash
2+
filesize=$(stat -c %s "$1")
3+
if [[ $filesize -gt "10240" ]]; then
4+
eval "nice -n 19 lame --silent --preset voice $1"
5+
rm $1
6+
fi

trunk-recorder/call.cc

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ void Call::create_filename() {
66

77
std::stringstream path_stream;
88

9-
path_stream << this->config.capture_dir << "/" << sys->get_short_name() << "/" << 1900 + ltm->tm_year << "/" << 1 + ltm->tm_mon << "/" << ltm->tm_mday;
9+
path_stream << this->config.capture_dir << "/" << 1900 + ltm->tm_year << "/" << 1 + ltm->tm_mon << "/" << ltm->tm_mday;
1010

1111
boost::filesystem::create_directories(path_stream.str());
1212
int nchars;
13-
nchars = snprintf(filename, 255, "%s/%ld-%ld_%g.wav", path_stream.str().c_str(), talkgroup, start_time, curr_freq);
13+
nchars = snprintf(filename, 255, "%s/%02d%02d%02d-%ld.wav", path_stream.str().c_str(), ltm->tm_hour, ltm->tm_min, ltm->tm_sec, talkgroup);
1414

1515
if (nchars >= 255) {
1616
BOOST_LOG_TRIVIAL(error) << "Call: Path longer than 160 charecters";
1717
}
18-
nchars = snprintf(status_filename, 255, "%s/%ld-%ld_%g.json", path_stream.str().c_str(), talkgroup, start_time, curr_freq);
18+
nchars = snprintf(status_filename, 255, "%s/calllog.txt", path_stream.str().c_str());
1919

2020
if (nchars >= 255) {
2121
BOOST_LOG_TRIVIAL(error) << "Call: Path longer than 160 charecters";
@@ -26,6 +26,8 @@ void Call::create_filename() {
2626
BOOST_LOG_TRIVIAL(error) << "Call: Path longer than 255 charecters";
2727
}
2828

29+
sprintf(filetime, "%02d%02d%02d", ltm->tm_hour, ltm->tm_min, ltm->tm_sec);
30+
2931
// sprintf(filename, "%s/%ld-%ld.wav",
3032
// path_stream.str().c_str(),talkgroup,start_time);
3133
// sprintf(status_filename, "%s/%ld-%ld.json",
@@ -129,37 +131,26 @@ void Call::end_call() {
129131
}
130132

131133
if (sys->get_call_log()) {
132-
std::ofstream myfile(status_filename);
134+
std::ofstream myfile(status_filename, std::ofstream::app);
133135

134136

135137
if (myfile.is_open())
136138
{
137-
myfile << "{\n";
138-
myfile << "\"freq\": " << this->curr_freq << ",\n";
139-
myfile << "\"start_time\": " << this->start_time << ",\n";
140-
myfile << "\"stop_time\": " << this->stop_time << ",\n";
141-
myfile << "\"emergency\": " << this->emergency << ",\n";
139+
myfile << "\n";
140+
myfile << this->get_filetime() << "," << (this->stop_time - this->start_time) << "," << this->talkgroup << "," << this->emergency << ";";
142141
//myfile << "\"source\": \"" << this->get_recorder()->get_source()->get_device() << "\",\n";
143-
myfile << "\"talkgroup\": " << this->talkgroup << ",\n";
144-
myfile << "\"srcList\": [ ";
145142

146143
for (int i = 0; i < src_count; i++) {
147-
if (i != 0) {
148-
myfile << ", ";
144+
myfile << src_list[i].source;
145+
if (i < (src_count-1)) {
146+
myfile << ",";
149147
}
150-
myfile << "{\"src\": " << std::fixed << src_list[i].source << ", \"time\": " << src_list[i].time << ", \"pos\": " << src_list[i].position << "}";
151148
}
152-
myfile << " ],\n";
153-
myfile << "\"freqList\": [ ";
149+
//myfile << ";";
154150

155151
for (int i = 0; i < freq_count; i++) {
156-
if (i != 0) {
157-
myfile << ", ";
158-
}
159-
myfile << "{ \"freq\": " << std::fixed << freq_list[i].freq << ", \"time\": " << freq_list[i].time << ", \"pos\": " << freq_list[i].position << ", \"len\": " << freq_list[i].total_len << ", \"error_count\": " << freq_list[i].error_count << ", \"spike_count\": " << freq_list[i].spike_count << "}";
152+
myfile << ";" << (freq_list[i].freq/1000000) << "," << freq_list[i].total_len << "," << freq_list[i].error_count << "," << freq_list[i].spike_count;
160153
}
161-
myfile << " ]\n";
162-
myfile << "}\n";
163154
myfile.close();
164155
}
165156
}
@@ -413,3 +404,7 @@ char * Call::get_converted_filename() {
413404
char * Call::get_filename() {
414405
return filename;
415406
}
407+
408+
char * Call::get_filetime() {
409+
return filetime;
410+
}

trunk-recorder/call.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Call {
5555

5656
char *get_converted_filename();
5757
char *get_filename();
58+
char *get_filetime();
5859
int get_sys_num();
5960
std::string get_short_name();
6061
void create_filename();
@@ -114,6 +115,7 @@ class Call {
114115
bool emergency;
115116
bool conventional;
116117
char filename[255];
118+
char filetime[7];
117119
char converted_filename[255];
118120
char status_filename[255];
119121
bool phase2_tdma;

trunk-recorder/main.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
#include <osmosdr/source.h>
5858

59-
#include <gnuradio/uhd/usrp_source.h>
59+
////#include <gnuradio/uhd/usrp_source.h>
6060
#include <gnuradio/msg_queue.h>
6161
#include <gnuradio/message.h>
6262
#include <gnuradio/blocks/file_sink.h>
@@ -795,9 +795,9 @@ void check_message_count(float timeDiff) {
795795
}
796796
}
797797

798-
if (msgs_decoded_per_second < 10) {
798+
// if (msgs_decoded_per_second < 10) {
799799
BOOST_LOG_TRIVIAL(error) << "[" << sys->get_short_name() << "]\t Control Channel Message Decode Rate: " << msgs_decoded_per_second << "/sec, count: " << sys->message_count;
800-
}
800+
// }
801801
sys->message_count = 0;
802802
}
803803
}
@@ -863,7 +863,7 @@ void monitor_messages() {
863863
}
864864
float timeDiff = currentTime - lastMsgCountTime;
865865

866-
if (timeDiff >= 3.0) {
866+
if (timeDiff >= 60.0) {
867867
check_message_count(timeDiff);
868868
lastMsgCountTime = currentTime;
869869
}

trunk-recorder/source.cc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ int Source::rec_num = 0;
66
void Source::set_antenna(std::string ant)
77
{
88
antenna = ant;
9-
10-
if (driver == "usrp") {
11-
BOOST_LOG_TRIVIAL(info) << "Setting antenna to [" << antenna << "]";
12-
cast_to_usrp_sptr(source_block)->set_antenna(antenna, 0);
13-
}
149
}
1510

1611
std::string Source::get_antenna() {
@@ -142,10 +137,6 @@ void Source::set_gain(int r)
142137
BOOST_LOG_TRIVIAL(info) << "Gain set to: " << cast_to_osmo_sptr(source_block)->get_gain();
143138
}
144139

145-
if (driver == "usrp") {
146-
gain = r;
147-
cast_to_usrp_sptr(source_block)->set_gain(gain);
148-
}
149140
}
150141

151142
int Source::get_gain() {
@@ -414,20 +405,4 @@ Source::Source(double c, double r, double e, std::string drv, std::string dev, C
414405
source_block = osmo_src;
415406
}
416407

417-
if (driver == "usrp") {
418-
gr::uhd::usrp_source::sptr usrp_src;
419-
usrp_src = gr::uhd::usrp_source::make(device, uhd::stream_args_t("fc32"));
420-
421-
BOOST_LOG_TRIVIAL(info) << "SOURCE TYPE USRP (UHD)";
422-
423-
BOOST_LOG_TRIVIAL(info) << "Setting sample rate to: " << rate;
424-
usrp_src->set_samp_rate(rate);
425-
actual_rate = usrp_src->get_samp_rate();
426-
BOOST_LOG_TRIVIAL(info) << "Actual sample rate: " << actual_rate;
427-
BOOST_LOG_TRIVIAL(info) << "Tunning to " << center + error << "hz";
428-
usrp_src->set_center_freq(center + error, 0);
429-
430-
431-
source_block = usrp_src;
432-
}
433408
}

trunk-recorder/source.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <gnuradio/basic_block.h>
66
#include <gnuradio/top_block.h>
77
#include <osmosdr/source.h>
8-
#include <gnuradio/uhd/usrp_source.h>
8+
////#include <gnuradio/uhd/usrp_source.h>
99
#include "config.h"
1010
//#include "recorders/recorder.h"
1111
#include "recorders/analog_recorder.h"
@@ -99,9 +99,5 @@ class Source
9999
return boost::dynamic_pointer_cast<osmosdr::source, gr::basic_block>(p);
100100
}
101101

102-
inline gr::uhd::usrp_source::sptr cast_to_usrp_sptr(gr::basic_block_sptr p)
103-
{
104-
return boost::dynamic_pointer_cast<gr::uhd::usrp_source, gr::basic_block>(p);
105-
}
106102
};
107103
#endif

0 commit comments

Comments
 (0)