summaryrefslogtreecommitdiff
path: root/mv_image/image/src/mv_private.c
blob: 16ae6a41c113e8d96d829e46d90973a04b547095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
/**
 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <system_info.h>

#include "mv_private.h"

bool __mv_check_system_info_feature_supported()
{
	bool isBarcodeDetectionSupported = false;
	bool isBarcodeGenerationSupported = false;
	bool isFaceRecognitionSupported = false;
	bool isImageRecognitionSupported = false;
	bool isInferenceImageSupported = false;
	bool isInferenceFaceSupported = false;

	const int nRetVal1 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.barcode_detection",
					&isBarcodeDetectionSupported);

	if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
		return false;
	}

	const int nRetVal2 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.barcode_generation",
					&isBarcodeGenerationSupported);

	if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
		return false;
	}

	const int nRetVal3 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.face_recognition",
					&isFaceRecognitionSupported);

	if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
		return false;
	}

	const int nRetVal4 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.image_recognition",
					&isImageRecognitionSupported);

	if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
		return false;
	}
	const int nRetVal5 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.image",
					&isInferenceImageSupported);

	if (nRetVal5 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.image");
		return false;
	}

	const int nRetVal6 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.face",
					&isInferenceFaceSupported);

	if (nRetVal6 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.face");
		return false;
	}
	(isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
		isFaceRecognitionSupported  || isImageRecognitionSupported ||
		isInferenceImageSupported || isInferenceFaceSupported) ?
			LOGI("system_info_get_platform_bool returned"
					"Supported one feature among barcode detection, "
					"barcode generation, face recognition, "
					"image recognition, and inference capability\n") :
			LOGE("system_info_get_platform_bool returned"
					"Unsupported all features of barcode detection, "
					"barcode generation, face recognition, "
					"image recognition, inference capability\n") ;

	return (isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
			isFaceRecognitionSupported  || isImageRecognitionSupported ||
			isInferenceImageSupported   || isInferenceFaceSupported);
}

bool __mv_barcode_detect_check_system_info_feature_supported()
{
	bool isBarcodeDetectionSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.barcode_detection",
					&isBarcodeDetectionSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection");
		return false;
	}

	isBarcodeDetectionSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported barcode detection feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported barcode detection feature capability\n");

	return isBarcodeDetectionSupported;
}

bool __mv_barcode_generate_check_system_info_feature_supported()
{
	bool isBarcodeGenerationSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.barcode_generation",
					&isBarcodeGenerationSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation");
		return false;
	}

	isBarcodeGenerationSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported barcode generation feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported barcode generation feature capability\n");

	return isBarcodeGenerationSupported;
}

bool __mv_face_check_system_info_feature_supported()
{
	bool isFaceRecognitionSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.face_recognition",
					&isFaceRecognitionSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.face_recognition");
		return false;
	}

	isFaceRecognitionSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported face recognition feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported face recognition feature capability\n");

	return isFaceRecognitionSupported;
}

bool __mv_image_check_system_info_feature_supported()
{
	bool isImageRecognitionSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.image_recognition",
					&isImageRecognitionSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.image_recognition");
		return false;
	}

	isImageRecognitionSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported image recognition feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported image recognition feature capability\n");

	return isImageRecognitionSupported;
}

bool __mv_inference_check_system_info_feature_supported()
{
	bool isInferenceImageSupported = false;
	bool isInferenceFaceSupported = false;

	const int nRetVal1 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.image",
					&isInferenceImageSupported);

	if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.image");
		return false;
	}

	const int nRetVal2 = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.face",
					&isInferenceFaceSupported);

	if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.face");
		return false;
	}

	(isInferenceImageSupported || isInferenceFaceSupported) ?
			LOGI("system_info_get_platform_bool returned "
					"Supported inference feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported inference feature capability\n");

	return (isInferenceImageSupported || isInferenceFaceSupported);
}

bool __mv_inference_image_check_system_info_feature_supported()
{
	bool isInferenceImageSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.image",
					&isInferenceImageSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.image");
		return false;
	}

	isInferenceImageSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported inference image feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported inference image feature capability\n");

	return isInferenceImageSupported;
}

bool __mv_inference_face_check_system_info_feature_supported()
{
	bool isInferenceFaceSupported = false;

	const int nRetVal = system_info_get_platform_bool(
					"http://tizen.org/feature/vision.inference.face",
					&isInferenceFaceSupported);

	if (nRetVal != SYSTEM_INFO_ERROR_NONE) {
		LOGE("SYSTEM_INFO_ERROR: vision.inference.face");
		return false;
	}

	isInferenceFaceSupported ?
			LOGI("system_info_get_platform_bool returned "
					"Supported inference face feature capability\n") :
			LOGE("system_info_get_platform_bool returned "
					"Unsupported inference face feature capability\n");

	return isInferenceFaceSupported;
}