Modify for replacing wearable version 2.4 with 3.0
[platform/core/api/audio-io.git] / include / CAudioError.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
18 #define __TIZEN_MEDIA_AUDIO_IO_CAUDIOERROR_H__
19
20
21 #ifdef __cplusplus
22
23
24 namespace tizen_media_audio {
25
26
27     /**
28      * Audio Error
29      */
30     class CAudioError {
31     public:
32         /* Enums Definition */
33         enum class EError : unsigned int {
34             ERROR_NONE,
35
36             ERROR_INVALID_ARGUMENT,
37             ERROR_INVALID_HANDLE,
38             ERROR_INVALID_SAMPLERATE,
39             ERROR_INVALID_CHANNEL,
40             ERROR_INVALID_FORMAT,
41             ERROR_INVALID_POINTER,
42             ERROR_INVALID_OPERATION,
43
44             ERROR_NOT_INITIALIZED,
45             ERROR_NOT_SUPPORTED,
46             ERROR_NOT_SUPPORTED_TYPE,
47
48             ERROR_PERMISSION_DENIED,
49
50             ERROR_DEVICE_NOT_OPENED,
51             ERROR_DEVICE_NOT_CLOSED,
52
53             ERROR_OUT_OF_MEMORY,
54             ERROR_INTERNAL_OPERATION,
55             ERROR_FAILED_OPERATION,
56
57             ERROR_POLICY_BLOCKED,
58             ERROR_POLICY_INTERRUPTED,
59             ERROR_POLICY_DUPLICATED,
60
61             ERROR_MAX
62         };
63
64         /* Constants Definition */
65         static const unsigned int MSG_LENGTH = 512;
66
67         /* Constructor & Destructor */
68         CAudioError(EError err);
69         CAudioError(EError err, const char* fileName, const char* parentFunc, int lineNum);
70         CAudioError(EError err, const char* msg, const char* fileName, const char* parentFunc, int lineNum);
71         //CAudioError(CAudioError& err);
72         ~CAudioError();
73
74         /* Static Methods */
75         static EError getLastError();
76         static const char* getLastErrorMsg();
77
78         /* Setter & Getter */
79         EError getError();
80         const char* getErrorMsg();
81
82         /* Overrided Operation */
83         CAudioError& operator =  (const EError err);
84         CAudioError& operator =  (const CAudioError& err);
85         bool         operator != (const EError err);
86         bool         operator == (const EError err);
87         //friend bool operator == (const CAudioError& src, const EError& err);
88
89     private:
90         const char* __convertErrorToString(EError err);
91
92         /* Members */
93         static EError __mLastError;
94         static char   __mLastErrorMsg[MSG_LENGTH];
95         EError        __mError;
96         char          __mErrorMsg[MSG_LENGTH];
97     };
98
99
100 } /* namespace tizen_media_audio */
101
102 #endif
103 #endif /* __TIZEN_MEDIA_CPP_OBJECTS_IO_H__ */