1/*
2 * Copyright (c) 1998-2010 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _IOKIT_IOAUDIOSELECTORCONTROL_H
24#define _IOKIT_IOAUDIOSELECTORCONTROL_H
25
26#ifndef IOAUDIOFAMILY_SELF_BUILD
27#include <IOKit/audio/IOAudioControl.h>
28#else
29#include "IOAudioControl.h"
30#endif
31
32class OSString;
33class OSArray;
34
35class IOAudioSelectorControl : public IOAudioControl
36{
37    OSDeclareDefaultStructors(IOAudioSelectorControl)
38
39protected:
40
41    OSArray *availableSelections;
42
43protected:
44    struct ExpansionData { };
45
46    ExpansionData *reserved;
47
48public:
49	static IOAudioSelectorControl *createOutputSelector(SInt32 initialValue,
50															UInt32 channelID,
51															const char *channelName = 0,
52															UInt32 cntrlID = 0);
53	static IOAudioSelectorControl *createOutputClockSelector(SInt32 initialValue,
54                                                                    UInt32 channelID,
55																	UInt32 clockSource,
56                                                                    const char *channelName = 0,
57                                                                    UInt32 cntrlID = 0);
58	static IOAudioSelectorControl *createInputClockSelector(SInt32 initialValue,
59                                                                    UInt32 channelID,
60																	UInt32 clockSource,
61                                                                    const char *channelName = 0,
62                                                                    UInt32 cntrlID = 0);
63
64    // OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 0);
65	virtual IOReturn removeAvailableSelection(SInt32 selectionValue);
66    // OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 1);
67	virtual IOReturn replaceAvailableSelection(SInt32 selectionValue, const char *selectionDescription);
68    // OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 2);
69	virtual IOReturn replaceAvailableSelection(SInt32 selectionValue, OSString *selectionDescription);
70    // OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 3);
71	virtual IOReturn addAvailableSelection(SInt32 selectionValue, OSString *selectionDescription, const char* pszName, OSObject* tag);		// <rdar://8202424>
72
73private:
74    OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 0);
75    OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 1);
76    OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 2);
77    OSMetaClassDeclareReservedUsed(IOAudioSelectorControl, 3);			// <rdar://8202424>
78
79    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 4);		// <rdar://8202424>
80
81    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 5);		// <rdar://8202424>
82    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 6);
83    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 7);
84    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 8);
85    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 9);
86    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 10);
87    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 11);
88    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 12);
89    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 13);
90    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 14);
91    OSMetaClassDeclareReservedUnused(IOAudioSelectorControl, 15);
92
93public:
94    static IOAudioSelectorControl *create(SInt32 initialValue,
95                                            UInt32 channelID,
96                                            const char *channelName = 0,
97                                            UInt32 cntrlID = 0,
98                                            UInt32 subType = 0,
99                                            UInt32 usage = 0);
100
101    static IOAudioSelectorControl *createInputSelector(SInt32 initialValue,
102                                                        UInt32 channelID,
103                                                        const char *channelName = 0,
104                                                        UInt32 cntrlID = 0);
105
106    virtual bool init(SInt32 initialValue,
107                      UInt32 channelID,
108                      const char *channelName = 0,
109                      UInt32 cntrlID = 0,
110                      UInt32 subType = 0,
111                      UInt32 usage = 0,
112                      OSDictionary *properties = 0);
113
114    virtual void free();
115
116    virtual IOReturn addAvailableSelection(SInt32 selectionValue, const char *selectionDescription);
117    virtual IOReturn addAvailableSelection(SInt32 selectionValue, OSString *selectionDescription);
118
119    virtual bool valueExists(SInt32 selectorValue);
120
121    virtual IOReturn validateValue(OSObject *newValue);
122
123};
124
125#endif /* _IOKIT_IOAUDIOSELECTORCONTROL_H */
126