📄 port.cpp
字号:
/*************************************************************************** port.cpp - The definition for the port ------------------- begin : 2002 authors : Linus Gasser emails : linus.gasser@epfl.ch***************************************************************************//*************************************************************************** Changes ------- date - name - description 02-12-19 - ineiti - begin **************************************************************************//*************************************************************************** * * * This program 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 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************//** * @short Holds the definition of a port */#include <qapplication.h>#include <qregexp.h>#include <iostream>#include <stdlib.h>#include <unistd.h>#include <math.h>#include "port.h"#include "swr_types.h"// this is the standard C++-way of using cout <<using namespace std;/** * Initialises a port, that is, checks for it's validity and * puts the right filename */Port::Port( FifoCmd *c, int m_i, int p ) : radio( c ), module_id( m_i ), portNum( p ) { QStringList ports = radio->getOutputs( module_id ); if ( (uint)portNum >= ports.count() ){ cout << "This port is higher than port_count...\n"; return; } QStringList args( QStringList::split( ",", ports[ portNum ] ) ); sig_type = (swr_signal_type_t)args[2].toInt(); length = args[3].toInt(); blockName = QString( "port_out %1" ).arg( p );}QByteArray Port::getData( ){ QByteArray data = radio->getPort( module_id, portNum ); if ( !data.size() ){ cout << "Block-size is zero...\n"; return QByteArray( 0 ); } length = data.size() / TypeSize(); return data;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -