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.
21 #ifndef _FBASE_NATIVE_ERROR_H_
22 #define _FBASE_NATIVE_ERROR_H_
24 #include <FBaseResult.h>
26 #define __FUNCX__ __PRETTY_FUNCTION__
29 #define __ConvertNativeErrorToResult(errNo) _NativeError::ConvertNativeErrorToResult(errNo, __FILE__, __LINE__, __FUNCX__)
30 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo, __FILE__, __LINE__, __FUNCX__)
32 #define __ConvertNativeErrorToResult(errNo) _NativeError::ConvertNativeErrorToResult(errNo)
33 #define __ConvertNativeErrorToMessage(errNo) _NativeError::ConvertNativeErrorToMessage(errNo)
36 #define __ConvertNativeSystemErrorToResult(errNo) _NativeError::ConvertNativeSystemErrorToResult(errNo)
37 #define __ConvertNativeDeviceErrorToResult(errNo) _NativeError::ConvertNativeDeviceErrorToResult(errNo)
38 #define __ConvertNativePowerErrorToResult(errNo) _NativeError::ConvertNativePowerErrorToResult(errNo)
39 #define __ConvertNativeAlarmErrorToResult(errNo) _NativeError::ConvertNativeAlarmErrorToResult(errNo)
40 #define __ConvertNativeHapticErrorToResult(errNo) _NativeError::ConvertNativeHapticErrorToResult(errNo)
41 #define __ConvertNativeTelephonyErrorToResult(errNo) _NativeError::ConvertNativeTelephonyErrorToResult(errNo)
42 #define __ConvertNativeSoundManagerErrorToResult(errNo) _NativeError::ConvertNativeSoundManagerErrorToResult(errNo)
43 #define __ConvertNativeSqliteErrorToResult(errNo) _NativeError::ConvertNativeSqliteErrorToResult(errNo)
44 #define __ConvertNativeSqliteErrorToDetailResult(errNo) _NativeError::ConvertNativeSqliteErrorToDetailResult(errNo)
47 * @class _NativeError & FBaseNativeError.h
48 * @brief This is implemenatation of handling native errors.
51 class _OSP_EXPORT_ _NativeError
55 // Convert Linux errno to Result type
57 static result ConvertNativeErrorToResult(int errNo, bool logNativeErr = false);
60 // Convert Linux errno to Result type
62 static result ConvertNativeErrorToResult(int errNo, const char* pFile, int line, const char* pFunction, bool logNativeErr = false);
65 // Convert Linux errno to Result type message
67 static const char* ConvertNativeErrorToMessage(int errNo);
70 // Convert Linux errno to Result type message
72 static const char* ConvertNativeErrorToMessage(int errNo, const char* pFile, int line, const char* pFunction);
75 // Convert SLP system_info error to Result type
77 static result ConvertNativeSystemErrorToResult(int err);
80 // Convert SLP device error to Result type
82 static result ConvertNativeDeviceErrorToResult(int err);
85 // Convert SLP power error to Result type
87 static result ConvertNativePowerErrorToResult(int err);
90 // Convert SLP alarm error to Result type
92 static result ConvertNativeAlarmErrorToResult(int err);
95 // Convert SLP haptic error to Result type
97 static result ConvertNativeHapticErrorToResult(int err);
100 // Convert SLP Telephony error to Result type
102 static result ConvertNativeTelephonyErrorToResult(int err);
105 // Convert SLP Telephony error to Result type
107 static result ConvertNativeSoundManagerErrorToResult(int err);
110 // Converts SQLite error to Result type for OSP 2.0
112 static result ConvertNativeSqliteErrorToResult(int err);
115 // Converts SQLite error to Result type for OSP 3.0
117 static result ConvertNativeSqliteErrorToDetailResult(int err);
120 #endif //_FBASE_NATIVE_ERROR_H_