tizen 2.3 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Systeminfo / SystemInfoDeviceCapability.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include <PlatformException.h>
19 #include <Logger.h>
20 #include <fstream>
21 #include <system_info.h>
22 #include <system_info_internal.h>
23
24 #include "SystemInfoDeviceCapability.h"
25 #include "SystemInfoUtil.h"
26
27 namespace DeviceAPI {
28 namespace SystemInfo {
29
30 namespace {
31
32 #ifdef PROFILE_MOBILE
33 const char* DEVICE_PROFILE = "MOBILE";
34 #elif PROFILE_MOBILE_FULL
35 const char* DEVICE_PROFILE = "MOBILE_FULL"; //TODO to be removed
36 #elif PROFILE_MOBILE_WEB
37 const char* DEVICE_PROFILE = "MOBILE_WEB"; //TODO to be removed
38 #elif PROFILE_WEARABLE
39 const char* DEVICE_PROFILE = "WEARABLE";
40 #elif PROFILE_TV
41 const char* DEVICE_PROFILE = "TV";
42 #else
43 const char* DEVICE_PROFILE = "";
44 #endif
45
46 const char* OPENGLES_TEXTURE_DELIMITER = "/";
47 const char* OPENGLES_TEXTURE_UTC = "utc";
48 const char* OPENGLES_TEXTURE_PTC = "ptc";
49 const char* OPENGLES_TEXTURE_ETC = "etc";
50 const char* OPENGLES_TEXTURE_3DC = "3dc";
51 const char* OPENGLES_TEXTURE_ATC = "atc";
52 const char* OPENGLES_TEXTURE_PVRTC = "pvrtc";
53 }
54
55 SystemInfoDeviceCapability::SystemInfoDeviceCapability()
56 {
57     LOGD("Entered");
58 }
59
60 SystemInfoDeviceCapability::~SystemInfoDeviceCapability()
61 {
62     LOGD("Entered");
63 }
64
65 bool SystemInfoDeviceCapability::isAccount()
66 {
67     LOGD("Entered");
68     return getValueBool("tizen.org/feature/account");
69 }
70
71 bool SystemInfoDeviceCapability::isArchive()
72 {
73     LOGD("Entered");
74     return getValueBool("tizen.org/feature/archive");
75 }
76
77 bool SystemInfoDeviceCapability::isBadge()
78 {
79     LOGD("Entered");
80     return getValueBool("tizen.org/feature/badge");
81 }
82
83 bool SystemInfoDeviceCapability::isBookmark()
84 {
85     LOGD("Entered");
86     return getValueBool("tizen.org/feature/bookmark");
87 }
88
89 bool SystemInfoDeviceCapability::isCalendar()
90 {
91     LOGD("Entered");
92     return getValueBool("tizen.org/feature/calendar");
93 }
94
95 bool SystemInfoDeviceCapability::isContact()
96 {
97     LOGD("Entered");
98     return getValueBool("tizen.org/feature/contact");
99 }
100
101 bool SystemInfoDeviceCapability::isDataControl()
102 {
103     LOGD("Entered");
104     return getValueBool("tizen.org/feature/datacontrol");
105 }
106
107 bool SystemInfoDeviceCapability::isDataSync()
108 {
109     LOGD("Entered");
110     return getValueBool("tizen.org/feature/datasync");
111 }
112
113 bool SystemInfoDeviceCapability::isDownload()
114 {
115     LOGD("Entered");
116     return getValueBool("tizen.org/feature/download");
117 }
118
119 bool SystemInfoDeviceCapability::isExif()
120 {
121     LOGD("Entered");
122     return getValueBool("tizen.org/feature/exif");
123 }
124
125 bool SystemInfoDeviceCapability::isMessagingEmail()
126 {
127     LOGD("Entered");
128     return getValueBool("tizen.org/feature/email");
129 }
130
131 bool SystemInfoDeviceCapability::isBluetooth()
132 {
133     LOGD("Entered");
134     return getValueBool("tizen.org/feature/network.bluetooth");
135 }
136
137 bool SystemInfoDeviceCapability::isBluetoothAudioCall()
138 {
139     LOGD("Entered");
140     return getValueBool("tizen.org/feature/network.bluetooth.audio.call");
141 }
142
143 bool SystemInfoDeviceCapability::isBluetoothAudioMedia()
144 {
145     LOGD("Entered");
146     return getValueBool("tizen.org/feature/network.bluetooth.audio.media");
147 }
148
149 bool SystemInfoDeviceCapability::isBluetootHealth()
150 {
151     LOGD("Entered");
152     return getValueBool("tizen.org/feature/network.bluetooth.health");
153 }
154
155 bool SystemInfoDeviceCapability::isBluetootHID()
156 {
157     LOGD("Entered");
158     return getValueBool("tizen.org/feature/network.bluetooth.hid");
159 }
160
161 bool SystemInfoDeviceCapability::isBluetootLE()
162 {
163     LOGD("Entered");
164     return getValueBool("tizen.org/feature/network.bluetooth.le");
165 }
166
167 bool SystemInfoDeviceCapability::isBluetootOPP()
168 {
169     LOGD("Entered");
170     return getValueBool("tizen.org/feature/network.bluetooth.opp");
171 }
172
173 bool SystemInfoDeviceCapability::isBluetoothAlwaysOn()
174 {
175     LOGD("Entered");
176 #ifdef FEATURE_OPTIONAL_BT_ALWAYS_ON
177     return true;
178 #else
179     return false;
180 #endif
181 }
182
183 std::string SystemInfoDeviceCapability::isCoreAPIVersion()
184 {
185     LOGD("Entered");
186     return "2.3";
187 }
188
189 bool SystemInfoDeviceCapability::isNfc()
190 {
191     LOGD("Entered");
192     return getValueBool("tizen.org/feature/network.nfc");
193 }
194
195 bool SystemInfoDeviceCapability::isNfcEmulation()
196 {
197     LOGD("Entered");
198     return getValueBool("tizen.org/feature/network.nfc.card_emulation");
199 }
200
201 bool SystemInfoDeviceCapability::isPush()
202 {
203     LOGD("Entered");
204     return getValueBool("tizen.org/feature/network.push");
205 }
206
207 bool SystemInfoDeviceCapability::isSecureElement()
208 {
209     LOGD("Entered");
210     return getValueBool("tizen.org/feature/network.secure_element");
211 }
212
213 bool SystemInfoDeviceCapability::isTelephony()
214 {
215     LOGD("Entered");
216     return getValueBool("tizen.org/feature/network.telephony");
217 }
218
219 bool SystemInfoDeviceCapability::isTelephonyMMS()
220 {
221     LOGD("Entered");
222     return getValueBool("tizen.org/feature/network.telephony.mms");
223 }
224
225 bool SystemInfoDeviceCapability::isNotification()
226 {
227     LOGD("Entered");
228     return getValueBool("tizen.org/feature/notification");
229 }
230
231 bool SystemInfoDeviceCapability::isWebSetting()
232 {
233     LOGD("Entered");
234     return getValueBool("tizen.org/feature/websetting");
235 }
236
237 bool SystemInfoDeviceCapability::isSystemSetting()
238 {
239     LOGD("Entered");
240     return getValueBool("tizen.org/feature/systemsetting");
241 }
242
243 bool SystemInfoDeviceCapability::isSystemSettingHomeScreen()
244 {
245     LOGD("Entered");
246     return getValueBool("tizen.org/feature/systemsetting.home_screen");
247 }
248
249 bool SystemInfoDeviceCapability::isSystemSettingLockScreen()
250 {
251     LOGD("Entered");
252     return getValueBool("tizen.org/feature/systemsetting.lock_screen");
253 }
254
255 bool SystemInfoDeviceCapability::isSystemSettingIncomingCall()
256 {
257     LOGD("Entered");
258     return getValueBool("tizen.org/feature/systemsetting.incoming_call");
259 }
260
261 bool SystemInfoDeviceCapability::isSystemSettingNotificationEmail()
262 {
263     LOGD("Entered");
264     return getValueBool("tizen.org/feature/systemsetting.notification_email");
265 }
266
267 bool SystemInfoDeviceCapability::isBattery()
268 {
269     LOGD("Entered");
270     return getValueBool("tizen.org/feature/battery");
271 }
272
273 bool SystemInfoDeviceCapability::isAccelerometer()
274 {
275     LOGD("Entered");
276     return getValueBool("tizen.org/feature/sensor.accelerometer");
277 }
278
279 bool SystemInfoDeviceCapability::isAccelerometerWakeup()
280 {
281     LOGD("Entered");
282     return getValueBool("tizen.org/feature/sensor.accelerometer.wakeup");
283 }
284
285 bool SystemInfoDeviceCapability::isActivityRecognition()
286 {
287     LOGD("Entered");
288     return getValueBool("tizen.org/feature/sensor.activity_recognition");
289 }
290
291 bool SystemInfoDeviceCapability::isBarometer()
292 {
293     LOGD("Entered");
294     return getValueBool("tizen.org/feature/sensor.barometer");
295 }
296
297 bool SystemInfoDeviceCapability::isBarometerWakeup()
298 {
299     LOGD("Entered");
300     return getValueBool("tizen.org/feature/sensor.barometer.wakeup");
301 }
302
303 bool SystemInfoDeviceCapability::isGestureRecognition()
304 {
305     LOGD("Entered");
306     return getValueBool("tizen.org/feature/sensor.gesture_recognition");
307 }
308
309 bool SystemInfoDeviceCapability::isGravity()
310 {
311     LOGD("Entered");
312     return getValueBool("tizen.org/feature/sensor.gravity");
313 }
314
315 bool SystemInfoDeviceCapability::isGyroscope()
316 {
317     LOGD("Entered");
318     return getValueBool("tizen.org/feature/sensor.gyroscope");
319 }
320
321 bool SystemInfoDeviceCapability::isGyroscopeWakeup()
322 {
323     LOGD("Entered");
324     return getValueBool("tizen.org/feature/sensor.gyroscope.wakeup");
325 }
326
327 bool SystemInfoDeviceCapability::isHumidity()
328 {
329     LOGD("Entered");
330     return getValueBool("tizen.org/feature/sensor.humidity");
331 }
332
333 bool SystemInfoDeviceCapability::isLinearAcceleration()
334 {
335     LOGD("Entered");
336     return getValueBool("tizen.org/feature/sensor.linear_acceleration");
337 }
338
339 bool SystemInfoDeviceCapability::isMagnetometer()
340 {
341     LOGD("Entered");
342     return getValueBool("tizen.org/feature/sensor.magnetometer");
343 }
344
345 bool SystemInfoDeviceCapability::isMagnetometerWakeup()
346 {
347     LOGD("Entered");
348     return getValueBool("tizen.org/feature/sensor.magnetometer.wakeup");
349 }
350
351 bool SystemInfoDeviceCapability::isPhotometer()
352 {
353     LOGD("Entered");
354     return getValueBool("tizen.org/feature/sensor.photometer");
355 }
356
357 bool SystemInfoDeviceCapability::isPhotometerWakeup()
358 {
359     LOGD("Entered");
360     return getValueBool("tizen.org/feature/sensor.photometer.wakeup");
361 }
362
363 bool SystemInfoDeviceCapability::isProximity()
364 {
365     LOGD("Entered");
366     return getValueBool("tizen.org/feature/sensor.proximity");
367 }
368
369 bool SystemInfoDeviceCapability::isProximityWakeup()
370 {
371     LOGD("Entered");
372     return getValueBool("tizen.org/feature/sensor.proximity.wakeup");
373 }
374
375 bool SystemInfoDeviceCapability::isTiltmeter()
376 {
377     LOGD("Entered");
378     return getValueBool("tizen.org/feature/sensor.tiltmeter");
379 }
380
381 bool SystemInfoDeviceCapability::isTiltmeterWakeup()
382 {
383     LOGD("Entered");
384     return getValueBool("tizen.org/feature/sensor.tiltmeter.wakeup");
385 }
386
387 bool SystemInfoDeviceCapability::isRotationVector()
388 {
389     LOGD("Entered");
390     return getValueBool("tizen.org/feature/sensor.rotation_vector");
391 }
392
393 bool SystemInfoDeviceCapability::isTemperature()
394 {
395     LOGD("Entered");
396     return getValueBool("tizen.org/feature/sensor.temperature");
397 }
398
399 bool SystemInfoDeviceCapability::isUltraviolet()
400 {
401     LOGD("Entered");
402     return getValueBool("tizen.org/feature/sensor.ultraviolet");
403 }
404
405 bool SystemInfoDeviceCapability::isPedometer()
406 {
407     LOGD("Entered");
408     return getValueBool("tizen.org/feature/sensor.pedometer");
409 }
410
411 bool SystemInfoDeviceCapability::isWristUp()
412 {
413     LOGD("Entered");
414     return getValueBool("tizen.org/feature/sensor.wrist_up");
415 }
416
417 bool SystemInfoDeviceCapability::isHumanActivityMonitor()
418 {
419     LOGD("Entered");
420     return getValueBool("tizen.org/feature/humanactivitymonitor");
421 }
422
423 bool SystemInfoDeviceCapability::isHrm()
424 {
425     LOGD("Entered");
426     return getValueBool("tizen.org/feature/sensor.heart_rate_monitor");
427 }
428
429 bool SystemInfoDeviceCapability::isCamera()
430 {
431     LOGD("Entered");
432     return getValueBool("tizen.org/feature/camera");
433 }
434
435 bool SystemInfoDeviceCapability::isCameraFront()
436 {
437     LOGD("Entered");
438     return getValueBool("tizen.org/feature/camera.front");
439 }
440
441 bool SystemInfoDeviceCapability::isCameraFrontFlash()
442 {
443     LOGD("Entered");
444     return getValueBool("tizen.org/feature/camera.front.flash");
445 }
446
447 bool SystemInfoDeviceCapability::isCameraBack()
448 {
449     LOGD("Entered");
450     return getValueBool("tizen.org/feature/camera.back");
451 }
452
453 bool SystemInfoDeviceCapability::isCameraBackFlash()
454 {
455     LOGD("Entered");
456     return getValueBool("tizen.org/feature/camera.back.flash");
457 }
458
459 bool SystemInfoDeviceCapability::isFmRadio()
460 {
461     LOGD("Entered");
462     return getValueBool("tizen.org/feature/fmradio");
463 }
464
465 bool SystemInfoDeviceCapability::isGraphicsAcceleration()
466 {
467     LOGD("Entered");
468     return getValueBool("tizen.org/feature/graphics.acceleration");
469 }
470
471 bool SystemInfoDeviceCapability::isLed()
472 {
473     LOGD("Entered");
474     return getValueBool("tizen.org/feature/led");
475 }
476
477 bool SystemInfoDeviceCapability::isInputKeyboard()
478 {
479     LOGD("Entered");
480     return getValueBool("tizen.org/feature/input.keyboard");
481 }
482
483 bool SystemInfoDeviceCapability::isInputKeyboardLayout()
484 {
485     LOGD("Entered");
486     std::string input_keyboard_layout = getValueString("tizen.org/feature/input.keyboard.layout");
487
488     bool input_keyboard = getValueBool("tizen.org/feature/input.keyboard");
489
490     // according to SystemInfo-DeviceCapabilities-dependency-table
491     // inputKeyboard   inputKeyboardLayout
492     //  O               O                   Possible
493     //  O               X                   Possible
494     //  X               X                   Possible
495     //  X               O                   Impossible
496
497     return input_keyboard ? !(input_keyboard_layout.empty()) : false;
498 }
499
500 std::string SystemInfoDeviceCapability::getInputKeyboardLayout()
501 {
502     LOGD("Entered");
503     return getValueString("tizen.org/feature/input.keyboard.layout");
504 }
505
506 bool SystemInfoDeviceCapability::isLocation()
507 {
508     LOGD("Entered");
509     return getValueBool("tizen.org/feature/location");
510 }
511
512 bool SystemInfoDeviceCapability::isLocationGps()
513 {
514     LOGD("Entered");
515     return getValueBool("tizen.org/feature/location.gps");
516 }
517
518 bool SystemInfoDeviceCapability::isLocationWps()
519 {
520     LOGD("Entered");
521     return getValueBool("tizen.org/feature/location.wps");
522 }
523
524 bool SystemInfoDeviceCapability::isLocationBatch()
525 {
526     LOGD("Entered");
527     return getValueBool("tizen.org/feature/location.batch");
528 }
529
530 bool SystemInfoDeviceCapability::isMultimediaTranscoder()
531 {
532     LOGD("Entered");
533     return getValueBool("tizen.org/feature/multimedia.transcoder");
534 }
535
536 bool SystemInfoDeviceCapability::isMicrophone()
537 {
538     LOGD("Entered");
539     return getValueBool("tizen.org/feature/microphone");
540 }
541
542 bool SystemInfoDeviceCapability::isMultiTouchPinchZoon()
543 {
544     LOGD("Entered");
545     return getValueBool("tizen.org/feature/multi_point_touch.pinch_zoom");
546 }
547
548 unsigned short SystemInfoDeviceCapability::getMultiTouchCount()
549 {
550     LOGD("Entered");
551     return getValueInt("tizen.org/feature/multi_point_touch.point_count");
552 }
553
554 bool SystemInfoDeviceCapability::isNfcReservedPush()
555 {
556     LOGD("Entered");
557     return getValueBool("tizen.org/feature/network.nfc.reserved_push");
558 }
559
560 bool SystemInfoDeviceCapability::isTelephonySMS()
561 {
562     LOGD("Entered");
563     return getValueBool("tizen.org/feature/network.telephony.sms");
564 }
565
566 bool SystemInfoDeviceCapability::isWifi()
567 {
568     LOGD("Entered");
569     return getValueBool("tizen.org/feature/network.wifi");
570 }
571
572 bool SystemInfoDeviceCapability::isWifiDirect()
573 {
574     LOGD("Entered");
575     return getValueBool("tizen.org/feature/network.wifi.direct");
576 }
577
578 bool SystemInfoDeviceCapability::isAutoRotation()
579 {
580     LOGD("Entered");
581     return getValueBool("tizen.org/feature/screen.auto_rotation");
582 }
583 unsigned short SystemInfoDeviceCapability::getScreenBpp()
584 {
585     LOGD("Entered");
586     return getValueInt("tizen.org/feature/screen.bpp");
587 }
588
589 bool SystemInfoDeviceCapability::isScreen()
590 {
591     LOGD("Entered");
592     return getValueBool("tizen.org/feature/screen.size.all");
593 }
594
595 bool SystemInfoDeviceCapability::isScreenCoordinateSystemSizeLarge()
596 {
597     LOGD("Entered");
598     return getValueBool("tizen.org/feature/screen.coordinate_system.size.large");
599 }
600
601 bool SystemInfoDeviceCapability::isScreenCoordinateSystemSizeNormal()
602 {
603     LOGD("Entered");
604     return getValueBool("tizen.org/feature/screen.coordinate_system.size.normal");
605 }
606
607 unsigned short SystemInfoDeviceCapability::getScreenDpi()
608 {
609     LOGD("Entered");
610     return getValueInt("tizen.org/feature/screen.dpi");
611 }
612
613 bool SystemInfoDeviceCapability::isScreenOutputHdmi()
614 {
615     LOGD("Entered");
616     return getValueBool("tizen.org/feature/screen.output.hdmi");
617 }
618
619 bool SystemInfoDeviceCapability::isScreenOutputRca()
620 {
621     LOGD("Entered");
622     return getValueBool("tizen.org/feature/screen.output.rca");
623 }
624
625 bool SystemInfoDeviceCapability::isUsbAccessory()
626 {
627     LOGD("Entered");
628     return getValueBool("tizen.org/feature/usb.accessory");
629 }
630
631 bool SystemInfoDeviceCapability::isUsbHost()
632 {
633     LOGD("Entered");
634     return getValueBool("tizen.org/feature/usb.host");
635 }
636
637 bool SystemInfoDeviceCapability::isWebService()
638 {
639     LOGD("Entered");
640     return getValueBool("tizen.org/feature/web.service");
641 }
642
643 unsigned short SystemInfoDeviceCapability::getScreenHeight()
644 {
645     LOGD("Entered");
646     int height = getValueInt("tizen.org/feature/screen.height");
647     return height;
648 }
649
650 bool SystemInfoDeviceCapability::isScreenSizeAll()
651 {
652     LOGD("Entered");
653     return getValueBool("tizen.org/feature/screen.size.all");
654 }
655
656 bool SystemInfoDeviceCapability::isScreenSizeLarge()
657 {
658     LOGD("Entered");
659     return getValueBool("tizen.org/feature/screen.size.large");
660 }
661
662 bool SystemInfoDeviceCapability::isScreenSizeNormal()
663 {
664     LOGD("Entered");
665     return getValueBool("tizen.org/feature/screen.size.normal");
666 }
667
668 bool SystemInfoDeviceCapability::isScreenSize320_320()
669 {
670     LOGD("Entered");
671     return getValueBool("tizen.org/feature/screen.size.normal.320.320");
672 }
673
674 bool SystemInfoDeviceCapability::isScreenSize240_400()
675 {
676     LOGD("Entered");
677     return getValueBool("tizen.org/feature/screen.size.normal.240.400");
678 }
679
680 bool SystemInfoDeviceCapability::isScreenSize320_480()
681 {
682     LOGD("Entered");
683     return getValueBool("tizen.org/feature/screen.size.normal.320.480");
684 }
685
686 bool SystemInfoDeviceCapability::isScreenSize360_480()
687 {
688     LOGD("Entered");
689     return getValueBool("tizen.org/feature/screen.size.normal.360.480");
690 }
691
692 bool SystemInfoDeviceCapability::isScreenSize540_960()
693 {
694     LOGD("Entered");
695     return getValueBool("tizen.org/feature/screen.size.normal.540.960");
696 }
697
698 bool SystemInfoDeviceCapability::isScreenSize600_1024()
699 {
700     LOGD("Entered");
701     return getValueBool("tizen.org/feature/screen.size.normal.600.1024");
702 }
703
704 bool SystemInfoDeviceCapability::isScreenSize480_800()
705 {
706     LOGD("Entered");
707     return getValueBool("tizen.org/feature/screen.size.normal.480.800");
708 }
709
710 bool SystemInfoDeviceCapability::isScreenSize720_1280()
711 {
712     LOGD("Entered");
713     return getValueBool("tizen.org/feature/screen.size.normal.720.1280");
714 }
715
716 bool SystemInfoDeviceCapability::isScreenSize1080_1920()
717 {
718     LOGD("Entered");
719     return getValueBool("tizen.org/feature/screen.size.normal.1080.1920");
720 }
721
722 unsigned short SystemInfoDeviceCapability::getScreenWidth()
723 {
724     LOGD("Entered");
725     int width = getValueInt("tizen.org/feature/screen.width");
726     return width;
727 }
728
729 bool SystemInfoDeviceCapability::isDataEncryption()
730 {
731     LOGD("Entered");
732     return getValueBool("tizen.org/feature/database.encryption");
733 }
734
735 bool SystemInfoDeviceCapability::isNativeOspCompatible()
736 {
737     LOGD("Entered");
738 #ifdef PROFILE_WEARABLE
739     return false;
740 #else
741     return getValueBool("tizen.org/feature/platform.native.osp_compatible");
742 #endif
743 }
744
745 std::string SystemInfoDeviceCapability::getOpenglesTextureFormat()
746 {
747     LOGD("Entered");
748     if (!getValueBool("tizen.org/feature/opengles")) {
749         // this exception is converted to "Undefined" value in JS layer
750         std::string log_msg = "OpenGL-ES is not supported";
751         LOGE("%s", log_msg.c_str());
752     }
753     std::string texture_format = "";
754     if (getValueBool("tizen.org/feature/opengles.texture_format.utc")) {
755         texture_format += OPENGLES_TEXTURE_UTC;
756     }
757     if (getValueBool("tizen.org/feature/opengles.texture_format.ptc")) {
758         if (!texture_format.empty()) {
759             texture_format += OPENGLES_TEXTURE_DELIMITER;
760         }
761         texture_format += OPENGLES_TEXTURE_PTC;
762     }
763     if (getValueBool("tizen.org/feature/opengles.texture_format.etc")) {
764         if (!texture_format.empty()) {
765             texture_format += OPENGLES_TEXTURE_DELIMITER;
766         }
767         texture_format += OPENGLES_TEXTURE_ETC;
768     }
769     if (getValueBool("tizen.org/feature/opengles.texture_format.3dc")) {
770         if (!texture_format.empty()) {
771             texture_format += OPENGLES_TEXTURE_DELIMITER;
772         }
773         texture_format += OPENGLES_TEXTURE_3DC;
774     }
775     if (getValueBool("tizen.org/feature/opengles.texture_format.atc")) {
776         if (!texture_format.empty()) {
777             texture_format += OPENGLES_TEXTURE_DELIMITER;
778         }
779         texture_format += OPENGLES_TEXTURE_ATC;
780     }
781     if (getValueBool("tizen.org/feature/opengles.texture_format.pvrtc")) {
782         if (!texture_format.empty()) {
783             texture_format += OPENGLES_TEXTURE_DELIMITER;
784         }
785         texture_format += OPENGLES_TEXTURE_PVRTC;
786     }
787     if (texture_format.empty()) {
788         // this exception is converted to "Undefined" value in JS layer
789         std::string log_msg = "Platform error while getting OpenGL-ES texture format";
790         LOGE("%s", log_msg.c_str());
791     }
792     return texture_format;
793 }
794
795 bool SystemInfoDeviceCapability::isOpenglesTextureFormat3DC()
796 {
797     LOGD("Entered");
798     return getValueBool("tizen.org/feature/opengles.texture_format.3dc");
799 }
800
801 bool SystemInfoDeviceCapability::isOpenglesTextureFormatATC()
802 {
803     LOGD("Entered");
804     return getValueBool("tizen.org/feature/opengles.texture_format.atc");
805 }
806
807 bool SystemInfoDeviceCapability::isOpenglesTextureFormatETC()
808 {
809     LOGD("Entered");
810     return getValueBool("tizen.org/feature/opengles.texture_format.etc");
811 }
812
813 bool SystemInfoDeviceCapability::isOpenglesTextureFormatPTC()
814 {
815     LOGD("Entered");
816     return getValueBool("tizen.org/feature/opengles.texture_format.ptc");
817 }
818
819 bool SystemInfoDeviceCapability::isOpenglesTextureFormatPVRTC()
820 {
821     LOGD("Entered");
822     return getValueBool("tizen.org/feature/opengles.texture_format.pvrtc");
823 }
824
825 bool SystemInfoDeviceCapability::isOpenglesTextureFormatUTC()
826 {
827     LOGD("Entered");
828     return getValueBool("tizen.org/feature/opengles.texture_format.utc");
829 }
830
831 bool SystemInfoDeviceCapability::isOpengles()
832 {
833     LOGD("Entered");
834     return getValueBool("tizen.org/feature/opengles");
835 }
836
837 bool SystemInfoDeviceCapability::isOpenglesVersion11()
838 {
839     LOGD("Entered");
840     return getValueBool("tizen.org/feature/opengles.version.1_1");
841 }
842
843 bool SystemInfoDeviceCapability::isOpenglesVersion20()
844 {
845     LOGD("Entered");
846     return getValueBool("tizen.org/feature/opengles.version.2_0");
847 }
848
849 bool SystemInfoDeviceCapability::isShellAppWidget()
850 {
851     LOGD("Entered");
852     return getValueBool("tizen.org/feature/shell.appwidget");
853 }
854
855 bool SystemInfoDeviceCapability::isSipVoip()
856 {
857     LOGD("Entered");
858     return getValueBool("tizen.org/feature/sip.voip");
859 }
860
861 bool SystemInfoDeviceCapability::isSpeechRecognition()
862 {
863     LOGD("Entered");
864     return getValueBool("tizen.org/feature/speech.recognition");
865 }
866
867 bool SystemInfoDeviceCapability::isSpeechSynthesis()
868 {
869     LOGD("Entered");
870     return getValueBool("tizen.org/feature/speech.synthesis");
871 }
872
873 bool SystemInfoDeviceCapability::isVisionFaceRecognition()
874 {
875     LOGD("Entered");
876     return getValueBool("tizen.org/feature/vision.face_recognition");
877 }
878
879 bool SystemInfoDeviceCapability::isVisionImageRecognition()
880 {
881     LOGD("Entered");
882     return getValueBool("tizen.org/feature/vision.image_recognition");
883 }
884
885 bool SystemInfoDeviceCapability::isVisionQrcodeGeneration()
886 {
887     LOGD("Entered");
888     return getValueBool("tizen.org/feature/vision.qrcode_generation");
889 }
890
891 bool SystemInfoDeviceCapability::isVisionQrcodeRecognition()
892 {
893     LOGD("Entered");
894     return getValueBool("tizen.org/feature/vision.qrcode_recognition");
895 }
896
897 std::string SystemInfoDeviceCapability::getPlatfomCoreCpuArch()
898 {
899     LOGD("Entered");
900     std::string result = "";
901     if (getValueBool("tizen.org/feature/platform.core.cpu.arch.armv6")) {
902         result = "armv6";
903     }
904     if (getValueBool("tizen.org/feature/platform.core.cpu.arch.armv7")) {
905         if (!result.empty()) {
906             result += " | armv7";
907         } else {
908             result = "armv7";
909         }
910     }
911     if (getValueBool("tizen.org/feature/platform.core.cpu.arch.x86")) {
912         if (!result.empty()) {
913             result += " | x86";
914         } else {
915             result = "x86";
916         }
917     }
918     if (result.empty()) {
919         LOGE("Platform error while retrieving platformCoreCpuArch: result is empty");
920     }
921     return result;
922 }
923
924 bool SystemInfoDeviceCapability::getPlatfomCoreCpuArchArmv7()
925 {
926     LOGD("Entered");
927     return getValueBool("tizen.org/feature/platform.core.cpu.arch.armv7");
928 }
929
930 bool SystemInfoDeviceCapability::getPlatfomCoreCpuArchArmv6()
931 {
932     LOGD("Entered");
933     return getValueBool("tizen.org/feature/platform.core.cpu.arch.armv6");
934 }
935
936 bool SystemInfoDeviceCapability::getPlatfomCoreCpuArchX86()
937 {
938     LOGD("Entered");
939     return getValueBool("tizen.org/feature/platform.core.cpu.arch.x86");
940 }
941
942 long SystemInfoDeviceCapability::getPlatformCoreCpuFrequency()
943 {
944     LOGD("Entered");
945     double freq = 0;
946     int ret = 0;
947
948     ret = system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, &freq);
949     if (ret != SYSTEM_INFO_ERROR_NONE) {
950         LOGE("Failed to get cpu frequency, %d, %s", ret, SystemInfoUtil::getSystemInfoErrorMessage(ret).c_str());
951     } else {
952         LOGD("cpu frequency : %d", freq);
953     }
954
955     return static_cast<long>(freq);
956 }
957
958 std::string SystemInfoDeviceCapability::getPlatfomCoreFpuArch()
959 {
960     LOGD("Entered");
961     std::string result = "";
962     if (getValueBool("tizen.org/feature/platform.core.fpu.arch.sse2")) {
963         result = "sse2";
964     }
965     if (getValueBool("tizen.org/feature/platform.core.fpu.arch.sse3")) {
966         if (!result.empty()) {
967             result += " | sse3";
968         } else {
969             result = "sse3";
970         }
971     }
972     if (getValueBool("tizen.org/feature/platform.core.fpu.arch.ssse3")) {
973         if (!result.empty()) {
974             result += " | ssse3";
975         } else {
976             result = "ssse3";
977         }
978     }
979     if (getValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv2")) {
980         if (!result.empty()) {
981             result += " | vfpv2";
982         } else {
983             result = "vfpv2";
984         }
985     }
986     if (getValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv3")) {
987         if (!result.empty()) {
988             result += " | vfpv3";
989         } else {
990             result = "vfpv3";
991         }
992     }
993     if (result.empty()) {
994         LOGE("Platform error while retrieving platformCoreFpuArch: result is empty");
995     }
996     return result;
997 }
998
999 bool SystemInfoDeviceCapability::getPlatfomCoreFpuArchSSE2()
1000 {
1001     LOGD("Entered");
1002     return getValueBool("tizen.org/feature/platform.core.fpu.arch.sse2");
1003 }
1004
1005 bool SystemInfoDeviceCapability::getPlatfomCoreFpuArchSSE3()
1006 {
1007     LOGD("Entered");
1008     return getValueBool("tizen.org/feature/platform.core.fpu.arch.sse3");
1009 }
1010
1011 bool SystemInfoDeviceCapability::getPlatfomCoreFpuArchSSSE3()
1012 {
1013     LOGD("Entered");
1014     return getValueBool("tizen.org/feature/platform.core.fpu.arch.ssse3");
1015 }
1016
1017 bool SystemInfoDeviceCapability::getPlatfomCoreFpuArchVFPV2()
1018 {
1019     LOGD("Entered");
1020     return getValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv2");
1021 }
1022
1023 bool SystemInfoDeviceCapability::getPlatfomCoreFpuArchVFPV3()
1024 {
1025     LOGD("Entered");
1026     return getValueBool("tizen.org/feature/platform.core.fpu.arch.vfpv3");
1027 }
1028
1029 std::string SystemInfoDeviceCapability::getWebApiVersion()
1030 {
1031     LOGD("Entered");
1032     return getValueString("tizen.org/feature/platform.web.api.version");
1033 }
1034
1035 std::string SystemInfoDeviceCapability::getPlatformVersionName()
1036 {
1037     LOGD("Entered");
1038     return "";
1039 }
1040
1041 std::string SystemInfoDeviceCapability::getPlatformName()
1042 {
1043     LOGD("Entered");
1044     return getValueString("tizen.org/system/platform.name");
1045 }
1046
1047 std::string SystemInfoDeviceCapability::getProfile()
1048 {
1049     LOGD("Entered");
1050     return DEVICE_PROFILE;
1051 }
1052
1053 std::string SystemInfoDeviceCapability::getDuid()
1054 {
1055     LOGD("Entered");
1056     return getValueString("tizen.org/system/tizenid");
1057 }
1058
1059 std::string SystemInfoDeviceCapability::getPlatformVersion()
1060 {
1061     LOGD("Entered");
1062     return getValueString("tizen.org/feature/platform.version");
1063 }
1064
1065 std::string SystemInfoDeviceCapability::getNativeApiVersion()
1066 {
1067     LOGD("Entered");
1068 #ifdef PROFILE_WEARABLE
1069     return "";
1070 #else
1071     return getValueString("tizen.org/feature/platform.native.api.version");
1072 #endif
1073 }
1074
1075 std::string SystemInfoDeviceCapability::getBuildDate()
1076 {
1077     LOGD("Entered");
1078     return getValueString("tizen.org/system/build.date");
1079 }
1080
1081 std::string SystemInfoDeviceCapability::getBuildString()
1082 {
1083     LOGD("Entered");
1084     return getValueString("tizen.org/system/build.string");
1085 }
1086
1087 std::string SystemInfoDeviceCapability::getBuildTime()
1088 {
1089     LOGD("Entered");
1090     return getValueString("tizen.org/system/build.time");
1091 }
1092
1093 std::string SystemInfoDeviceCapability::getBuildManafacture()
1094 {
1095     LOGD("Entered");
1096     return getValueString("tizen.org/system/manufacturer");
1097 }
1098
1099 std::string SystemInfoDeviceCapability::getModelName()
1100 {
1101     LOGD("Entered");
1102     return getValueString("tizen.org/system/model_name");
1103 }
1104
1105 std::string SystemInfoDeviceCapability::getPlatformCommunicationProcessor()
1106 {
1107     LOGD("Entered");
1108     return getValueString("tizen.org/system/platform.communication_processor");
1109 }
1110
1111 std::string SystemInfoDeviceCapability::getPlatformProcessor()
1112 {
1113     LOGD("Entered");
1114     return getValueString("tizen.org/system/platform.processor");
1115 }
1116
1117 bool SystemInfoDeviceCapability::getValueBool(const char *key)
1118 {
1119     bool value = false;
1120
1121     int ret = system_info_get_platform_bool(key, &value);
1122     if (ret != SYSTEM_INFO_ERROR_NONE) {
1123         std::string log_msg = "Platform error while getting bool value: ";
1124         log_msg += std::string(key);
1125         LOGE("%s, %d, %s", log_msg.c_str(), ret,
1126                 SystemInfoUtil::getSystemInfoErrorMessage(ret).c_str());
1127         SystemInfoUtil::throwSystemInfoException(ret, log_msg);
1128     }
1129
1130     LOGD("value[%s]: %s", key, value ? "true" : "false");
1131     return value;
1132 }
1133
1134 int SystemInfoDeviceCapability::getValueInt(const char *key)
1135 {
1136     int value = 0;
1137
1138     int ret = system_info_get_platform_int(key, &value);
1139     if (ret != SYSTEM_INFO_ERROR_NONE) {
1140         std::string log_msg = "Platform error while getting int value: ";
1141         log_msg += std::string(key);
1142         LOGE("%s, %d, %s", log_msg.c_str(), ret,
1143                 SystemInfoUtil::getSystemInfoErrorMessage(ret).c_str());
1144         SystemInfoUtil::throwSystemInfoException(ret, log_msg);
1145     }
1146
1147     LOGD("value[%s]: %d", key, value);
1148     return value;
1149 }
1150
1151 std::string SystemInfoDeviceCapability::getValueString(const char *key)
1152 {
1153     char* value = NULL;
1154     std::string str_value = "";
1155
1156     int ret = system_info_get_platform_string(key, &value);
1157     if (ret == SYSTEM_INFO_ERROR_NONE) {
1158         if (value != NULL) {
1159             str_value = value;
1160             free(value);
1161             value = NULL;
1162         }
1163     } else {
1164         std::string log_msg = "Platform error while getting string value: ";
1165         log_msg += std::string(key);
1166         LOGE("%s, %d, %s", log_msg.c_str(), ret,
1167                 SystemInfoUtil::getSystemInfoErrorMessage(ret).c_str());
1168         SystemInfoUtil::throwSystemInfoException(ret, log_msg);
1169     }
1170
1171     LOGD("value[%s]: %s", key, value);
1172     return str_value;
1173 }
1174
1175 } // SystemInfo
1176 } // DeviceAPI