GNU Radio's TEST Package
xtrx_obj.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2017 Sergey Kostanbaev <sergey.kostanbaev@fairwaves.co>
4  *
5  * GNU Radio is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * GNU Radio is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with GNU Radio; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 #ifndef XTRX_OBJ_H
21 #define XTRX_OBJ_H
22 
23 #include <boost/shared_ptr.hpp>
24 #include <xtrx_api.h>
25 #include <map>
26 #include <vector>
27 #include <boost/thread/mutex.hpp>
28 
29 class xtrx_obj;
30 
31 typedef std::shared_ptr<xtrx_obj> xtrx_obj_sptr;
32 
33 class xtrx_obj
34 {
35 public:
36  xtrx_obj(const std::string& path, unsigned loglevel, bool lmsreset);
38 
39  static std::vector<std::string> get_devices();
40 
41  static xtrx_obj_sptr get(const char* xtrx_dev,
42  unsigned loglevel,
43  bool lmsreset);
44  static void clear_all();
45 
46  xtrx_dev* dev() { return _obj; }
47  unsigned dev_count() { return _devices; }
48 
49  double set_smaplerate(double rate, double master, bool sink, unsigned flags);
50 
51  void set_vio(unsigned vio) { _vio = vio; }
52 
53  boost::mutex mtx;
54 protected:
55  xtrx_dev* _obj;
56  bool _run;
57  unsigned _vio;
58 
59  double _sink_rate;
60  double _sink_master;
61  double _source_rate;
63 
64  unsigned _flags;
65  unsigned _devices;
66 };
67 
68 #endif // XTRX_OBJ_H
Definition: xtrx_obj.h:34
xtrx_dev * dev()
Definition: xtrx_obj.h:46
unsigned dev_count()
Definition: xtrx_obj.h:47
static xtrx_obj_sptr get(const char *xtrx_dev, unsigned loglevel, bool lmsreset)
unsigned _flags
Definition: xtrx_obj.h:64
double set_smaplerate(double rate, double master, bool sink, unsigned flags)
double _source_master
Definition: xtrx_obj.h:62
double _sink_rate
Definition: xtrx_obj.h:59
boost::mutex mtx
Definition: xtrx_obj.h:53
bool _run
Definition: xtrx_obj.h:56
double _sink_master
Definition: xtrx_obj.h:60
static std::vector< std::string > get_devices()
xtrx_obj(const std::string &path, unsigned loglevel, bool lmsreset)
static void clear_all()
void set_vio(unsigned vio)
Definition: xtrx_obj.h:51
xtrx_dev * _obj
Definition: xtrx_obj.h:55
unsigned _vio
Definition: xtrx_obj.h:57
double _source_rate
Definition: xtrx_obj.h:61
unsigned _devices
Definition: xtrx_obj.h:65