audio-io handles not supported stream type
[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         /* Constants Definition */
33         static const unsigned int MSG_LENGTH = 512;
34
35         enum EError {
36             ERROR_NONE,
37
38             ERROR_INVALID_ARGUMENT,
39             ERROR_INVALID_HANDLE,
40             ERROR_INVALID_SAMPLERATE,
41             ERROR_INVALID_CHANNEL,
42             ERROR_INVALID_FORMAT,
43             ERROR_INVALID_POINTER,
44             ERROR_INVALID_OPERATION,
45
46             ERROR_NOT_INITIALIZED,
47             ERROR_NOT_SUPPORTED,
48             ERROR_NOT_SUPPORTED_TYPE,
49
50             ERROR_PERMISSION_DENIED,
51
52             ERROR_DEVICE_NOT_OPENED,
53             ERROR_DEVICE_NOT_CLOSED,
54
55             ERROR_OUT_OF_MEMORY,
56             ERROR_INTERNAL_OPERATION,
57             ERROR_FAILED_OPERATION,
58
59             ERROR_POLICY_BLOCKED,
60             ERROR_POLICY_INTERRUPTED,
61             ERROR_POLICY_DUPLICATED,
62
63             ERROR_MAX
64         };
65
66     private:
67         /* Members */
68         static EError mLastError;
69         static char   mLastErrorMsg[MSG_LENGTH];
70
71         EError        mError;
72         char          mErrorMsg[MSG_LENGTH];
73
74         const char* _convertErrorToString(EError err);
75
76     public:
77         /* Constructor & Destructor */
78         CAudioError(EError err);
79         CAudioError(EError err, const char* fileName, const char* parentFunc, int lineNum);
80         CAudioError(EError err, const char* msg, const char* fileName, const char* parentFunc, int lineNum);
81         //CAudioError(CAudioError& err);
82         ~CAudioError();
83
84         /* Static Methods */
85         static EError getLastError();
86         static const char* getLastErrorMsg();
87
88         /* Setter & Getter */
89         EError getError();
90         const char* getErrorMsg();
91
92         /* Overrided Operation */
93         CAudioError& operator =  (const EError err);
94         CAudioError& operator =  (const CAudioError& err);
95         bool         operator != (const EError err);
96         bool         operator == (const EError err);
97 //        friend bool operator == (const CAudioError& src, const EError& err);
98     };
99
100 } /* namespace tizen_media_audio */
101
102 #endif
103 #endif /* __TIZEN_MEDIA_CPP_OBJECTS_IO_H__ */