[Internal: smack patch , dbus auto-activation patch ]
[framework/system/oma-dm-agent.git] / src / agent / common / dm_common.c
index 029c0bd..7c9e754 100755 (executable)
@@ -117,30 +117,31 @@ DM_ERROR init_dm()
                _DEBUG_INFO("success register wap push : %d ", ret);
        }
 
+/*
        ret = register_fumo_ip_push();
        if (ret == -1) {
                _DEBUG_INFO("fail register fumo ip push : %d ", ret);
        } else {
                _DEBUG_INFO("success register fumo ip push : %d ", ret);
 
-               /*todo temp code
-                * will integrate notification UI */
-               /*ret = register_fota_account();
-
-                  if (ret == -1) {
-                  _DEBUG_INFO("fail register fota account : %d ", ret);
-                  } else {
-                  _DEBUG_INFO("success register fota account : %d ", ret);
-                  } */
+               //todo temp code
+               //  will integrate notification UI
+               //ret = register_fota_account();
+               //if (ret == -1) {
+               //      _DEBUG_INFO("fail register fota account : %d ", ret);
+               //} else {
+               //      _DEBUG_INFO("success register fota account : %d ", ret);
+               //}
        }
-
+*/
+/*
        ret = register_lawmo_samsung_account();
        if (ret == -1) {
                _DEBUG_INFO("fail register fmm server : %d ", ret);
        } else {
                _DEBUG_INFO("success register fmm server : %d ", ret);
        }
-
+*/
        ret = register_telephony();
        if (ret == -1) {
                _DEBUG_INFO("fail register telephony : %d ", ret);
@@ -176,12 +177,14 @@ DM_ERROR reset_dm()
        _DEBUG_INFO("--------------------------------------------------------------------------------------------");
        /* ddf mo db reset */
        ret = clean_dm_mo();
+       _DEBUG_INFO("clean_dm_mo [%d]", ret);
        if (ret != DM_OK)
                goto error;
 
        /* engine status db reset */
        //ret = DB_Delete_Table();
        ret = DB_Reset_Table();
+       _DEBUG_INFO("DB_Reset_Table [%d]", ret);
        if (ret != DM_OK)
                goto error;
 
@@ -209,7 +212,6 @@ DM_ERROR auto_operate_service_engine()
        engine_status *status = NULL;
 
        if (IsExist_Engine_id(FUMO_SERVICE_ENGINE) != 0) {
-               printf("engine id VALUE : %d ", FUMO_SERVICE_ENGINE);
                _DEBUG_INFO("engine id VALUE : %d ", FUMO_SERVICE_ENGINE);
 
                ret = Get_Engine_Status(FUMO_SERVICE_ENGINE, &status);
@@ -230,7 +232,6 @@ DM_ERROR auto_operate_service_engine()
        }
 
        if (IsExist_Engine_id(LAWMO_SERVICE_ENGINE) != 0) {
-               printf("engine id VALUE : %d ", LAWMO_SERVICE_ENGINE);
                _DEBUG_INFO("engine id VALUE : %d ", LAWMO_SERVICE_ENGINE);
 
                ret = Get_Engine_Status(LAWMO_SERVICE_ENGINE, &status);
@@ -511,12 +512,22 @@ void delete_account_registration_alarm(char *alarm_str, CONFIG_TYPE alarm_type)
        _EXTERN_FUNC_EXIT;
 }
 
+
+void delete_polling_alarm_item(char *alarm_type, CONFIG_TYPE conf_type)
+{
+       _EXTERN_FUNC_ENTER;
+
+       delete_alarm_item(alarm_type, conf_type);
+       _EXTERN_FUNC_EXIT;
+
+}
+
 DM_ERROR add_alarm_item(Reminder_Interval interval, char *alarm_type, CONFIG_TYPE conf_type)
 {
        _EXTERN_FUNC_ENTER;
 
        DM_ERROR ret = DM_OK;
-       /*int week[] = {DAY_SUN, DAY_MON, DAY_TUE, DAY_WED, DAY_THU, DAY_FRI, DAY_SAT}; */
+       //int week[] = {DAY_SUN, DAY_MON, DAY_TUE, DAY_WED, DAY_THU, DAY_FRI, DAY_SAT};
 
        time_t current_time;
        struct tm *struct_time;
@@ -549,6 +560,13 @@ DM_ERROR add_alarm_item(Reminder_Interval interval, char *alarm_type, CONFIG_TYP
                   }
                   break;
                 */
+       case INTERVAL_30MINUTES:
+               {
+                       /* 30 minutes */
+                       alarm_info->repeat_type = REPEAT;
+                       alarm_info->repeat_value = ((1 * 30) * 60);
+               }
+               break;
        case INTERVAL_1HOUR:
                {
                        /* 1 hour */
@@ -813,6 +831,9 @@ DM_ERROR get_fumo_ui_mode(char **ui_mode)
        engine_status *status = NULL;
        ret = Get_Engine_Status(FUMO_SERVICE_ENGINE, &status);
        if (ret != DM_OK) {
+               if(status != NULL)
+                       Free_Memory_Engine_Status(&status, 1);
+
                _EXTERN_FUNC_EXIT;
                return ret;
        }
@@ -1193,6 +1214,31 @@ void get_roaming_state(int *roaming_state)
        _EXTERN_FUNC_EXIT;
 }
 
+void get_wifi_connected_state(int *wifi_state)
+{
+       _EXTERN_FUNC_ENTER;
+
+       int wifi_connection = VCONFKEY_WIFI_OFF;
+       int nRes_wifistatus = vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_connection);
+       *wifi_state = -1;
+
+       if (nRes_wifistatus != 0) {
+               _DEBUG_INFO("vconf_get_int get wificonnection fail\n");
+               *wifi_state = -1;
+               _EXTERN_FUNC_EXIT;
+               return;
+       }
+
+       if(wifi_connection >= VCONFKEY_WIFI_CONNECTED) {
+               _DEBUG_INFO("vconf_get_int get wificonnection success\n");
+               *wifi_state = 0;
+               _EXTERN_FUNC_EXIT;
+               return;
+       }
+
+       _EXTERN_FUNC_EXIT;
+}
+
 void get_call_sate(int *call_state)
 {
        _EXTERN_FUNC_ENTER;
@@ -1200,7 +1246,7 @@ void get_call_sate(int *call_state)
         * 1 : dont service
         * 2 : ?
         */
-       if (vconf_get_int(VCONFKEY_TELEPHONY_CALL_STATE, call_state) != 0) {
+       if (vconf_get_int(VCONFKEY_CALL_STATE, call_state) != 0) {
                *call_state = -1;
                _DEBUG_INFO("end, call state : %d", *call_state);
                _EXTERN_FUNC_EXIT;
@@ -1250,12 +1296,14 @@ DM_ERROR compare_memory_space(char *memory_type, long double file_size)
                return DM_MEMORY_ERROR;
        }
 
-       _DEBUG_INFO("memory free size : %f, total size : %f ", sizeFree, sizeTotal);
+       _DEBUG_INFO("need free size [%f], memory free size [%f], total size [%f] ", file_size, sizeFree, sizeTotal);
        if (file_size > sizeFree) {
                _EXTERN_FUNC_EXIT;
                return DM_OVER_MEMORY_ERROR;
        }
 
+       //_DEBUG_INFO("below return value is test code"); // for memory not enough - testing
+       //return DM_OVER_MEMORY_ERROR; // for memory not enough - testing
        _EXTERN_FUNC_EXIT;
 
        return DM_OK;
@@ -1439,6 +1487,10 @@ int get_default_noti_type(char *ui_mode, NotI_Type noti_type)
                        _EXTERN_FUNC_EXIT;
                        return NOTI_DOWNLOAD;   //connect to server
                        break;
+               case NOTI_TYPE_POLLINTERACTION:
+                       _EXTERN_FUNC_EXIT;
+                       return NOTI_POLL_INTERACTION;   //connect to server
+                       break;
                default:
                        return NOTI_UNKNOWN;    //none type
                        break;