Skip to content
Snippets Groups Projects
Commit 6a9a83b0 authored by tho's avatar tho
Browse files

added first (prototype) handle for the DVB frontend device

parent 0df47ce1
No related branches found
No related tags found
No related merge requests found
File moved
Import('env')
import SENFSCons
###########################################################################
import glob
import os.path
SENFSCons.Binary(env, 'uledec', 'ULEdec.cc',
LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ],
OBJECTS = [ '#/Packets/MPEGDVBBundle/MPEGDVBBundle.o' ]);
###########################################################################
SENFSCons.Binary(env, 'mpedec', 'MPEdec.cc',
for f in glob.glob('*.cc'):
bin = os.path.splitext(f)[0]
SENFSCons.Binary(env, bin, f,
LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ],
OBJECTS = [ '#/Packets/MPEGDVBBundle/MPEGDVBBundle.o' ]);
File moved
// $Id: ULEdec.cc 327 2007-07-20 10:03:44Z tho $
//
// Copyright (C) 2006
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
//
// 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.
//
// This program 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 this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string>
#include <iostream>
#include <iomanip>
#include <sys/ioctl.h>
#include <linux/sockios.h>
#include <linux/dvb/dmx.h>
#include "Scheduler/Scheduler.hh"
#include "Packets/DefaultBundle/EthernetPacket.hh"
#include "Packets/MPEGDVBBundle/DatagramSection.hh"
#include "Utils/membind.hh"
#include "Socket/DVBFrontendHandle.hh"
#include "Packets/ParseInt.hh"
#include "Packets/Packet.hh"
#include "Packets/PacketData.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
int main(int argc, char const * argv[])
{
try {
senf::DVBFrontendHandle handle;
int16_t strength;
while (true) {
handle.protocol().signalStrength(&strength);
std::cout << "signal strength: " << strength << "\n";
sleep(1);
}
}
catch (std::exception const & ex) {
std::cerr << senf::prettyName(typeid(ex)) << ": " << ex.what() << "\n";
}
return 0;
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
// Local Variables:
// mode: c++
// fill-column: 100
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// comment-column: 40
// End:
......@@ -135,7 +135,7 @@
\li <a href="../../DefaultBundle/doc/html/index.html">DefaultBundle</a>: Some basic
default protocols: Ethernet, Ip, TCP, UDP
\li <a href="../../MPEG_DVBBundle/doc/html/index.html">MPEG_DVBBundle</a>: MPEG and DVB
\li <a href="../../MPEGDVBBundle/doc/html/index.html">MPEGDVBBundle</a>: MPEG and DVB
protocols
*/
......
......@@ -28,11 +28,9 @@
#define HH_DVBDemuxHandles_ 1
// Custom includes
#include "BSDSocketProtocol.hh"
#include "FramingPolicy.hh"
#include "CommunicationPolicy.hh"
#include "ReadWritePolicy.hh"
#include "BufferingPolicy.hh"
#include "ProtocolClientSocketHandle.hh"
#include "DVBDemuxProtocol.hh"
......
......@@ -39,8 +39,6 @@
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
prefix_ void senf::DVBDemuxProtocol::setBufferSize(unsigned long size)
const
{
......
......@@ -31,7 +31,6 @@
// Custom includes
#include "SocketProtocol.hh"
#include "INetAddressing.hh"
//#include "DVBProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
......@@ -54,15 +53,11 @@ namespace senf {
///\name Abstract Interface Implementation
///@{
//unsigned available() const;
bool eof() const;
///@}
};
}
///////////////////////////////hh.e////////////////////////////////////////
......
// $Id: DVBDemuxHandles.cc 329 2007-07-20 12:29:34Z tho $
//
// Copyright (C) 2007
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
//
// 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.
//
// This program 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 this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief xxx
*/
#include "DVBFrontendHandle.hh"
//#include "DVBFrontendHandle.ih"
// Custom includes
#include <sys/types.h>
#include <sys/socket.h>
#include <iostream>
#include <string>
#include <sys/ioctl.h>
#include <linux/sockios.h>
#include <stdio.h>
#include <fcntl.h>
#include "SocketHandle.hh"
#include "Utils/Exception.hh"
//#include "DVBFrontendHandle.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// senf::DVBFrontendHandle
prefix_ void senf::DVBFrontendProtocol::init_client()
const
{
int fd = open("/dev/dvb/adapter0/frontend0", O_RDONLY | O_NONBLOCK);
if (fd < 0)
throw SystemException(errno);
body().fd(fd);
}
prefix_ unsigned senf::DVBFrontendProtocol::available()
const
{
return 0;
}
prefix_ bool senf::DVBFrontendProtocol::eof()
const
{
return false;
}
prefix_ std::auto_ptr<senf::SocketProtocol> senf::DVBFrontendProtocol::clone()
const
{
return std::auto_ptr<SocketProtocol>(new DVBFrontendProtocol());
}
prefix_ void senf::DVBFrontendProtocol::signalStrength(int16_t *strength)
const
{
if (::ioctl(body().fd(), FE_READ_SIGNAL_STRENGTH, strength) < 0)
throw SystemException(errno);
}
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "DVBFrontendHandle.mpp"
// Local Variables:
// mode: c++
// fill-column: 100
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// comment-column: 40
// End:
// $Id: DVBDemuxSectionHandle.hh 321 2007-07-19 09:00:23Z tho $
//
// Copyright (C) 2007
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
//
// 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.
//
// This program 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 this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
\brief DVBHandles
*/
#ifndef HH_DVBFrontendHandle_
#define HH_DVBFrontendHandle_ 1
// Custom includes
#include "FramingPolicy.hh"
#include "CommunicationPolicy.hh"
#include "ReadWritePolicy.hh"
#include "ProtocolClientSocketHandle.hh"
#include "SocketProtocol.hh"
#include <linux/dvb/frontend.h>
//#include "DVBFrontendHandle.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
/// \addtogroup concrete_protocol_group
/// @{
typedef MakeSocketPolicy<
NoAddressingPolicy,
DatagramFramingPolicy,
UnconnectedCommunicationPolicy,
NotReadablePolicy,
NotWriteablePolicy
>::policy DVBFrontend_Policy; ///< Socket Policy for xxxx
/** \brief xxx
*/
class DVBFrontendProtocol
: public ConcreteSocketProtocol<DVBFrontend_Policy>
{
public:
///////////////////////////////////////////////////////////////////////////
// internal interface
///\name Constructors
///@{
void init_client() const; ///< xxx
/**< \note This member is implicitly called from the
ProtocolClientSocketHandle::ProtocolClientSocketHandle()
constructor */
///@}
///\name Abstract Interface Implementation
unsigned available() const;
bool eof() const;
std::auto_ptr<SocketProtocol> clone() const;
///@}
void signalStrength(int16_t *strength) const;
};
typedef ProtocolClientSocketHandle<DVBFrontendProtocol> DVBFrontendHandle;
}
///////////////////////////////hh.e////////////////////////////////////////
//#include "DVBFrontendHandle.cci"
//#include "DVBFrontendHandle.ct"
//#include "DVBFrontendHandle.cti"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
// comment-column: 40
// End:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment