mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 15:38:14 -08:00
Select stations from touch screen
This commit is contained in:
@@ -213,34 +213,6 @@ MenuFunctions::MenuFunctions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
|
||||||
if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) {
|
|
||||||
//Serial.print("Toggle on: ");
|
|
||||||
//Serial.println(btn_text);
|
|
||||||
for (int i = 0; i < access_points->size(); i++) {
|
|
||||||
if (access_points->get(i).essid == btn_text) {
|
|
||||||
Serial.println("Adding AP: " + (String)access_points->get(i).essid);
|
|
||||||
AccessPoint ap = access_points->get(i);
|
|
||||||
ap.selected = true;
|
|
||||||
access_points->set(i, ap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//Serial.print("Toggle off: ");
|
|
||||||
//Serial.println(btn_text);
|
|
||||||
for (int i = 0; i < access_points->size(); i++) {
|
|
||||||
if (access_points->get(i).essid == btn_text) {
|
|
||||||
Serial.println("Removing AP: " + (String)access_points->get(i).essid);
|
|
||||||
AccessPoint ap = access_points->get(i);
|
|
||||||
ap.selected = false;
|
|
||||||
access_points->set(i, ap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuFunctions::displaySettingsGFX(){
|
void MenuFunctions::displaySettingsGFX(){
|
||||||
@@ -273,35 +245,119 @@ MenuFunctions::MenuFunctions()
|
|||||||
list_btn = lv_list_add_btn(list1, LV_SYMBOL_WIFI, buf);
|
list_btn = lv_list_add_btn(list1, LV_SYMBOL_WIFI, buf);
|
||||||
lv_btn_set_checkable(list_btn, false);
|
lv_btn_set_checkable(list_btn, false);
|
||||||
lv_obj_set_event_cb(list_btn, settings_list_cb);
|
lv_obj_set_event_cb(list_btn, settings_list_cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GFX Function to build a list showing all Stations scanned
|
||||||
|
void MenuFunctions::addStationGFX(){
|
||||||
|
extern LinkedList<Station>* stations;
|
||||||
|
extern LinkedList<AccessPoint>* access_points;
|
||||||
|
extern WiFiScan wifi_scan_obj;
|
||||||
|
|
||||||
//lv_list_add_text(list1, buf);
|
lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL);
|
||||||
|
lv_obj_set_size(list1, 160, 200);
|
||||||
|
lv_obj_set_width(list1, LV_HOR_RES);
|
||||||
|
lv_obj_align(list1, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
// Create the dropdown menu
|
lv_obj_t * list_btn;
|
||||||
/*lv_obj_t * dd = lv_dropdown_create(list1, NULL);
|
|
||||||
lv_dropdown_set_options(dd, "Apple\n"
|
|
||||||
"Banana\n"
|
|
||||||
"Orange\n"
|
|
||||||
"Cherry\n"
|
|
||||||
"Grape\n"
|
|
||||||
"Raspberry\n"
|
|
||||||
"Melon\n"
|
|
||||||
"Orange\n"
|
|
||||||
"Lemon\n"
|
|
||||||
"Nuts");
|
|
||||||
|
|
||||||
//lv_obj_align(dd, LV_ALIGN_IN_RIGHT_MID, 0, 20);
|
lv_obj_t * label;
|
||||||
lv_obj_align(dd, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
|
|
||||||
lv_obj_set_width(dd, LV_HOR_RES / 3);
|
list_btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, text09);
|
||||||
lv_obj_set_event_cb(dd, setting_dropdown_cb);
|
lv_obj_set_event_cb(list_btn, station_list_cb);
|
||||||
//lv_obj_add_event_cb(dd, setting_dropdown_cb, LV_EVENT_ALL, NULL);*/
|
|
||||||
|
char addr[] = "00:00:00:00:00:00";
|
||||||
|
for (int x = 0; x < access_points->size(); x++) {
|
||||||
|
AccessPoint cur_ap = access_points->get(x);
|
||||||
|
|
||||||
|
// Add non clickable button for AP
|
||||||
|
String full_label = "AP: " + cur_ap.essid;
|
||||||
|
char buf[full_label.length() + 1] = {};
|
||||||
|
full_label.toCharArray(buf, full_label.length() + 1);
|
||||||
|
list_btn = lv_list_add_btn(list1, NULL, buf);
|
||||||
|
lv_btn_set_checkable(list_btn, false);
|
||||||
|
|
||||||
//if (access_points->get(i).selected)
|
int cur_ap_sta_len = access_points->get(x).stations->size();
|
||||||
// lv_btn_toggle(list_btn);
|
for (int y = 0; y < cur_ap_sta_len; y++) {
|
||||||
|
Station cur_sta = stations->get(cur_ap.stations->get(y));
|
||||||
|
// Convert uint8_t MAC to char array
|
||||||
|
wifi_scan_obj.getMAC(addr, cur_sta.mac, 0);
|
||||||
|
|
||||||
|
//char buf[stations->get(i).mac.length() + 1] = {};
|
||||||
|
//stations->get(i).mac.toCharArray(buf, stations->get(i).mac.length() + 1);
|
||||||
|
|
||||||
|
list_btn = lv_list_add_btn(list1, LV_SYMBOL_WIFI, addr);
|
||||||
|
lv_btn_set_checkable(list_btn, true);
|
||||||
|
lv_obj_set_event_cb(list_btn, station_list_cb);
|
||||||
|
|
||||||
|
if (cur_sta.selected)
|
||||||
|
lv_btn_toggle(list_btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to work with list of Stations
|
||||||
|
void station_list_cb(lv_obj_t * btn, lv_event_t event) {
|
||||||
|
extern LinkedList<Station>* stations;
|
||||||
|
extern MenuFunctions menu_function_obj;
|
||||||
|
extern WiFiScan wifi_scan_obj;
|
||||||
|
|
||||||
//lv_obj_t * btn1 = lv_btn_create(list_btn, NULL);
|
String btn_text = lv_list_get_btn_text(btn);
|
||||||
//lv_obj_set_event_cb(btn1, ap_list_cb);
|
String display_string = "";
|
||||||
//lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0);
|
char addr[] = "00:00:00:00:00:00";
|
||||||
//lv_btn_set_checkable(btn1, true);
|
|
||||||
|
if (event == LV_EVENT_CLICKED) {
|
||||||
|
if (btn_text != text09) {
|
||||||
|
//lv_list_focus_btn(lv_obj_get_parent(lv_obj_get_parent(btn)), btn);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Serial.println("Exiting...");
|
||||||
|
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
|
||||||
|
|
||||||
|
for (int i = 0; i < stations->size(); i++) {
|
||||||
|
if (stations->get(i).selected) {
|
||||||
|
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
|
||||||
|
Serial.print("Selected: ");
|
||||||
|
Serial.println(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("LV_EVENT_CANCEL\n");
|
||||||
|
menu_function_obj.deinitLVGL();
|
||||||
|
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||||
|
display_obj.exit_draw = true; // set everything back to normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||||
|
if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) {
|
||||||
|
//Serial.print("Toggle on: ");
|
||||||
|
//Serial.println(btn_text);
|
||||||
|
for (int i = 0; i < stations->size(); i++) {
|
||||||
|
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
|
||||||
|
if (strcmp(addr, btn_text.c_str()) == 0) {
|
||||||
|
Serial.print("Adding Station: ");
|
||||||
|
Serial.println(addr);
|
||||||
|
Station sta = stations->get(i);
|
||||||
|
sta.selected = true;
|
||||||
|
stations->set(i, sta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Serial.print("Toggle off: ");
|
||||||
|
//Serial.println(btn_text);
|
||||||
|
for (int i = 0; i < stations->size(); i++) {
|
||||||
|
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
|
||||||
|
if (strcmp(addr, btn_text.c_str()) == 0) {
|
||||||
|
Serial.print("Removing Station: ");
|
||||||
|
Serial.println(addr);
|
||||||
|
Station sta = stations->get(i);
|
||||||
|
sta.selected = false;
|
||||||
|
stations->set(i, sta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,14 +387,6 @@ MenuFunctions::MenuFunctions()
|
|||||||
|
|
||||||
if (access_points->get(i).selected)
|
if (access_points->get(i).selected)
|
||||||
lv_btn_toggle(list_btn);
|
lv_btn_toggle(list_btn);
|
||||||
|
|
||||||
//lv_obj_t * btn1 = lv_btn_create(list_btn, NULL);
|
|
||||||
//lv_obj_set_event_cb(btn1, ap_list_cb);
|
|
||||||
//lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, 0);
|
|
||||||
//lv_btn_set_checkable(btn1, true);
|
|
||||||
|
|
||||||
//label = lv_label_create(btn1, NULL);
|
|
||||||
//lv_label_set_text(label, buf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1678,6 +1726,12 @@ void MenuFunctions::RunSetup()
|
|||||||
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
|
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
|
||||||
addAPGFX();
|
addAPGFX();
|
||||||
});
|
});
|
||||||
|
addNodes(&wifiGeneralMenu, text_table1[61], TFT_LIGHTGREY, NULL, KEYBOARD_ICO, [this](){
|
||||||
|
display_obj.clearScreen();
|
||||||
|
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
|
||||||
|
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
|
||||||
|
addStationGFX();
|
||||||
|
});
|
||||||
#else
|
#else
|
||||||
// Select APs on Mini
|
// Select APs on Mini
|
||||||
addNodes(&wifiGeneralMenu, text_table1[56], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
|
addNodes(&wifiGeneralMenu, text_table1[56], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ PROGMEM static void write_bad_usb_keyboard_event_cb(lv_obj_t * keyboard, lv_even
|
|||||||
PROGMEM static void load_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
PROGMEM static void load_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||||
PROGMEM static void test_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
PROGMEM static void test_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||||
PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event);
|
PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event);
|
||||||
|
PROGMEM static void station_list_cb(lv_obj_t * btn, lv_event_t event);
|
||||||
PROGMEM static void setting_dropdown_cb(lv_obj_t * btn, lv_event_t event);
|
PROGMEM static void setting_dropdown_cb(lv_obj_t * btn, lv_event_t event);
|
||||||
PROGMEM static void save_as_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
PROGMEM static void save_as_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||||
|
|
||||||
@@ -205,6 +206,7 @@ class MenuFunctions
|
|||||||
void joinWiFiGFX();
|
void joinWiFiGFX();
|
||||||
void addSSIDGFX();
|
void addSSIDGFX();
|
||||||
void addAPGFX();
|
void addAPGFX();
|
||||||
|
void addStationGFX();
|
||||||
void displaySettingsGFX();
|
void displaySettingsGFX();
|
||||||
void writeBadUSB();
|
void writeBadUSB();
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ PROGMEM const char text1_57[] = "AP Clone Spam";
|
|||||||
PROGMEM const char text1_58[] = "Raw Capture";
|
PROGMEM const char text1_58[] = "Raw Capture";
|
||||||
PROGMEM const char text1_59[] = "Station Sniff";
|
PROGMEM const char text1_59[] = "Station Sniff";
|
||||||
PROGMEM const char text1_60[] = "Clear Stations";
|
PROGMEM const char text1_60[] = "Clear Stations";
|
||||||
|
PROGMEM const char text1_61[] = "Select Stations";
|
||||||
|
|
||||||
|
|
||||||
//SDInterface.cpp texts
|
//SDInterface.cpp texts
|
||||||
@@ -177,7 +178,7 @@ PROGMEM const char text4_46[] = "Stations Cleared: ";
|
|||||||
|
|
||||||
//Making tables
|
//Making tables
|
||||||
PROGMEM const char *text_table0[] = {text0_0,text0_1, text0_2, text0_3, text0_4, text0_5, text0_6, text0_7, text0_8};
|
PROGMEM const char *text_table0[] = {text0_0,text0_1, text0_2, text0_3, text0_4, text0_5, text0_6, text0_7, text0_8};
|
||||||
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56,text1_57,text1_58,text1_59,text1_60};
|
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56,text1_57,text1_58,text1_59,text1_60,text1_61};
|
||||||
PROGMEM const char *text_table2[] = {text2_0,text2_1,text2_2,text2_3,text2_4,text2_5,text2_6,text2_7,text2_8,text2_9,text2_10,text2_11,text2_12,text2_13,text2_14};
|
PROGMEM const char *text_table2[] = {text2_0,text2_1,text2_2,text2_3,text2_4,text2_5,text2_6,text2_7,text2_8,text2_9,text2_10,text2_11,text2_12,text2_13,text2_14};
|
||||||
PROGMEM const char *text_table3[] = {text3_0,text3_1,text3_2,text3_3,text3_4,text3_5};
|
PROGMEM const char *text_table3[] = {text3_0,text3_1,text3_2,text3_3,text3_4,text3_5};
|
||||||
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text1_54,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44,text4_45,text4_46};
|
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text1_54,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44,text4_45,text4_46};
|
||||||
|
|||||||
Reference in New Issue
Block a user