Initial commit
[platform/core/ml/aitt.git] / include / AittTypes.h
1 /*
2  * Copyright (c) 2021-2022 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 #pragma once
17
18 #define API __attribute__((visibility("default")))
19
20 typedef void* AittSubscribeID;
21
22 enum AittProtocol {
23     AITT_TYPE_UNKNOWN = 0,
24     AITT_TYPE_MQTT = (0x1 << 0),    // Publish message through the MQTT
25     AITT_TYPE_TCP = (0x1 << 1),     // Publish message to peers using the TCP
26     AITT_TYPE_WEBRTC = (0x1 << 2),  // Publish message to peers using the WEBRTC
27 };
28
29 // AittQoS only works with the AITT_TYPE_MQTT
30 enum AittQoS {
31     AITT_QOS_AT_MOST_ONCE = 0,   // Fire and forget
32     AITT_QOS_AT_LEAST_ONCE = 1,  // Receiver is able to receive multiple times
33     AITT_QOS_EXACTLY_ONCE = 2,   // Receiver only receives exactly once
34 };
35
36 enum AittConnectionState {
37     AITT_DISCONNECTED = 0,  // The connection is disconnected.
38     AITT_CONNECTED = 1,     // A connection was successfully established to the mqtt broker.
39 };
40
41 #ifdef TIZEN
42 #include <tizen.h>
43 #define TIZEN_ERROR_AITT -0x04020000
44 #else
45 #include <errno.h>
46
47 #define TIZEN_ERROR_NONE 0
48 #define TIZEN_ERROR_INVALID_PARAMETER -EINVAL
49 #define TIZEN_ERROR_PERMISSION_DENIED -EACCES
50 #define TIZEN_ERROR_OUT_OF_MEMORY -ENOMEM
51 #define TIZEN_ERROR_TIMED_OUT (-1073741824LL + 1)
52 #define TIZEN_ERROR_NOT_SUPPORTED (-1073741824LL + 2)
53 #define TIZEN_ERROR_AITT -0x04020000
54 #endif
55
56 enum AittError {
57     AITT_ERROR_NONE = TIZEN_ERROR_NONE,                           /**< On Success */
58     AITT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
59     AITT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
60     AITT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,         /**< Out of memory */
61     AITT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT,                 /**< Time out */
62     AITT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,         /**< Not supported */
63     AITT_ERROR_UNKNOWN = TIZEN_ERROR_AITT | 0x01,                 /**< Unknown Error */
64     AITT_ERROR_SYSTEM = TIZEN_ERROR_AITT | 0x02,                  /**< System errors */
65     AITT_ERROR_NOT_READY = TIZEN_ERROR_AITT | 0x03,               /**< System errors */
66 };