root/branches/libfreebob-2.0/src/bebob/bebob_avdevice_subunit.h

Revision 336, 3.2 kB (checked in by pieterpalmers, 16 years ago)

- Merged the developments on trunk since branch-off:

branch occurred at rev 194
svn merge -r 194:HEAD https://svn.sourceforge.net/svnroot/freebob/trunk/libfreebob

- Modified libfreebobavc to use the messagebuffer for debug info.
- This should compile and run

Line 
1 /* bebob_avdevice_subunit.h
2  * Copyright (C) 2005,06 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #ifndef BEBOB_AVDEVICESUBUNIT_H
22 #define BEBOB_AVDEVICESUBUNIT_H
23
24 #include "bebob/bebob_avplug.h"
25 #include "bebob/bebob_functionblock.h"
26
27 #include "debugmodule/debugmodule.h"
28 #include "libfreebobavc/avc_extended_subunit_info.h"
29 #include "libfreebobavc/avc_definitions.h"
30 #include "libfreebobavc/avc_generic.h"
31
32 #include <vector>
33
34 namespace BeBoB {
35
36 class AvDevice;
37
38 class AvDeviceSubunit {
39  public:
40     AvDeviceSubunit( AvDevice& avDevice,
41                      AVCCommand::ESubunitType type,
42                      subunit_t id,
43                      int verboseLevel );
44     virtual ~AvDeviceSubunit();
45
46     virtual bool discover();
47     virtual bool discoverConnections();
48     virtual const char* getName() = 0;
49
50     bool addPlug( AvPlug& plug );
51
52     subunit_t getSubunitId()
53         { return m_sbId; }
54     AVCCommand::ESubunitType getSubunitType()
55         { return m_sbType; }
56
57     AvPlugVector& getPlugs()
58         { return m_plugs; }
59     AvPlug* getPlug(AvPlug::EAvPlugDirection direction, plug_id_t plugId);
60
61
62     AvDevice& getAvDevice() const
63         { return *m_avDevice; }
64
65  protected:
66     bool discoverPlugs();
67     bool discoverPlugs(AvPlug::EAvPlugDirection plugDirection,
68                        plug_id_t plugMaxId );
69
70  protected:
71     AvDevice*                m_avDevice;
72     AVCCommand::ESubunitType m_sbType;
73     subunit_t                m_sbId;
74     int                      m_verboseLevel;
75
76     AvPlugVector             m_plugs;
77
78     DECLARE_DEBUG_MODULE;
79 };
80
81 typedef std::vector<AvDeviceSubunit*> AvDeviceSubunitVector;
82
83 /////////////////////////////
84
85 class AvDeviceSubunitAudio: public AvDeviceSubunit {
86  public:
87     AvDeviceSubunitAudio( AvDevice& avDevice,
88                           subunit_t id,
89                           int verboseLevel );
90     virtual ~AvDeviceSubunitAudio();
91
92     virtual bool discover();
93     virtual bool discoverConnections();
94
95     virtual const char* getName();
96
97
98 protected:
99     bool discoverFunctionBlocks();
100     bool discoverFunctionBlocksDo(
101         ExtendedSubunitInfoCmd::EFunctionBlockType fbType );
102     bool createFunctionBlock(
103         ExtendedSubunitInfoCmd::EFunctionBlockType fbType,
104         ExtendedSubunitInfoPageData& data );
105
106     FunctionBlock::ESpecialPurpose convertSpecialPurpose(
107         function_block_special_purpose_t specialPurpose );
108
109 protected:
110     FunctionBlockVector m_functions;
111 };
112
113 /////////////////////////////
114
115 class AvDeviceSubunitMusic: public AvDeviceSubunit {
116  public:
117     AvDeviceSubunitMusic( AvDevice& avDevice,
118                           subunit_t id,
119                           int verboseLevel );
120     virtual ~AvDeviceSubunitMusic();
121
122     virtual const char* getName();
123 };
124
125 }
126
127 #endif
Note: See TracBrowser for help on using the browser.