- /* Initialize parameters */
- in_param = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
- g_hash_table_insert(in_param, "1", g_strdup(dormancy_info->mccmnc));
-
- out_param = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy);
-
- memset(szQuery, '\0', szQUERY_SIZE);
- strcpy(szQuery, "select");
- strcat(szQuery, " a.dormant_id, a.network_info_id, a.lcd_on_timeout, a.lcd_off_timeout"); //0,1,2,3
- strcat(szQuery, " from fast_dormancy a, network_info b");
- strcat(szQuery, " where b.mccmnc= ? and a.network_info_id = b.network_info_id ");
-
- tcore_storage_read_query_database(strg_db, db_handle, szQuery, in_param, out_param, 4);
-
- dbg("Get dormancy value");
- g_hash_table_iter_init(&iter, out_param);
- while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- GHashTableIter iter2;
- gpointer key2, value2;
-
- if (value) {
- g_hash_table_iter_init(&iter2, (GHashTable *)value);
- while (g_hash_table_iter_next(&iter2, &key2, &value2) == TRUE) {
- if (g_str_equal(key2, "2") == TRUE) {
- dormancy_info->lcd_on_timeout = atoi((const char*)value2);
- dbg("lcd on timeout(%d)", dormancy_info->lcd_on_timeout);
- }
- else if (g_str_equal(key2, "3") == TRUE) {
- dormancy_info->lcd_off_timeout = atoi((const char*)value2);
- dbg("lcd off timeout(%d)", dormancy_info->lcd_off_timeout);
- }
- }
- break;
- }
- }
-
- /* Free resources */
- g_hash_table_destroy(in_param);
- g_hash_table_destroy(out_param);
-
- if(dormancy_info->lcd_on_timeout > 0 || dormancy_info->lcd_off_timeout > 0) {
- dormancy_info->is_dormant_set = TRUE;
- }
-
- /* De-initialize Storage */
- tcore_storage_remove_handle(strg_db, db_handle);
- }
-}
-
-static gboolean __s_indi_check_fast_dormancy(TcorePlugin *indi_plugin, CoreObject *co_ps, s_indi_dormancy_info_type *dormancy_info, gboolean b_pm_lock)
-{
- int rv =0;
-
- S_INDI_NOT_USED(indi_plugin);
- S_INDI_NOT_USED(co_ps);
-
- if(!dormancy_info->is_dormant_set){
- dormancy_info->dormant_cnt = 0;
- dormancy_info->is_dormant = FALSE;
-
- //cancle pm lock
- b_pm_lock = __s_indi_cancel_pm_lock(b_pm_lock);
- return b_pm_lock;
- }
-
- if(dormancy_info->is_dormant){
- dormancy_info->dormant_cnt = 0;
- return b_pm_lock;
- }
-
- if(dormancy_info->lcd_state < 3 && dormancy_info->lcd_on_timeout > 0){ //on 1 && dim 2
-
- //satisfy with fd condition, set fd and cancle the pm lock
- if(dormancy_info->dormant_cnt >= dormancy_info->lcd_on_timeout){
- dbg("set lcd on fast dormancy");
- dormancy_info->dormant_cnt = 0;
- dormancy_info->is_dormant = TRUE;
- }