mmserv/tms/tmsutility/src/tmsutility.cpp
changeset 42 1fa3fb47b1e3
parent 22 128eb6a32b84
--- a/mmserv/tms/tmsutility/src/tmsutility.cpp	Tue Jul 06 14:50:35 2010 +0300
+++ b/mmserv/tms/tmsutility/src/tmsutility.cpp	Wed Aug 18 10:17:22 2010 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
  * All rights reserved.
  * This component and the accompanying materials are made available
  * under the terms of "Eclipse Public License v1.0"
@@ -120,6 +120,52 @@
     }
 
 // -----------------------------------------------------------------------------
+// TMSUtility::SymbianResult
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt TMSUtility::SymbianResult(const gint aError)
+    {
+    TInt result(KErrNone);
+
+    if (aError <= TMS_RESULT_SUCCESS)
+        {
+        return aError; //return Symbian error
+        }
+
+    switch (aError)
+        {
+        case TMS_RESULT_DOES_NOT_EXIST:
+            result = KErrNotFound;
+            break;
+        case TMS_RESULT_OPERATION_CANCELLED:
+            result = KErrCancel;
+            break;
+        case TMS_RESULT_INSUFFICIENT_MEMORY:
+            result = KErrNoMemory;
+            break;
+        case TMS_RESULT_ILLEGAL_OPERATION:
+            result = KErrNotSupported;
+            break;
+        case TMS_RESULT_INVALID_ARGUMENT:
+            result = KErrArgument;
+            break;
+        case TMS_RESULT_BUFFER_LATENCY_ERROR:
+            result = KErrUnderflow;
+            break;
+        case TMS_RESULT_ALREADY_EXIST:
+            result = KErrAlreadyExists;
+            break;
+        case TMS_RESULT_FATAL_ERROR:
+        case TMS_RESULT_GENERAL_ERROR:
+        default:
+            result = KErrGeneral;
+            break;
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
 // TMSUtility::EtelToTMSResult
 //
 // -----------------------------------------------------------------------------