back-end for #123
This commit is contained in:
+2
-2
@@ -37,7 +37,7 @@ static const int ansi_en_main = 1;
|
||||
|
||||
// Max nr of CSI parameters
|
||||
#define CSI_N_MAX 10
|
||||
#define STR_CHAR_MAX 64
|
||||
#define ANSI_STR_LEN 64
|
||||
|
||||
static volatile int cs = -1;
|
||||
static volatile bool inside_string = false;
|
||||
@@ -105,7 +105,7 @@ ansi_parser(char newchar)
|
||||
static int arg_ni;
|
||||
static int arg_cnt;
|
||||
static int arg[CSI_N_MAX];
|
||||
static char string_buffer[STR_CHAR_MAX];
|
||||
static char string_buffer[ANSI_STR_LEN];
|
||||
static int str_ni;
|
||||
|
||||
// This is used to detect timeout delay (time since last rx char)
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
|
||||
// Max nr of CSI parameters
|
||||
#define CSI_N_MAX 10
|
||||
#define STR_CHAR_MAX 64
|
||||
#define ANSI_STR_LEN 64
|
||||
|
||||
static volatile int cs = -1;
|
||||
static volatile bool inside_string = false;
|
||||
@@ -80,7 +80,7 @@ ansi_parser(char newchar)
|
||||
static int arg_ni;
|
||||
static int arg_cnt;
|
||||
static int arg[CSI_N_MAX];
|
||||
static char string_buffer[STR_CHAR_MAX];
|
||||
static char string_buffer[ANSI_STR_LEN];
|
||||
static int str_ni;
|
||||
|
||||
// This is used to detect timeout delay (time since last rx char)
|
||||
|
||||
+7
-1
@@ -14,13 +14,14 @@
|
||||
#include "apars_logging.h"
|
||||
#include "screen.h"
|
||||
#include "ansi_parser.h"
|
||||
#include "cgi_sockets.h"
|
||||
|
||||
/**
|
||||
* Helper function to parse incoming OSC (Operating System Control)
|
||||
* @param buffer - the OSC body (after OSC and before ST)
|
||||
*/
|
||||
void ICACHE_FLASH_ATTR
|
||||
apars_handle_osc(const char *buffer)
|
||||
apars_handle_osc(char *buffer)
|
||||
{
|
||||
int n = 0;
|
||||
char c = 0;
|
||||
@@ -38,6 +39,11 @@ apars_handle_osc(const char *buffer)
|
||||
if (n == 0 || n == 2) {
|
||||
screen_set_title(buffer);
|
||||
}
|
||||
else if (n == 9) {
|
||||
buffer--;
|
||||
buffer[0] = 'g';
|
||||
notify_growl(buffer);
|
||||
}
|
||||
else if (n >= 81 && n <= 85) { // ESPTerm: action button label
|
||||
screen_set_button_text(n - 80, buffer);
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@
|
||||
#ifndef ESP_VT100_FIRMWARE_APARS_OSC_H
|
||||
#define ESP_VT100_FIRMWARE_APARS_OSC_H
|
||||
|
||||
void apars_handle_osc(const char *buffer);
|
||||
void apars_handle_osc(char *buffer);
|
||||
|
||||
#endif //ESP_VT100_FIRMWARE_APARS_OSC_H
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
// ----- Generic String cmd - disambiguation -----
|
||||
|
||||
void ICACHE_FLASH_ATTR
|
||||
apars_handle_string_cmd(char leadchar, const char *buffer)
|
||||
apars_handle_string_cmd(char leadchar, char *buffer)
|
||||
{
|
||||
switch (leadchar) {
|
||||
case 'k': // ESC k TITLE ST (defined in GNU screen manpage)
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@
|
||||
#ifndef ESP_VT100_FIRMWARE_APARS_STRING_H
|
||||
#define ESP_VT100_FIRMWARE_APARS_STRING_H
|
||||
|
||||
void apars_handle_string_cmd(char leadchar, const char *buffer);
|
||||
// not const char so some edits can be made when processing
|
||||
void apars_handle_string_cmd(char leadchar, char *buffer);
|
||||
|
||||
#endif //ESP_VT100_FIRMWARE_APARS_STRING_H
|
||||
|
||||
@@ -119,6 +119,16 @@ send_beep(void)
|
||||
}
|
||||
|
||||
|
||||
/** Pop-up notification (from iTerm2) */
|
||||
void ICACHE_FLASH_ATTR
|
||||
notify_growl(char *msg)
|
||||
{
|
||||
// TODO via timer...
|
||||
// here's some potential for a race error with the other broadcast functions :C
|
||||
cgiWebsockBroadcast(URL_WS_UPDATE, msg, (int) strlen(msg), 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Broadcast screen state to sockets.
|
||||
* This is a callback for the Screen module,
|
||||
|
||||
@@ -12,6 +12,9 @@ void notify_empty_txbuf(void);
|
||||
|
||||
void send_beep(void);
|
||||
|
||||
/** open pop-up notification */
|
||||
void notify_growl(char *msg);
|
||||
|
||||
// defined in the makefile
|
||||
#if DEBUG_INPUT
|
||||
#define ws_warn warn
|
||||
|
||||
Reference in New Issue
Block a user