+void _update_tethering_item(mh_appdata_t * ad, mh_state_e state)
+{
+ ERR("type : %d state : %d\n", ad->type, state);
+ switch (ad->type) {
+ case TETHERING_TYPE_WIFI:
+ _update_wifi_item(ad, state);
+ break;
+ case TETHERING_TYPE_BT:
+ _update_bt_item(ad, state);
+ break;
+ case TETHERING_TYPE_USB:
+ _update_usb_item(ad, state);
+ break;
+ default:
+ break;
+ }
+}
+
+gboolean _ps_recheck_timeout_cb(gpointer data)
+{
+ connection_cellular_state_e cellular_state = _get_cellular_state();
+ mh_appdata_t *ad = (mh_appdata_t *)data;
+ static int recheck_count = 0;
+
+ DBG("Re-Check cellular state (%d)\n", recheck_count);
+
+ if (cellular_state == CONNECTION_CELLULAR_STATE_FLIGHT_MODE) {
+ _update_tethering_item(ad, MH_STATE_NONE);
+ recheck_count = 0;
+ return FALSE;
+ }
+
+ if (cellular_state == CONNECTION_CELLULAR_STATE_CONNECTED ||
+ cellular_state == CONNECTION_CELLULAR_STATE_AVAILABLE) {
+ if (ad->type == TETHERING_TYPE_WIFI) {
+ if (_create_wifi_hotspot_on_popup(ad) < 0) {
+ ERR("__create_wifi_hotspot_on_popup fail\n");
+ _update_tethering_item(ad, MH_STATE_NONE);
+ recheck_count = 0;
+ return FALSE;
+ }
+ _send_signal_qp(QP_SIGNAL_PROGRESS_ON);
+ } else if (ad->type == TETHERING_TYPE_BT && _create_bt_tethering_on_popup(ad) < 0) {
+ ERR("_create_bt_tethering_on_popup fail\n");
+ _update_tethering_item(ad, MH_STATE_NONE);
+ recheck_count = 0;
+ return FALSE;
+ } else if (ad->type == TETHERING_TYPE_USB && _create_usb_tethering_on_popup(ad) < 0) {
+ ERR("__create_usb_hotspot_on_popup fail\n");
+ _update_tethering_item(ad, MH_STATE_NONE);
+ recheck_count = 0;
+ return FALSE;
+ } else {
+ ERR("Unknown tethering type \n");
+ recheck_count = 0;
+ return FALSE;
+ }
+ } else {
+ if (++recheck_count >= PS_RECHECK_COUNT_MAX) {
+ DBG("Cellular network is not connected : %d\n", cellular_state);
+ _update_tethering_item(ad, MH_STATE_NONE);
+ _prepare_popup(MH_POPUP_NETWORK_OUT_OF_RANGE, STR_NO_DATA_SERVICE);
+ _create_popup(ad);
+ recheck_count = 0;
+ return FALSE;
+ }
+ return TRUE;
+ }
+ recheck_count = 0;
+ return FALSE;
+}
+