1 |
/* bounce_avdevice.cpp |
---|
2 |
* Copyright (C) 2006 by Pieter Palmers |
---|
3 |
* Copyright (C) 2006 by Daniel Wagner |
---|
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 "bounce/bounce_avdevice.h" |
---|
23 |
#include "configrom.h" |
---|
24 |
|
---|
25 |
#include "libfreebobavc/ieee1394service.h" |
---|
26 |
#include "libfreebobavc/avc_definitions.h" |
---|
27 |
|
---|
28 |
#include "debugmodule/debugmodule.h" |
---|
29 |
|
---|
30 |
#include <string> |
---|
31 |
#include <stdint.h> |
---|
32 |
|
---|
33 |
namespace Bounce { |
---|
34 |
|
---|
35 |
IMPL_DEBUG_MODULE( BounceDevice, BounceDevice, DEBUG_LEVEL_NORMAL ); |
---|
36 |
|
---|
37 |
BounceDevice::BounceDevice( Ieee1394Service& ieee1394service, |
---|
38 |
int nodeId, |
---|
39 |
int verboseLevel ) |
---|
40 |
: m_1394Service( &ieee1394service ) |
---|
41 |
, m_nodeId( nodeId ) |
---|
42 |
, m_verboseLevel( verboseLevel ) |
---|
43 |
{ |
---|
44 |
if ( m_verboseLevel ) { |
---|
45 |
setDebugLevel( DEBUG_LEVEL_VERBOSE ); |
---|
46 |
} |
---|
47 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", |
---|
48 |
nodeId ); |
---|
49 |
m_configRom = new ConfigRom( m_1394Service, m_nodeId ); |
---|
50 |
m_configRom->initialize(); |
---|
51 |
} |
---|
52 |
|
---|
53 |
BounceDevice::~BounceDevice() |
---|
54 |
{ |
---|
55 |
|
---|
56 |
} |
---|
57 |
|
---|
58 |
ConfigRom& |
---|
59 |
BounceDevice::getConfigRom() const |
---|
60 |
{ |
---|
61 |
return *m_configRom; |
---|
62 |
} |
---|
63 |
|
---|
64 |
bool |
---|
65 |
BounceDevice::discover() |
---|
66 |
{ |
---|
67 |
std::string vendor = std::string(FREEBOB_BOUNCE_SERVER_VENDORNAME); |
---|
68 |
std::string model = std::string(FREEBOB_BOUNCE_SERVER_MODELNAME); |
---|
69 |
|
---|
70 |
if (m_configRom->getVendorName().compare(0,vendor.length(),vendor,0,vendor.length())==0) { |
---|
71 |
if(m_configRom->getModelName().compare(0,model.length(),model,0,model.length())==0) { |
---|
72 |
return true; |
---|
73 |
} |
---|
74 |
} |
---|
75 |
return false; |
---|
76 |
} |
---|
77 |
|
---|
78 |
bool |
---|
79 |
BounceDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) |
---|
80 |
{ |
---|
81 |
return true; |
---|
82 |
} |
---|
83 |
|
---|
84 |
void |
---|
85 |
BounceDevice::showDevice() const |
---|
86 |
{ |
---|
87 |
printf( "\nI am the bouncedevice, the bouncedevice I am...\n" ); |
---|
88 |
printf( "Vendor : %s\n", m_configRom->getVendorName().c_str()); |
---|
89 |
printf( "Model : %s\n", m_configRom->getModelName().c_str()); |
---|
90 |
printf( "GUID : 0x%016llX\n", m_configRom->getGuid()); |
---|
91 |
printf( "\n" ); |
---|
92 |
} |
---|
93 |
|
---|
94 |
bool |
---|
95 |
BounceDevice::addXmlDescription( xmlNodePtr deviceNode ) |
---|
96 |
{ |
---|
97 |
return true; |
---|
98 |
} |
---|
99 |
|
---|
100 |
} |
---|