BLE Spam support protocols extra config menus

This commit is contained in:
Willy-JL
2023-10-19 11:45:31 +01:00
parent f76f9008eb
commit 147c981cdf
3 changed files with 11 additions and 0 deletions

View File

@@ -320,6 +320,7 @@ static bool input_callback(InputEvent* input, void* ctx) {
if(input->type == InputTypeLong) { if(input->type == InputTypeLong) {
if(advertising) toggle_adv(state); if(advertising) toggle_adv(state);
state->ctx.attack = &attacks[state->index]; state->ctx.attack = &attacks[state->index];
scene_manager_set_scene_state(state->ctx.scene_manager, SceneConfig, 0);
scene_manager_next_scene(state->ctx.scene_manager, SceneConfig); scene_manager_next_scene(state->ctx.scene_manager, SceneConfig);
} else if(input->type == InputTypeShort) { } else if(input->type == InputTypeShort) {
toggle_adv(state); toggle_adv(state);

View File

@@ -8,6 +8,7 @@
#include "ble_spam_icons.h" #include "ble_spam_icons.h"
#include <furi_hal_random.h> #include <furi_hal_random.h>
#include <core/core_defines.h> #include <core/core_defines.h>
#include "../ble_spam.h"
typedef union ProtocolCfg ProtocolCfg; typedef union ProtocolCfg ProtocolCfg;
@@ -15,4 +16,5 @@ typedef struct {
const Icon* icon; const Icon* icon;
const char* (*get_name)(const ProtocolCfg* _cfg); const char* (*get_name)(const ProtocolCfg* _cfg);
void (*make_packet)(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg); void (*make_packet)(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg);
uint8_t (*config_list)(Ctx* ctx);
} Protocol; } Protocol;

View File

@@ -15,11 +15,19 @@ void scene_config_on_enter(void* _ctx) {
variable_item_list_reset(list); variable_item_list_reset(list);
variable_item_list_set_header(list, ctx->attack->title); variable_item_list_set_header(list, ctx->attack->title);
uint8_t item_count = 0;
if(ctx->attack->protocol && ctx->attack->protocol->config_list) {
item_count = ctx->attack->protocol->config_list(ctx);
}
UNUSED(item_count);
item = variable_item_list_add(list, "Random MAC", 2, random_mac_changed, ctx); item = variable_item_list_add(list, "Random MAC", 2, random_mac_changed, ctx);
variable_item_set_current_value_index(item, ctx->attack->payload.random_mac); variable_item_set_current_value_index(item, ctx->attack->payload.random_mac);
variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF"); variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF");
variable_item_list_set_selected_item(
list, scene_manager_get_scene_state(ctx->scene_manager, SceneConfig));
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewVariableItemList); view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewVariableItemList);
} }