Guest User

Untitled

a guest
May 7th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 17.32 KB | None | 0 0
  1. diff -cr ./trunk-recorder-master/analog_recorder.cc ./trunk-recorder-modded/analog_recorder.cc
  2. *** ./trunk-recorder-master/analog_recorder.cc  2016-04-20 19:38:18.000000000 -0600
  3. --- ./trunk-recorder-modded/analog_recorder.cc  2016-05-03 21:27:16.000000000 -0600
  4. ***************
  5. *** 51,61 ****
  6.     //on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
  7.     //the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
  8.  
  9. !   /*squelch = gr::analog::pwr_squelch_cc::make(28,        //squelch point
  10. !                                               0.1,    //alpha
  11. !                                               10,         //ramp
  12. !                                               true);  //gated so that the audio recording doesn't contain blank spaces between transmissions
  13. ! */
  14.  
  15.  
  16.  
  17. --- 51,69 ----
  18.     //on a trunked network where you know you will have good signal, a carrier power squelch works well. real FM receviers use a noise squelch, where
  19.     //the received audio is high-passed above the cutoff and then fed to a reverse squelch. If the power is then BELOW a threshold, open the squelch.
  20.  
  21. !   squelch_db = source->get_squelch_in();
  22. !         if (squelch_db!=0) {
  23. !       squelch = gr::analog::pwr_squelch_cc::make(squelch_db,      //squelch point
  24. !                                                            0.01,      //alpha
  25. !                              10,      //ramp
  26. !                              false);  // Non-blocking as we are using squelch_two as a gate.
  27. !
  28. !        //  based on squelch code form ham2mon
  29. !       squelch_two = gr::analog::pwr_squelch_ff::make(-200,    // set low -200 since its after demod and its just gate for previous squelch
  30. !                                   0.01,   //alpha
  31. !                                   0,  //ramp
  32. !                                   true);  //gated so that the audio recording doesn't contain blank spaces between transmissions
  33. !         }
  34.  
  35.  
  36.  
  37. ***************
  38. *** 102,118 ****
  39.     wav_sink = gr::blocks::wavfile_sink::make(filename,1,8000,16);
  40.  
  41.  
  42. !
  43. !   connect(self(),0, valve,0);
  44. !   connect(valve,0, prefilter,0);
  45. !   connect(prefilter, 0, downsample_sig, 0);
  46. !   connect(downsample_sig, 0, demod, 0);
  47. !   //connect(downsample_sig, 0, squelch, 0);
  48. !   //connect(squelch, 0,   demod, 0);
  49. !   connect(demod, 0, deemph, 0);
  50. !   connect(deemph, 0, decim_audio, 0);
  51. !   connect(decim_audio, 0, wav_sink, 0);
  52. !
  53.  
  54.   }
  55.  
  56. --- 110,136 ----
  57.     wav_sink = gr::blocks::wavfile_sink::make(filename,1,8000,16);
  58.  
  59.  
  60. !         if (squelch_db!=0) { 
  61. !       // using squelch
  62. !       connect(self(),0, valve,0);
  63. !       connect(valve,0, prefilter,0);
  64. !       connect(prefilter, 0, downsample_sig, 0);
  65. !       connect(downsample_sig, 0, squelch, 0);
  66. !       connect(squelch, 0, demod, 0);
  67. !       connect(demod, 0, deemph, 0);
  68. !       connect(deemph, 0, decim_audio, 0);
  69. !       connect(decim_audio, 0, squelch_two, 0);
  70. !       connect(squelch_two, 0, wav_sink, 0);
  71. !      } else {
  72. !       // No squelch used
  73. !       connect(self(),0, valve,0);
  74. !       connect(valve,0, prefilter,0);
  75. !       connect(prefilter, 0, downsample_sig, 0);
  76. !       connect(downsample_sig, 0, demod, 0);
  77. !       connect(demod, 0, deemph, 0);
  78. !       connect(deemph, 0, decim_audio, 0);
  79. !       connect(decim_audio, 0, wav_sink, 0);
  80. !   }
  81.  
  82.   }
  83.  
  84. diff -cr ./trunk-recorder-master/analog_recorder.h ./trunk-recorder-modded/analog_recorder.h
  85. *** ./trunk-recorder-master/analog_recorder.h   2016-04-20 19:38:18.000000000 -0600
  86. --- ./trunk-recorder-modded/analog_recorder.h   2016-05-03 21:27:16.000000000 -0600
  87. ***************
  88. *** 28,34 ****
  89.   #include <gnuradio/analog/quadrature_demod_cf.h>
  90.   #include <gnuradio/analog/sig_source_f.h>
  91.   #include <gnuradio/analog/sig_source_c.h>
  92. ! //#include <gnuradio/analog/pwr_squelch_cc.h>
  93.   #include <gnuradio/blocks/multiply_cc.h>
  94.   #include <gnuradio/blocks/file_sink.h>
  95.   #include <gnuradio/filter/rational_resampler_base_ccf.h>
  96. --- 28,35 ----
  97.   #include <gnuradio/analog/quadrature_demod_cf.h>
  98.   #include <gnuradio/analog/sig_source_f.h>
  99.   #include <gnuradio/analog/sig_source_c.h>
  100. ! #include <gnuradio/analog/pwr_squelch_cc.h>
  101. ! #include <gnuradio/analog/pwr_squelch_ff.h>
  102.   #include <gnuradio/blocks/multiply_cc.h>
  103.   #include <gnuradio/blocks/file_sink.h>
  104.   #include <gnuradio/filter/rational_resampler_base_ccf.h>
  105. ***************
  106. *** 67,72 ****
  107. --- 68,74 ----
  108.  
  109.     void deactivate();
  110.     double get_freq();
  111. +   double get_squelch_in();
  112.       Source *get_source();
  113.     long get_talkgroup();
  114.     bool is_active();
  115. ***************
  116. *** 79,84 ****
  117. --- 81,87 ----
  118.     bool muted;
  119.     long talkgroup;
  120.     long samp_rate;
  121. +   double squelch_db;
  122.     time_t timestamp;
  123.     time_t starttime;
  124.     char filename[160];
  125. ***************
  126. *** 112,118 ****
  127.     gr::filter::rational_resampler_base_ccf::sptr downsample_sig;
  128.     gr::filter::fir_filter_fff::sptr decim_audio;
  129.     gr::filter::rational_resampler_base_fff::sptr upsample_audio;
  130. !   //gr::analog::pwr_squelch_cc::sptr squelch;
  131.     gr::analog::quadrature_demod_cf::sptr demod;
  132.     gr::blocks::wavfile_sink::sptr wav_sink;
  133.     gr::blocks::file_sink::sptr raw_sink;
  134. --- 115,122 ----
  135.     gr::filter::rational_resampler_base_ccf::sptr downsample_sig;
  136.     gr::filter::fir_filter_fff::sptr decim_audio;
  137.     gr::filter::rational_resampler_base_fff::sptr upsample_audio;
  138. !   gr::analog::pwr_squelch_cc::sptr squelch;
  139. !   gr::analog::pwr_squelch_ff::sptr squelch_two;
  140.     gr::analog::quadrature_demod_cf::sptr demod;
  141.     gr::blocks::wavfile_sink::sptr wav_sink;
  142.     gr::blocks::file_sink::sptr raw_sink;
  143. ***************
  144. *** 125,128 ****
  145.   };
  146.  
  147.  
  148. ! #endif
  149. \ No newline at end of file
  150. --- 129,132 ----
  151.   };
  152.  
  153.  
  154. ! #endif
  155. diff -cr ./trunk-recorder-master/config-multi-rtl.json.sample ./trunk-recorder-modded/config-multi-rtl.json.sample
  156. *** ./trunk-recorder-master/config-multi-rtl.json.sample    2016-04-20 19:38:18.000000000 -0600
  157. --- ./trunk-recorder-modded/config-multi-rtl.json.sample    2016-05-03 21:35:31.000000000 -0600
  158. ***************
  159. *** 1,6 ****
  160. --- 1,7 ----
  161.   { "sources": [
  162.   {"center": 857800000.0,
  163.   "rate": 2048000.0,
  164. + "squelch": -50,
  165.   "error": 1800,
  166.   "ppm": 0,
  167.   "gain": 42,
  168. ***************
  169. *** 9,14 ****
  170. --- 10,16 ----
  171.   "device": "30"},
  172.   {"center": 855700000.0,
  173.   "rate": 2048000.0,
  174. + "squelch": -50,
  175.   "error": 1900,
  176.   "ppm": 0,
  177.   "gain": 42,
  178. ***************
  179. *** 28,32 ****
  180.     "control_channels": [855462500],
  181.     "type": "p25"
  182.     },
  183. ! "talkgroupsFile": "ChanList.csv"
  184.   }
  185. --- 30,35 ----
  186.     "control_channels": [855462500],
  187.     "type": "p25"
  188.     },
  189. ! "talkgroupsFile": "ChanList.csv",
  190. ! "defaultMode": "digital"
  191.   }
  192. diff -cr ./trunk-recorder-master/config-uhd.json.sample ./trunk-recorder-modded/config-uhd.json.sample
  193. *** ./trunk-recorder-master/config-uhd.json.sample  2016-04-20 19:38:18.000000000 -0600
  194. --- ./trunk-recorder-modded/config-uhd.json.sample  2016-05-03 21:35:31.000000000 -0600
  195. ***************
  196. *** 1,6 ****
  197. --- 1,7 ----
  198.   { "sources": [
  199.   {"center": 857000000.0,
  200.   "rate": 8000000.0,
  201. + "squelch": -50,
  202.   "error": 1400,
  203.   "gain": 16,
  204.   "antenna": "TX/RX",
  205. ***************
  206. *** 12,16 ****
  207.     "control_channels": [855462500],
  208.     "type": "p25"
  209.     },
  210. ! "talkgroupsFile": "ChanList.csv"
  211.   }
  212. --- 13,18 ----
  213.     "control_channels": [855462500],
  214.     "type": "p25"
  215.     },
  216. ! "talkgroupsFile": "ChanList.csv",
  217. ! "defaultMode": "digital"
  218.   }
  219. diff -cr ./trunk-recorder-master/dc-config.json ./trunk-recorder-modded/dc-config.json
  220. *** ./trunk-recorder-master/dc-config.json  2016-04-20 19:38:18.000000000 -0600
  221. --- ./trunk-recorder-modded/dc-config.json  2016-05-03 21:35:31.000000000 -0600
  222. ***************
  223. *** 1,6 ****
  224. --- 1,7 ----
  225.   { "sources": [
  226.   {"center": 857000000.0,
  227.   "rate": 8000000.0,
  228. + "squelch": -50,
  229.   "error": 0,
  230.   "gain": 40,
  231.   "antenna": "TX/RX",
  232. ***************
  233. *** 12,16 ****
  234.     "control_channels": [854862500],
  235.     "type": "smartnet"
  236.     },
  237. ! "talkgroupsFile": "ChanList.csv"
  238. ! }
  239. --- 13,18 ----
  240.     "control_channels": [854862500],
  241.     "type": "smartnet"
  242.     },
  243. ! "talkgroupsFile": "ChanList.csv",
  244. ! "defaultMode": "digital"
  245. ! }
  246. diff -cr ./trunk-recorder-master/main.cc ./trunk-recorder-modded/main.cc
  247. *** ./trunk-recorder-master/main.cc 2016-04-20 19:38:18.000000000 -0600
  248. --- ./trunk-recorder-modded/main.cc 2016-05-03 21:35:31.000000000 -0600
  249. ***************
  250. *** 62,67 ****
  251. --- 62,68 ----
  252.   std::vector<Call *> calls;
  253.   Talkgroups *talkgroups;
  254.   std::string talkgroups_file;
  255. + string default_mode;
  256.   string system_type;
  257.   string system_modulation;
  258.   bool qpsk_mod = true;
  259. ***************
  260. *** 133,138 ****
  261. --- 134,140 ----
  262.           BOOST_LOG_TRIVIAL(info);
  263.  
  264.           talkgroups_file = pt.get<std::string>("talkgroupsFile","");
  265. +         default_mode = pt.get<std::string>("defaultMode","analog");
  266.           BOOST_LOG_TRIVIAL(info) << "Talkgroups File: " << talkgroups_file;
  267.           system_type = pt.get<std::string>("system.type");
  268.           boost::optional<std::string> mod_exists = pt.get_optional<std::string>("system.modulation");
  269. ***************
  270. *** 159,164 ****
  271. --- 161,167 ----
  272.               int gain = node.second.get<int>("gain",0);
  273.               int if_gain = node.second.get<int>("ifGain",0);
  274.               int bb_gain = node.second.get<int>("bbGain",0);
  275. +             double squelch_in = node.second.get<double>("squelch",0);
  276.               std::string antenna = node.second.get<string>("antenna","");
  277.               int digital_recorders = node.second.get<int>("digitalRecorders",0);
  278.               int debug_recorders = node.second.get<int>("debugRecorders",0);
  279. ***************
  280. *** 174,179 ****
  281. --- 177,183 ----
  282.               BOOST_LOG_TRIVIAL(info) << "Gain: " << node.second.get<int>("gain",0);
  283.               BOOST_LOG_TRIVIAL(info) << "IF Gain: " << node.second.get<int>("ifGain",0);
  284.               BOOST_LOG_TRIVIAL(info) << "BB Gain: " << node.second.get<int>("bbGain",0);
  285. +             BOOST_LOG_TRIVIAL(info) << "Squelch: " << node.second.get<double>("squelch",0);
  286.  
  287.               BOOST_LOG_TRIVIAL(info) << "Digital Recorders: " << node.second.get<int>("digitalRecorders",0);
  288.               BOOST_LOG_TRIVIAL(info) << "Debug Recorders: " << node.second.get<int>("debugRecorders",0);
  289. ***************
  290. *** 186,192 ****
  291.                   error = 0;
  292.               }
  293.  
  294. !             Source *source = new Source(center,rate,error,driver,device);
  295.               BOOST_LOG_TRIVIAL(info) << "Max HZ: " << source->get_max_hz();
  296.               BOOST_LOG_TRIVIAL(info) << "Min HZ: " << source->get_min_hz();
  297.               source->set_if_gain(if_gain);
  298. --- 190,196 ----
  299.                   error = 0;
  300.               }
  301.  
  302. !             Source *source = new Source(center,rate,squelch_in,error,driver,device);
  303.               BOOST_LOG_TRIVIAL(info) << "Max HZ: " << source->get_max_hz();
  304.               BOOST_LOG_TRIVIAL(info) << "Min HZ: " << source->get_min_hz();
  305.               source->set_if_gain(if_gain);
  306. ***************
  307. *** 267,274 ****
  308.                       }
  309.                   } else {
  310.                       BOOST_LOG_TRIVIAL(error) << "\tTalkgroup not found: " << call->get_freq() << " For TG: " << call->get_talkgroup();
  311. !
  312. !                     recorder = source->get_digital_recorder(2);
  313.                   }
  314.                  
  315.                   int total_recorders = get_total_recorders();
  316. --- 271,281 ----
  317.                       }
  318.                   } else {
  319.                       BOOST_LOG_TRIVIAL(error) << "\tTalkgroup not found: " << call->get_freq() << " For TG: " << call->get_talkgroup();
  320. !                     if (default_mode == "analog") {
  321. !                         recorder = source->get_analog_recorder(2) ;
  322. !                     } else {
  323. !                         recorder = source->get_digital_recorder(2);
  324. !                     }
  325.                   }
  326.                  
  327.                   int total_recorders = get_total_recorders();
  328. diff -cr ./trunk-recorder-master/README.md ./trunk-recorder-modded/README.md
  329. *** ./trunk-recorder-master/README.md   2016-04-20 19:38:18.000000000 -0600
  330. --- ./trunk-recorder-modded/README.md   2016-05-03 21:35:31.000000000 -0600
  331. ***************
  332. *** 61,66 ****
  333. --- 61,67 ----
  334.       "sources": [{
  335.           "center": 857000000.0,
  336.           "rate": 8000000.0,
  337. +         "squelch": -50,
  338.           "error": 0,
  339.           "gain": 40,
  340.           "antenna": "TX/RX",
  341. ***************
  342. *** 80,85 ****
  343. --- 81,87 ----
  344.    - **sources** - an array of JSON objects that define the different SDRs available and how to configure them
  345.      - **center** - the center frequency in Hz to tune the SDR to
  346.      - **rate** - the sampling rate to set the SDR to, in samples / second
  347. +    - **squelch** - Analog Squelch, Set each source when using multiple sources, my rtl-sdr's are around -60. [0 = Disabled]
  348.      - **error** - the tuning error for the SDR in Hz. This is the difference between the target value and the actual value. So if you wanted to recv 856MHz but you had to tune your SDR to 855MHz to actually recieve it, you would set this to -1000000. You should also probably get a new SDR.
  349.      - **gain** - the RF gain to set the SDR to. Use a program like GQRX to find a good value.
  350.      - **ifGain** - [hackrf only] sets the ifgain.
  351. ***************
  352. *** 94,100 ****
  353.      - **type** - the type of trunking system. The options are *smartnet* & *p25*.
  354.      - **modulation** - the type of modulation that the system uses. The options are *QPSK* & *FSK4*.
  355.    - **talkgroupsFile** - this is a CSV file that provides information about the talkgroups. It determines whether a talkgroup is analog or digital, and what priority it should have.
  356. !
  357.   **ChanList.csv**
  358.  
  359.   This file provides info on the different talkgroups in a trunking system. A lot of this info can be found on the Radio Reference website. You need to be a site member to download the table for your system. If you are not, try clicking on the "List All in one table" link, selecting everything in the table and copying it into Excel or a spreadsheet.
  360. --- 96,102 ----
  361.      - **type** - the type of trunking system. The options are *smartnet* & *p25*.
  362.      - **modulation** - the type of modulation that the system uses. The options are *QPSK* & *FSK4*.
  363.    - **talkgroupsFile** - this is a CSV file that provides information about the talkgroups. It determines whether a talkgroup is analog or digital, and what priority it should have.
  364. ! - **defaultMode** - Default mode to use when a talkgroups is not listed in the **talkgroupsFile** [digital/analog].
  365.   **ChanList.csv**
  366.  
  367.   This file provides info on the different talkgroups in a trunking system. A lot of this info can be found on the Radio Reference website. You need to be a site member to download the table for your system. If you are not, try clicking on the "List All in one table" link, selecting everything in the table and copying it into Excel or a spreadsheet.
  368. diff -cr ./trunk-recorder-master/source.cc ./trunk-recorder-modded/source.cc
  369. *** ./trunk-recorder-master/source.cc   2016-04-20 19:38:18.000000000 -0600
  370. --- ./trunk-recorder-modded/source.cc   2016-05-03 21:35:16.000000000 -0600
  371. ***************
  372. *** 25,30 ****
  373. --- 25,33 ----
  374.   double Source::get_rate() {
  375.     return rate;
  376.   }
  377. + double Source::get_squelch_in() {
  378. +   return squelch_in;
  379. + }
  380.   std::string Source::get_driver() {
  381.     return driver;
  382.   }
  383. ***************
  384. *** 90,95 ****
  385. --- 93,102 ----
  386.   }
  387.   Recorder * Source::get_analog_recorder(int priority)
  388.   {
  389. +   if (priority> 99) {
  390. +       BOOST_LOG_TRIVIAL(info) << "\t\tNot recording because of priority";
  391. +       return NULL;
  392. +   }
  393.     for(std::vector<analog_recorder_sptr>::iterator it = analog_recorders.begin(); it != analog_recorders.end(); it++) {
  394.         analog_recorder_sptr rx = *it;
  395.         if (!rx->is_active())
  396. ***************
  397. *** 179,188 ****
  398.   gr::basic_block_sptr Source::get_src_block() {
  399.     return source_block;
  400.   }
  401. ! Source::Source(double c, double r, double e, std::string drv, std::string dev)
  402.   {
  403.     rate = r;
  404.     center = c;
  405.     error = e;
  406.     min_hz = center - (rate/2);
  407.     max_hz = center + (rate/2);
  408. --- 186,197 ----
  409.   gr::basic_block_sptr Source::get_src_block() {
  410.     return source_block;
  411.   }
  412. ! //Source::Source(double c, double r, double e, std::string drv, std::string dev)
  413. ! Source::Source(double c, double r, double q, double e, std::string drv, std::string dev)
  414.   {
  415.     rate = r;
  416.     center = c;
  417. +   squelch_in = q;
  418.     error = e;
  419.     min_hz = center - (rate/2);
  420.     max_hz = center + (rate/2);
  421. diff -cr ./trunk-recorder-master/source.h ./trunk-recorder-modded/source.h
  422. *** ./trunk-recorder-master/source.h    2016-04-20 19:38:18.000000000 -0600
  423. --- ./trunk-recorder-modded/source.h    2016-05-03 21:27:16.000000000 -0600
  424. ***************
  425. *** 17,22 ****
  426. --- 17,23 ----
  427.     double max_hz;
  428.     double center;
  429.     double rate;
  430. +   double squelch_in;
  431.       double actual_rate;
  432.     double error;
  433.       double ppm;
  434. ***************
  435. *** 37,48 ****
  436.  
  437.   public:
  438.     int get_num_available_recorders();
  439. !   Source(double c, double r, double e, std::string driver, std::string device);
  440.     gr::basic_block_sptr get_src_block();
  441.     double get_min_hz();
  442.     double get_max_hz();
  443.     double get_center();
  444.     double get_rate();
  445.     std::string get_driver();
  446.     std::string get_device();
  447.     void set_antenna(std::string ant);
  448. --- 38,50 ----
  449.  
  450.   public:
  451.     int get_num_available_recorders();
  452. !   Source(double c, double r, double q, double e, std::string driver, std::string device);
  453.     gr::basic_block_sptr get_src_block();
  454.     double get_min_hz();
  455.     double get_max_hz();
  456.     double get_center();
  457.     double get_rate();
  458. +   double get_squelch_in();
  459.     std::string get_driver();
  460.     std::string get_device();
  461.     void set_antenna(std::string ant);
Add Comment
Please, Sign In to add comment