summaryrefslogtreecommitdiff
path: root/src/mv_private.c
blob: 796f8f915880f0f0af6dbef6671115e640d153fe (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
/**
 * 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;

	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;
	}

	(isBarcodeDetectionSupported || isBarcodeGenerationSupported ||
		isFaceRecognitionSupported  || isImageRecognitionSupported) ?
			LOGI("system_info_get_platform_bool returned"
					"Supported one feature among barcode detection, "
					"barcode generation, face recognition, "
					"and image recognition capability\n") :
			LOGE("system_info_get_platform_bool returned"
					"Unsupported all features of barcode detection, "
					"barcode generation, face recognition, "
					"and image recognition capability\n") ;

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

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;
}