GNU Radio's FOOT Package
packetsource_usrp.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2010 Michael Ossmann
4  * Copyright 2009, 2010 Mike Kershaw
5  *
6  * This file is part of gr-bluetooth
7  *
8  * gr-bluetooth is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * gr-bluetooth is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with gr-bluetooth; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef __PACKETSOURCE_USRP_H__
25 #define __PACKETSOURCE_USRP_H__
26 
27 #include "config.h"
28 
29 #include <packetsource.h>
30 #include "bluetooth_top_block.h"
31 
32 #define USE_PACKETSOURCE_USRP
33 
34 class PacketSource_USRP : public KisPacketSource {
35 public:
37  fprintf(stderr, "FATAL OOPS: Packetsource_USRP()\n");
38  exit(1);
39  }
40 
41  PacketSource_USRP(GlobalRegistry *in_globalreg) :
42  KisPacketSource(in_globalreg) {
43 
44  }
45 
46  virtual KisPacketSource *CreateSource(GlobalRegistry *in_globalreg,
47  string in_interface,
48  vector<opt_pair> *in_opts) {
49  return new PacketSource_USRP(in_globalreg, in_interface, in_opts);
50  }
51 
52  virtual int AutotypeProbe(string in_device);
53 
54  virtual int RegisterSources(Packetsourcetracker *tracker) {
55  tracker->RegisterPacketProto("usrp", this, "BLUETOOTH", 0);
56  return 1;
57  }
58 
59  PacketSource_USRP(GlobalRegistry *in_globalreg, string in_interface,
60  vector<opt_pair> *in_opts);
61 
62  virtual ~PacketSource_USRP();
63 
64  virtual int ParseOptions(vector<opt_pair> *in_opts);
65 
66  virtual int OpenSource();
67  virtual int CloseSource();
68 
69  virtual int FetchChannelCapable() { return 1; }
70  virtual int EnableMonitor() { return 1; }
71  virtual int DisableMonitor() { return 1; }
72 
73  virtual int SetChannel(unsigned int in_ch);
74 
75  virtual int FetchDescriptor();
76  virtual int Poll();
77 
78  unsigned int channel;
79 
80 protected:
81  virtual void FetchRadioData(kis_packet *in_packet) { };
82 
83  int btbb_packet_id;
84 
86 
87  pthread_t cap_thread;
88 
89  // Named USB interface
90  string usb_dev;
91 
92  // GNU Radio flowgraph
93  bluetooth_top_block_sptr top_block;
94  bluetooth_kismet_block_sptr kblock;
95 
96  //struct usb_dev_handle *devhdl;
97 
98  // Error from thread
99  string thread_error;
100 
101  friend void *usrp_cap_thread(void *);
102 
103  void packet_callback(char *pkt, int len);
104 
105 };
106 
107 #endif
virtual int DisableMonitor()
Definition: packetsource_usrp.h:71
virtual int FetchDescriptor()
virtual int EnableMonitor()
Definition: packetsource_usrp.h:70
virtual int OpenSource()
virtual int Poll()
int thread_active
Definition: packetsource_usrp.h:85
pthread_t cap_thread
Definition: packetsource_usrp.h:87
virtual KisPacketSource * CreateSource(GlobalRegistry *in_globalreg, string in_interface, vector< opt_pair > *in_opts)
Definition: packetsource_usrp.h:46
friend void * usrp_cap_thread(void *)
virtual int AutotypeProbe(string in_device)
bluetooth_top_block_sptr top_block
Definition: packetsource_usrp.h:93
virtual void FetchRadioData(kis_packet *in_packet)
Definition: packetsource_usrp.h:81
virtual int RegisterSources(Packetsourcetracker *tracker)
Definition: packetsource_usrp.h:54
string usb_dev
Definition: packetsource_usrp.h:90
virtual int SetChannel(unsigned int in_ch)
virtual ~PacketSource_USRP()
int btbb_packet_id
Definition: packetsource_usrp.h:81
Definition: packetsource_usrp.h:34
PacketSource_USRP(GlobalRegistry *in_globalreg)
Definition: packetsource_usrp.h:41
unsigned int channel
Definition: packetsource_usrp.h:78
void packet_callback(char *pkt, int len)
PacketSource_USRP()
Definition: packetsource_usrp.h:36
bluetooth_kismet_block_sptr kblock
Definition: packetsource_usrp.h:94
virtual int CloseSource()
string thread_error
Definition: packetsource_usrp.h:99
virtual int ParseOptions(vector< opt_pair > *in_opts)
virtual int FetchChannelCapable()
Definition: packetsource_usrp.h:69