Tzien coding convention
[platform/core/multimedia/libmm-wfd.git] / src / include / mm_wfd_sink_attrs.h
1 /*
2  * libmm-wfd
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, ByungWook Jang <bw.jang@samsung.com>,
7  * Manoj Kumar K <manojkumar.k@samsung.com>, Hyunil Park <hyunil46.park@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __MM_WFD_ATTRS_H__
24 #define __MM_WFD_ATTRS_H__
25
26 #include <string.h>
27 #include <glib.h>
28 #include <mm_message.h>
29 #include <mm_error.h>
30 #include <mm_types.h>
31 #include <mm_attrs_private.h>
32 #include <mm_attrs.h>
33 #include <mm_debug.h>
34
35 /* general */
36 #ifndef ARRAY_SIZE
37 #define ARRAY_SIZE(arr)  (sizeof(arr) / sizeof((arr)[0]))
38 #endif
39 #define MMWFD_MAX_INT (2147483647)
40
41 /**
42  * Enumeration for attribute values types.
43  */
44 typedef enum {
45         MM_WFD_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
46         MM_WFD_ATTRS_TYPE_INT,                 /**< Integer type */
47         MM_WFD_ATTRS_TYPE_DOUBLE,              /**< Double type */
48         MM_WFD_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
49         MM_WFD_ATTRS_TYPE_DATA,                /**< Pointer type */
50         MM_WFD_ATTRS_TYPE_ARRAY,               /**< Array type */
51         MM_WFD_ATTRS_TYPE_RANGE,               /**< Range type */
52         MM_WFD_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
53 } MMWfdAttrsType;
54
55 /**
56  * Enumeration for attribute validation type.
57  */
58 typedef enum {
59         MM_WFD_ATTRS_VALID_TYPE_INVALID = -1,       /**< Invalid validation type */
60         MM_WFD_ATTRS_VALID_TYPE_NONE,               /**< Do not check validity */
61         MM_WFD_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
62         MM_WFD_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
63         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_ARRAY,       /**< validity checking type of double array */
64         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
65 } MMWfdAttrsValidType;
66
67 /**
68  * Enumeration for attribute access flag.
69  */
70 typedef enum {
71         MM_WFD_ATTRS_FLAG_NONE = 0,              /**< None flag is set */
72         MM_WFD_ATTRS_FLAG_READABLE = 1 << 0,     /**< Readable */
73         MM_WFD_ATTRS_FLAG_WRITABLE = 1 << 1,     /**< Writable */
74         MM_WFD_ATTRS_FLAG_MODIFIED = 1 << 2,     /**< Modified */
75
76         MM_WFD_ATTRS_FLAG_RW = MM_WFD_ATTRS_FLAG_READABLE | MM_WFD_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
77 } MMWfdAttrsFlag;
78
79 /**
80  * Attribute validity structure
81  */
82 typedef struct {
83         MMWfdAttrsType type;
84         MMWfdAttrsValidType validity_type;
85         MMWfdAttrsFlag flag;
86         /**
87           * a union that describes validity of the attribute.
88           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
89           * the attribute can have validity.
90          */
91         union {
92                 /**
93                    * Validity structure for integer array.
94                  */
95                 struct {
96                         int *array;  /**< a pointer of array */
97                         int count;   /**< size of array */
98                         int d_val;
99                 } int_array;
100                 /**
101                    * Validity structure for integer range.
102                  */
103                 struct {
104                         int min;   /**< minimum range */
105                         int max;   /**< maximum range */
106                         int d_val;
107                 } int_range;
108                 /**
109                 * Validity structure for double array.
110                 */
111                 struct {
112                         double    *array;  /**< a pointer of array */
113                         int    count;   /**< size of array */
114                         double d_val;
115                 } double_array;
116                 /**
117                 * Validity structure for double range.
118                 */
119                 struct {
120                         double   min;   /**< minimum range */
121                         double   max;   /**< maximum range */
122                         double d_val;
123                 } double_range;
124         };
125 } MMWfdAttrsInfo;
126
127 MMHandleType _mmwfd_construct_attribute(MMHandleType hwfd);
128 void  _mmwfd_deconstruct_attribute(MMHandleType hwfd);
129 int _mmwfd_set_attribute(MMHandleType hwfd,  char **err_atr_name, const char *attribute_name, va_list args_list);
130 int _mmwfd_get_attributes_info(MMHandleType handle,  const char *attribute_name, MMWfdAttrsInfo *dst_info);
131 int _mmwfd_get_attribute(MMHandleType handle,  char **err_attr_name, const char *attribute_name, va_list args_list);
132 #endif /* __MM_WFD_ATTRS_H__ */