root/branches/streaming-rework/src/iavdevice.cpp

Revision 426, 1.8 kB (checked in by pieterpalmers, 15 years ago)

- changed the IAvDevice from an interface to a base class,

since there is some code duplication starting to
appear.

Line 
1 /* iavdevice.h
2  * Copyright (C) 2006 by Daniel Wagner
3  * Copyright (C) 2007 by Pieter Palmers
4  *
5  * This file is part of FreeBoB.
6  *
7  * FreeBoB is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  * FreeBoB is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with FreeBoB; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19  * MA 02111-1307 USA.
20  */
21
22 #include "iavdevice.h"
23
24 #include "libieee1394/configrom.h"
25 #include "libieee1394/ieee1394service.h"
26
27 #include <iostream>
28 #include <sstream>
29
30 IMPL_DEBUG_MODULE( IAvDevice, IAvDevice, DEBUG_LEVEL_VERBOSE );
31
32 IAvDevice::IAvDevice( std::auto_ptr< ConfigRom >( configRom ),
33                     Ieee1394Service& ieee1394service,
34                     int nodeId )
35     : m_pConfigRom( configRom )
36     , m_p1394Service( &ieee1394service )
37     , m_verboseLevel( DEBUG_LEVEL_NORMAL )
38     , m_nodeId ( nodeId )
39 {
40     addOption(Util::OptionContainer::Option("id",std::string("dev?")));
41
42 }
43
44
45 ConfigRom&
46 IAvDevice::getConfigRom() const
47 {
48     return *m_pConfigRom;
49 }
50
51 bool
52 IAvDevice::setId( unsigned int id)
53 {
54     // FIXME: decent ID system nescessary
55     std::ostringstream idstr;
56     idstr << "dev" << id;
57     debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %s...\n", idstr.str().c_str());
58
59     return setOption("id",idstr.str());
60 }
61
62 void
63 IAvDevice::setVerboseLevel(int l)
64 {
65     m_verboseLevel=l;
66     setDebugLevel(l);
67 }
Note: See TracBrowser for help on using the browser.