summaryrefslogtreecommitdiff
path: root/source/LCDriverInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/LCDriverInterface.cpp')
-rw-r--r--source/LCDriverInterface.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/source/LCDriverInterface.cpp b/source/LCDriverInterface.cpp
new file mode 100644
index 0000000..adda735
--- /dev/null
+++ b/source/LCDriverInterface.cpp
@@ -0,0 +1,55 @@
+/******************************************************************************
+*
+* File name: LCDriverInterface.cpp
+* Project: LoaderCommunicationDriver
+* Language: Visual C++
+* Description: Interface class.
+*
+*
+* Copyright (C) ST-Ericsson SA 2011
+* License terms: 3-clause BSD license
+*
+******************************************************************************/
+
+#include "LCDriverInterface.h"
+
+CCriticalSectionObject CLCDriverInterface::InitializationCS;
+CObjectList<CLCDriverMethods> CLCDriverInterface::ObjectList;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+CLCDriverInterface::CLCDriverInterface()
+{
+ isStarted = false;
+ m_pObject = NULL;
+ m_szObjectId[0] = '\0';
+}
+
+CLCDriverInterface::~CLCDriverInterface()
+{
+ CLockCS CsLock(InitializationCS);
+
+ // Disconnect from the CLCDriverMethods object
+ if (m_pObject != NULL) {
+ if (ObjectList.Release(m_pObject) == 0) {
+ delete m_pObject;
+ m_pObject = NULL;
+ }
+ }
+}
+
+CLCDriverMethods *CLCDriverInterface::FindObject(const char *interfaceId)
+{
+ return ObjectList.Find(interfaceId);
+}
+
+void CLCDriverInterface::ReleaseObject(CLCDriverMethods *object)
+{
+ ObjectList.Release(object);
+}
+
+int CLCDriverInterface::AddObject(CLCDriverMethods *object, const char *interfaceId)
+{
+ return ObjectList.Add(object, interfaceId);
+}