initial commit
[profile/ivi/hfdialer.git] / src / policy / audio-resource.h
1 /*************************************************************************
2 This file is part of libresourceqt
3
4 Copyright (C) 2010 Nokia Corporation.
5
6 This library is free software; you can redistribute
7 it and/or modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation
9 version 2.1 of the License.
10
11 This library 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 GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA.
20 *************************************************************************/
21 /**
22  * @file audio-resource.h
23  * @brief Declaration of ResourcePolicy::AudioResource resource class.
24  *
25  * @copyright Copyright (C) 2010 Nokia Corporation.
26  * @author Wolf Bergenheim
27  * \par License
28  * @license LGPL
29  * This file is part of libresourceqt
30  * \par
31  * Copyright (C) 2010 Nokia Corporation.
32  * \par
33  * This library is free software; you can redistribute
34  * it and/or modify it under the terms of the GNU Lesser General Public
35  * License as published by the Free Software Foundation
36  * version 2.1 of the License.
37  * \par
38  * This library is distributed in the hope that it will be useful,
39  * but WITHOUT ANY WARRANTY; without even the implied warranty of
40  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41  * Lesser General Public License for more details.
42  * \par
43  * You should have received a copy of the GNU Lesser General Public
44  * License along with this library; if not, write to the Free Software
45  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
46  * USA.
47  */
48
49 #ifndef AUDIO_RESOURCE_H
50 #define AUDIO_RESOURCE_H
51
52 #include <QObject>
53 #include <QString>
54 #include <policy/resource.h>
55
56 namespace ResourcePolicy
57 {
58
59 /**
60  * The AudioResource class represents the audio device. It is a bit 
61  * different from other resource types in that in takes more parameters to
62  * allow the programmer to classify the audio stream used by the application.
63  */
64 class AudioResource: public QObject, public Resource
65 {
66     Q_OBJECT
67 public:
68         /**
69      * The constructor.
70      * \param audioGroup The audio group which this application belongs to.
71      * This is an optional parameter.
72      */
73     AudioResource(const QString &audioGroup = QString());
74     AudioResource(const AudioResource &other);
75     virtual ~AudioResource();
76
77     //! Accessor for the  audioGroup.
78     QString audioGroup() const;
79     //! A test to check whether the audio group is set or not.
80     bool audioGroupIsSet() const;
81     /**
82      * Set the audio group (classification)
83      * \param newGroup The new audio group to set.
84      */
85     void setAudioGroup(const QString & newGroup);
86
87     //! \return The PID of the process which is responsible for rendering the audio stream.
88     quint32 processID() const;
89     /**
90      * Use this to indicate to the Resource Manager the PID of the audio
91      * stream renderer.
92      * \param newPID Set this to the PID of the process which will render the audio.
93      */
94     void setProcessID(quint32 newPID);
95
96     //! \return the name of the stream tag.
97     QString streamTagName() const;
98     //! \return the value of the stream tag.
99     QString streamTagValue() const;
100     //! A test to check whether the stream tag has been set or not.
101     bool streamTagIsSet() const;
102     /**
103      * Set the tream tag to help policy to correctly identify the audio stream
104      * beloning to you.
105      * \param name The name of the tag. For example "media.name"
106      * \param value The value of the stream tag.
107      */
108     void setStreamTag(const QString &name, const QString &value);
109
110     virtual ResourceType type() const;
111 private:
112     QString group;
113     quint32 pid;
114     QString streamName;
115     QString streamValue;
116 signals:
117     /**
118      * This signal is emitted when any of the properties of the AudioResource
119      * are changed. This signal is connected to in the ResourceSet to
120      * track the changes to the AudioResource object.
121      * \param group The new audio group
122      * \param pid The new PID of the audio renderer
123      * \param name The new Stream tag name
124      * \param value the new stream tag value
125      */
126     void audioPropertiesChanged(const QString &group, quint32 pid,
127                                 const QString &name, const QString &value);
128 };
129 }
130
131 #endif