summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Lorenz <jlorenz@de.adit-jv.com>2016-11-25 15:29:14 +0100
committerJens Lorenz <jlorenz@de.adit-jv.com>2016-11-25 15:29:14 +0100
commit30754a4100cf18b6d0b689bafbb23583d165f81b (patch)
treea2824e2e40e7c90d4f576a1dc57a7f4ba5d325be
parent70f3263edf097b7990fcd2d27d4d47da34b6c0da (diff)
downloadaudiomanager-30754a4100cf18b6d0b689bafbb23583d165f81b.tar.gz
AMCore: Fix deamon to update interrupt state of source.
Signed-off-by: Toshiaki Isogai <tisogai@jp.adit-jv.com>
-rw-r--r--AudioManagerCore/include/CAmDatabaseHandlerMap.h1
-rw-r--r--AudioManagerCore/include/IAmDatabaseHandler.h1
-rw-r--r--AudioManagerCore/src/CAmDatabaseHandlerMap.cpp13
-rw-r--r--AudioManagerCore/src/CAmRoutingReceiver.cpp7
-rw-r--r--AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp17
-rw-r--r--AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp20
6 files changed, 58 insertions, 1 deletions
diff --git a/AudioManagerCore/include/CAmDatabaseHandlerMap.h b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
index 38628a4..05443b1 100644
--- a/AudioManagerCore/include/CAmDatabaseHandlerMap.h
+++ b/AudioManagerCore/include/CAmDatabaseHandlerMap.h
@@ -103,6 +103,7 @@ public:
am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay);
am_Error_e changeConnectionFinal(const am_connectionID_t connectionID);
am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState);
+ am_Error_e changeSourceInterruptState(const am_sourceID_t sourceID, const am_InterruptState_e interruptState);
am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume);
am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume);
am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink);
diff --git a/AudioManagerCore/include/IAmDatabaseHandler.h b/AudioManagerCore/include/IAmDatabaseHandler.h
index 7284d4b..aa275db 100644
--- a/AudioManagerCore/include/IAmDatabaseHandler.h
+++ b/AudioManagerCore/include/IAmDatabaseHandler.h
@@ -90,6 +90,7 @@ public:
virtual am_Error_e changeConnectionTimingInformation(const am_connectionID_t connectionID, const am_timeSync_t delay) = 0;
virtual am_Error_e changeConnectionFinal(const am_connectionID_t connectionID) = 0;
virtual am_Error_e changeSourceState(const am_sourceID_t sourceID, const am_SourceState_e sourceState) = 0;
+ virtual am_Error_e changeSourceInterruptState(const am_sourceID_t sourceID, const am_InterruptState_e interruptState) = 0;
virtual am_Error_e changeSinkVolume(const am_sinkID_t sinkID, const am_volume_t volume) = 0;
virtual am_Error_e changeSourceVolume(const am_sourceID_t sourceID, const am_volume_t volume) = 0;
virtual am_Error_e changeCrossFaderHotSink(const am_crossfaderID_t crossfaderID, const am_HotSink_e hotsink) = 0;
diff --git a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
index 0965a1d..fa7f5fc 100644
--- a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
+++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp
@@ -2589,6 +2589,19 @@ am_Error_e CAmDatabaseHandlerMap::changeSourceState(const am_sourceID_t sourceID
return (E_NON_EXISTENT);
}
+am_Error_e CAmDatabaseHandlerMap::changeSourceInterruptState(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
+{
+ assert(sourceID!=0);
+ assert(interruptState>=IS_UNKNOWN && interruptState<=IS_MAX);
+ if(existSource(sourceID))
+ {
+ mMappedData.mSourceMap.at(sourceID).interruptState = interruptState;
+ return (E_OK);
+ }
+ return (E_NON_EXISTENT);
+}
+
+
am_Error_e CAmDatabaseHandlerMap::getSinkMainVolume(const am_sinkID_t sinkID, am_mainVolume_t& mainVolume) const {
diff --git a/AudioManagerCore/src/CAmRoutingReceiver.cpp b/AudioManagerCore/src/CAmRoutingReceiver.cpp
index 587cbf4..dfcb6f6 100644
--- a/AudioManagerCore/src/CAmRoutingReceiver.cpp
+++ b/AudioManagerCore/src/CAmRoutingReceiver.cpp
@@ -291,7 +291,12 @@ am_Error_e CAmRoutingReceiver::deregisterCrossfader(const am_crossfaderID_t cros
void CAmRoutingReceiver::hookInterruptStatusChange(const am_sourceID_t sourceID, const am_InterruptState_e interruptState)
{
- return (mpControlSender->hookSystemInterruptStateChange(sourceID, interruptState));
+ am_Error_e error;
+ error = mpDatabaseHandler->changeSourceInterruptState(sourceID, interruptState);
+ if (error == E_OK)
+ {
+ mpControlSender->hookSystemInterruptStateChange(sourceID, interruptState);
+ }
}
void CAmRoutingReceiver::hookDomainRegistrationComplete(const am_domainID_t domainID)
diff --git a/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
index 3e9e728..9c09deb 100644
--- a/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
+++ b/AudioManagerCore/test/AmControlInterfaceTest/CAmControlInterfaceTest.cpp
@@ -165,6 +165,23 @@ TEST_F(CAmControlInterfaceTest,deregisterSource)
ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSource(sourceID));
}
+TEST_F(CAmControlInterfaceTest,hookInterruptStatusChange)
+{
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ pCF.createSource(source);
+ source.sourceID=12;
+ source.interruptState = IS_UNKNOWN;
+ sourceID = source.sourceID;
+
+ //prepare the stage
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //When we run this test, we expect the call on the control interface
+ EXPECT_CALL(pMockControlInterface,hookSystemInterruptStateChange(sourceID, IS_OFF));
+ pRoutingReceiver.hookInterruptStatusChange(sourceID, IS_OFF);
+}
+
TEST_F(CAmControlInterfaceTest,registerGateway)
{
am_Gateway_s gateway;
diff --git a/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
index 4c91d2a..559764d 100644
--- a/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
+++ b/AudioManagerCore/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
@@ -480,6 +480,26 @@ TEST_F(CAmMapHandlerTest,sourceState)
ASSERT_EQ(listSources[0].sourceState, SS_ON);
}
+TEST_F(CAmMapHandlerTest,sourceInterruptState)
+{
+ am_Source_s source;
+ am_sourceID_t sourceID;
+ std::vector<am_Source_s> listSources;
+ pCF.createSource(source);
+ source.interruptState = IS_OFF;
+
+ //prepare the test
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ //change the source interrupt state
+ ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceInterruptState(sourceID,IS_INTERRUPTED));
+
+ //read out the changed values
+ ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
+ ASSERT_EQ(listSources[0].interruptState, IS_INTERRUPTED);
+}
+
TEST_F(CAmMapHandlerTest,sinkVolumeChange)
{
am_Sink_s sink;