2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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.
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
24 namespace tizen_media_audio {
32 /* Enums Definition */
33 enum class EError : unsigned int {
36 ERROR_INVALID_ARGUMENT,
38 ERROR_INVALID_SAMPLERATE,
39 ERROR_INVALID_CHANNEL,
41 ERROR_INVALID_POINTER,
42 ERROR_INVALID_OPERATION,
45 ERROR_NOT_INITIALIZED,
47 ERROR_NOT_SUPPORTED_TYPE,
49 ERROR_PERMISSION_DENIED,
51 ERROR_DEVICE_POLICY_RESTRICTION,
52 ERROR_DEVICE_NOT_OPENED,
53 ERROR_DEVICE_NOT_CLOSED,
56 ERROR_INTERNAL_OPERATION,
57 ERROR_FAILED_OPERATION,
60 ERROR_POLICY_INTERRUPTED,
61 ERROR_POLICY_DUPLICATED,
66 /* Constants Definition */
67 static const unsigned int MSG_LENGTH = 512;
69 /* Constructor & Destructor */
70 explicit CAudioError(EError err);
71 CAudioError(EError err, const char* fileName, const char* parentFunc, int lineNum);
72 CAudioError(EError err, const char* msg, const char* fileName, const char* parentFunc, int lineNum);
73 CAudioError(const CAudioError& err);
74 virtual ~CAudioError() = default;
77 static EError getLastError();
78 static const char* getLastErrorMsg();
82 const char* getErrorMsg();
84 /* Overrided Operation */
85 CAudioError& operator = (const EError err);
86 CAudioError& operator = (const CAudioError& err);
87 bool operator != (const EError err);
88 bool operator == (const EError err);
89 //friend bool operator == (const CAudioError& src, const EError& err);
92 const char* __convertErrorToString(EError err);
95 static EError __mLastError;
96 static char __mLastErrorMsg[MSG_LENGTH];
98 char __mErrorMsg[MSG_LENGTH]{};
102 } /* namespace tizen_media_audio */
105 #endif /* __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__ */