1 /* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "maps_util.h"
18 #include "maps_error.h"
20 #include <system_info.h>
23 #define DEFAULT_UNKNOWN_DPI 132
25 int maps_set_string(const char *src, const int max_length, char **dst)
27 if (!dst || !src || (max_length <= 0))
28 return MAPS_ERROR_INVALID_PARAMETER;
31 *dst = g_strndup(src, max_length);
32 return MAPS_ERROR_NONE;
35 int maps_get_string(const char *src, const int max_length, char **dst)
37 if (!dst || !src || (max_length <= 0))
38 return MAPS_ERROR_INVALID_PARAMETER;
39 *dst = g_strndup(src, max_length);
40 return MAPS_ERROR_NONE;
43 int maps_get_screen_dpi(int *dpi)
46 return MAPS_ERROR_INVALID_PARAMETER;
48 static int __dpi = DEFAULT_UNKNOWN_DPI;
49 if (__dpi == DEFAULT_UNKNOWN_DPI)
50 system_info_get_platform_int("http://tizen.org/feature/screen.dpi", &__dpi);
52 return MAPS_ERROR_NONE;
56 tizen_profile_t _get_tizen_profile()
58 static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
59 if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
63 system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
64 switch (*profileName) {
67 profile = TIZEN_PROFILE_MOBILE;
71 profile = TIZEN_PROFILE_WEARABLE;
75 profile = TIZEN_PROFILE_TV;
79 profile = TIZEN_PROFILE_IVI;
81 default: // common or unknown ==> ALL ARE COMMON.
82 profile = TIZEN_PROFILE_COMMON;