summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon/CommandReceive.cpp
blob: afc87b29becf14661a88086c7365021ff9c11416 (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
/*
 * CommandReceive.cpp
 *
 *  Created on: Jul 26, 2011
 *      Author: christian
 */

#include "CommandReceive.h"

CommandReceive::CommandReceive(AudioManagerCore* core) : m_core(core) {

}

CommandReceive::~CommandReceive() {

}

connection_t CommandReceive::connect(source_t source, sink_t sink) {
	DLT_LOG(AudioManager,DLT_LOG_ERROR, DLT_STRING("Connect"));
	if (m_core->UserConnect(source, sink) == GEN_OK) {
		return 1;
	}
	return -1;

	/**
	 * \todo returns a connection_t but this is always one. Somethings not right....
	 */
}



connection_t CommandReceive::disconnect(source_t source, source_t sink){

	genRoute_t ReturnRoute;
	if (int value=m_core->returnDatabaseHandler()->returnMainconnectionIDforSinkSourceID(sink,source)>0) {
		return m_core->UserDisconnect(value);
	} else {
		return -1;
	}

	/**
	 * \todo not sure if the test of existance of thatconnection should be done here...
	 */
}



std::list<ConnectionType> CommandReceive::getListConnections(){
	return m_core->getListConnections();
}



std::list<SinkType> CommandReceive::getListSinks(){
	return m_core->getListSinks();
}



std::list<SourceType> CommandReceive::getListSources() {
	return m_core->getListSources();
}



genInt_t CommandReceive::interruptRequest(const std::string & SourceName, const std::string & SinkName) {
	source_t sourceID = m_core->returnSourceIDfromName(SourceName);
	sink_t sinkID = m_core->returnSinkIDfromName(SinkName);
	genInt_t intID = -1;
	if (m_core->interruptRequest(sourceID, sinkID, &intID)==GEN_OK) {
		return intID;
	}

	return -1;

	/**
	 * \todo need to change something?
	 */
}



interrupt_t CommandReceive::interruptResume(interrupt_t interrupt){
	/**
	 * \todo here a callback mechanism needs to be installed....
	 */

	return 1;
}



volume_t CommandReceive::setVolume(sink_t sink, volume_t volume) {
	if (m_core->UserSetVolume(sink, volume) == GEN_OK) {
		return 1;
	}
	return -1;
}