Repackage capi-media-vision to each submodules
[platform/core/api/mediavision.git] / mv_common / src / mv_private.c
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 #include <system_info.h>
18
19 #include "mv_private.h"
20
21 bool __mv_check_system_info_feature_supported()
22 {
23         bool isBarcodeDetectionSupported = false;
24         bool isBarcodeGenerationSupported = false;
25         bool isFaceRecognitionSupported = false;
26         bool isImageRecognitionSupported = false;
27
28         const int nRetVal1 = system_info_get_platform_bool(
29                                         "http://tizen.org/feature/vision.barcode_detection",
30                                         &isBarcodeDetectionSupported);
31
32         if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
33                 LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
34                 return false;
35         }
36
37         const int nRetVal2 = system_info_get_platform_bool(
38                                         "http://tizen.org/feature/vision.barcode_generation",
39                                         &isBarcodeGenerationSupported);
40
41         if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
42                 LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
43                 return false;
44         }
45
46         const int nRetVal3 = system_info_get_platform_bool(
47                                         "http://tizen.org/feature/vision.face_recognition",
48                                         &isFaceRecognitionSupported);
49
50         if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
51                 LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
52                 return false;
53         }
54
55         const int nRetVal4 = system_info_get_platform_bool(
56                                         "http://tizen.org/feature/vision.image_recognition",
57                                         &isImageRecognitionSupported);
58
59         if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
60                 LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
61                 return false;
62         }
63
64         (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
65                 isFaceRecognitionSupported  || isImageRecognitionSupported) ?
66                         LOGI("system_info_get_platform_bool returned"
67                                         "Supported one feature among barcode detection, "
68                                         "barcode generation, face recognition, "
69                                         "and image recognition capability\n") :
70                         LOGE("system_info_get_platform_bool returned"
71                                         "Unsupported all features of barcode detection, "
72                                         "barcode generation, face recognition, "
73                                         "and image recognition capability\n") ;
74
75         return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
76                         isFaceRecognitionSupported  || isImageRecognitionSupported);
77 }
78
79 bool __mv_barcode_detect_check_system_info_feature_supported()
80 {
81         bool isBarcodeDetectionSupported = false;
82
83         const int nRetVal = system_info_get_platform_bool(
84                                         "http://tizen.org/feature/vision.barcode_detection",
85                                         &isBarcodeDetectionSupported);
86
87         if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
88                 LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
89                 return false;
90         }
91
92         isBarcodeDetectionSupported ?
93                         LOGI("system_info_get_platform_bool returned "
94                                         "Supported barcode detection feature capability\n") :
95                         LOGE("system_info_get_platform_bool returned "
96                                         "Unsupported barcode detection feature capability\n");
97
98         return isBarcodeDetectionSupported;
99 }
100
101 bool __mv_barcode_generate_check_system_info_feature_supported()
102 {
103         bool isBarcodeGenerationSupported = false;
104
105         const int nRetVal = system_info_get_platform_bool(
106                                         "http://tizen.org/feature/vision.barcode_generation",
107                                         &isBarcodeGenerationSupported);
108
109         if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
110                 LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
111                 return false;
112         }
113
114         isBarcodeGenerationSupported ?
115                         LOGI("system_info_get_platform_bool returned "
116                                         "Supported barcode generation feature capability\n") :
117                         LOGE("system_info_get_platform_bool returned "
118                                         "Unsupported barcode generation feature capability\n");
119
120         return isBarcodeGenerationSupported;
121 }
122
123 bool __mv_face_check_system_info_feature_supported()
124 {
125         bool isFaceRecognitionSupported = false;
126
127         const int nRetVal = system_info_get_platform_bool(
128                                         "http://tizen.org/feature/vision.face_recognition",
129                                         &isFaceRecognitionSupported);
130
131         if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
132                 LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
133                 return false;
134         }
135
136         isFaceRecognitionSupported ?
137                         LOGI("system_info_get_platform_bool returned "
138                                         "Supported face recognition feature capability\n") :
139                         LOGE("system_info_get_platform_bool returned "
140                                         "Unsupported face recognition feature capability\n");
141
142         return isFaceRecognitionSupported;
143 }
144
145 bool __mv_image_check_system_info_feature_supported()
146 {
147         bool isImageRecognitionSupported = false;
148
149         const int nRetVal = system_info_get_platform_bool(
150                                         "http://tizen.org/feature/vision.image_recognition",
151                                         &isImageRecognitionSupported);
152
153         if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
154                 LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
155                 return false;
156         }
157
158         isImageRecognitionSupported ?
159                         LOGI("system_info_get_platform_bool returned "
160                                         "Supported image recognition feature capability\n") :
161                         LOGE("system_info_get_platform_bool returned "
162                                         "Unsupported image recognition feature capability\n");
163
164         return isImageRecognitionSupported;
165 }