-Copyright (c) 2012 - 2020 Samsung Electronics Co., Ltd. All rights reserved.\r
-\r
- Apache License\r
- Version 2.0, January 2004\r
- http://www.apache.org/licenses/\r
-\r
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
-\r
- 1. Definitions.\r
-\r
- "License" shall mean the terms and conditions for use, reproduction,\r
- and distribution as defined by Sections 1 through 9 of this document.\r
-\r
- "Licensor" shall mean the copyright owner or entity authorized by\r
- the copyright owner that is granting the License.\r
-\r
- "Legal Entity" shall mean the union of the acting entity and all\r
- other entities that control, are controlled by, or are under common\r
- control with that entity. For the purposes of this definition,\r
- "control" means (i) the power, direct or indirect, to cause the\r
- direction or management of such entity, whether by contract or\r
- otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
- outstanding shares, or (iii) beneficial ownership of such entity.\r
-\r
- "You" (or "Your") shall mean an individual or Legal Entity\r
- exercising permissions granted by this License.\r
-\r
- "Source" form shall mean the preferred form for making modifications,\r
- including but not limited to software source code, documentation\r
- source, and configuration files.\r
-\r
- "Object" form shall mean any form resulting from mechanical\r
- transformation or translation of a Source form, including but\r
- not limited to compiled object code, generated documentation,\r
- and conversions to other media types.\r
-\r
- "Work" shall mean the work of authorship, whether in Source or\r
- Object form, made available under the License, as indicated by a\r
- copyright notice that is included in or attached to the work\r
- (an example is provided in the Appendix below).\r
-\r
- "Derivative Works" shall mean any work, whether in Source or Object\r
- form, that is based on (or derived from) the Work and for which the\r
- editorial revisions, annotations, elaborations, or other modifications\r
- represent, as a whole, an original work of authorship. For the purposes\r
- of this License, Derivative Works shall not include works that remain\r
- separable from, or merely link (or bind by name) to the interfaces of,\r
- the Work and Derivative Works thereof.\r
-\r
- "Contribution" shall mean any work of authorship, including\r
- the original version of the Work and any modifications or additions\r
- to that Work or Derivative Works thereof, that is intentionally\r
- submitted to Licensor for inclusion in the Work by the copyright owner\r
- or by an individual or Legal Entity authorized to submit on behalf of\r
- the copyright owner. For the purposes of this definition, "submitted"\r
- means any form of electronic, verbal, or written communication sent\r
- to the Licensor or its representatives, including but not limited to\r
- communication on electronic mailing lists, source code control systems,\r
- and issue tracking systems that are managed by, or on behalf of, the\r
- Licensor for the purpose of discussing and improving the Work, but\r
- excluding communication that is conspicuously marked or otherwise\r
- designated in writing by the copyright owner as "Not a Contribution."\r
-\r
- "Contributor" shall mean Licensor and any individual or Legal Entity\r
- on behalf of whom a Contribution has been received by Licensor and\r
- subsequently incorporated within the Work.\r
-\r
- 2. Grant of Copyright License. Subject to the terms and conditions of\r
- this License, each Contributor hereby grants to You a perpetual,\r
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
- copyright license to reproduce, prepare Derivative Works of,\r
- publicly display, publicly perform, sublicense, and distribute the\r
- Work and such Derivative Works in Source or Object form.\r
-\r
- 3. Grant of Patent License. Subject to the terms and conditions of\r
- this License, each Contributor hereby grants to You a perpetual,\r
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
- (except as stated in this section) patent license to make, have made,\r
- use, offer to sell, sell, import, and otherwise transfer the Work,\r
- where such license applies only to those patent claims licensable\r
- by such Contributor that are necessarily infringed by their\r
- Contribution(s) alone or by combination of their Contribution(s)\r
- with the Work to which such Contribution(s) was submitted. If You\r
- institute patent litigation against any entity (including a\r
- cross-claim or counterclaim in a lawsuit) alleging that the Work\r
- or a Contribution incorporated within the Work constitutes direct\r
- or contributory patent infringement, then any patent licenses\r
- granted to You under this License for that Work shall terminate\r
- as of the date such litigation is filed.\r
-\r
- 4. Redistribution. You may reproduce and distribute copies of the\r
- Work or Derivative Works thereof in any medium, with or without\r
- modifications, and in Source or Object form, provided that You\r
- meet the following conditions:\r
-\r
- (a) You must give any other recipients of the Work or\r
- Derivative Works a copy of this License; and\r
-\r
- (b) You must cause any modified files to carry prominent notices\r
- stating that You changed the files; and\r
-\r
- (c) You must retain, in the Source form of any Derivative Works\r
- that You distribute, all copyright, patent, trademark, and\r
- attribution notices from the Source form of the Work,\r
- excluding those notices that do not pertain to any part of\r
- the Derivative Works; and\r
-\r
- (d) If the Work includes a "NOTICE" text file as part of its\r
- distribution, then any Derivative Works that You distribute must\r
- include a readable copy of the attribution notices contained\r
- within such NOTICE file, excluding those notices that do not\r
- pertain to any part of the Derivative Works, in at least one\r
- of the following places: within a NOTICE text file distributed\r
- as part of the Derivative Works; within the Source form or\r
- documentation, if provided along with the Derivative Works; or,\r
- within a display generated by the Derivative Works, if and\r
- wherever such third-party notices normally appear. The contents\r
- of the NOTICE file are for informational purposes only and\r
- do not modify the License. You may add Your own attribution\r
- notices within Derivative Works that You distribute, alongside\r
- or as an addendum to the NOTICE text from the Work, provided\r
- that such additional attribution notices cannot be construed\r
- as modifying the License.\r
-\r
- You may add Your own copyright statement to Your modifications and\r
- may provide additional or different license terms and conditions\r
- for use, reproduction, or distribution of Your modifications, or\r
- for any such Derivative Works as a whole, provided Your use,\r
- reproduction, and distribution of the Work otherwise complies with\r
- the conditions stated in this License.\r
-\r
- 5. Submission of Contributions. Unless You explicitly state otherwise,\r
- any Contribution intentionally submitted for inclusion in the Work\r
- by You to the Licensor shall be under the terms and conditions of\r
- this License, without any additional terms or conditions.\r
- Notwithstanding the above, nothing herein shall supersede or modify\r
- the terms of any separate license agreement you may have executed\r
- with Licensor regarding such Contributions.\r
-\r
- 6. Trademarks. This License does not grant permission to use the trade\r
- names, trademarks, service marks, or product names of the Licensor,\r
- except as required for reasonable and customary use in describing the\r
- origin of the Work and reproducing the content of the NOTICE file.\r
-\r
- 7. Disclaimer of Warranty. Unless required by applicable law or\r
- agreed to in writing, Licensor provides the Work (and each\r
- Contributor provides its Contributions) on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
- implied, including, without limitation, any warranties or conditions\r
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
- PARTICULAR PURPOSE. You are solely responsible for determining the\r
- appropriateness of using or redistributing the Work and assume any\r
- risks associated with Your exercise of permissions under this License.\r
-\r
- 8. Limitation of Liability. In no event and under no legal theory,\r
- whether in tort (including negligence), contract, or otherwise,\r
- unless required by applicable law (such as deliberate and grossly\r
- negligent acts) or agreed to in writing, shall any Contributor be\r
- liable to You for damages, including any direct, indirect, special,\r
- incidental, or consequential damages of any character arising as a\r
- result of this License or out of the use or inability to use the\r
- Work (including but not limited to damages for loss of goodwill,\r
- work stoppage, computer failure or malfunction, or any and all\r
- other commercial damages or losses), even if such Contributor\r
- has been advised of the possibility of such damages.\r
-\r
- 9. Accepting Warranty or Additional Liability. While redistributing\r
- the Work or Derivative Works thereof, You may choose to offer,\r
- and charge a fee for, acceptance of support, warranty, indemnity,\r
- or other liability obligations and/or rights consistent with this\r
- License. However, in accepting such obligations, You may act only\r
- on Your own behalf and on Your sole responsibility, not on behalf\r
- of any other Contributor, and only if You agree to indemnify,\r
- defend, and hold each Contributor harmless for any liability\r
- incurred by, or claims asserted against, such Contributor by reason\r
- of your accepting any such warranty or additional liability.\r
-\r
- END OF TERMS AND CONDITIONS\r
-\r
- APPENDIX: How to apply the Apache License to your work.\r
-\r
- To apply the Apache License to your work, attach the following\r
- boilerplate notice, with the fields enclosed by brackets "[]"\r
- replaced with your own identifying information. (Don't include\r
- the brackets!) The text should be enclosed in the appropriate\r
- comment syntax for the file format. We also recommend that a\r
- file or class name and description of purpose be included on the\r
- same "printed page" as the copyright notice for easier\r
- identification within third-party archives.\r
-\r
- Copyright [yyyy] [name of copyright owner]\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
+Copyright (c) 2012 - 2020 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
<manifest>
- <request>
- <domain name="_"/>
- </request>
- <assign>
- <filesystem path="/usr/local/bin/test_system_settings_gui" exec_label="none"/>
- </assign>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/local/bin/test_system_settings_gui" exec_label="none"/>
+ </assign>
</manifest>
{
int i;
/*int max = SYSTEM_SETTINGS_MAX; */
- int max = sizeof(system_setting_table) / sizeof(system_setting_s) - 1 ;
+ int max = sizeof(system_setting_table) / sizeof(system_setting_s) - 1;
for (i = 0; i < max; i++) {
LOGE("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key);
{
int index = 0;
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
while (system_setting_table[index].key != SYSTEM_SETTINGS_MAX) {
if (system_setting_table[index].key == key) {
LOGE("Enter [%s], index = %d, key = %d, type = %d", __FUNCTION__, index, key, (*item)->data_type);
if (system_setting_table[index].feature_check_cb != NULL) {
int ret = system_setting_table[index].feature_check_cb(item);
- if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) {
+ if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
LOGE("Not supported API, because there is no feature!");
- }
+
return ret;
} else {
return SYSTEM_SETTINGS_ERROR_NONE;
while (start <= end) {
int mid = (start + end) / 2;
- if (system_setting_table[mid].key == key) {
+ if (system_setting_table[mid].key == key)
return mid;
- } else if (system_setting_table[mid].key < key) {
+ else if (system_setting_table[mid].key < key)
start = mid + 1;
- } else {
+ else
end = mid - 1;
- }
}
LOGE("Enter [%s], key=%d, Can NOT find the key", __FUNCTION__, key);
LOGE("Enter [%s], key = %d, type = %d", __FUNCTION__, key, (*item)->data_type);
if (system_setting_table[idx].feature_check_cb != NULL) {
int ret = system_setting_table[idx].feature_check_cb(item);
- if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) {
+ if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
LOGE("Not supported API, because there is no feature!");
- }
+
return ret;
}
return SYSTEM_SETTINGS_ERROR_NONE;
int **val = (int**)value;
bool vconf_bool;
- switch(item->data_type) {
+ switch (item->data_type) {
case SYSTEM_SETTING_DATA_TYPE_STRING:
if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_char))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
*value = vconf_char;
- break;
+ break;
case SYSTEM_SETTING_DATA_TYPE_INT:
if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_int))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
**val = vconf_int;
- break;
+ break;
case SYSTEM_SETTING_DATA_TYPE_BOOL:
if (system_setting_vconf_get_value_bool(item->vconf_key, &vconf_bool))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
*value = (void *)vconf_bool;
- break;
+ break;
default:
LOGE("Error system_setting_h struct data_type");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
int vconf_int;
bool vconf_bool;
- switch(item->data_type) {
+ switch (item->data_type) {
case SYSTEM_SETTING_DATA_TYPE_STRING:
vconf_char = (char*)value;
if (system_setting_vconf_set_value_string(item->vconf_key, vconf_char))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- break;
+ break;
case SYSTEM_SETTING_DATA_TYPE_INT:
vconf_int = **(int**)value;
if (system_setting_vconf_set_value_int(item->vconf_key, vconf_int))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- break;
+ break;
case SYSTEM_SETTING_DATA_TYPE_BOOL:
vconf_bool = *(bool*)value;
if (system_setting_vconf_set_value_bool(item->vconf_key, vconf_bool))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- break;
+ break;
default:
LOGE("Error system_setting_h struct data_type");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
int system_settings_get_value(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
system_setting_h system_setting_item;
system_setting_get_value_cb system_setting_getter;
int system_settings_set_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
-
system_setting_h system_setting_item;
system_setting_set_value_cb system_setting_setter;
int system_settings_add_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
-
system_setting_h system_setting_item;
system_setting_add_value_cb system_setting_adder;
int system_settings_del_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
-
system_setting_h system_setting_item;
system_setting_del_value_cb system_setting_deler;
/* LCOV_EXCL_START */
-int system_settings_list_value(system_settings_key_e key, system_setting_data_type_e data_type, bool (*system_setting_data_iterator)(int, const char* , void *), void *user_data)
+int system_settings_list_value(system_settings_key_e key, system_setting_data_type_e data_type, bool(*system_setting_data_iterator)(int, const char*, void *), void *user_data)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
-
system_setting_h system_setting_item;
system_setting_list_value_cb system_setting_lister;
int system_settings_set_value_int(system_settings_key_e key, int value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
int *ptr = &value;
int **p_ptr = &ptr;
int system_settings_get_value_int(system_settings_key_e key, int *value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
+
int value_int = 0;
int *ptr = &value_int;
int **p_ptr = &ptr;
int system_settings_set_value_bool(system_settings_key_e key, bool value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
bool *ptr = &value;
return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void *)ptr);
int ret;
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
ret = system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void **)&flag);
SETTING_TRACE(" inf (flag) value : %ld ", flag);
int system_settings_get_value_string(system_settings_key_e key, char **value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
return system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void **)value);
}
system_setting_h system_setting_item;
system_setting_set_changed_callback_cb system_setting_set_changed_cb;
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
system_setting_h system_setting_item;
system_setting_unset_changed_callback_cb system_setting_unset_changed_cb;
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
LOGE("Enter [%s]", __FUNCTION__);
system_setting_h system_setting_item;
- if (callback == NULL) {
+ if (callback == NULL)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
- if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE) {
+ if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
int ret = system_settings_get_item(key, &system_setting_item);
if (ret != 0) {
int system_settings_foreach_value_string(system_settings_key_e key, system_settings_iter_cb callback, void *value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
return system_settings_list_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, callback, (void *)value);
}
int system_settings_add_value_string(system_settings_key_e key, const char* value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
return system_settings_add_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value);
}
int system_settings_delete_value_string(system_settings_key_e key, const char* value)
{
LOGE("Enter [%s]", __FUNCTION__);
- if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
+ if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
return system_settings_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value);
}
/*SYSTEM_SETTING_DATA_TYPE_FLOAT, */
/*SYSTEM_SETTING_DATA_TYPE_DOULBE, */
#endif
-}
-system_setting_data_type_e;
+} system_setting_data_type_e;
/**
* @internal
SYSTEM_SETTING_CALLBACK_SLOT_3 = 3,
SYSTEM_SETTING_CALLBACK_SLOT_4 = 4,
SYSTEM_SETTING_CALLBACK_SLOT_5 = 5
-}
-system_setting_callback_slot_e;
+} system_setting_callback_slot_e;
typedef struct _system_setting_s *system_setting_h;
system_setting_set_value_cb set_value_cb; /**< function pointer for setter */
system_setting_set_changed_callback_cb set_changed_cb; /**< function pointer to register for notification callback */
- system_setting_unset_changed_callback_cb unset_changed_cb ; /**< function pointer to un-register for notification callback */
+ system_setting_unset_changed_callback_cb unset_changed_cb; /**< function pointer to un-register for notification callback */
system_settings_changed_cb changed_cb; /* registered by user application */
system_setting_add_value_cb add_value_cb;
g_object_unref(generator);
}
-void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
+void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
{
int size = json_array_get_length(json_node_get_array(root));
SETTING_TRACE("BBB size : (%d) \n", size);
int i = 0;
- for (i = 0; i < size ; i++) {
+ for (i = 0; i < size; i++) {
JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
//char *nameval = (char *)json_object_get_string_member(ringtone, "name");
char *pathval = (char *)json_object_get_string_member(ringtone, "path");
bool ret = false;
int i = 0;
- for (i = 0; i < size ; i++) {
+ for (i = 0; i < size; i++) {
JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
//char *nameval = (char *)json_object_get_string_member(ringtone, "name");
char *pathval = (char *)json_object_get_string_member(ringtone, "path");
int size = json_array_get_length(json_node_get_array(root));
int i = 0;
- for (i = 0; i < size ; i++) {
+ for (i = 0; i < size; i++) {
JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
char *name = (char *)json_object_get_string_member(ringtone, "name");
char *path = (char *)json_object_get_string_member(ringtone, "path");
void ss_json_ringtone_print(JsonNode *root);
-void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del);
+void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del);
bool ss_json_ringtone_contain(JsonNode *root, char* newfile);
void ss_json_ringtone_list(JsonNode *root);
-/*// */
#ifdef __cplusplus
}
#endif
#include <glib.h>
#include "system_settings.h"
-typedef struct __st_multi_callback_node_
-{
+typedef struct __st_multi_callback_node_ {
system_settings_changed_cb callback;
void* user_data;
-}callback_node;
+} callback_node;
-typedef struct __st_multi_callback_list_
-{
+typedef struct __st_multi_callback_list_ {
GList * list;
int is_registered;
-}callback_list;
+} callback_list;
int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void* user_data);
int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr);
#define __FREE(del, arg) do { \
- if (arg) { \
- del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
- arg = NULL; \
- } \
- } while (0);
+ if (arg) { \
+ del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
+ arg = NULL; \
+ } \
+} while (0);
#define FREE(arg) __FREE(free, arg)
#ifdef SETTING_ARCH_64
{
SETTING_TRACE_BEGIN;
char *vconf_value = NULL;
- if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
/* check to see if it's accessable -> OK */
/* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
{
SETTING_TRACE_BEGIN;
char *vconf_value = NULL;
- if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
/* check to see if it's accessable -> OK */
/* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
SETTING_TRACE_BEGIN;
char *pkg_name = NULL;
int locktype = -1;
- if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- if (system_setting_vconf_get_value_string(item->vconf_key, &pkg_name)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &pkg_name))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
free(pkg_name);
int _is_file_accessible(const char *path)
{
SETTING_TRACE_BEGIN;
- int ret = access(path , R_OK);
+ int ret = access(path, R_OK);
if (ret == 0) {
SETTING_TRACE("found the file %s", path);
return 0;
// 1. get the default ringtone list
//-----------------------------------------------------------------------------------------------------------------
int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
- if (ret != 0) {
+ if (ret != 0)
SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
- }
filelist = g_list_sort(filelist, _compare_cb);
int size = json_array_get_length(json_node_get_array(root));
int i = 0;
- for (i = 0; i < size ; i++) {
+ for (i = 0; i < size; i++) {
JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
char *nameval = (char *)json_object_get_string_member(ringtone, "name");
char *pathval = (char *)json_object_get_string_member(ringtone, "path");
int ret = _is_file_accessible(vconf_value);
if (ret == 0) {
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
} else {
/* @todo add a common ret_handler */
return ret;
int ret = _is_file_accessible(vconf_value);
if (ret == 0) {
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
} else {
/*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
/* @todo add a common ret_handler */
void *handle = NULL;
char *error;
bool ret = false;
- bool (*image_type_check)(char *path);
+ bool(*image_type_check)(char *path);
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return false;
void *handle = NULL;
char *error;
int ret = false;
- int (*check_available_font)(char *font_name);
+ int(*check_available_font)(char *font_name);
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return false;
{
void *handle = NULL;
char *error;
- void (*set_font_size)();
+ void(*set_font_size)();
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return;
{
void *handle = NULL;
char *error;
- void (*set_font_nodification)();
+ void(*set_font_nodification)();
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return;
void *handle = NULL;
char *error;
bool ret = false;
- bool (*check_font_type)(char *font_name);
+ bool(*check_font_type)(char *font_name);
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return false;
char *ret = NULL;
char *(*get_font_info)();
- handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
if (!handle) {
SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
return false;
const char *find_str = "extended_wallpaper_";
char *ch = NULL;
- if (!(ch = strstr(file_path, find_str))) {
+ if (!(ch = strstr(file_path, find_str)))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
strncpy(buffer, file_path, ch - file_path);
buffer[ch - file_path] = 0;
sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
{
SETTING_TRACE_BEGIN;
- if (!source_file_path || !dest_file_path) {
+ if (!source_file_path || !dest_file_path)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
char buf[1024];
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- while (read(fd, buf, sizeof(buf) - 1) > 0) {
+ while (read(fd, buf, sizeof(buf) - 1) > 0)
write(fd2, buf, sizeof(buf) - 1);
- }
close(fd2);
close(fd);
- if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
+ if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0)
SETTING_TRACE("chmod failed: %s", dest_file_path);
- }
return SYSTEM_SETTINGS_ERROR_NONE;
}
continue;
if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
- != SYSTEM_SETTINGS_ERROR_NONE) {
+ != SYSTEM_SETTINGS_ERROR_NONE) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
char *vconf_value;
vconf_value = (char *)value;
- bool isok = dl_is_supported_image_type_load(vconf_value);
+ bool isok = dl_is_supported_image_type_load(vconf_value);
if (!isok) {
/* not supported */
SETTING_TRACE("path : %s is not supported file format", vconf_value);
if (_is_file_accessible(vconf_value) != 0)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
#ifdef TIZEN_MOBILE
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
#endif
#ifdef TIZEN_WEARABLE
continue;
if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
- != SYSTEM_SETTINGS_ERROR_NONE) {
+ != SYSTEM_SETTINGS_ERROR_NONE) {
if (dp)
closedir(dp);
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- if ((image_count == 0) || (max_image_num < temp_image_num)) {
+ if ((image_count == 0) || (max_image_num < temp_image_num))
max_image_num = temp_image_num;
- }
image_count++;
}
/* Numbering rule: Gear is odd number */
max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
- : max_image_num + 2;
+ : max_image_num + 2;
char file_name_buffer[512];
snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
- _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
+ _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
/* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
- != SYSTEM_SETTINGS_ERROR_NONE) {
+ != SYSTEM_SETTINGS_ERROR_NONE) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
/* remove oldest wallpaper */
if (image_count >= WALLPAPER_MAX_COUNT) {
if (system_setting_remove_oldest_extended_wallpaper()
- != SYSTEM_SETTINGS_ERROR_NONE) {
+ != SYSTEM_SETTINGS_ERROR_NONE) {
remove(file_name_buffer);
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
}
- if (system_setting_vconf_set_value_string(item->vconf_key, file_name_buffer)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, file_name_buffer))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
- VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
+ VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
} else {
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
}
#endif
char *vconf_value;
vconf_value = (char *)value;
- bool isok = dl_is_supported_image_type_load(vconf_value);
+ bool isok = dl_is_supported_image_type_load(vconf_value);
if (!isok) {
/* not supported */
SETTING_TRACE("path : %s is not supported file format", vconf_value);
if (_is_file_accessible(vconf_value) != 0)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
return SYSTEM_SETTINGS_ERROR_NONE;
}
int *vconf_value;
vconf_value = *(int **)value;
- if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
+ if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- }
- if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value)) {
+ if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
dl_font_size_set();
SETTING_TRACE_END;
return SYSTEM_SETTINGS_ERROR_NONE;
char *vconf_value;
vconf_value = (char *)value;
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
/* LCOV_EXCL_STOP */
pkgmgrinfo_appinfo_destroy_appinfo(handle);
/*----------------------------------------------------------------------------------- */
int locktype = -1;
- if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
- if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
- if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
+ if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
}
return SYSTEM_SETTINGS_ERROR_NONE;
}
{
SETTING_TRACE_BEGIN;
char *vconf_value = NULL;
- if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
/* parsing validation */
/* en_US.UTF-8 */
- char arr[21] = {0,};
+ char arr[21] = { 0, };
snprintf(arr, 20, "%s", vconf_value);
for (int i = 0; i < strlen(arr); i++) {
if ('.' == arr[i]) {
char arr[20];
snprintf(arr, 20, "%s.%s", vconf_value, ext);
- if (system_setting_vconf_set_value_string(item->vconf_key, arr)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, arr))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
/* LCOV_EXCL_STOP */
{
SETTING_TRACE_BEGIN;
char *vconf_value = NULL;
- if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
/* parsing validation */
/* en_US.UTF-8 */
- char arr[21] = {0,};
+ char arr[21] = { 0, };
snprintf(arr, 20, "%s", vconf_value);
for (int i = 0; i < strlen(arr); i++) {
if ('.' == arr[i]) {
char arr[20];
snprintf(arr, 20, "%s.%s", vconf_value, ext);
- if (system_setting_vconf_set_value_string(item->vconf_key, arr)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, arr))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
/* LCOV_EXCL_STOP */
SETTING_TRACE_BEGIN;
int vconf_value;
- if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
bool ret_value = true;
if (vconf_value == VCONFKEY_TIME_FORMAT_12)
vconf_value = (bool *)value;
if (*vconf_value) {
- if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_24)) {
+ if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_24))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
-
} else {
- if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_12)) {
+ if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_12))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
-
}
return SYSTEM_SETTINGS_ERROR_NONE;
int system_setting_get_locale_timezone(system_setting_h item, void **value)
{
char tzpath[256];
- ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
+ ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
if (len != -1) {
tzpath[len] = '\0';
} else {
if (is_load == 0) {
alarmmgr_set_timezone(tz_path);
- if (system_setting_vconf_set_value_string(item->vconf_key, timezone_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, timezone_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
bool vib_cond;
bool vconf_value;
- if (system_setting_vconf_get_value_bool(item->vconf_key, &sound_cond)) {
+ if (system_setting_vconf_get_value_bool(item->vconf_key, &sound_cond))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
+ if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (sound_cond == false && vib_cond == false) {
vconf_value = true;
vconf_vib = false;
}
- if (system_setting_vconf_set_value_bool(item->vconf_key, vconf_sound)) {
+ if (system_setting_vconf_set_value_bool(item->vconf_key, vconf_sound))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
+
+ if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
return SYSTEM_SETTINGS_ERROR_NONE;
}
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
}
- if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value)) {
+ if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+
SETTING_TRACE_END;
return SYSTEM_SETTINGS_ERROR_NONE;
}
char *vconf_value = NULL;
vconf_value = (char *)value;
- if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
return SYSTEM_SETTINGS_ERROR_NONE;
}
{
SETTING_TRACE_BEGIN;
int vconf_value;
- if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- bool bret ;
+
+ bool bret;
bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
*value = (void *)bret;
{
SETTING_TRACE_BEGIN;
int optout_value = 0;
- if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
if (optout_value == 1) {
*value = strdup(DEFAULT_ADS_ID);
}
char *vconf_value = NULL;
- if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
*value = vconf_value;
return SYSTEM_SETTINGS_ERROR_NONE;
void make_ad_id(void)
{
uuid_t uuid_value;
- char uuid_unparsed[50] = {0};
+ char uuid_unparsed[50] = { 0 };
uuid_generate(uuid_value);
uuid_unparse(uuid_value, uuid_unparsed);
system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
char *vconf_value = NULL;
vconf_value = (char *)value;
- if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
+ if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
int vconf_value;
char *vconf_string_value = NULL;
- if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) {
+ if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
//retv_if(isEmptyStr(dir_path) || isEmptyStr(name), NULL);
if (dir_path == NULL) return NULL;
- char path[512] = {0, };
+ char path[512] = { 0 };
snprintf(path, sizeof(path), "%s/%s", dir_path, name);
metadata_extractor_h metadata = NULL;
int tempvalue = 0;
int ret = vconf_get_bool(vconf_key, &tempvalue);
- if (tempvalue == 1) {
+ if (tempvalue == 1)
*value = true;
- } else {
+ else
*value = false;
- }
+
return ret;
}
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key))
- {
+ if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key)) {
LOGE("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
vconf_event_cb = system_setting_vconf_get_event_cb_slot(slot);
- if (vconf_event_cb != NULL) {
+ if (vconf_event_cb != NULL)
vconf_ignore_key_changed(vconf_key, vconf_event_cb);
- }
return SYSTEM_SETTINGS_ERROR_NONE;
}
static system_setting_vconf_event_cb system_setting_vconf_get_event_multi_cb_slot(system_settings_key_e key)
{
- int cal = (int) key;
+ int cal = (int)key;
int slot = cal % 4;
switch (slot) {
pkgmgrinfo_app_list_cb app_func, uid_t uid, int flag,
void *user_data)
{
- return PMINFO_R_OK;
+ return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_get_installed_list_full(
}
API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
- int *operation_count, char ***operation)
+ int *operation_count, char ***operation)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
- int *uri_count, char ***uri)
+ int *uri_count, char ***uri)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
- int *mime_count, char ***mime)
+ int *mime_count, char ***mime)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
- int *subapp_count, char ***subapp)
+ int *subapp_count, char ***subapp)
{
return PMINFO_R_OK;
}
}
API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
- pkgmgrinfo_app_category_list_cb category_func, void *user_data)
+ pkgmgrinfo_app_category_list_cb category_func, void *user_data)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
- pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
+ pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
{
return PMINFO_R_OK;
}
}
API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
- pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
+ pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_foreach_remote_appcontrol(pkgmgrinfo_appinfo_h handle,
- pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
+ pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
{
return PMINFO_R_OK;
}
}
API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
- const char *property, const int value)
+ const char *property, const int value)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
- const char *property, const bool value)
+ const char *property, const bool value)
{
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
- const char *property, const char *value)
+ const char *property, const char *value)
{
return PMINFO_R_OK;
}
}
API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
- pkgmgrinfo_app_list_cb app_cb, void *user_data)
+ pkgmgrinfo_app_list_cb app_cb, void *user_data)
{
return PMINFO_R_OK;
}
# define EXPORT __attribute__((visibility("default")))
#endif
-typedef std::map<string, pair<void*,void*>> NotifyMap;
+typedef std::map<string, pair<void*, void*>> NotifyMap;
static NotifyMap notifyCallBackMap;
#ifdef __cplusplus
#define MAX_BUF_LEN 2048
#define DB_NAME "./vconf.db"
- enum get_option_t {
- VCONF_GET_KEY = 0, /**< Get only keys */
- VCONF_GET_ALL, /**< Get keys and directories */
- VCONF_GET_DIR /**< Get only directories */
- };
- typedef enum get_option_t get_option_t;
- enum vconf_t {
- VCONF_TYPE_NONE = 0, /**< Vconf none type for Error detection */
- VCONF_TYPE_STRING = 40, /**< Vconf string type */
- VCONF_TYPE_INT = 41, /**< Vconf integer type */
- VCONF_TYPE_DOUBLE = 42, /**< Vconf double type */
- VCONF_TYPE_BOOL = 43, /**< Vconf boolean type */
- VCONF_TYPE_DIR /**< Vconf directory type */
- };
-
- typedef struct _keynode_t {
- char *keyname; /**< Keyname for keynode */
- int type; /**< Keynode type */
- union {
- int i; /**< Integer type */
- int b; /**< Bool type */
- double d; /**< Double type */
- char *s; /**< String type */
- } value; /**< Value for keynode */
- } keynode_t;
- typedef struct _keylist_t keylist_t;
-
- typedef void (*vconf_callback_fn) (keynode_t *node, void *user_data);
-
- union UnionValue {
- int i; /**< Integer type */
- int b; /**< Bool type */
- double d; /**< Double type */
- char *s; /**< String type */
- }; /**< Value for keynode */
-
- void checkNotifyCallBack( const char* in_key, int type, UnionValue* value ){
-
- string str;
- str = in_key;
-
- NotifyMap::iterator itr;
- for(itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++){
- LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
-
- if( str.compare( itr->first ) == 0 ){
- vconf_callback_fn cb = (vconf_callback_fn)itr->second.first;
- void* user_data = itr->second.second;
-
- keynode_t node;
- node.keyname = (char*)str.c_str();
- node.type = type;
- switch( node.type ) {
- case VCONF_TYPE_STRING:
- node.value.s = value->s;
- break;
- case VCONF_TYPE_INT:
- node.value.i = value->i;
- break;
- case VCONF_TYPE_DOUBLE:
- node.value.d = value->d;
- break;
- case VCONF_TYPE_BOOL:
- node.value.b = value->b;
- break;
- default:
- LOG_D(stdout, "[%s][%d] invalid type [%d] \n", __func__, __LINE__, node.type );
- return;
- }
- cb(&node, user_data);
- }
- }
- }
-
-
- static sqlite3 *db = NULL;
-
- void _sqlite_close() {
- if( db != NULL ){
- sqlite3_close(db);
- db = NULL;
- }
- }
-
- int _sqlite_connect() {
- if( db != NULL ) {
- return VCONF_OK;
- }
-
- int rc = sqlite3_open(DB_NAME, &db);
- if (rc != SQLITE_OK) {
- LOG_E(stderr, "[%s][%d] sqlite3_open error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), sqlite3_errmsg(db));
- _sqlite_close();
- return VCONF_ERROR;
- }
- return VCONF_OK;
- }
-
- /************************************************
- * keynode handling APIs *
- ************************************************/
- EXPORT char *vconf_keynode_get_name(keynode_t *keynode){
- return NULL;
- }
-
- EXPORT int vconf_keynode_get_type(keynode_t *keynode){
- return 0;
- }
-
- EXPORT int vconf_keynode_get_int(keynode_t *keynode){
- return 0;
- }
-
- EXPORT double vconf_keynode_get_dbl(keynode_t *keynode){
- return 0;
- }
-
- EXPORT int vconf_keynode_get_bool(keynode_t *keynode){
- return 0;
- }
-
- EXPORT char *vconf_keynode_get_str(keynode_t *keynode){
- return NULL;
- }
-
-
- /************************************************
- * keylist handling APIs
- ************************************************/
- keylist_t *vconf_keylist_new(void){
- return NULL;
- }
-
- EXPORT int vconf_keylist_rewind(keylist_t *keylist){
- return 0;
- }
-
- EXPORT int vconf_keylist_free(keylist_t *keylist){
- return 0;
- }
-
- EXPORT int vconf_keylist_lookup(keylist_t *keylist, const char *keyname,
- keynode_t **return_node){
- return 0;
- }
-
- EXPORT keynode_t *vconf_keylist_nextnode(keylist_t *keylist){
- return NULL;
- }
-
- EXPORT int vconf_keylist_add_int(keylist_t *keylist, const char *keyname,
- const int value){
- return 0;
- }
-
- EXPORT int vconf_keylist_add_bool(keylist_t *keylist, const char *keyname,
- const int value){
- return 0;
- }
-
- EXPORT int vconf_keylist_add_dbl(keylist_t *keylist, const char *keyname,
- const double value){
- return 0;
- }
-
- EXPORT int vconf_keylist_add_str(keylist_t *keylist, const char *keyname,
- const char *value){
- return 0;
- }
-
- EXPORT int vconf_keylist_add_null(keylist_t *keylist, const char *keyname){
- return 0;
- }
-
- EXPORT int vconf_keylist_del(keylist_t *keylist, const char *keyname){
- return 0;
- }
-
- /************************************************
- * setting APIs *
- ************************************************/
-
- int _vconf_set_str(const char *in_key, const char *strval){
-
- int rc;
- char *err_msg = 0;
- char sql[MAX_BUF_LEN+1];
-
- rc = _sqlite_connect();
- if (rc != SQLITE_OK) {
- _sqlite_close();
- return VCONF_ERROR;
- }
+enum get_option_t {
+ VCONF_GET_KEY = 0, /**< Get only keys */
+ VCONF_GET_ALL, /**< Get keys and directories */
+ VCONF_GET_DIR /**< Get only directories */
+};
+typedef enum get_option_t get_option_t;
+enum vconf_t {
+ VCONF_TYPE_NONE = 0, /**< Vconf none type for Error detection */
+ VCONF_TYPE_STRING = 40, /**< Vconf string type */
+ VCONF_TYPE_INT = 41, /**< Vconf integer type */
+ VCONF_TYPE_DOUBLE = 42, /**< Vconf double type */
+ VCONF_TYPE_BOOL = 43, /**< Vconf boolean type */
+ VCONF_TYPE_DIR /**< Vconf directory type */
+};
+
+typedef struct _keynode_t {
+ char *keyname; /**< Keyname for keynode */
+ int type; /**< Keynode type */
+ union {
+ int i; /**< Integer type */
+ int b; /**< Bool type */
+ double d; /**< Double type */
+ char *s; /**< String type */
+ } value; /**< Value for keynode */
+} keynode_t;
+typedef struct _keylist_t keylist_t;
+
+typedef void(*vconf_callback_fn) (keynode_t *node, void *user_data);
+
+union UnionValue {
+ int i; /**< Integer type */
+ int b; /**< Bool type */
+ double d; /**< Double type */
+ char *s; /**< String type */
+}; /**< Value for keynode */
+
+void checkNotifyCallBack(const char* in_key, int type, UnionValue* value)
+{
+ string str;
+ str = in_key;
+
+ NotifyMap::iterator itr;
+ for (itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++) {
+ LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
+
+ if (str.compare(itr->first) == 0) {
+ vconf_callback_fn cb = (vconf_callback_fn)itr->second.first;
+ void* user_data = itr->second.second;
+
+ keynode_t node;
+ node.keyname = (char*)str.c_str();
+ node.type = type;
+ switch (node.type) {
+ case VCONF_TYPE_STRING:
+ node.value.s = value->s;
+ break;
+ case VCONF_TYPE_INT:
+ node.value.i = value->i;
+ break;
+ case VCONF_TYPE_DOUBLE:
+ node.value.d = value->d;
+ break;
+ case VCONF_TYPE_BOOL:
+ node.value.b = value->b;
+ break;
+ default:
+ LOG_D(stdout, "[%s][%d] invalid type [%d] \n", __func__, __LINE__, node.type);
+ return;
+ }
+ cb(&node, user_data);
+ }
+ }
+}
-#if 1 /* journal mode */
- {
- LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
- snprintf(sql, MAX_BUF_LEN, "PRAGMA JOURNAL_MODE=MEMORY");
-
- rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
- if (rc != SQLITE_OK ) {
- LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
-
- sqlite3_free(err_msg);
- _sqlite_close();
- return VCONF_ERROR;
- }
- }
-#endif
+static sqlite3 *db = NULL;
+void _sqlite_close()
+{
+ if (db != NULL) {
+ sqlite3_close(db);
+ db = NULL;
+ }
+}
-#if 0 /* select key */
- {
- sqlite3_stmt *stmt = NULL;
- snprintf(sql, MAX_BUF_LEN, "SELECT layer, key, value, type read_privilege, write_privilege FROM vconf WHERE key = ? and layer = 'system'");
-
- rc = sqlite3_prepare(db, sql, -1, &stmt, 0);
- if(rc != SQLITE_OK ){
- LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- _sqlite_close();
- return VCONF_ERROR;
- }
-
- sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
- rc = sqlite3_step(stmt);
- if( rc != SQLITE_ROW ) {
- LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- _sqlite_close();
- return VCONF_ERROR;
- }
-
- LOG_D(stdout, "vconf get: layer[%s] key[%s], value[%s]\n",
- sqlite3_column_text(stmt,0),
- sqlite3_column_text(stmt,1),
- sqlite3_column_text(stmt,2) );
-
- sqlite3_finalize(stmt);
- }
-#endif
+int _sqlite_connect()
+{
+ if (db != NULL)
+ return VCONF_OK;
+
+ int rc = sqlite3_open(DB_NAME, &db);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqlite3_open error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), sqlite3_errmsg(db));
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+ return VCONF_OK;
+}
-#if 0 /* insert key */
- {
- LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
- snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
- "VALUES ( \"%s\", \"%s\", \'%s\');", "system", in_key, strval );
+/************************************************
+ * keynode handling APIs *
+ ************************************************/
+EXPORT char *vconf_keynode_get_name(keynode_t *keynode)
+{
+ return NULL;
+}
- rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
- if (rc != SQLITE_OK ) {
- LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
+EXPORT int vconf_keynode_get_type(keynode_t *keynode)
+{
+ return 0;
+}
- sqlite3_free(err_msg);
- _sqlite_close();
+EXPORT int vconf_keynode_get_int(keynode_t *keynode)
+{
+ return 0;
+}
- return VCONF_ERROR;
- }
- }
-#endif
+EXPORT double vconf_keynode_get_dbl(keynode_t *keynode)
+{
+ return 0;
+}
-#if 1 /* insert key with parameter */
- {
- sqlite3_stmt *stmt = NULL;
- LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
- snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
- "VALUES ( \"%s\", ?, ?);", "system" );
-
- rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
- if(rc != SQLITE_OK ){
- LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- _sqlite_close();
- return VCONF_ERROR;
- }
-
- sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
- sqlite3_bind_text(stmt, 2, strval, strlen(strval), SQLITE_STATIC);
-
- rc = sqlite3_step(stmt);
- if( rc != SQLITE_DONE ) {
- LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- _sqlite_close();
- return VCONF_ERROR;
- }
- }
-#endif
- return VCONF_OK;
- }
+EXPORT int vconf_keynode_get_bool(keynode_t *keynode)
+{
+ return 0;
+}
- EXPORT int vconf_set(keylist_t *keylist){
- return 0;
- }
+EXPORT char *vconf_keynode_get_str(keynode_t *keynode)
+{
+ return NULL;
+}
- EXPORT int vconf_set_int(const char *in_key, const int intval){
- int rc;
- char buf[MAX_BUF_LEN+1];
- snprintf(buf, MAX_BUF_LEN, "%d", intval);
-
- rc = _vconf_set_str(in_key, buf);
- if( rc != VCONF_OK ){
- LOG_E(stderr,"[%s][%d] _vconf_set_str error!\n", __func__,__LINE__);
- return VCONF_ERROR;
- }
-
- UnionValue uValue;
- uValue.i = intval;
- checkNotifyCallBack( in_key, VCONF_TYPE_INT, &uValue );
-
- return VCONF_OK;
- }
-
- EXPORT int vconf_set_bool(const char *in_key, const int boolval){
- int rc;
- char buf[MAX_BUF_LEN+1];
- snprintf(buf, MAX_BUF_LEN, "%d", boolval);
-
- rc = _vconf_set_str(in_key, buf);
- if( rc != VCONF_OK ){
- LOG_E(stderr,"[%s][%d] _vconf_set_str error!\n", __func__,__LINE__);
- return VCONF_ERROR;
- }
-
- UnionValue uValue;
- uValue.b = boolval;
- checkNotifyCallBack( in_key, VCONF_TYPE_BOOL, &uValue );
-
- return VCONF_OK;
- }
-
- EXPORT int vconf_set_dbl(const char *in_key, const double dblval){
-
- int rc;
- char buf[MAX_BUF_LEN+1];
- snprintf(buf, MAX_BUF_LEN, "%lf", dblval);
- rc = _vconf_set_str(in_key, buf);
- if( rc != VCONF_OK ){
- LOG_E(stderr,"[%s][%d] _vconf_set_str error!\n", __func__,__LINE__);
- return VCONF_ERROR;
- }
+/************************************************
+ * keylist handling APIs
+ ************************************************/
+keylist_t *vconf_keylist_new(void)
+{
+ return NULL;
+}
- UnionValue uValue;
- uValue.d = dblval;
- checkNotifyCallBack( in_key, VCONF_TYPE_DOUBLE, &uValue );
+EXPORT int vconf_keylist_rewind(keylist_t *keylist)
+{
+ return 0;
+}
- return VCONF_OK;
- }
+EXPORT int vconf_keylist_free(keylist_t *keylist)
+{
+ return 0;
+}
- EXPORT int vconf_set_str(const char *in_key, const char *strval){
- int rc;
+EXPORT int vconf_keylist_lookup(keylist_t *keylist, const char *keyname,
+ keynode_t **return_node)
+{
+ return 0;
+}
- rc = _vconf_set_str(in_key, strval);
- if( rc != VCONF_OK ){
- LOG_E(stderr,"[%s][%d] _vconf_set_str error!\n", __func__,__LINE__);
- return VCONF_ERROR;
- }
+EXPORT keynode_t *vconf_keylist_nextnode(keylist_t *keylist)
+{
+ return NULL;
+}
- UnionValue uValue;
- uValue.s = (char*)strval;
- checkNotifyCallBack( in_key, VCONF_TYPE_STRING, &uValue );
+EXPORT int vconf_keylist_add_int(keylist_t *keylist, const char *keyname,
+ const int value)
+{
+ return 0;
+}
- return VCONF_OK;
- }
+EXPORT int vconf_keylist_add_bool(keylist_t *keylist, const char *keyname,
+ const int value)
+{
+ return 0;
+}
- EXPORT int vconf_get(keylist_t *keylist, const char *in_parentDIR, get_option_t option){
- return 0;
- }
+EXPORT int vconf_keylist_add_dbl(keylist_t *keylist, const char *keyname,
+ const double value)
+{
+ return 0;
+}
- EXPORT char *vconf_get_str(const char *in_key){
+EXPORT int vconf_keylist_add_str(keylist_t *keylist, const char *keyname,
+ const char *value)
+{
+ return 0;
+}
- int rc;
- char sql[MAX_BUF_LEN+1];
- char* str = NULL;
+EXPORT int vconf_keylist_add_null(keylist_t *keylist, const char *keyname)
+{
+ return 0;
+}
- LOG_D(stdout,"[%s][%d] start! key [%s] \n", __func__, __LINE__ , in_key );
+EXPORT int vconf_keylist_del(keylist_t *keylist, const char *keyname)
+{
+ return 0;
+}
- rc = _sqlite_connect();
- if (rc != SQLITE_OK) {
- _sqlite_close();
- return NULL;
- }
+/************************************************
+ * setting APIs *
+ ************************************************/
- sqlite3_stmt *stmt = NULL;
- snprintf(sql, MAX_BUF_LEN, "SELECT layer, key, value, type read_privilege, write_privilege FROM vconf WHERE key = ? and layer = 'system'");
+int _vconf_set_str(const char *in_key, const char *strval)
+{
+ int rc;
+ char *err_msg = 0;
+ char sql[MAX_BUF_LEN + 1];
- int count = 0;
- do {
- rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
- if(rc != SQLITE_OK ){
- LOG_E(stderr, "[%s][%d] sqltie3_prepare error! rc[%d] : %s\n", __func__, __LINE__, rc, sqlite3_errmsg(db));
+ rc = _sqlite_connect();
+ if (rc != SQLITE_OK) {
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
- if( count >= 5 ){
- _sqlite_close();
- return NULL;
- }
+#if 1 /* journal mode */
+ {
+ LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+ snprintf(sql, MAX_BUF_LEN, "PRAGMA JOURNAL_MODE=MEMORY");
+
+ rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
+
+ sqlite3_free(err_msg);
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+ }
+#endif
- count++;
- usleep(1000000);
- }
- else {
- break;
- }
- }while(1);
+#if 0 /* select key */
+ {
+ sqlite3_stmt *stmt = NULL;
+ snprintf(sql, MAX_BUF_LEN, "SELECT layer, key, value, type read_privilege, write_privilege FROM vconf WHERE key = ? and layer = 'system'");
+
+ rc = sqlite3_prepare(db, sql, -1, &stmt, 0);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+
+ sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
+ rc = sqlite3_step(stmt);
+ if (rc != SQLITE_ROW) {
+ LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+
+ LOG_D(stdout, "vconf get: layer[%s] key[%s], value[%s]\n",
+ sqlite3_column_text(stmt, 0),
+ sqlite3_column_text(stmt, 1),
+ sqlite3_column_text(stmt, 2));
+
+ sqlite3_finalize(stmt);
+ }
+#endif
- sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
- rc = sqlite3_step(stmt);
- if( rc != SQLITE_ROW ) {
- LOG_E(stderr, "[%s][%d] sqlite3_step error! key[%s]\n", __func__, __LINE__, in_key);
- sqlite3_finalize(stmt);
- _sqlite_close();
- return NULL;
- }
+#if 0 /* insert key */
+ {
+ LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+ snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
+ "VALUES ( \"%s\", \"%s\", \'%s\');", "system", in_key, strval);
- LOG_D(stdout, "[%s][%d] vconf get: layer[%s] key[%s], value[%s]\n",
- __func__, __LINE__,
- sqlite3_column_text(stmt,0),
- sqlite3_column_text(stmt,1),
- sqlite3_column_text(stmt,2) );
+ rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
- str = (char*)malloc(MAX_BUF_LEN+1);
- strncpy( str, (char*)sqlite3_column_text(stmt,2), MAX_BUF_LEN);
+ sqlite3_free(err_msg);
+ _sqlite_close();
- sqlite3_finalize(stmt);
+ return VCONF_ERROR;
+ }
+ }
+#endif
- LOG_D(stdout, "[%s][%d] vconf get: key[%s], value[%s]\n", __func__, __LINE__, in_key, str );
- return str;
- }
+#if 1 /* insert key with parameter */
+ {
+ sqlite3_stmt *stmt = NULL;
+ LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+ snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
+ "VALUES ( \"%s\", ?, ?);", "system");
+
+ rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+
+ sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
+ sqlite3_bind_text(stmt, 2, strval, strlen(strval), SQLITE_STATIC);
+
+ rc = sqlite3_step(stmt);
+ if (rc != SQLITE_DONE) {
+ LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+ sqlite3_finalize(stmt);
+ _sqlite_close();
+ return VCONF_ERROR;
+ }
+ }
+#endif
+ return VCONF_OK;
+}
+
+EXPORT int vconf_set(keylist_t *keylist)
+{
+ return 0;
+}
+
+EXPORT int vconf_set_int(const char *in_key, const int intval)
+{
+ int rc;
+ char buf[MAX_BUF_LEN + 1];
+ snprintf(buf, MAX_BUF_LEN, "%d", intval);
+
+ rc = _vconf_set_str(in_key, buf);
+ if (rc != VCONF_OK) {
+ LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+ return VCONF_ERROR;
+ }
+
+ UnionValue uValue;
+ uValue.i = intval;
+ checkNotifyCallBack(in_key, VCONF_TYPE_INT, &uValue);
+
+ return VCONF_OK;
+}
+
+EXPORT int vconf_set_bool(const char *in_key, const int boolval)
+{
+ int rc;
+ char buf[MAX_BUF_LEN + 1];
+ snprintf(buf, MAX_BUF_LEN, "%d", boolval);
+
+ rc = _vconf_set_str(in_key, buf);
+ if (rc != VCONF_OK) {
+ LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+ return VCONF_ERROR;
+ }
+
+ UnionValue uValue;
+ uValue.b = boolval;
+ checkNotifyCallBack(in_key, VCONF_TYPE_BOOL, &uValue);
+
+ return VCONF_OK;
+}
+
+EXPORT int vconf_set_dbl(const char *in_key, const double dblval)
+{
+ int rc;
+ char buf[MAX_BUF_LEN + 1];
+ snprintf(buf, MAX_BUF_LEN, "%lf", dblval);
+
+ rc = _vconf_set_str(in_key, buf);
+ if (rc != VCONF_OK) {
+ LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+ return VCONF_ERROR;
+ }
+
+ UnionValue uValue;
+ uValue.d = dblval;
+ checkNotifyCallBack(in_key, VCONF_TYPE_DOUBLE, &uValue);
- EXPORT int vconf_get_int(const char *in_key, int *intval){
+ return VCONF_OK;
+}
- LOG_D(stdout,"[%s][%d] start!\n", __func__, __LINE__ );
+EXPORT int vconf_set_str(const char *in_key, const char *strval)
+{
+ int rc;
- char* value = vconf_get_str(in_key);
+ rc = _vconf_set_str(in_key, strval);
+ if (rc != VCONF_OK) {
+ LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+ return VCONF_ERROR;
+ }
- if( value == NULL ){
- return VCONF_ERROR;
- }
+ UnionValue uValue;
+ uValue.s = (char*)strval;
+ checkNotifyCallBack(in_key, VCONF_TYPE_STRING, &uValue);
- *intval = atoi(value);
+ return VCONF_OK;
+}
- free(value);
- return VCONF_OK;
- }
+EXPORT int vconf_get(keylist_t *keylist, const char *in_parentDIR, get_option_t option)
+{
+ return 0;
+}
- EXPORT int vconf_get_bool(const char *in_key, int *boolval){
+EXPORT char *vconf_get_str(const char *in_key)
+{
+ int rc;
+ char sql[MAX_BUF_LEN + 1];
+ char* str = NULL;
+
+ LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key);
+
+ rc = _sqlite_connect();
+ if (rc != SQLITE_OK) {
+ _sqlite_close();
+ return NULL;
+ }
+
+ sqlite3_stmt *stmt = NULL;
+ snprintf(sql, MAX_BUF_LEN, "SELECT layer, key, value, type read_privilege, write_privilege FROM vconf WHERE key = ? and layer = 'system'");
+
+ int count = 0;
+ do {
+ rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
+ if (rc != SQLITE_OK) {
+ LOG_E(stderr, "[%s][%d] sqltie3_prepare error! rc[%d] : %s\n", __func__, __LINE__, rc, sqlite3_errmsg(db));
+
+ if (count >= 5) {
+ _sqlite_close();
+ return NULL;
+ }
+
+ count++;
+ usleep(1000000);
+
+ } else {
+ break;
+ }
+ } while (1);
+
+ sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
+ rc = sqlite3_step(stmt);
+ if (rc != SQLITE_ROW) {
+ LOG_E(stderr, "[%s][%d] sqlite3_step error! key[%s]\n", __func__, __LINE__, in_key);
+ sqlite3_finalize(stmt);
+ _sqlite_close();
+ return NULL;
+ }
+
+ LOG_D(stdout, "[%s][%d] vconf get: layer[%s] key[%s], value[%s]\n",
+ __func__, __LINE__,
+ sqlite3_column_text(stmt, 0),
+ sqlite3_column_text(stmt, 1),
+ sqlite3_column_text(stmt, 2));
+
+ str = (char*)malloc(MAX_BUF_LEN + 1);
+ strncpy(str, (char*)sqlite3_column_text(stmt, 2), MAX_BUF_LEN);
+
+ sqlite3_finalize(stmt);
+
+ LOG_D(stdout, "[%s][%d] vconf get: key[%s], value[%s]\n", __func__, __LINE__, in_key, str);
+ return str;
+}
- LOG_D(stdout,"[%s][%d] start! key [%s] \n", __func__, __LINE__ , in_key );
+EXPORT int vconf_get_int(const char *in_key, int *intval)
+{
+ LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__);
- char* value = vconf_get_str(in_key);
+ char* value = vconf_get_str(in_key);
- if( value == NULL ){
- LOG_E(stdout, "[%s][%d] value is NULL! \n", __func__, __LINE__ );
- return VCONF_ERROR;
- }
+ if (value == NULL)
+ return VCONF_ERROR;
- if( *value == '0' ){
- *boolval = 0;
- } else {
- *boolval = 1;
- }
+ *intval = atoi(value);
- free(value);
- return VCONF_OK;
- }
+ free(value);
+ return VCONF_OK;
+}
- EXPORT int vconf_get_dbl(const char *in_key, double *dblval){
+EXPORT int vconf_get_bool(const char *in_key, int *boolval)
+{
+ LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key);
- LOG_D(stdout,"[%s][%d] start!\n", __func__, __LINE__ );
+ char* value = vconf_get_str(in_key);
- char* value = vconf_get_str(in_key);
- char *ptr;
+ if (value == NULL) {
+ LOG_E(stdout, "[%s][%d] value is NULL! \n", __func__, __LINE__);
+ return VCONF_ERROR;
+ }
- if( value == NULL ){
- return VCONF_ERROR;
- }
+ if (*value == '0')
+ *boolval = 0;
+ else
+ *boolval = 1;
- *dblval = strtod(value, &ptr);;
+ free(value);
+ return VCONF_OK;
+}
+
+EXPORT int vconf_get_dbl(const char *in_key, double *dblval)
+{
+ LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__);
- free(value);
- return VCONF_OK;
- }
+ char* value = vconf_get_str(in_key);
+ char *ptr;
- EXPORT int vconf_unset(const char *in_key){
- return 0;
- }
+ if (value == NULL)
+ return VCONF_ERROR;
- EXPORT int vconf_sync_key(const char *in_key){
- return 0;
- }
+ *dblval = strtod(value, &ptr);;
- EXPORT int vconf_unset_recursive(const char *in_dir){
- return 0;
- }
+ free(value);
+ return VCONF_OK;
+}
- EXPORT int vconf_notify_key_changed(const char *in_key, vconf_callback_fn cb,
- void *user_data){
- string str;
- str = in_key;
- notifyCallBackMap.insert(make_pair(str, make_pair((void*)cb,user_data)));
+EXPORT int vconf_unset(const char *in_key)
+{
+ return 0;
+}
+
+EXPORT int vconf_sync_key(const char *in_key)
+{
+ return 0;
+}
+
+EXPORT int vconf_unset_recursive(const char *in_dir)
+{
+ return 0;
+}
+
+EXPORT int vconf_notify_key_changed(const char *in_key, vconf_callback_fn cb,
+ void *user_data)
+{
+ string str;
+ str = in_key;
+ notifyCallBackMap.insert(make_pair(str, make_pair((void*)cb, user_data)));
#if 0 /* map debug */
- NotifyMap::iterator itr;
- for(itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++){
- LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
- }
+ NotifyMap::iterator itr;
+ for (itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++) {
+ LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
+ }
#endif
- return VCONF_OK;
- }
+ return VCONF_OK;
+}
- EXPORT int vconf_ignore_key_changed(const char *in_key, vconf_callback_fn cb){
- string str;
- str = in_key;
- notifyCallBackMap.erase(notifyCallBackMap.find(str));
+EXPORT int vconf_ignore_key_changed(const char *in_key, vconf_callback_fn cb)
+{
+ string str;
+ str = in_key;
+ notifyCallBackMap.erase(notifyCallBackMap.find(str));
- return VCONF_OK;
- }
+ return VCONF_OK;
+}
- EXPORT int vconf_get_ext_errno(void){
- return 0;
- }
+EXPORT int vconf_get_ext_errno(void)
+{
+ return 0;
+}
#ifdef __cplusplus
}
return 1;
}
#else
-#define my_assert_ret(retcode) do{ \
+#define my_assert_ret(retcode) do { \
if (retcode != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { \
if (retcode != SYSTEM_SETTINGS_ERROR_NONE) \
printf("Error!!(%d)\n", retcode); \
assert(retcode == SYSTEM_SETTINGS_ERROR_NONE); \
} \
-}while(0)
+} while (0)
-#define my_assert_ret_eq_bool(retcode,a,b) do{ \
+#define my_assert_ret_eq_bool(retcode, a, b) do { \
if (retcode != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { \
if (retcode != SYSTEM_SETTINGS_ERROR_NONE) \
printf("Error!!\n"); \
assert(retcode == SYSTEM_SETTINGS_ERROR_NONE); \
assert_eq(a, b); \
} \
-}while(0)
+} while (0)
#endif
{
int retcode = system_settings_get_value_string(-1, NULL);
//assert_neq(retcode, SYSTEM_SETTINGS_ERROR_NONE);
- assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
+ assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
RETURN(0);
}
{
int retcode = system_settings_get_value_bool(-1, NULL);
//assert_neq(retcode, SYSTEM_SETTINGS_ERROR_NONE);
- assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
+ assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
RETURN(0);
}
{
int retcode = system_settings_get_value_int(-1, NULL);
//assert_neq(retcode, SYSTEM_SETTINGS_ERROR_NONE);
- assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
+ assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
RETURN(0);
}
RETTYPE utc_system_settings_get_value_int_p3(void)
{
int value;
- int nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, &value);
+ int nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, &value);
my_assert_ret(nRetVal);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_TIME_CHANGED,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_TIME_CHANGED,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_TIME_CHANGED);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_LOCK,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_LOCK,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_LOCK);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_TOUCH,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_TOUCH,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_TOUCH);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DEVICE_NAME,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DEVICE_NAME,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_DEVICE_NAME);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ENABLED,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ENABLED,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_MOTION_ENABLED);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION);
my_assert_ret(retcode);
if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
RETURN(0);
- if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath)) {
+ if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath))
assert(1);
- } else {
+ else
assert(0);
- }
+
RETURN(0);
}
RETTYPE utc_system_settings_set_value_int_n1(void)
{
int ret;
- int value = 3600;
+ int value = 3600;
ret = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_TIME_CHANGED, value);
my_assert_ret(ret);
char *ret_device = NULL;
ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_DEVICE_NAME, &ret_device);
- if (ret_device != NULL && 0 == strcmp(ret_device, new_device)) {
+ if (ret_device != NULL && 0 == strcmp(ret_device, new_device))
assert(0);
- } else {
+ else
assert(1);
- }
+
RETURN(0);
}
if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
RETURN(0);
- if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath)) {
+ if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath))
assert(1);
- } else {
+ else
assert(0);
- }
+
RETURN(0);
}
ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, &ret_country);
my_assert_ret(ret);
- if (ret_country != NULL && 0 == strcmp(ret_country, new_country)) {
+ if (ret_country != NULL && 0 == strcmp(ret_country, new_country))
assert(1);
- } else {
+ else
assert(0);
- }
ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, backup);
my_assert_ret(ret);
RETTYPE utc_system_settings_set_changed_cb_n(void)
{
int retcode = system_settings_set_changed_cb(-1, NULL, NULL);
- assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
+ assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
RETURN(0);
}
RETTYPE utc_system_settings_get_value_int_p4(void)
{
int value = 0;
- int nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, &value);
+ int nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, &value);
my_assert_ret(nRetVal);
RETURN(0);
}
*/
RETTYPE utc_system_settings_set_value_int_p1(void)
{
- int nRetVal = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 30);
+ int nRetVal = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 30);
my_assert_ret(nRetVal);
int value;
- nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, &value);
+ nRetVal = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, &value);
//assert_eq(value, 30);
RETURN(0);
}
RETTYPE utc_system_settings_set_value_int_n2(void)
{
int ret = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, -5);
- assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+ assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
ret = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 601);
- assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+ assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
ret = system_settings_set_value_int(SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 0);
- assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+ assert(ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
RETURN(0);
}
};
srand(time(NULL));
- int size = sizeof(arr)/sizeof(arr[0]);
+ int size = sizeof(arr) / sizeof(arr[0]);
int sel = rand() % size;
/* backup */
char *ret_ringtonepath = NULL;
ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, &ret_ringtonepath);
- if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath)) {
+ if (ret_ringtonepath != NULL && 0 == strcmp(ret_ringtonepath, new_ringtonepath))
my_assert_ret(0);
- } else {
+ else
my_assert_ret(1);
- }
+
RETURN(0);
}
RETTYPE utc_system_settings_unset_changed_cb_n(void)
{
int retcode = system_settings_unset_changed_cb(-1);
- assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
+ assert(retcode != SYSTEM_SETTINGS_ERROR_NONE);
RETURN(0);
}
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_VIBRATION,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_VIBRATION,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_VIBRATION);
my_assert_ret(retcode);
static bool system_setting_get_ringtone_list_cb(int index, const char* data, void *user_data)
{
cb_count += 1;
-/* printf("%s\n", (char*)data); */
+ //printf("%s\n", (char*)data);
return true;
}
static gpointer test_multi_callback_thread(gpointer arg)
{
int retcode = system_settings_add_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- utc_system_settings_changed_multi_callback1, arg);
+ utc_system_settings_changed_multi_callback1, arg);
my_assert_ret(retcode);
retcode = system_settings_add_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- utc_system_settings_changed_multi_callback1, arg);
+ utc_system_settings_changed_multi_callback1, arg);
/* not support same callback about 1 system-settings key */
assert_eq(retcode, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
retcode = system_settings_add_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- utc_system_settings_changed_multi_callback2, arg);
+ utc_system_settings_changed_multi_callback2, arg);
bool bk_state = false;
- system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR , &bk_state);
+ system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &bk_state);
bool state = true;
- system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR , state);
+ system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, state);
sleep(1);
my_assert_ret(retcode);
retcode = system_settings_remove_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- utc_system_settings_changed_multi_callback1);
+ utc_system_settings_changed_multi_callback1);
my_assert_ret(retcode);
retcode = system_settings_remove_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
- utc_system_settings_changed_multi_callback2);
+ utc_system_settings_changed_multi_callback2);
my_assert_ret(retcode);
- system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR , bk_state);
+ system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, bk_state);
return 0;
int retcode = 0;
int key_idx = 0;
- for (key_idx = SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE; key_idx < SYSTEM_SETTINGS_KEY_MAX ; key_idx++) {
+ for (key_idx = SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE; key_idx < SYSTEM_SETTINGS_KEY_MAX; key_idx++) {
system_settings_changed_cb callback_1 = get_system_settings_test_callback();
system_settings_changed_cb callback_2 = get_system_settings_test_callback();
continue; /* skip not supported notification callback of system-setting key */
retcode = system_settings_add_changed_cb(key_idx,
- callback_1, NULL);
+ callback_1, NULL);
if (retcode == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) {
assert_eq(retcode, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
}
retcode = system_settings_remove_changed_cb(key_idx,
- callback_1);
+ callback_1);
if (retcode == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) {
assert_eq(retcode, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
}
retcode = system_settings_add_changed_cb(key_idx,
- callback_1, NULL);
+ callback_1, NULL);
my_assert_ret(retcode);
retcode = system_settings_add_changed_cb(key_idx,
- callback_2, NULL);
+ callback_2, NULL);
my_assert_ret(retcode);
retcode = system_settings_remove_changed_cb(key_idx,
- callback_1);
+ callback_1);
my_assert_ret(retcode);
retcode = system_settings_remove_changed_cb(key_idx,
- callback_2);
+ callback_2);
my_assert_ret(retcode);
}
free(ret_ads_id);
retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ADS_ID,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ADS_ID);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR);
my_assert_ret(retcode);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED,
- callback, NULL);
+ callback, NULL);
my_assert_ret(retcode);
RETURN(0);
{
system_settings_changed_cb callback = get_system_settings_test_callback();
int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED,
- callback, NULL);
+ callback, NULL);
retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED);
my_assert_ret(retcode);
add_test_func("/utc_system_settings_set_value_string_n6", utc_system_settings_set_value_string_n6);
g_test_add_func("/utc_system_settings_unset_changed_cb_n", utc_system_settings_unset_changed_cb_n);
}
-
static GThread *my_thread = NULL;
static GMainLoop *main_loop = NULL;
-static thread_test_node thread_test_table[1000] = {0};
+static thread_test_node thread_test_table[1000] = { 0 };
static int thread_test_idx = 0;
static int loop = 100;
static int thread_sw = 1;
{
int i;
GThread **thread_list = (GThread **)calloc(sizeof(GThread*), N_THREADS);
- for (i = 0; i < N_THREADS; i++) {
+ for (i = 0; i < N_THREADS; i++)
thread_list[i] = g_thread_new(NULL, thread_function, (void*)test_num);
- }
+
return thread_list;
}
static void unit_test_thread_stop(GThread **thread_list)
{
int i;
- for (i = 0; i < N_THREADS; i++) {
+ for (i = 0; i < N_THREADS; i++)
g_thread_join(thread_list[i]);
- }
g_free(thread_list);
}
return 0;
}
-void add_test_func(char * test_name, GTestFunc func_pointer)
+void add_test_func(char * test_name, GTestFunc func_pointer)
{
g_test_add_func(test_name, func_pointer);
#include "sys_settings_test.h"
-void add_test_func(char * test_name, GTestFunc func_pointer);
+void add_test_func(char * test_name, GTestFunc func_pointer);
void unittest_api();
#ifndef SYS_SETTINGS_TEST_DIR
#include <dlfcn.h>
typedef struct _f_libs {
- FcConfig *
- (*d_FcInitLoadConfigAndFonts) (void);
-
- FcPattern *
- (*d_FcPatternBuild) (FcPattern *p, ...);
-
- void
- (*d_FcConfigDestroy) (FcConfig *config);
-
- FcBool
- (*d_FcConfigSubstitute) (FcConfig *config,
- FcPattern *p,
- FcMatchKind kind);
-
- void
- (*d_FcDefaultSubstitute) (FcPattern *pattern);
-
- FcFontSet *
- (*d_FcFontSort) (FcConfig *config,
- FcPattern *p,
- FcBool trim,
- FcCharSet **csp,
- FcResult *result);
-
- FcResult
- (*d_FcPatternGetString) (const FcPattern *p, const char *object, int n, FcChar8 ** s);
-
- void
- (*d_FcFontSetDestroy) (FcFontSet *s);
-
- void
- (*d_FcPatternDestroy) (FcPattern *p);
-
- FcPattern *
- (*d_FcPatternCreate) (void);
-
- FcObjectSet *
- (*d_FcObjectSetBuild) (const char *first, ...);
-
- FcFontSet *
- (*d_FcFontList) (FcConfig *config,
- FcPattern *p,
- FcObjectSet *os);
-
- void
- (*d_FcObjectSetDestroy) (FcObjectSet *os);
-}f_libs;
-
+ FcConfig* (*d_FcInitLoadConfigAndFonts) (void);
+ FcPattern* (*d_FcPatternBuild) (FcPattern *p, ...);
+ void(*d_FcConfigDestroy) (FcConfig *config);
+ FcBool(*d_FcConfigSubstitute) (FcConfig *config, FcPattern *p, FcMatchKind kind);
+ void(*d_FcDefaultSubstitute) (FcPattern *pattern);
+ FcFontSet* (*d_FcFontSort) (FcConfig *config, FcPattern *p, FcBool trim, FcCharSet **csp, FcResult *result);
+ FcResult(*d_FcPatternGetString) (const FcPattern *p, const char *object, int n, FcChar8 ** s);
+ void(*d_FcFontSetDestroy) (FcFontSet *s);
+ void(*d_FcPatternDestroy) (FcPattern *p);
+ FcPattern* (*d_FcPatternCreate) (void);
+ FcObjectSet* (*d_FcObjectSetBuild) (const char *first, ...);
+ FcFontSet* (*d_FcFontList) (FcConfig *config, FcPattern *p, FcObjectSet *os);
+ void(*d_FcObjectSetDestroy) (FcObjectSet *os);
+} f_libs;
typedef struct _e_libs {
- int
- (*d_evas_init) (void);
-
- void *
- (*d_ecore_evas_new) (const char *engine_name, int x, int y, int w, int h, const char *extra_options);
-
- void *
- (*d_ecore_evas_get) (const void *ee);
-
- void *
- (*d_evas_object_image_add) (void *eo_e);
-
- void
- (*d_evas_object_image_file_set) (void *obj, const char *file, const char *key);
-
- int
- (*d_evas_object_image_load_error_get) (const void *obj);
-
- void
- (*d_ecore_evas_free) (void *ee);
-
- int
- (*d_evas_shutdown) (void);
-
- int
- (*d_ecore_evas_init) (void);
-
- int
- (*d_ecore_evas_shutdown) (void);
-}e_libs;
-
+ int (*d_evas_init) (void);
+ void* (*d_ecore_evas_new) (const char *engine_name, int x, int y, int w, int h, const char *extra_options);
+ void* (*d_ecore_evas_get) (const void *ee);
+ void* (*d_evas_object_image_add) (void *eo_e);
+ void (*d_evas_object_image_file_set) (void *obj, const char *file, const char *key);
+ int (*d_evas_object_image_load_error_get) (const void *obj);
+ void (*d_ecore_evas_free) (void *ee);
+ int (*d_evas_shutdown) (void);
+ int (*d_ecore_evas_init) (void);
+ int (*d_ecore_evas_shutdown) (void);
+} e_libs;
typedef struct _eext_libs {
- bool
- (*d_eext_config_font_set)(char *name, int size);
-}ex_libs;
+ bool(*d_eext_config_font_set)(char *name, int size);
+} ex_libs;
return false;
if (!d_font_handle) {
- d_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY);
+ d_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY);
if (!d_font_handle) {
SETTING_TRACE("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH);
return false;
return false;
if (!d_ecore_evas_handle) {
- d_ecore_evas_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY);
+ d_ecore_evas_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY);
if (!d_ecore_evas_handle) {
SETTING_TRACE("ERROR!! canNOT find "SETTING_ECORE_EVAS_SO_PATH" %s", dlerror());
}
if (!d_evas_handle) {
- d_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY);
+ d_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY);
if (!d_evas_handle) {
SETTING_TRACE("ERROR!! canNOT find "SETTING_EVAS_SO_PATH" %s", dlerror());
return false;
FcPattern *pat = NULL;
FcConfig *font_config = NULL;
int ret = 0;
- f_libs font_libs = {0};
+ f_libs font_libs = { 0 };
if (!loading_dym_font(&font_libs))
return -1;
pat = font_libs.d_FcPatternCreate();
- os = font_libs.d_FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char *) 0);
+ os = font_libs.d_FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char *)0);
if (os) {
fs = font_libs.d_FcFontList(font_config, pat, os);
pat = NULL;
}
- if (fs) {
+ if (fs) {
int j;
SETTING_TRACE("fs->nfont = %d", fs->nfont);
- for (j = 0; j < fs->nfont; j++) {
+ for (j = 0; j < fs->nfont; j++) {
FcChar8 *family = NULL;
FcChar8 *file = NULL;
char *family_result = NULL;
FcChar8 *lang = NULL;
int id = 0;
- if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
+ if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch)
break;
- }
- if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
+ if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch)
break;
- }
family_result = (char *)family;
/* Find proper family name for current locale. */
/* I will set english as default family language. */
/* If there is no proper family language for current locale, */
/* we have to show the english family name. */
- if (!strcmp((char *)lang, (char *)"en")) {
+ if (!strcmp((char *)lang, (char *)"en"))
family_result = (char *)family;
- }
+
id++;
- if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
+ if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch)
break;
- }
- if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
+ if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch)
break;
- }
}
if (family_result) {
int font_size = -1;
int vconf_value = -1;
- if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
+ if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value))
return -1;
- }
switch (vconf_value) {
case SYSTEM_SETTINGS_FONT_SIZE_SMALL: