root/trunk/libffado/src/libavc/general/avc_subunit.h

Revision 560, 3.3 kB (checked in by ppalmers, 17 years ago)

- Sort the FFADODevice vector on GUID before assigning device id's

This results in the same device id for identical device setups,
independent of the way they are connected or the node numbers they
have been assigned.

- Sanitized debug message reporting a bit
- Cosmetic changes

Line 
1 /*
2  * Copyright (C)      2007 by Pieter Palmers
3  * Copyright (C) 2005-2007 by Daniel Wagner
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License version 2.1, as published by the Free Software Foundation;
13  *
14  * This library 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 GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #ifndef AVC_SUBUNIT_H
26 #define AVC_SUBUNIT_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "../avc_definitions.h"
31 #include "../general/avc_plug.h"
32 #include "../general/avc_extended_subunit_info.h"
33 #include "../general/avc_generic.h"
34 #include "../audiosubunit/avc_function_block.h"
35
36 #include <vector>
37
38 #warning merge with bebob functionblock
39 #include "bebob/bebob_functionblock.h"
40
41 namespace AVC {
42
43 class Unit;
44
45 class Subunit {
46  public:
47     Subunit( Unit& avDevice,
48              ESubunitType type,
49              subunit_t id );
50     virtual ~Subunit();
51
52     virtual bool discover();
53     virtual bool discoverConnections();
54     virtual const char* getName() = 0;
55
56     subunit_t getSubunitId()
57     { return m_sbId; }
58     ESubunitType getSubunitType()
59     { return m_sbType; }
60
61     Unit& getUnit() const
62         { return *m_unit; }
63     Subunit& getSubunit()
64         { return *this; }
65
66     virtual Plug *createPlug( AVC::Unit* unit,
67                               AVC::Subunit* subunit,
68                               AVC::function_block_type_t functionBlockType,
69                               AVC::function_block_type_t functionBlockId,
70                               AVC::Plug::EPlugAddressType plugAddressType,
71                               AVC::Plug::EPlugDirection plugDirection,
72                               AVC::plug_id_t plugId );
73
74     bool addPlug( Plug& plug );
75     virtual bool initPlugFromDescriptor( Plug& plug );
76
77     PlugVector& getPlugs()
78     { return m_plugs; }
79     Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId);
80
81     virtual void setVerboseLevel(int l);
82
83     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
84     static Subunit* deserialize( Glib::ustring basePath,
85                      Util::IODeserialize& deser, Unit& avDevice );
86  protected:
87     Subunit();
88
89     virtual bool serializeChild( Glib::ustring basePath,
90                                  Util::IOSerialize& ser ) const = 0;
91     virtual bool deserializeChild( Glib::ustring basePath,
92                                    Util::IODeserialize& deser,
93                                    Unit& avDevice ) = 0;
94     bool discoverPlugs();
95     bool discoverPlugs(Plug::EPlugDirection plugDirection,
96                        AVC::plug_id_t plugMaxId );
97
98  protected:
99     Unit*           m_unit;
100     ESubunitType    m_sbType;
101     subunit_t       m_sbId;
102
103     PlugVector      m_plugs;
104
105     DECLARE_DEBUG_MODULE;
106 };
107
108 typedef std::vector<Subunit*> SubunitVector;
109
110 }
111
112 #endif
Note: See TracBrowser for help on using the browser.