bool onconfirm_main_menu(MenuItem<int> choice) { switch (activeLineIndexMain) { case 0: process_player_menu(onconfirm_playerteleport_menu, 1); break; case 1: process_anim_menu(); break; case 2: process_settings_menu(); break; case 3: show_notification("Options in this menu are not guaranteed to work and may cause crashes"); process_misc_menu(); break; case 4: show_notification("Enhanced FiveM Trainer v" TRAINER_VERSION); show_notification("by ~r~<C>5-H</C> ~s~(fb.me/TheDroidGeek)"); show_notification("Credits goes to~n~~y~Enhanced Native Trainer~n~~s~for the trainer menu code."); break; } return false; }
static gboolean pin_request(DBusGMethodInvocation *context, DBusGProxy *device, gpointer user_data) { DBusGProxy *adapter = user_data; char *name, *long_name, *line; name = device_get_name (device, &long_name); if (name == NULL) return FALSE; pin_dialog(adapter, device, name, long_name, TRUE, context); g_free (long_name); if (notification_supports_actions () == FALSE) { g_free (name); present_notification_dialogs (); return TRUE; } /* translators: this is a popup telling you a particular device * has asked for pairing */ line = g_strdup_printf(_("Pairing request for '%s'"), name); g_free(name); show_notification(_("Bluetooth device"), line, _("Enter PIN"), 0, G_CALLBACK(notification_closed)); g_free(line); return TRUE; }
static gboolean authorize_request (DBusGMethodInvocation *context, DBusGProxy *device, const char *uuid, gpointer user_data) { DBusGProxy *adapter = user_data; char *name, *long_name, *line; name = device_get_name (device, &long_name); if (name == NULL) return FALSE; auth_dialog (adapter, device, name, long_name, uuid, context); g_free (long_name); if (notification_supports_actions () == FALSE) { g_free (name); present_notification_dialogs (); return TRUE; } line = g_strdup_printf (_("Authorization request from '%s'"), name); g_free (name); show_notification (_("Bluetooth device"), line, _("Check authorization"), 0, G_CALLBACK (notification_closed)); g_free (line); return TRUE; }
void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { paused = !paused; if (paused) { show_notification(TXT_PAUSE); } else { hide_notification(); } }
static int on_songstarted (ddb_event_track_t *ev) { if (ev->track && deadbeef->conf_get_int ("notify.enable", 0)) { DB_playItem_t *track = ev->track; if (track) { show_notification (track); } } return 0; }
static int tray_cmd_cb (char *word[], char *word_eol[], gpointer userdata) { if (word[2] && !g_ascii_strcasecmp (word[2], "-b") && word[3] && word[4]) { if (should_alert ()) show_notification (word[3], word_eol[4]); return HEXCHAT_EAT_ALL; } return HEXCHAT_EAT_NONE; }
static void show_notificationf (const char *text, const char *format, ...) { va_list args; char *buf; va_start (args, format); buf = g_strdup_vprintf (format, args); va_end (args); show_notification (buf, text); g_free (buf); }
void on_unplug1_activate(GtkMenuItem * menuitem, gpointer user_data) { if (g_ismenuclicked == FALSE) { THISFUNCBECALLED; debug("--------------menu não pode ser clicado\n"); return; } g_ismenuclicked = FALSE; if (g_isclickinginprogress == TRUE) { debug("g_isclickinginprogress == TRUE"); return; } g_isclickinginprogress = TRUE; debug("+ chamada da funcao: on_unplug_active()\n"); gray_wb_menu(); adjust_menu_item(MODE_NULL); adjust_func_state(); if (g_state == BLUETOOTH_DISABLE_WLAN_DISABLE) { debug("\nMenu Desconectar ja foi selecionado! menuitem = 0x%lx\n", (long) menuitem); adjust_menu_item(MODE_UNPLUG); enable_wb_menu(); g_isclickinginprogress = FALSE; return; } if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE || g_state == BLUETOOTH_DISABLE_WLAN_ENABLE || g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { if (FALSE == unplugdevices()) { debug("falha de dispositivo desplugado ! \n"); enable_wb_menu(); g_isclickinginprogress = FALSE; return; } wait_device_unplug_stable(); } adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); adjust_menu_item(MODE_UNPLUG); g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; enable_wb_menu(); refresh_gui_and_timeout(); g_isclickinginprogress = FALSE; show_notification(_("uWB Aviso"), _("Dispositivos desconectados"), NULL, SWITCH_NOTIFY_TIME, NULL); // show_notification(_("wbusb Notice"), _("switch to unplug state"), _("OK"), 0, NULL); return; }
void process_player_menu(bool(*onConfirmation)(MenuItem<int> value), bool warningMsg) { if (NETWORK::NETWORK_IS_SESSION_STARTED()) { std::vector<StandardOrToggleMenuDef> lines_v; playerIdForMenuEntries.clear(); for (int i = 0; i < MAX_PLAYERS; i++) { if (playerdb[i].name != "") { std::string linetxt = "[ID: " + std::to_string(i) + "] " + playerdb[i].name; playerIdForMenuEntries.push_back(i); lines_v.push_back({ linetxt, NULL, NULL, true }); } } const int lineCount = (int)lines_v.size(); if (lineCount == 0) { show_notification("Do you feel forever alone ?"); return; } std::string caption = std::to_string(lineCount) + " CONNECTED PLAYER" + (lineCount == 1 ? "" : "S"); if (warningMsg) show_notification("Please don't abuse this feature and annoy other players."); draw_menu_from_struct_def(&lines_v[0], lineCount, &activeLineIndexPlayer, caption, onConfirmation); } else { show_notification("Not in a network session."); } }
bool onconfirm_playerteleport_menu(MenuItem<int> choice) { Player targetId = playerIdForMenuEntries[activeLineIndexPlayer]; playerinfo target = playerdb[targetId]; if (!NETWORK::NETWORK_IS_PLAYER_CONNECTED(targetId)) show_notification("Player has disconnected."); else if (ENTITY::DOES_ENTITY_EXIST(target.ped)) { Entity us = PLAYER::PLAYER_PED_ID(); if (PED::IS_PED_IN_ANY_VEHICLE(us, 0)) { Vehicle v = PED::GET_VEHICLE_PED_IS_USING(us); if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(v, -1) == us) us = v; } Vector3 targetpos = ENTITY::GET_ENTITY_COORDS(target.ped, 0); targetpos.x += 3.0; targetpos.z += 3.0; ENTITY::SET_ENTITY_COORDS_NO_OFFSET(us, targetpos.x, targetpos.y, targetpos.z, 0, 0, 1); if (target.name == "androidgeek") show_notification("Teleported to the creator of this trainer."); else { std::string msg = "Teleported to <C>" + target.name + "</C>"; show_notification((char*)msg.c_str()); } } process_player_menu(onconfirm_playerteleport_menu, 0); return true; // Returned true as onConfirmation() to close the old menu since we processed a new updated one }
static void cover_avail_callback (const char *fname, const char *artist, const char *album, void *user_data) { if (!fname) { // Give up return; } deadbeef->pl_lock (); if (last_track && (time (NULL) - request_timer < 4)) { show_notification (last_track); } if (last_track) { deadbeef->pl_item_unref (last_track); last_track = NULL; } deadbeef->pl_unlock (); }
void mnp_alarm_instance_raise (MnpAlarmInstance *alarm) { MnpAlarmInstancePrivate *priv = ALARM_INSTANCE_PRIVATE(alarm); MnpAlarmItem *item = priv->item; show_notification(alarm); if (item->sound == MNP_SOUND_BEEP) gdk_beep(); else if(item->sound == MNP_SOUND_MUSIC) { play_music(); } if (!priv->repeat) { /* raised alarm should be deleted */ alarm_del(priv->item); } else { g_signal_emit (alarm, signals[ALARM_CHANGED], 0); } }
static gboolean display_request (DBusGMethodInvocation *context, DBusGProxy *device, guint pin, guint entered, gpointer user_data) { g_warning ("Not implemented, please file a bug at how this happened"); return FALSE; #if 0 DBusGProxy *adapter = user_data; char *name, *text; name = get_name_for_display (device); if (name == NULL) return FALSE; text = g_strdup_printf("%d", pin); display_dialog(adapter, device, address, name, text, entered, context); g_free(text); if (notification_supports_actions () == FALSE) { g_free (name); present_notification_dialogs (); return TRUE; } /* translators: this is a popup telling you a particular device * has asked for pairing */ line = g_strdup_printf(_("Pairing request for '%s'"), name); g_free(name); show_notification(_("Bluetooth device"), line, _("Enter PIN"), 0, G_CALLBACK(notification_closed)); g_free(line); return TRUE; #endif }
static gboolean confirm_request (DBusGMethodInvocation *context, DBusGProxy *device, guint pin, gpointer user_data) { DBusGProxy *adapter = user_data; char *name, *long_name, *line, *text; name = device_get_name (device, &long_name); if (name == NULL) return FALSE; text = g_strdup_printf("%d", pin); confirm_dialog(adapter, device, name, long_name, text, context); g_free(text); g_free (long_name); /* translators: this is a popup telling you a particular device * has asked for pairing */ line = g_strdup_printf(_("Pairing confirmation for '%s'"), name); g_free(name); /* translators: * This message is for Bluetooth 2.1 support, when the * action is clicked in the notification popup, the user * will get to check whether the PIN matches the one * showing on the Bluetooth device */ if (notification_supports_actions () != FALSE) show_notification(_("Bluetooth device"), line, _("Verify PIN"), 0, G_CALLBACK(notification_closed)); else present_notification_dialogs (); g_free(line); return TRUE; }
bool onconfirm_vehicle_menu(MenuItem<int> choice) { Ped playerPed = PLAYER::PLAYER_PED_ID(); switch (activeLineIndexVeh) { case 0: if (ownedveh != NULL && ENTITY::DOES_ENTITY_EXIST(ownedveh)) { show_notification("You already have an owned vehicle, please clear it first."); } else if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 1)) { ownedveh = PED::GET_VEHICLE_PED_IS_USING(playerPed); if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(ownedveh, -1) == playerPed) { ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ownedveh, 1, 1); AUDIO::SET_VEHICLE_RADIO_LOUD(ownedveh, 1); ownedvehlocked = false; show_notification("Your current vehicle has been set as owned."); } else { ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&ownedveh); show_notification("You can't own a vehicle you're not driving."); } } else show_notification("Not in a vehicle."); break; case 1: if (ownedveh != NULL && ENTITY::DOES_ENTITY_EXIST(ownedveh)) { VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(ownedveh, 0); VEHICLE::SET_VEHICLE_ALARM(ownedveh, 0); ownedveh = NULL; show_notification("Cleared previously owned vehicle."); } else show_notification("Owned vehicle not found."); break; case 2: if (ownedveh != NULL && ENTITY::DOES_ENTITY_EXIST(ownedveh)) { if (!ownedvehlocked) { VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(ownedveh, 1); VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_PLAYER(ownedveh, playerId, 0); VEHICLE::SET_VEHICLE_ALARM(ownedveh, 1); ownedvehlocked = true; if (VEHICLE::IS_VEHICLE_SEAT_FREE(ownedveh, -1)) { if (VEHICLE::IS_VEHICLE_A_CONVERTIBLE(ownedveh, 0)) { int rstate = VEHICLE::GET_CONVERTIBLE_ROOF_STATE(ownedveh); if (rstate != 0 && rstate != 3) VEHICLE::RAISE_CONVERTIBLE_ROOF(ownedveh, 0); } show_notification("Owned vehicle locked for other players."); VEHICLE::START_VEHICLE_ALARM(ownedveh); WAIT(2000); VEHICLE::SET_VEHICLE_ALARM(ownedveh, 0); VEHICLE::SET_VEHICLE_ALARM(ownedveh, 1); } else show_notification("Owned vehicle will be locked as soon as the driver gets out."); } else show_notification("Owned vehicle already locked."); } else show_notification("Owned vehicle not found."); break; case 3: if (ownedveh != NULL && ENTITY::DOES_ENTITY_EXIST(ownedveh)) { if (ownedvehlocked) { VEHICLE::SET_VEHICLE_DOORS_LOCKED_FOR_ALL_PLAYERS(ownedveh, 0); show_notification("Owned vehicle unlocked."); if (VEHICLE::IS_VEHICLE_SEAT_FREE(ownedveh, -1)) { VEHICLE::SET_VEHICLE_ALARM(ownedveh, 1); VEHICLE::START_VEHICLE_ALARM(ownedveh); WAIT(1000); } VEHICLE::SET_VEHICLE_ALARM(ownedveh, 0); ownedvehlocked = false; } else show_notification("Owned vehicle already unlocked."); } else show_notification("Owned vehicle not found."); break; case 4: if (ownedveh != NULL && ENTITY::DOES_ENTITY_EXIST(ownedveh)) { Ped driver = VEHICLE::GET_PED_IN_VEHICLE_SEAT(ownedveh, -1); if (ENTITY::DOES_ENTITY_EXIST(driver)) { if (driver == playerPed) show_notification("Really now?"); else { int lastSeat = VEHICLE::GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(ownedveh) - 1; bool emptySeatFound = false; for (int i = 0; i <= lastSeat; i++) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(ownedveh, i)) { emptySeatFound = true; AI::CLEAR_PED_TASKS_IMMEDIATELY(playerPed); AI::TASK_WARP_PED_INTO_VEHICLE(playerPed, ownedveh, i); show_notification("Vehicle driver seat full, warping to passenger seat."); break; } } if (!emptySeatFound) { Entity us = playerPed; Vector3 vpos = ENTITY::GET_ENTITY_COORDS(ownedveh, 0); vpos.z += 3.0; if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) { Vehicle v = PED::GET_VEHICLE_PED_IS_USING(playerPed); if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(v, -1) == playerPed) us = v; } ENTITY::SET_ENTITY_COORDS_NO_OFFSET(us, vpos.x, vpos.y, vpos.z, 0, 0, 1); show_notification("Could not retrieve vehicle."); } } } else { Vector3 mypos = ENTITY::GET_ENTITY_COORDS(playerPed, 0); AI::CLEAR_PED_TASKS_IMMEDIATELY(playerPed); AI::TASK_WARP_PED_INTO_VEHICLE(playerPed, ownedveh, -1); ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ownedveh, mypos.x, mypos.y, mypos.z, 0, 0, 1); VEHICLE::SET_VEHICLE_FIXED(ownedveh); show_notification("Your vehicle was retrieved and fixed, you're welcome."); } } else show_notification("Owned vehicle not found."); break; } return false; }
void update_score(int me, int opponent) { int vibrate = VIBE_NONE; score_me += me; score_opponent += opponent; count++; if (score_me == 10 && score_opponent == 10) { overtime = true; } if (((count % 2) == 0 && overtime == false) || overtime) { vibrate = VIBE_SINGLE; /*static char txt[11]; mini_snprintf(txt, 10, TXT_SCORE_OPPONENT, score_opponent);*/ show_notification(TXT_ALTERNATE_SERVE); } if ((!overtime && score_me == 11) || (overtime && (score_me >= (score_opponent + 2)))) { match_me++; score_me = 0; score_opponent = 0; count = 0; overtime = false; layer_mark_dirty(&match_layer); vibrate = VIBE_DOUBLE; show_notification(TXT_SWITCH_SIDE); } if ((!overtime && score_opponent == 11) || (overtime && (score_opponent >= (score_me + 2)))) { match_opponent++; score_me = 0; score_opponent = 0; count = 0; overtime = false; layer_mark_dirty(&match_layer); vibrate = VIBE_DOUBLE; show_notification(TXT_SWITCH_SIDE); } if (match_me == 3) { paused = true; vibrate = VIBE_LONG; show_notification(TXT_MATCH_WON); } else if (match_opponent == 3) { paused = true; vibrate = VIBE_LONG; show_notification(TXT_MATCH_LOST); } switch (vibrate) { case VIBE_SINGLE: vibes_short_pulse(); break; case VIBE_DOUBLE: vibes_double_pulse(); break; case VIBE_LONG: vibes_long_pulse(); break; } layer_mark_dirty(&score_layer_me); layer_mark_dirty(&score_layer_opponent); }
void updateStuff() { if (NETWORK::NETWORK_IS_SESSION_STARTED()) { if (playerWasDisconnected) { NETWORK::NETWORK_SET_FRIENDLY_FIRE_OPTION(1); playerId = PLAYER::PLAYER_ID(); PED::SET_CAN_ATTACK_FRIENDLY(playerId, 1, 1); } std::string voice_status_msg = "Currently Talking:"; bool isVoiceChatRunning = false; for (int i = 0; i < MAX_PLAYERS; i++) { if (trainer_switch_pressed()) { // To increase chances of trainer switch key capture, set_menu_showing(true); // since this is a consuming function. return; } if (featureShowVoiceChatSpeaker && isVoiceChatRunning) update_status_text(); if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i)) { std::string name = (char*)PLAYER::GET_PLAYER_NAME(i); if (featureShowVoiceChatSpeaker && NETWORK::NETWORK_IS_PLAYER_TALKING(i)) { if (!isVoiceChatRunning) isVoiceChatRunning = true; voice_status_msg += "~n~" + name; } if (i != playerId) { Ped pedId = PLAYER::GET_PLAYER_PED(i); unsigned int headDisplayId = UI::_0xBFEFE3321A3F5015(pedId, (Any*)"", 0, 0, (Any*)"", 0); // CREATE_PED_HEAD_DISPLAY if (UI::_0x4E929E7A5796FD26(headDisplayId)) { playerdb[i].head = headDisplayId; if (featurePlayerHeadDisplay) UI::_0xDEA2B8283BAA3944(headDisplayId, (Any*)name.c_str()); // SET_HEAD_DISPLAY_STRING UI::_0x63BB75ABEDC1F6A0(headDisplayId, 0, 1); // SET_HEAD_DISPLAY_FLAG } if (playerWasDisconnected || !UI::DOES_BLIP_EXIST(playerdb[i].blip)) { if (featurePlayerBlips) { playerdb[i].blip = UI::ADD_BLIP_FOR_ENTITY(pedId); UI::SET_BLIP_COLOUR(playerdb[i].blip, 0); UI::SET_BLIP_SCALE(playerdb[i].blip, 0.8); if (featurePlayerBlipCone) UI::SET_BLIP_SHOW_CONE(playerdb[i].blip, 1); UI::SET_BLIP_NAME_TO_PLAYER_NAME(playerdb[i].blip, i); UI::SET_BLIP_CATEGORY(playerdb[i].blip, 7); } if (playerWasDisconnected || playerdb[i].name != name) // Making sure the player wasn't already here and only changed his ped (ex. skin change) { if (featurePlayerNotifications) { std::string msg = "<C>" + name + "</C> joined."; show_notification((char*)msg.c_str()); } PED::SET_CAN_ATTACK_FRIENDLY(i, 1, 1); playerdb[i].name = name; } playerdb[i].ped = pedId; } if (featurePlayerBlips) { Vehicle v = PED::GET_VEHICLE_PED_IS_IN(playerdb[i].ped, false); switch (VEHICLE::GET_VEHICLE_CLASS(v)) { case 14: UI::SET_BLIP_SPRITE(playerdb[i].blip, 410); break; //Boat case 15: UI::SET_BLIP_SPRITE(playerdb[i].blip, 422); break; //Helicopter case 16: UI::SET_BLIP_SPRITE(playerdb[i].blip, 423); break; //Airplane case 19: UI::SET_BLIP_SPRITE(playerdb[i].blip, 421); break; //Military } } } } else if (playerdb[i].name != "") { if (featurePlayerNotifications) { std::string msg = "<C>" + playerdb[i].name + "</C> left."; show_notification((char*)msg.c_str()); } if (UI::_0x4E929E7A5796FD26(playerdb[i].head)) UI::_0xDEA2B8283BAA3944(playerdb[i].head, (Any*)""); if (UI::DOES_BLIP_EXIST(playerdb[i].blip)) UI::REMOVE_BLIP(&playerdb[i].blip); playerdb[i].name = ""; } } playerWasDisconnected = false; if(isVoiceChatRunning) set_status_text(voice_status_msg); } else { playerWasDisconnected = true; if (trainer_switch_pressed()) set_menu_showing(true); } }
void on_exit1_activate(GtkMenuItem * menuitem, gpointer user_data) { show_notification(_("uWB Aviso"), _("Saindo do uWB"), NULL, 0, NULL); sleep(2); gtk_main_quit(); }
void on_coexist1_activate(GtkMenuItem * menuitem, gpointer user_data) { if (g_ismenuclicked == FALSE) { THISFUNCBECALLED; debug("--------------menu nao pode ser clicado\n"); return; } g_ismenuclicked = FALSE; if (g_isclickinginprogress == TRUE) { debug("g_isclickinginprogress == TRUE"); return; } g_isclickinginprogress = TRUE; THISFUNCBECALLED; gray_wb_menu(); adjust_menu_item(MODE_NULL); adjust_func_state(); if (!g_iscardin) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; g_isclickinginprogress = FALSE; debug("on_coexist_active, retornar nocardin\n"); enable_wb_menu(); return; } if (g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { adjust_menu_item(MODE_COEXIST); g_isclickinginprogress = FALSE; debug("on_coexist_active, retorno para o modo atual tambem e COMBO\n"); enable_wb_menu(); return; } usleep(200000); if (g_bDirectlyFlag) { if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE) { write_enum_mode(3); tdsp_download_dsp_code(2); usleep(500000); tdsp_set_init_flag(1); usleep(500000); tdsp_add_device(TDSPWLANID, sizeof(TDSPWLANID), TDSP_SERIAL_NO_WLAN); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { adjust_func_state(); adjust_menu_item(MODE_UNPLUG); debug("on_coexist_active, retorno falha de download_dspcode \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } } if (g_state == BLUETOOTH_DISABLE_WLAN_ENABLE) { write_enum_mode(3); tdsp_download_dsp_code(1); usleep(500000); tdsp_set_init_flag(2); usleep(500000); tdsp_add_device(TDSPBTID, sizeof(TDSPBTID), TDSP_SERIAL_NO_BT); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { adjust_func_state(); adjust_menu_item(MODE_UNPLUG); debug("on_coexist_active, retornou falha de download_dspcode \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } } if (g_state == BLUETOOTH_DISABLE_WLAN_DISABLE) { write_enum_mode(3); tdsp_download_dsp_code(2); usleep(200000); tdsp_add_device(TDSPWLANID, sizeof(TDSPWLANID), TDSP_SERIAL_NO_WLAN); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { adjust_func_state(); adjust_menu_item(MODE_UNPLUG); debug("on_coexist_active, retornou falha de download_dspcode \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } while (1) { tdsp_query_pnp_state(2); if (g_dsppnpstate != Started) { tdsp_query_power_state(); if (g_buspowerstate != PowerOn) { debug("on_coexist_active, retornou falha de powerOn \n"); enable_wb_menu(); g_isclickinginprogress = FALSE; return; } usleep(500000); continue; } else break; } tdsp_set_init_flag(2); usleep(500000); tdsp_download_dsp_code(1); usleep(200000); tdsp_add_device(TDSPBTID, sizeof(TDSPBTID), TDSP_SERIAL_NO_BT); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_isclickinginprogress = FALSE; debug("on_coexist_active, retornou falha de powerOn \n"); enable_wb_menu(); return; } } } else { if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE || g_state == BLUETOOTH_DISABLE_WLAN_ENABLE) { if (FALSE == unplugdevices()) { g_isclickinginprogress = FALSE; debug("on_coexist_active, retorno falha de dispositivo desplugado\n"); enable_wb_menu(); return; } wait_device_unplug_stable(); } write_enum_mode(3); tdsp_download_dsp_code(2); usleep(200000); tdsp_add_device(TDSPWLANID, sizeof(TDSPWLANID), TDSP_SERIAL_NO_WLAN); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_func_state(); adjust_menu_item(MODE_UNPLUG); debug("on_coexist_active, retornou falha de download_dspcode\n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } while (1) { tdsp_query_pnp_state(2); if (g_dsppnpstate != Started) { tdsp_query_power_state(); if (g_buspowerstate != PowerOn) { g_isclickinginprogress = FALSE; debug("on_coexist_active, retornou falha de powerOn\n"); enable_wb_menu(); return; } usleep(500000); continue; } else break; } tdsp_set_init_flag(2); usleep(500000); tdsp_download_dsp_code(1); usleep(500000); tdsp_add_device(TDSPBTID, sizeof(TDSPBTID), TDSP_SERIAL_NO_BT); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_isclickinginprogress = FALSE; debug("on_coexist_active, retornou falha de powerOn\n"); enable_wb_menu(); return; } } refresh_gui_and_timeout(); g_state = BLUETOOTH_ENABLE_WLAN_ENABLE; adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_ENABLE); adjust_menu_item(MODE_COEXIST); enable_wb_menu(); refresh_gui_and_timeout(); show_notification(_("uWB Aviso"), _("Ativado modo COMBO"), NULL, SWITCH_NOTIFY_TIME, NULL); g_isclickinginprogress = FALSE; call_shell_for_btEnv(TDSPSHELLFILEFORBT); return; }
void on_wlan1_activate(GtkMenuItem * menuitem, gpointer user_data) { if (g_ismenuclicked == FALSE) { THISFUNCBECALLED; debug("--------------menu nao pode ser clicado\n"); return; } g_ismenuclicked = FALSE; if (g_isclickinginprogress == TRUE) { debug("g_isclickinginprogress == TRUE"); return; } g_isclickinginprogress = TRUE; THISFUNCBECALLED; gray_wb_menu(); adjust_menu_item(MODE_NULL); adjust_func_state(); if (g_iscardin == FALSE) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; g_isclickinginprogress = FALSE; debug(" chamada da funcao on_wlan_active, retornou g_iscardin=FALSE\n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); adjust_menu_item(MODE_UNPLUG); return; } if (g_state == BLUETOOTH_DISABLE_WLAN_ENABLE) { debug("\nmenu WLAN ja selecionado ! menuitem = 0x%lx\n\n", (long) menuitem); adjust_menu_item(MODE_WLAN); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); g_isclickinginprogress = FALSE; return; } usleep(200000); if (g_bDirectlyFlag) { if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE) { if (FALSE == unplugdevices()) { debug("Falha de dispositivo nao conectado! \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); g_isclickinginprogress = FALSE; return; } wait_device_unplug_stable(); } if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE || g_state == BLUETOOTH_DISABLE_WLAN_DISABLE) { write_enum_mode(2); tdsp_download_dsp_code(2); usleep(500000); tdsp_add_device(TDSPWLANID, sizeof(TDSPWLANID), TDSP_SERIAL_NO_WLAN); usleep(500000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_func_state(); adjust_menu_item(MODE_UNPLUG); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); g_isclickinginprogress = FALSE; return; } g_state = BLUETOOTH_DISABLE_WLAN_ENABLE; } if (g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { int iiTimes = 0; do { if (tdsp_query_reset_flag() == -1) debug("Ha um erro na funcao: tdsp_query_reset_flag()\n"); if (g_busresetflag == 1) { usleep(1000000); } iiTimes++; } while (g_busresetflag == 1 && iiTimes < 60); debug("--g_busresetflag = %ld, e a interacao iiTimes = %d\n", g_busresetflag, iiTimes); tdsp_remove_device(TDSP_SERIAL_NO_BT); usleep(500000); int iTimes = 0; do { tdsp_query_power_state(); if (g_buspowerstate != PowerOn) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; g_message("Retornou porque g_buspowerstate != PowerOn\n"); return; } tdsp_query_device(); usleep(500000); if (g_currentserialno == 0x2) break; iTimes++; } while (g_currentserialno != 0x2 && iTimes < 600); write_enum_mode(2); } } else { if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE || g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { if (FALSE == unplugdevices()) { g_isclickinginprogress = FALSE; enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); return; } wait_device_unplug_stable(); } write_enum_mode(2); tdsp_download_dsp_code(2); usleep(500000); tdsp_add_device(TDSPWLANID, sizeof(TDSPWLANID), TDSP_SERIAL_NO_WLAN); usleep(1000000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_func_state(); adjust_menu_item(MODE_UNPLUG); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); g_isclickinginprogress = FALSE; return; } } g_state = BLUETOOTH_DISABLE_WLAN_ENABLE; adjust_menu_item(MODE_WLAN); adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_ENABLE); enable_wb_menu(); refresh_gui_and_timeout(); g_isclickinginprogress = FALSE; show_notification(_("uWB Aviso"), _("Ativado modo WLAN"), NULL, SWITCH_NOTIFY_TIME, NULL); return; }
void on_bluetooth_activate(GtkMenuItem * menuitem, gpointer user_data) { // adjust_icon(0); if (g_ismenuclicked == FALSE) { THISFUNCBECALLED; debug("--------------menu nao pode ser clicado\n"); return; } g_ismenuclicked = FALSE; if (g_isclickinginprogress == TRUE) { debug("g_isclickinginprogress == TRUE"); return; } g_isclickinginprogress = TRUE; THISFUNCBECALLED; gray_wb_menu(); adjust_menu_item(MODE_NULL); adjust_func_state(); if (!g_iscardin) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); debug("chamada on_bluetooth_active, retornou g_iscardin = FALSE\n"); g_isclickinginprogress = FALSE; return; } if (g_state == BLUETOOTH_ENABLE_WLAN_DISABLE) { adjust_menu_item(MODE_BLUETOOTH); debug("chamada onbluetoothactive, retornou que ultimo estado já é on_bluetooth\n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } if (g_bDirectlyFlag) { if (g_state == BLUETOOTH_DISABLE_WLAN_ENABLE) { if (FALSE == unplugdevices()) { debug("Falha de dispositivo nao conectado! \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } wait_device_unplug_stable(); } if (g_state == BLUETOOTH_DISABLE_WLAN_ENABLE || g_state == BLUETOOTH_DISABLE_WLAN_DISABLE) { tdsp_download_dsp_code(1); usleep(500000); tdsp_add_device(TDSPBTID, sizeof(TDSPBTID), TDSP_SERIAL_NO_BT); usleep(500000); if (tdsp_is_download_dspcode_ok() != TRUE) { adjust_func_state(); adjust_menu_item(MODE_UNPLUG); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } g_state = BLUETOOTH_ENABLE_WLAN_DISABLE; } if (g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { int iiTimes = 0; do { if (tdsp_query_reset_flag() == -1) debug("Ha um erro na funcao: tdsp_query_reset_flag()\n"); if (g_busresetflag == 1) { usleep(1000000); } iiTimes++; } while (g_busresetflag == 1 && iiTimes < 60); debug("--g_busresetflag = %ld, e a interação iiTimes = %d\n", g_busresetflag, iiTimes); tdsp_remove_device(TDSP_SERIAL_NO_WLAN); usleep(500000); int iTimes = 0; do { tdsp_query_power_state(); if (g_buspowerstate != PowerOn) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_tooltip_text(BLUETOOTH_DISABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; g_message("Retornou porque g_buspowerstate != PowerOn\n"); return; } tdsp_query_device(); usleep(500000); if (g_currentserialno == 0x1) break; iTimes++; } while (g_currentserialno != 0x1 && iTimes < 600); } } else { if (g_state == BLUETOOTH_DISABLE_WLAN_ENABLE || g_state == BLUETOOTH_ENABLE_WLAN_ENABLE) { if (FALSE == unplugdevices()) { debug("Falha de dispositivo nao conectado! ! \n"); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } wait_device_unplug_stable(); } write_enum_mode(1); tdsp_download_dsp_code(1); usleep(500000); tdsp_add_device(TDSPBTID, sizeof(TDSPBTID), TDSP_SERIAL_NO_BT); usleep(500000); if (tdsp_is_download_dspcode_ok() != TRUE) { g_state = BLUETOOTH_DISABLE_WLAN_DISABLE; adjust_func_state(); adjust_menu_item(MODE_UNPLUG); enable_wb_menu(); adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); g_isclickinginprogress = FALSE; return; } } g_state = BLUETOOTH_ENABLE_WLAN_DISABLE; adjust_tooltip_text(BLUETOOTH_ENABLE_WLAN_DISABLE); adjust_menu_item(MODE_BLUETOOTH); enable_wb_menu(); refresh_gui_and_timeout(); show_notification(_("uWB Aviso"), _("Ativado modo Bluetooth"), NULL, SWITCH_NOTIFY_TIME, NULL); call_shell_for_btEnv(TDSPSHELLFILEFORBT); g_isclickinginprogress = FALSE; return; // enable_blinking(); }