summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/src/Observer.cpp
blob: 648c29502f4b12aa15ed4db35d7f15f34a2b0cf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
 * Observer.cpp
 *
 *  Created on: Dec 10, 2011
 *      Author: christian
 */

#include "Observer.h"
#include "CommandSender.h"
#include <assert.h>

Observer::Observer(CommandSender *iCommandSender, RoutingSender *iRoutingSender)
	:mCommandSender(iCommandSender),
	 mRoutingSender(iRoutingSender)
{
	assert(mCommandSender!=0);
	assert(mRoutingSender!=0);
	mCommandSender->cbCommunicationReady();
}

Observer::~Observer() {
	// TODO Auto-generated destructor stub
}

void Observer::newSink(am_Sink_s sink)
{
	mRoutingSender->addSinkLookup(sink);
	mCommandSender->cbNumberOfSinksChanged();
}



void Observer::newSource(am_Source_s source)
{
	mRoutingSender->addSourceLookup(source);
	mCommandSender->cbNumberOfSourcesChanged();
}



void Observer::newDomain(am_Domain_s domain)
{
	mRoutingSender->addDomainLookup(domain);
}



void Observer::newGateway(am_Gateway_s gateway)
{

}



void Observer::newCrossfader(am_Crossfader_s crossfader)
{
	mRoutingSender->addCrossfaderLookup(crossfader);
}



void Observer::removedSink(am_sinkID_t sinkID)
{
	mRoutingSender->removeSinkLookup(sinkID);
	mCommandSender->cbNumberOfSinksChanged();
}



void Observer::removedSource(am_sourceID_t sourceID)
{
	mRoutingSender->removeSourceLookup(sourceID);
	mCommandSender->cbNumberOfSourcesChanged();
}



void Observer::removeDomain(am_domainID_t domainID)
{
	mRoutingSender->removeDomainLookup(domainID);
}



void Observer::removeGateway(am_gatewayID_t gatewayID)
{
}



void Observer::removeCrossfader(am_crossfaderID_t crossfaderID)
{
	mRoutingSender->removeCrossfaderLookup(crossfaderID);
}


void Observer::numberOfMainConnectionsChanged()
{
	mCommandSender->cbNumberOfMainConnectionsChanged();
}

void Observer::numberOfSinkClassesChanged()
{
	mCommandSender->cbNumberOfSinkClassesChanged();
}



void Observer::numberOfSourceClassesChanged()
{
	mCommandSender->cbNumberOfSourceClassesChanged();
}



void Observer::mainConnectionStateChanged(const am_mainConnectionID_t connectionID, const am_ConnectionState_e connectionState)
{
	mCommandSender->cbMainConnectionStateChanged(connectionID,connectionState);
}



void Observer::mainSinkSoundPropertyChanged(const am_sinkID_t sinkID, const am_MainSoundProperty_s SoundProperty)
{
	mCommandSender->cbMainSinkSoundPropertyChanged(sinkID,SoundProperty);
}



void Observer::mainSourceSoundPropertyChanged(const am_sourceID_t sourceID, const am_MainSoundProperty_s & SoundProperty)
{
	mCommandSender->cbMainSourceSoundPropertyChanged(sourceID,SoundProperty);
}



void Observer::sinkAvailabilityChanged(const am_sinkID_t sinkID, const am_Availability_s & availability)
{
	mCommandSender->cbSinkAvailabilityChanged(sinkID,availability);
}



void Observer::sourceAvailabilityChanged(const am_sourceID_t sourceID, const am_Availability_s & availability)
{
	mCommandSender->cbSourceAvailabilityChanged(sourceID,availability);
}



void Observer::volumeChanged(const am_sinkID_t sinkID, const am_mainVolume_t volume)
{
	mCommandSender->cbVolumeChanged(sinkID,volume);
}



void Observer::sinkMuteStateChanged(const am_sinkID_t sinkID, const am_MuteState_e muteState)
{
	mCommandSender->cbSinkMuteStateChanged(sinkID,muteState);
}



void Observer::systemPropertyChanged(const am_SystemProperty_s & SystemProperty)
{
	mCommandSender->cbSystemPropertyChanged(SystemProperty);
}



void Observer::timingInformationChanged(const am_mainConnectionID_t mainConnection, const am_timeSync_t time)
{
	mCommandSender->cbTimingInformationChanged(mainConnection,time);
	//todo:inform the controller via controlsender
}