mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Rename plugins to external
This commit is contained in:
34
applications/external/cli_bridge/text_input.c
vendored
Normal file
34
applications/external/cli_bridge/text_input.c
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "text_input.h"
|
||||
#include "cligui_main_i.h"
|
||||
|
||||
void text_input_result_callback(void* ctx) {
|
||||
CliguiApp* app = ctx;
|
||||
char* data = app->text_input_store;
|
||||
size_t len = strlen(data);
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
if(data[i] >= 0x41 && data[i] <= 0x5A) {
|
||||
// Char is uppercase
|
||||
data[i] += 0x20;
|
||||
}
|
||||
}
|
||||
furi_stream_buffer_send(app->data->streams.app_tx, data, len, FuriWaitForever);
|
||||
furi_stream_buffer_send(app->data->streams.app_tx, "\r\n", 2, FuriWaitForever);
|
||||
data[0] = 0;
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, ViewConsoleOutput);
|
||||
app->data->state = ViewConsoleOutput;
|
||||
}
|
||||
|
||||
void text_input_input_handler(CliguiApp* app, InputEvent* event) {
|
||||
if(event->type == InputTypeShort && event->key == InputKeyBack) {
|
||||
// view_dispatcher_switch_to_view(app->view_dispatcher, ViewConsoleOutput);
|
||||
// app->data->state = ViewConsoleOutput;
|
||||
size_t len = strlen(app->text_input_store);
|
||||
app->text_input_store[len] = ' ';
|
||||
app->text_input_store[len + 1] = 0;
|
||||
}
|
||||
if(event->type == InputTypeLong &&
|
||||
(event->key == InputKeyLeft || event->key == InputKeyRight)) {
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, ViewConsoleOutput);
|
||||
app->data->state = ViewConsoleOutput;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user