summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schuldt <michael.schuldt@bmw.de>2013-07-05 12:32:20 +0200
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>2013-07-05 12:40:31 +0200
commit4fa82547c347cf28c84c1c17414de249bff5faaa (patch)
tree398d0cc90d6849bea0fb8e9201cfd4ba8d6de201
parent79f9ba1f86f584dde61a20517ef8d507f969efe9 (diff)
downloadlayer_management-4fa82547c347cf28c84c1c17414de249bff5faaa.tar.gz
LayerManagerCommands: added SetSynchronizedsurface command
Signed-off-by: Michael Schuldt <michael.schuldt@bmw.de>
-rw-r--r--LayerManagerCommands/include/SetSynchronizedSurfacesCommand.h72
-rw-r--r--LayerManagerCommands/src/SetSynchronizedSurfacesCommand.cpp58
2 files changed, 130 insertions, 0 deletions
diff --git a/LayerManagerCommands/include/SetSynchronizedSurfacesCommand.h b/LayerManagerCommands/include/SetSynchronizedSurfacesCommand.h
new file mode 100644
index 0000000..a2389b7
--- /dev/null
+++ b/LayerManagerCommands/include/SetSynchronizedSurfacesCommand.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ *
+ * Copyright 2012, Bayerische Motorenwerke Aktiengesellschaft
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#ifndef _SETSYNCHRONIZEDSURFACESCOMMAND_H_
+#define _SETSYNCHRONIZEDSURFACESCOMMAND_H_
+
+#include "ICommand.h"
+
+class SetSynchronizedSurfacesCommand: public ICommand
+{
+public:
+ /*!
+ * \action This command sets the surfaces which forces a synchronized composition
+ * in the GENIVI LayerManagement
+ * \frequency Called to force synchronized composition on a list of surfaces .
+ * \param[in] sender process id of application that sent this command
+ * \param[in] array array of surface ids
+ * \param[in] length length of array provided in parameter array
+ * \ingroup Commands
+ */
+ SetSynchronizedSurfacesCommand(pid_t sender, unsigned int* array, unsigned int length)
+ : ICommand(ExecuteAsynchronous, sender)
+ , m_array(array)
+ , m_length(length)
+ {}
+
+ /**
+ * \brief default destructor
+ */
+ virtual ~SetSynchronizedSurfacesCommand()
+ {
+ delete [] m_array;
+ }
+
+ /**
+ * \brief Execute this command.
+ * \param[in] executor Pointer to instance executing the LayerManagement COmmands
+ * \return ExecutionSuccess: execution successful
+ * \return ExecutionSuccessRedraw: execution successful and screen needs to be redrawn
+ * \return ExecutionFailed: execution failed
+ * \return ExecutionFailedRedraw: execution unsuccessful and screen needs to be redrawn
+ */
+ virtual ExecutionResult execute(ICommandExecutor* executor);
+
+ /**
+ * \brief Get description string for this command.
+ * \return String object with description of this command object
+ */
+ virtual const std::string getString();
+
+private:
+ unsigned int* m_array;
+ const unsigned int m_length;
+};
+
+#endif /* _SETSYNCHRONIZEDSURFACESCOMMAND_H_ */
diff --git a/LayerManagerCommands/src/SetSynchronizedSurfacesCommand.cpp b/LayerManagerCommands/src/SetSynchronizedSurfacesCommand.cpp
new file mode 100644
index 0000000..2e44d12
--- /dev/null
+++ b/LayerManagerCommands/src/SetSynchronizedSurfacesCommand.cpp
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *
+ * Copyright 2010,2011 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+#include "SetSynchronizedSurfacesCommand.h"
+#include "ICommandExecutor.h"
+#include "Scene.h"
+#include "Log.h"
+
+ExecutionResult SetSynchronizedSurfacesCommand::execute(ICommandExecutor* executor)
+{
+ Scene& scene = *(executor->getScene());
+ ExecutionResult result = ExecutionFailed;
+
+ LOG_DEBUG("SetSynchronizedSurfacesCommand", "Length to set: " << m_length);
+
+ // First of all get all surfaces which are in the current render order.
+ for (unsigned int i = 0; i < m_length; i++)
+ {
+ Surface* surface = scene.getSurface(m_array[i]);
+ if (surface)
+ {
+ surface->setSynchronized(true);
+ LOG_DEBUG("SetSynchronizedSurfacesCommand", "Setting Surface : " << m_array[i] << " to synchronized");
+ result = ExecutionSuccess;
+ }
+ }
+ return result;
+}
+
+const std::string SetSynchronizedSurfacesCommand::getString()
+{
+ std::stringstream description;
+ description << "SetSynchronizedSurfacesCommand("
+ << "m_array=[";
+
+ for (unsigned int i = 0; i < m_length; ++i)
+ {
+ description << m_array[i] << ",";
+ }
+ description << "], m_length=" << m_length
+ << ")";
+ return description.str();
+}