root/trunk/libffado/src/bebob/bebob_avdevice_subunit.h

Revision 1110, 4.3 kB (checked in by wagi, 14 years ago)

Lot's of small and big bug fixes allong the caching path.
There were several parts not correctly deserialized.

This should fix ticket #65

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef BEBOB_AVDEVICESUBUNIT_H
25 #define BEBOB_AVDEVICESUBUNIT_H
26
27 #include "bebob/bebob_avplug.h"
28 #include "bebob/bebob_functionblock.h"
29
30 #include "debugmodule/debugmodule.h"
31 #include "libavc/general/avc_extended_subunit_info.h"
32 #include "libavc/avc_definitions.h"
33 #include "libavc/general/avc_generic.h"
34
35 #include <vector>
36
37 #include "libavc/general/avc_subunit.h"
38 #include "libavc/musicsubunit/avc_musicsubunit.h"
39 #include "libavc/audiosubunit/avc_audiosubunit.h"
40 #include "libavc/general/avc_plug.h"
41
42 namespace BeBoB {
43
44 /////////////////////////////
45
46 class SubunitAudio : public AVC::SubunitAudio
47 {
48 public:
49     SubunitAudio( AVC::Unit& avDevice,
50                   AVC::subunit_t id );
51     SubunitAudio();
52     virtual ~SubunitAudio();
53
54     virtual bool discover();
55     virtual bool discoverConnections();
56
57     virtual AVC::Plug *createPlug( AVC::Unit* unit,
58                                    AVC::Subunit* subunit,
59                                    AVC::function_block_type_t functionBlockType,
60                                    AVC::function_block_type_t functionBlockId,
61                                    AVC::Plug::EPlugAddressType plugAddressType,
62                                    AVC::Plug::EPlugDirection plugDirection,
63                                    AVC::plug_id_t plugId );
64
65     virtual const char* getName();
66     virtual FunctionBlockVector getFunctionBlocks() { return m_functions; };
67
68 protected:
69     bool discoverFunctionBlocks();
70     bool discoverFunctionBlocksDo(
71         AVC::ExtendedSubunitInfoCmd::EFunctionBlockType fbType );
72     bool createFunctionBlock(
73         AVC::ExtendedSubunitInfoCmd::EFunctionBlockType fbType,
74         AVC::ExtendedSubunitInfoPageData& data );
75
76     FunctionBlock::ESpecialPurpose convertSpecialPurpose(
77         AVC::function_block_special_purpose_t specialPurpose );
78
79     virtual bool serializeChild( Glib::ustring basePath,
80                                  Util::IOSerialize& ser ) const;
81     virtual bool deserializeChild( Glib::ustring basePath,
82                                    Util::IODeserialize& deser,
83                                    AVC::Unit& unit );
84     virtual bool deserializeUpdateChild( Glib::ustring basePath,
85                                          Util::IODeserialize& deser );
86
87 protected:
88      FunctionBlockVector m_functions;
89 };
90
91 /////////////////////////////
92
93 class SubunitMusic : public AVC::SubunitMusic
94 {
95  public:
96     SubunitMusic( AVC::Unit& avDevice,
97               AVC::subunit_t id );
98     SubunitMusic();
99     virtual ~SubunitMusic();
100
101     virtual bool discover();
102    
103     virtual AVC::Plug *createPlug( AVC::Unit* unit,
104                                    AVC::Subunit* subunit,
105                                    AVC::function_block_type_t functionBlockType,
106                                    AVC::function_block_type_t functionBlockId,
107                                    AVC::Plug::EPlugAddressType plugAddressType,
108                                    AVC::Plug::EPlugDirection plugDirection,
109                                    AVC::plug_id_t plugId );
110
111     virtual const char* getName();
112
113 protected:
114     virtual bool serializeChild( Glib::ustring basePath,
115                                  Util::IOSerialize& ser ) const;
116     virtual bool deserializeChild( Glib::ustring basePath,
117                                    Util::IODeserialize& deser,
118                                    AVC::Unit& unit );
119     virtual bool deserializeUpdateChild( Glib::ustring basePath,
120                                          Util::IODeserialize& deser );
121
122 };
123
124 }
125
126 #endif
Note: See TracBrowser for help on using the browser.