diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/location-appman-crypt.h | 42 | ||||
-rw-r--r-- | include/location-appman-log.h | 43 | ||||
-rw-r--r-- | include/location-appman.h | 104 |
3 files changed, 189 insertions, 0 deletions
diff --git a/include/location-appman-crypt.h b/include/location-appman-crypt.h new file mode 100644 index 0000000..b4215e8 --- /dev/null +++ b/include/location-appman-crypt.h @@ -0,0 +1,42 @@ +/* + * liblocation-appman + * + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * Genie Kim <daejins.kim@samsung.com> + * + * 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. + */ + +#ifndef LOCATION_APPMAN_CRYPTION_H_ +#define LOCATION_APPMAN_CRYPTION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + LOCATION_APPMAN_CRYPT_ERROR_NONE = 0, + LOCATION_APPMAN_CRYPT_ERROR_GCRYPT = -200, + LOCATION_APPMAN_CRYPT_ERROR_INTERNAL= LOCATION_APPMAN_CRYPT_ERROR_GCRYPT | 0x01, + LOCATION_APPMAN_CRYPT_ERROR_UNKNOWN = LOCATION_APPMAN_CRYPT_ERROR_GCRYPT | 0x02, +}Location_appamn_error_last_postion; + +int location_appman_encrypt(const char *key, const char *input, char *output); +int location_appman_decrypt(const char *key, const char *input, char *output); +#ifdef __cplusplus +} +#endif + +#endif /* LOCATION_APPMAN_CRYPTION_H_ */ diff --git a/include/location-appman-log.h b/include/location-appman-log.h new file mode 100644 index 0000000..c05e420 --- /dev/null +++ b/include/location-appman-log.h @@ -0,0 +1,43 @@ +/* + * liblocation-appman + * + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * Genie Kim <daejins.kim@samsung.com> + * + * 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. + */ + +#ifndef LOCATION_APPMAN_LOG_H__ +#define LOCATION_APPMAN_LOG_H__ + +/** + * @file location-appman-log.h + * @brief This file contains macro functions for logging. + */ + +#include <dlog.h> +#include <libgen.h> + +#define TAG_LOCATION_APPMAN "location-appman" + +#define LOCATION_APPMAN_LOG(fmt,args...) SLOG(LOG_DEBUG, TAG_LOCATION_APPMAN, "[%-15s:%-4d]"fmt"\n", basename(__FILE__), __LINE__, ##args) +#define LOCATION_APPMAN_FUNC LOCATION_APPMAN_LOGD("FUNC: %s", __FUNCTION__) + +#define LOCATION_APPMAN_NULL_ARG_CHECK(arg) \ + if(NULL != arg) {} else \ + {LOCATION_APPMAN_LOG("%s(0x%08x)\n", "LOCATION_APPMAN_ERROR_INVALID_PARAMETER",LOCATION_APPMAN_ERROR_INVALID_PARAMETER);} + +#endif + diff --git a/include/location-appman.h b/include/location-appman.h new file mode 100644 index 0000000..032bd3f --- /dev/null +++ b/include/location-appman.h @@ -0,0 +1,104 @@ +/* + * liblocation-appman + * + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Youngae Kang <youngae.kang@samsung.com>, Minjune Kim <sena06.kim@samsung.com> + * Genie Kim <daejins.kim@samsung.com> + * + * 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. + */ + +#ifndef LOCATION_APPMAN_H_ +#define LOCATION_APPMAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup liblocation-appman + */ + +typedef struct{ + char package[64]; + char appname[64]; + char appicon[256]; + int appid; + int installed_date; + int recently_used; + int enable; +} location_appman_s; + +typedef enum { + LOCATION_APPMAN_COLUMN_PACKAGE = 0, + LOCATION_APPMAN_COLUMN_APPICON, + LOCATION_APPMAN_COLUMN_APPID, + LOCATION_APPMAN_COLUMN_INSTALLED_DATE, + LOCATION_APPMAN_COLUMN_RECENTLY_USED, + LOCATION_APPMAN_COLUMN_ENABLE +}location_appman_column_e; + +typedef enum { + LOCATION_APPMAN_ERROR_NONE = 0, + LOCATION_APPMAN_ERROR_SQLITE_FAIL = -100, + LOCATION_APPMAN_ERROR_INVALID_PARAMETER = LOCATION_APPMAN_ERROR_SQLITE_FAIL | 0x01, + LOCATION_APPMAN_ERROR_INTERNAL = LOCATION_APPMAN_ERROR_SQLITE_FAIL | 0x02, + LOCATION_APPMAN_ERROR_UNKNOWN = LOCATION_APPMAN_ERROR_SQLITE_FAIL | 0x03, + LOCATION_APPMAN_ERROR_INVALID_XML = LOCATION_APPMAN_ERROR_SQLITE_FAIL | 0x04, +}Location_appman_error_e; + +typedef enum { + LOCATION_APPMAN_ENABLE_OFF = 0, + LOCATION_APPMAN_ENABLE_ON, + LOCATION_APPMAN_PACKAGE_NOTFOUND +}Location_appman_onoff_e; + +/** + * @} + */ + +int location_appman_check_developer_mode(void); + +int location_appman_get_total_count(int *count); +int location_appman_insert(location_appman_s *appman); +int location_appman_delete(const char *package); +int location_appman_reset(void); +int location_appman_update(location_appman_s *appman); + +// GET +int location_appman_get_app_list(location_appman_column_e sort_by, int *list_count, location_appman_s **appman); +int location_appman_get_name(const char *package, char **appname); +int location_appman_get_icon(const char *package, char **appicon); +int location_appman_get_appid(const char *package, int *appid); +int location_appman_get_installed_date(const char *package, unsigned int *installed_date); +int location_appman_get_recently_used(const char *package, unsigned int *recently_used); +int location_appman_is_enabled(const char *package, int *enable); + +// SET +int location_appman_set_icon(const char *package, char *appicon); +int location_appman_set_appid(const char *package, int appid); +int location_appman_set_installed_date(const char *pakage, unsigned int installed_date); +int location_appman_set_recently_used(const char *package, unsigned int recently_used); +int location_appman_set_on(const char *package, int onoff); + +// For manifest +int location_appamn_parse_manifest(const char *xml, location_appman_s **appman); +int location_appman_get_package_by_pid(pid_t pid, location_appman_s **appman); +int location_appman_find_package(const char *package, int *findpackage); +int location_appman_register_package(location_appman_s *appman); + +#ifdef __cplusplus +} +#endif +#endif /* LOCATION_APPMAN_H_ */ |