diff options
author | unknown <xvsnepe@.seavus-dev2.com> | 2012-01-04 13:33:09 +0100 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2012-05-25 14:41:30 +0200 |
commit | e80c74d2b26a3ac5e8fc818d749fdcf60181d101 (patch) | |
tree | dd0f9d89413076b1ecc6216f92024b8ee77bd5a2 /source | |
parent | f2be658909048b1050bf66c14324cccce852a931 (diff) |
Add LCD/LCM compatibility check version 2
Small changes for LCD/LCM compatibility check added.
ST-Ericsson ID: 362575
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: Ic8d9b0940cc9c949aac84cea8abca4f95c992a93
Signed-off-by: unknown <xvsnepe@.seavus-dev2.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/39382
Reviewed-by: QABUILD
Tested-by: Vlatko STENKOSKI
Tested-by: Cvetko MLADENOVSKI <cvetko.mladenovski@seavus.com>
Reviewed-by: Zoran ANCEVSKI <zoran.ancevski@seavus.com>
Diffstat (limited to 'source')
-rw-r--r-- | source/LCDriver.cpp | 4 | ||||
-rw-r--r-- | source/LCDriver.rc | 18 | ||||
-rw-r--r-- | source/LcdVersion.cpp | 12 | ||||
-rw-r--r-- | source/LcmInterface.cpp | 28 | ||||
-rw-r--r-- | source/config/lcdriver_error_codes.xml | 4 |
5 files changed, 34 insertions, 32 deletions
diff --git a/source/LCDriver.cpp b/source/LCDriver.cpp index 0754e5e..9af739e 100644 --- a/source/LCDriver.cpp +++ b/source/LCDriver.cpp @@ -42,8 +42,8 @@ LCDRIVER_API int __cdecl Initialize(LCDContext *pContext, const char *InterfaceI SwitchProtocolFamily(*pContext, R15_PROTOCOL_FAMILY); SetMessageCallback(*pContext, Message_fn); SetProgressCallback(*pContext, ProgressBar_fn); - - return StartContext(*pContext, Instance); + Result = StartContext(*pContext, Instance); + return Result; } else { return 0; } diff --git a/source/LCDriver.rc b/source/LCDriver.rc index 679a33a..c7827e5 100644 --- a/source/LCDriver.rc +++ b/source/LCDriver.rc @@ -13,13 +13,11 @@ #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
-#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@@ -46,18 +44,16 @@ END #endif // APSTUDIO_INVOKED
-#endif // English (U.S.) resources
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (U.K.) resources
+// English (United Kingdom) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
-#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
-#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
@@ -81,15 +77,15 @@ BEGIN BEGIN
BLOCK "000904b0"
BEGIN
- VALUE "Comments", "Build date: 2011-12-26"
+ VALUE "Comments", "Build date: 2012-01-04"
VALUE "CompanyName", "STEricsson AB"
VALUE "FileDescription", "LCDriver Dynamic Link Library"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Loader Communication Driver"
VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2011"
- VALUE "PrivateBuild", "Change-Id: Ia6539a7ebab97a078bc0d105b23b6a0545762194"
+ VALUE "PrivateBuild", "Change-Id: Ic8d9b0940cc9c949aac84cea8abca4f95c992a93"
VALUE "ProductName", "CXC 173 0865, LCDriver DLL"
- VALUE "ProductVersion", "PU4"
+ VALUE "ProductVersion", "PU5"
END
END
BLOCK "VarFileInfo"
@@ -98,7 +94,7 @@ BEGIN END
END
-#endif // English (U.K.) resources
+#endif // English (United Kingdom) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/source/LcdVersion.cpp b/source/LcdVersion.cpp index 168f0b5..a1b9dcc 100644 --- a/source/LcdVersion.cpp +++ b/source/LcdVersion.cpp @@ -13,9 +13,11 @@ #define GetProcAddress dlsym #endif /** - * var char *LCD_VersionList[] - * brief ASCII string list variable holding the LCD version/build time/product number.. + * var char *LCD_LCM_CompatibilityList[] + * brief ASCII string list holding the permitted LCM versions. + * This table contains compatibility information for the versions of LCM. + * Current LCM version is defined in file lcm_version.c in LCM code. */ -char *LCD_VersionList[] = {"PX4", - NULL - }; +char *LCD_LCM_CompatibilityList[] = {"PX5", + NULL + }; diff --git a/source/LcmInterface.cpp b/source/LcmInterface.cpp index 335fbe0..b7067ed 100644 --- a/source/LcmInterface.cpp +++ b/source/LcmInterface.cpp @@ -6,6 +6,7 @@ #include "lcdriver_error_codes.h" #include "LcmInterface.h" #include "Error.h" +#include <string.h> #ifdef _WIN32 #include "WinApiWrappers.h" #else @@ -15,7 +16,7 @@ #endif char *LcmInterface::m_pchLCMLibPath = 0; -extern char *LCD_VersionList[]; +extern char *LCD_LCM_CompatibilityList[]; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -124,12 +125,14 @@ int LcmInterface::LoadLCMLibrary() return E_SUCCESS; } + void LcmInterface::SetLCMLibPath(const char *lcmLibPath) { size_t pathLength = strlen(lcmLibPath); if (0 != m_pchLCMLibPath) { delete[] m_pchLCMLibPath; + m_pchLCMLibPath = NULL; } m_pchLCMLibPath = new char[pathLength + 1]; @@ -141,6 +144,7 @@ void LcmInterface::CloseLCMLibrary() { if (0 != m_pchLCMLibPath) { delete[] m_pchLCMLibPath; + m_pchLCMLibPath = NULL; } #ifdef _WIN32 @@ -158,17 +162,18 @@ ErrorCode_e LcmInterface::CommunicationInitialize(void *Object_p, Family_t Famil if (m_hDLL == NULL) { CLockCS lock(m_CriticalSection); - - if (m_hDLL == NULL) { - VERIFY_SUCCESS(LoadLCMLibrary()); - // LCMVersion_p = Communication.GetVersion_Fn(m_pCommunication); - // VERIFY_SUCCESS(CommunicationCheckVersion(LCMVersion_p, LCMType)); - } + VERIFY_SUCCESS(LoadLCMLibrary()); + LCMVersion_p = Communication.GetVersion_Fn(m_pCommunication); + VERIFY_SUCCESS(CommunicationCheckVersion(LCMVersion_p, LCMType)); } ReturnValue = Communication.Initialize_Fn(Object_p, &m_pCommunication, Family, HashDevice_p, CommunicationDevice_p, CommandCallback_p, Buffers_p, Timers_p, Queue_p); ErrorExit: + if (ReturnValue != E_SUCCESS){ + CloseLCMLibrary(); + m_hDLL = NULL; + } return static_cast<ErrorCode_e>(ReturnValue); } @@ -195,21 +200,20 @@ ErrorCode_e LcmInterface::CommunicationGetProtocolTimeouts(void *TimeoutData_p) ErrorCode_e LcmInterface::CommunicationCheckVersion(char *LCMVersion_p, LCM_t LCMType) { - int ReturnValue = LCM_DLL_LOAD_INCOMPATIBLE_PC_VERSION; + int ReturnValue = LCM_LOAD_INCOMPATIBLE_PC_VERSION; int i = 0; if (LCMType == LDR_LCM) { - ReturnValue = LCM_DLL_LOAD_INCOMPATIBLE_LDR_VERSION; + ReturnValue = LCM_LOAD_INCOMPATIBLE_LDR_VERSION; } do { - if (strcmp(LCMVersion_p, LCD_VersionList[i]) == 0) { + if (strcmp(LCMVersion_p, LCD_LCM_CompatibilityList[i]) == 0) { ReturnValue = E_SUCCESS; break; } - i++; - } while (LCD_VersionList[i] != NULL); + } while (LCD_LCM_CompatibilityList[i] != NULL); return static_cast<ErrorCode_e>(ReturnValue); } diff --git a/source/config/lcdriver_error_codes.xml b/source/config/lcdriver_error_codes.xml index a7f7f5c..412a9e9 100644 --- a/source/config/lcdriver_error_codes.xml +++ b/source/config/lcdriver_error_codes.xml @@ -83,8 +83,8 @@ --> <value number="10401" name="LCM_DLL_LOAD_LOADLIBRARY_ERROR" fatal="true" short="Failed to load LCM library.">Loading of dependant library failed. Make sure that it is placed on correct location.</value> <value number="10402" name="LCM_DLL_LOAD_FUNCTION_NOT_FOUND" fatal="true" short="Failed to import LCM functionality.">Some of dependend functions was not found in the given LCM library. Make sure that the version that is used is compatible.</value> - <value number="10426" name="LCM_DLL_LOAD_INCOMPATIBLE_PC_VERSION" fatal="false" short="Incompatible PC LCM version.">Some of functions may not work in the given LCM library. Make sure that the PC LCM version that is used is compatible.</value> - <value number="10427" name="LCM_DLL_LOAD_INCOMPATIBLE_LDR_VERSION" fatal="false" short="Incompatible LDR LCM version.">Some of functions may not work in the given LCM library. Make sure that the LDR LCM version that is used is compatible.</value> + <value number="10426" name="LCM_LOAD_INCOMPATIBLE_PC_VERSION" fatal="true" short="Incompatible PC LCM version.">Some of functions may not work in the given LCM library. Make sure that the PC LCM version that is used is compatible.</value> + <value number="10427" name="LCM_LOAD_INCOMPATIBLE_LDR_VERSION" fatal="false" short="Incompatible LDR LCM version.">Some of functions may not work in the given LCM library. Make sure that the LDR LCM version that is used is compatible.</value> <!-- * Exceptions Fatal 10451-10475 |