forked from sdr/gr-osmosdr
parent
f4f5918c25
commit
9a5e93cf0d
@ -0,0 +1,27 @@ |
||||
if(NOT LIBOSMOSDR_FOUND) |
||||
pkg_check_modules (LIBOSMOSDR_PKG libosmosdr) |
||||
find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h |
||||
PATHS |
||||
${LIBOSMOSDR_PKG_INCLUDE_DIRS} |
||||
/usr/include |
||||
/usr/local/include |
||||
) |
||||
|
||||
find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr |
||||
PATHS |
||||
${LIBOSMOSDR_PKG_LIBRARY_DIRS} |
||||
/usr/lib |
||||
/usr/local/lib |
||||
) |
||||
|
||||
if(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) |
||||
set(LIBOSMOSDR_FOUND TRUE CACHE INTERNAL "libosmosdr found") |
||||
message(STATUS "Found libosmosdr: ${LIBOSMOSDR_INCLUDE_DIR}, ${LIBOSMOSDR_LIBRARIES}") |
||||
else(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) |
||||
set(LIBOSMOSDR_FOUND FALSE CACHE INTERNAL "libosmosdr found") |
||||
message(STATUS "libosmosdr not found.") |
||||
endif(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) |
||||
|
||||
mark_as_advanced(LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES) |
||||
|
||||
endif(NOT LIBOSMOSDR_FOUND) |
@ -1,105 +0,0 @@ |
||||
/* -*- c++ -*- */ |
||||
/*
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net> |
||||
* |
||||
* GNU Radio is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation; either version 3, or (at your option) |
||||
* any later version. |
||||
* |
||||
* GNU Radio is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with GNU Radio; see the file COPYING. If not, write to |
||||
* the Free Software Foundation, Inc., 51 Franklin Street, |
||||
* Boston, MA 02110-1301, USA. |
||||
*/ |
||||
|
||||
#include <fstream> |
||||
#include <string> |
||||
#include <sstream> |
||||
|
||||
#include <boost/assign.hpp> |
||||
|
||||
#include "osmosdr_control.h" |
||||
|
||||
using namespace boost::assign; |
||||
|
||||
osmosdr_control::osmosdr_control(const std::string &args) |
||||
{ |
||||
/* lookup acm control channel device name for a given alsa device name */ |
||||
|
||||
/*
|
||||
if (args.empty()) |
||||
pick first available device or throw an exception(); |
||||
*/ |
||||
} |
||||
|
||||
osmosdr_control::~osmosdr_control() |
||||
{ |
||||
} |
||||
|
||||
/*
|
||||
1 [OsmoSDR ]: USB-Audio - OsmoSDR |
||||
sysmocom OsmoSDR at usb-0000:00:06.1-2, high speed |
||||
*/ |
||||
std::vector< std::string > osmosdr_control::find_devices() |
||||
{ |
||||
std::vector< std::string > devices; |
||||
|
||||
std::string line; |
||||
std::ifstream cards( "/proc/asound/cards" ); |
||||
if ( cards.is_open() ) |
||||
{ |
||||
while ( cards.good() ) |
||||
{ |
||||
getline (cards, line); |
||||
|
||||
if ( line.find( "USB-Audio - OsmoSDR" ) != std::string::npos ) |
||||
{ |
||||
int id; |
||||
std::istringstream( line ) >> id; |
||||
|
||||
std::ostringstream hw_id; |
||||
hw_id << "hw:" << id; // build alsa identifier
|
||||
|
||||
devices += hw_id.str(); |
||||
} |
||||
} |
||||
|
||||
cards.close(); |
||||
} |
||||
|
||||
return devices; |
||||
} |
||||
|
||||
std::string osmosdr_control::audio_dev_name() |
||||
{ |
||||
return "hw:1"; |
||||
} |
||||
|
||||
std::string osmosdr_control::control_dev_name() |
||||
{ |
||||
return "/dev/ttyUSB0"; |
||||
} |
||||
|
||||
osmosdr_rx_control::osmosdr_rx_control(const std::string &args) : |
||||
osmosdr_control(args) |
||||
{ |
||||
} |
||||
|
||||
osmosdr_rx_control::~osmosdr_rx_control() |
||||
{ |
||||
} |
||||
|
||||
osmosdr_tx_control::osmosdr_tx_control(const std::string &args) : |
||||
osmosdr_control(args) |
||||
{ |
||||
} |
||||
|
||||
osmosdr_tx_control::~osmosdr_tx_control() |
||||
{ |
||||
} |
@ -1,67 +0,0 @@ |
||||
/* -*- c++ -*- */ |
||||
/*
|
||||
* Copyright 2012 Dimitri Stolnikov <horiz0n@gmx.net> |
||||
* |
||||
* GNU Radio is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation; either version 3, or (at your option) |
||||
* any later version. |
||||
* |
||||
* GNU Radio is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with GNU Radio; see the file COPYING. If not, write to |
||||
* the Free Software Foundation, Inc., 51 Franklin Street, |
||||
* Boston, MA 02110-1301, USA. |
||||
*/ |
||||
#ifndef OSMOSDR_CONTROL_H |
||||
#define OSMOSDR_CONTROL_H |
||||
|
||||
#include <string> |
||||
#include <complex> |
||||
#include <osmosdr_ranges.h> |
||||
|
||||
/*!
|
||||
* session object to cdc-acm based control channel of the device |
||||
*/ |
||||
class osmosdr_control |
||||
{ |
||||
public: |
||||
osmosdr_control(const std::string &args); |
||||
virtual ~osmosdr_control(); |
||||
|
||||
/*!
|
||||
* Discovers all devices connected to the host computer. |
||||
* \return a vector of device addresses |
||||
*/ |
||||
static std::vector< std::string > find_devices(); |
||||
|
||||
protected: |
||||
std::string audio_dev_name(); |
||||
std::string control_dev_name(); |
||||
}; |
||||
|
||||
/*!
|
||||
* osmosdr_source class derives from this class to be able to control the device |
||||
*/ |
||||
class osmosdr_rx_control : public osmosdr_control |
||||
{ |
||||
public: |
||||
osmosdr_rx_control(const std::string &args); |
||||
virtual ~osmosdr_rx_control(); |
||||
}; |
||||
|
||||
/*!
|
||||
* osmosdr_sink class derives from this class to be able to control the device |
||||
*/ |
||||
class osmosdr_tx_control : public osmosdr_control |
||||
{ |
||||
public: |
||||
osmosdr_tx_control(const std::string &args); |
||||
virtual ~osmosdr_tx_control(); |
||||
}; |
||||
|
||||
#endif // OSMOSDR_CONTROL_H
|
Loading…
Reference in new issue