Jpp
KM3NeT_Audio_Channel.h
Go to the documentation of this file.
1 #ifndef KM3NET_AUDIO_CHANNEL_H_
2 #define KM3NET_AUDIO_CHANNEL_H_
3 /**
4  * \author fsimeone
5  */
6 
7 
8 #include <cstdio>
9 #include <cstdlib>
10 #include <ctime>
11 
12 #include <boost/asio.hpp>
13 #include <boost/bind.hpp>
14 #include <boost/function.hpp>
15 
16 #include "KM3NeT_Audio_Data.h"
17 #include "toalib/km3_toa_lib.hpp"
18 
19 
21 typedef boost::shared_ptr<KM3::TOALIB::CTOAFinder::probeSignalT> pProbe;
22 typedef boost::function<void(ToA_Packet packet)> callback_send_toa;
23 
24 //#define DEBUG_KM3NET_AUDIO_CHANNEL
25 #define MAX_DUMP_SIZE 4194304
26 
28 {
29 public:
30  static const int DEBUG_LEVEL=2;
31 
32  KM3NeT_Audio_Channel( boost::asio::io_service& io_service,\
33  callback_send_toa callback,\
34  uint32_t id,\
35  std::string& debug_path,\
36  uint32_t window=STD_WINDOW,\
37  uint32_t overlap=STD_OVERLAP);
38  virtual ~KM3NeT_Audio_Channel();
39 
40  void Add_probe(pProbe probe, std::size_t id, std::size_t threshold);
41  void Append(real_type sample);
42  void Check_time(Audio_Header header){data_.Check_time(header);};
43  void Set_test(uint32_t id){test_=id;};
44 
45 private:
46  void Analysis(ToA_Packet packet,real_type* buffer,uint32_t length);
47  boost::asio::io_service::strand strand_;
50 
52 
53  uint32_t id_;
54 
55  KM3::TOALIB::CTOAFinder finder_;
57 
58  std::string debug_files_path_;
59  void Open_test_file(uint32_t id, uint8_t ch);
60  uint32_t test_;
61  uint32_t overlap_;
62  std::FILE* test_file_;
63 };
64 
65 #endif
KM3NeT_Audio_Channel::id_
uint32_t id_
Definition: KM3NeT_Audio_Channel.h:53
KM3NeT_Audio_Channel::finder_
KM3::TOALIB::CTOAFinder finder_
Definition: KM3NeT_Audio_Channel.h:55
KM3NeT_Audio_Channel::test_
uint32_t test_
Definition: KM3NeT_Audio_Channel.h:60
KM3NeT_Audio_Channel::Add_probe
void Add_probe(pProbe probe, std::size_t id, std::size_t threshold)
Definition: KM3NeT_Audio_Channel.cpp:42
KM3NeT_Audio_Data
Definition: KM3NeT_Audio_Data.h:19
STD_WINDOW
#define STD_WINDOW
Definition: KM3NeT_Audio_Data.h:9
KM3NeT_Audio_Channel::DEBUG_LEVEL
static const int DEBUG_LEVEL
Definition: KM3NeT_Audio_Channel.h:30
ToA_Packet
Definition: Audio_Structures.h:85
std::vector< std::size_t >
KM3NeT_Audio_Channel::probes_id_
std::vector< std::size_t > probes_id_
Definition: KM3NeT_Audio_Channel.h:49
KM3NeT_Audio_Channel::~KM3NeT_Audio_Channel
virtual ~KM3NeT_Audio_Channel()
Definition: KM3NeT_Audio_Channel.cpp:36
KM3NeT_Audio_Channel::Analysis
void Analysis(ToA_Packet packet, real_type *buffer, uint32_t length)
Definition: KM3NeT_Audio_Channel.cpp:60
KM3NeT_Audio_Channel::Set_test
void Set_test(uint32_t id)
Definition: KM3NeT_Audio_Channel.h:43
JTOOLS::overlap
bool overlap(const JRange< T, JComparator_t > &first, const JRange< T, JComparator_t > &second)
Test overlap between ranges.
Definition: JRange.hh:653
KM3NeT_Audio_Data::Check_time
void Check_time(Audio_Header header)
Definition: KM3NeT_Audio_Data.cpp:42
KM3NeT_Audio_Data.h
KM3NeT_Audio_Channel::KM3NeT_Audio_Channel
KM3NeT_Audio_Channel(boost::asio::io_service &io_service, callback_send_toa callback, uint32_t id, std::string &debug_path, uint32_t window=STD_WINDOW, uint32_t overlap=STD_OVERLAP)
Definition: KM3NeT_Audio_Channel.cpp:17
pProbe
boost::shared_ptr< KM3::TOALIB::CTOAFinder::probeSignalT > pProbe
Definition: KM3NeT_Audio_Channel.h:21
KM3NeT_Audio_Channel
Definition: KM3NeT_Audio_Channel.h:27
callback_send_toa
boost::function< void(ToA_Packet packet)> callback_send_toa
Definition: KM3NeT_Audio_Channel.h:22
Audio_Header
Definition: Audio_Structures.h:47
KM3NeT_Audio_Channel::send_toa_
callback_send_toa send_toa_
Definition: KM3NeT_Audio_Channel.h:51
threshold_entry
std::pair< std::size_t, std::size_t > threshold_entry
Definition: KM3NeT_Audio_Channel.h:20
std::map< std::size_t, std::size_t >
std::pair
Definition: JSTDTypes.hh:15
KM3NeT_Audio_Channel::Open_test_file
void Open_test_file(uint32_t id, uint8_t ch)
Definition: KM3NeT_Audio_Channel.cpp:127
KM3NeT_Audio_Channel::test_file_
std::FILE * test_file_
Definition: KM3NeT_Audio_Channel.h:62
KM3NeT_Audio_Channel::data_
KM3NeT_Audio_Data data_
Definition: KM3NeT_Audio_Channel.h:56
KM3NeT_Audio_Channel::Append
void Append(real_type sample)
Definition: KM3NeT_Audio_Channel.cpp:49
KM3NeT_Audio_Channel::Check_time
void Check_time(Audio_Header header)
Definition: KM3NeT_Audio_Channel.h:42
STD_OVERLAP
#define STD_OVERLAP
Definition: KM3NeT_Audio_Data.h:10
KM3NeT_Audio_Channel::strand_
boost::asio::io_service::strand strand_
Definition: KM3NeT_Audio_Channel.h:47
KM3NeT_Audio_Channel::debug_files_path_
std::string debug_files_path_
Definition: KM3NeT_Audio_Channel.h:58
KM3NeT_Audio_Channel::thresholds_
std::map< std::size_t, std::size_t > thresholds_
Definition: KM3NeT_Audio_Channel.h:48
KM3NeT_Audio_Channel::overlap_
uint32_t overlap_
Definition: KM3NeT_Audio_Channel.h:61