Merge "Add initial structure for unittest" into tizen
[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.h>
32 #include <mm_debug.h>
33
34 /* general */
35 #ifndef ARRAY_SIZE
36 #define ARRAY_SIZE(arr)  (sizeof(arr) / sizeof((arr)[0]))
37 #endif
38 #define MMWFD_MAX_INT (2147483647)
39
40 /**
41  * Enumeration for attribute values types.
42  */
43 typedef enum {
44         MM_WFD_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
45         MM_WFD_ATTRS_TYPE_INT,                 /**< Integer type */
46         MM_WFD_ATTRS_TYPE_DOUBLE,              /**< Double type */
47         MM_WFD_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
48         MM_WFD_ATTRS_TYPE_DATA,                /**< Pointer type */
49         MM_WFD_ATTRS_TYPE_ARRAY,               /**< Array type */
50         MM_WFD_ATTRS_TYPE_RANGE,               /**< Range type */
51         MM_WFD_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
52 } MMWfdAttrsType;
53
54 /**
55  * Enumeration for attribute validation type.
56  */
57 typedef enum {
58         MM_WFD_ATTRS_VALID_TYPE_INVALID = -1,       /**< Invalid validation type */
59         MM_WFD_ATTRS_VALID_TYPE_NONE,               /**< Do not check validity */
60         MM_WFD_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
61         MM_WFD_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
62         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_ARRAY,       /**< validity checking type of double array */
63         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
64 } MMWfdAttrsValidType;
65
66 /**
67  * Enumeration for attribute access flag.
68  */
69 typedef enum {
70         MM_WFD_ATTRS_FLAG_NONE = 0,              /**< None flag is set */
71         MM_WFD_ATTRS_FLAG_READABLE = 1 << 0,     /**< Readable */
72         MM_WFD_ATTRS_FLAG_WRITABLE = 1 << 1,     /**< Writable */
73         MM_WFD_ATTRS_FLAG_MODIFIED = 1 << 2,     /**< Modified */
74
75         MM_WFD_ATTRS_FLAG_RW = MM_WFD_ATTRS_FLAG_READABLE | MM_WFD_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
76 } MMWfdAttrsFlag;
77
78 /**
79  * Attribute validity structure
80  */
81 typedef struct {
82         MMWfdAttrsType type;
83         MMWfdAttrsValidType validity_type;
84         MMWfdAttrsFlag flag;
85         /**
86           * a union that describes validity of the attribute.
87           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
88           * the attribute can have validity.
89          */
90         union {
91                 /**
92                    * Validity structure for integer array.
93                  */
94                 struct {
95                         int *array;  /**< a pointer of array */
96                         int count;   /**< size of array */
97                         int d_val;
98                 } int_array;
99                 /**
100                    * Validity structure for integer range.
101                  */
102                 struct {
103                         int min;   /**< minimum range */
104                         int max;   /**< maximum range */
105                         int d_val;
106                 } int_range;
107                 /**
108                 * Validity structure for double array.
109                 */
110                 struct {
111                         double    *array;  /**< a pointer of array */
112                         int    count;   /**< size of array */
113                         double d_val;
114                 } double_array;
115                 /**
116                 * Validity structure for double range.
117                 */
118                 struct {
119                         double   min;   /**< minimum range */
120                         double   max;   /**< maximum range */
121                         double d_val;
122                 } double_range;
123         };
124 } MMWfdAttrsInfo;
125
126 MMHandleType _mmwfd_construct_attribute(MMHandleType hwfd);
127 void  _mmwfd_deconstruct_attribute(MMHandleType hwfd);
128 int _mmwfd_set_attribute(MMHandleType hwfd,  char **err_atr_name, const char *attribute_name, va_list args_list);
129 int _mmwfd_get_attributes_info(MMHandleType handle,  const char *attribute_name, MMWfdAttrsInfo *dst_info);
130 int _mmwfd_get_attribute(MMHandleType handle,  char **err_attr_name, const char *attribute_name, va_list args_list);
131 #endif /* __MM_WFD_ATTRS_H__ */