2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseNativeError.h
19 * @brief This is the header file for handling Native errors.
22 #ifndef _FBASE_NATIVE_ERROR_H_
23 #define _FBASE_NATIVE_ERROR_H_
25 #include <FBaseResult.h>
28 #define __FUNCX__ __PRETTY_FUNCTION__
31 #define __ConvertNativeErrorToResult(errNo) _NativeError::ConvertNativeErrorToResult(errNo, __FILE__, __LINE__, __FUNCX__)
32 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo, __FILE__, __LINE__, __FUNCX__)
34 #define __ConvertNativeErrorToResult(errNo) _NativeError::ConvertNativeErrorToResult(errNo)
35 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo)
38 #define __ConvertNativeSystemErrorToResult(errNo) _NativeError::ConvertNativeSystemErrorToResult(errNo)
39 #define __ConvertNativeDeviceErrorToResult(errNo) _NativeError::ConvertNativeDeviceErrorToResult(errNo)
40 #define __ConvertNativePowerErrorToResult(errNo) _NativeError::ConvertNativePowerErrorToResult(errNo)
41 #define __ConvertNativeAlarmErrorToResult(errNo) _NativeError::ConvertNativeAlarmErrorToResult(errNo)
42 #define __ConvertNativeHapticErrorToResult(errNo) _NativeError::ConvertNativeHapticErrorToResult(errNo)
43 #define __ConvertNativeTelephonyErrorToResult(errNo) _NativeError::ConvertNativeTelephonyErrorToResult(errNo)
44 #define __ConvertNativeSoundManagerErrorToResult(errNo) _NativeError::ConvertNativeSoundManagerErrorToResult(errNo)
45 #define __ConvertNativeSqliteErrorToResult(errNo) _NativeError::ConvertNativeSqliteErrorToResult(errNo)
46 #define __ConvertNativeSqliteErrorToDetailResult(errNo) _NativeError::ConvertNativeSqliteErrorToDetailResult(errNo)
49 * @class _NativeError & FBaseNativeError.h
50 * @brief This is implemenatation of handling native errors.
57 // Convert Linux errno to Result type
59 static result ConvertNativeErrorToResult(int errNo, bool logNativeErr = false);
62 // Convert Linux errno to Result type
64 static result ConvertNativeErrorToResult(int errNo, const char* pFile, int line, const char* pFunction, bool logNativeErr = false);
67 // Convert Linux errno to Result type message
69 static const char* ConvertNativeErrorToMessage(int errNo);
72 // Convert Linux errno to Result type message
74 static const char* ConvertNativeErrorToMessage(int errNo, const char* pFile, int line, const char* pFunction);
77 // Convert SLP system_info error to Result type
79 static result ConvertNativeSystemErrorToResult(int err);
82 // Convert SLP device error to Result type
84 static result ConvertNativeDeviceErrorToResult(int err);
87 // Convert SLP power error to Result type
89 static result ConvertNativePowerErrorToResult(int err);
92 // Convert SLP alarm error to Result type
94 static result ConvertNativeAlarmErrorToResult(int err);
97 // Convert SLP haptic error to Result type
99 static result ConvertNativeHapticErrorToResult(int err);
102 // Convert SLP Telephony error to Result type
104 static result ConvertNativeTelephonyErrorToResult(int err);
107 // Convert SLP Telephony error to Result type
109 static result ConvertNativeSoundManagerErrorToResult(int err);
112 // Converts SQLite error to Result type for OSP 2.0
114 static result ConvertNativeSqliteErrorToResult(int err);
117 // Converts SQLite error to Result type for OSP 3.0
119 static result ConvertNativeSqliteErrorToDetailResult(int err);
123 #endif //_FBASE_NATIVE_ERROR_H_