detailled definition of key layout for the diferrent scenes
This commit is contained in:
parent
d51dc79da0
commit
20f59bb8eb
12 changed files with 127 additions and 112 deletions
|
@ -97,7 +97,7 @@
|
|||
|
||||
enum commandHandlers {
|
||||
SPECIAL,
|
||||
SCENE
|
||||
SCENE,
|
||||
IR_GC,
|
||||
IR_NEC,
|
||||
IR_SAMSUNG,
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#include <lvgl.h>
|
||||
#include "hardware/tft.h"
|
||||
#include "device_samsungTV/device_samsungTV.h"
|
||||
#include "gui_general_and_keys/guiBase.h"
|
||||
#include "gui_general_and_keys/guiRegistry.h"
|
||||
#include "commandHandler.h"
|
||||
#include "scenes/sceneHandler.h"
|
||||
#include "scenes/scene_TV.h"
|
||||
#include "scenes/scene_fireTV.h"
|
||||
|
||||
// Virtual Keypad Event handler
|
||||
static void virtualKeypad_event_cb(lv_event_t* e) {
|
||||
|
@ -11,10 +15,17 @@ static void virtualKeypad_event_cb(lv_event_t* e) {
|
|||
if (target == cont) return; // stop if container was clicked
|
||||
|
||||
// send corrensponding number
|
||||
byte virtualKeyMapFireTVNumbers[10] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x0};
|
||||
int number = virtualKeyMapFireTVNumbers[(int)target->user_data];
|
||||
std::string numberStr = std::to_string(number);
|
||||
executeCommand(KEYBOARD_SENDSTRING, numberStr);
|
||||
if (currentScene == scene_name_TV) {
|
||||
std::string virtualKeyMapTVNumbers[10] = {SAMSUNG_NUM_1, SAMSUNG_NUM_2, SAMSUNG_NUM_3, SAMSUNG_NUM_4, SAMSUNG_NUM_5, SAMSUNG_NUM_6, SAMSUNG_NUM_7, SAMSUNG_NUM_8, SAMSUNG_NUM_9, SAMSUNG_NUM_0};
|
||||
std::string command = virtualKeyMapTVNumbers[(int)target->user_data];
|
||||
executeCommand(command);
|
||||
|
||||
} else if (currentScene == scene_name_fireTV) {
|
||||
byte virtualKeyMapFireTVNumbers[10] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x0};
|
||||
int number = virtualKeyMapFireTVNumbers[(int)target->user_data];
|
||||
std::string numberStr = std::to_string(number);
|
||||
executeCommand(KEYBOARD_SENDSTRING, numberStr);
|
||||
}
|
||||
}
|
||||
|
||||
void init_gui_tab_numpad(lv_obj_t* tabview) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
#include "scenes/sceneregistry.h"
|
||||
#include <string>
|
||||
#include "device_samsungTV/device_samsungTV.h"
|
||||
#include "device_yamahaAmp/device_yamahaAmp.h"
|
||||
#include "scenes/sceneRegistry.h"
|
||||
#include "scenes/scene_allOff.h"
|
||||
#include "scenes/scene_TV.h"
|
||||
#include "scenes/scene_fireTV.h"
|
||||
|
@ -10,34 +10,34 @@
|
|||
#include "commandHandler.h"
|
||||
|
||||
std::map<char, repeatModes> key_repeatModes_default {
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_short_default {
|
||||
{'o', SCENE_ALLOFF},
|
||||
/*{'=', KEYBOARD_PLAYPAUSE},*/ {'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
|
||||
{'u', KEYBOARD_UP},
|
||||
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
|
||||
{'d', KEYBOARD_DOWN},
|
||||
/* {'b', }, */ {'s', KEYBOARD_BACK},
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, {'^', SAMSUNG_CHANNEL_UP},
|
||||
{'-', YAMAHA_VOL_MINUS}, /* {'e', }, */ {'v', SAMSUNG_CHANNEL_DOWN},
|
||||
/*{'=', COMMAND_UNKNOWN},*/ /*{'<', COMMAND_UNKNOWN},*/ /*{'p', COMMAND_UNKNOWN},*/ /*{'>', COMMAND_UNKNOWN},*/
|
||||
/*{'c', COMMAND_UNKNOWN}, */ /*{'i', COMMAND_UNKNOWN},*/
|
||||
/*{'u', COMMAND_UNKNOWN},*/
|
||||
/*{'l', COMMAND_UNKNOWN},*/ /*{'k', COMMAND_UNKNOWN},*/ /*{'r', COMMAND_UNKNOWN},*/
|
||||
/*{'d', COMMAND_UNKNOWN},*/
|
||||
/* {'b', COMMAND_UNKNOWN},*/ /*{'s', COMMAND_UNKNOWN},*/
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, /*{'^', COMMAND_UNKNOWN},*/
|
||||
{'-', YAMAHA_VOL_MINUS}, /*{'e', COMMAND_UNKNOWN},*/ /*{'v', COMMAND_UNKNOWN},*/
|
||||
{'1', SCENE_TV}, {'2', SCENE_FIRETV}, {'3', SCENE_CHROMECAST}, {'4', YAMAHA_STANDARD},
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_long_default {
|
||||
{'<', KEYBOARD_REWIND_LONG},
|
||||
{'>', KEYBOARD_FASTFORWARD_LONG},
|
||||
|
||||
|
||||
};
|
||||
|
||||
// https://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __SCENE_REGISTRY_H__
|
||||
#define __SCENE_REGISTRY_H__
|
||||
#ifndef __SCENEREGISTRY_H__
|
||||
#define __SCENEREGISTRY_H__
|
||||
|
||||
#include <map>
|
||||
#include "gui_general_and_keys/keys.h"
|
||||
|
@ -27,4 +27,4 @@ repeatModes get_key_repeatMode(std::string sceneName, char keyChar);
|
|||
std::string get_command_short(std::string sceneName, char keyChar);
|
||||
std::string get_command_long(std::string sceneName, char keyChar);
|
||||
|
||||
#endif /*__SCENE_REGISTRY_H__*/
|
||||
#endif /*__SCENEREGISTRY_H__*/
|
||||
|
|
|
@ -10,34 +10,34 @@
|
|||
#include "commandHandler.h"
|
||||
|
||||
std::map<char, repeatModes> key_repeatModes_TV {
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
|
||||
{'=', SHORT_REPEATED}, {'<', SHORT }, {'p', SHORT }, {'>', SHORT_REPEATED },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT_REPEATED},
|
||||
{'l', SHORT_REPEATED}, {'k', SHORT}, {'r', SHORT_REPEATED},
|
||||
{'d', SHORT_REPEATED},
|
||||
{'s', SHORT },
|
||||
{'^', SHORT },
|
||||
{'v', SHORT },
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_short_TV {
|
||||
{'o', SCENE_ALLOFF},
|
||||
/*{'=', KEYBOARD_PLAYPAUSE},*/ {'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
|
||||
{'u', KEYBOARD_UP},
|
||||
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
|
||||
{'d', KEYBOARD_DOWN},
|
||||
/* {'b', }, */ {'s', KEYBOARD_BACK},
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, {'^', SAMSUNG_CHANNEL_UP},
|
||||
{'-', YAMAHA_VOL_MINUS}, /* {'e', }, */ {'v', SAMSUNG_CHANNEL_DOWN},
|
||||
{'1', SCENE_TV}, {'2', SCENE_FIRETV}, {'3', SCENE_CHROMECAST}, {'4', YAMAHA_STANDARD},
|
||||
|
||||
{'=', SAMSUNG_REWIND}, {'<', SAMSUNG_PAUSE}, {'p', SAMSUNG_PLAY}, {'>', SAMSUNG_FASTFORWARD},
|
||||
{'c', SAMSUNG_GUIDE}, {'i', SAMSUNG_MENU},
|
||||
{'u', SAMSUNG_UP},
|
||||
{'l', SAMSUNG_LEFT}, {'k', SAMSUNG_SELECT}, {'r', SAMSUNG_RIGHT},
|
||||
{'d', SAMSUNG_DOWN},
|
||||
{'s', SAMSUNG_EXIT},
|
||||
{'^', SAMSUNG_CHANNEL_UP},
|
||||
{'v', SAMSUNG_CHANNEL_DOWN},
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_long_TV {
|
||||
{'<', KEYBOARD_REWIND_LONG},
|
||||
{'>', KEYBOARD_FASTFORWARD_LONG},
|
||||
|
||||
|
||||
};
|
||||
|
||||
void scene_start_sequence_TV(void) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#define SCENE_TV "Scene_tv"
|
||||
|
||||
extern std::string scene_name_TV;
|
||||
void register_scene_TV(void);
|
||||
|
||||
#endif /*__SCENE_TV_H__*/
|
||||
|
|
|
@ -10,34 +10,34 @@
|
|||
#include "commandHandler.h"
|
||||
|
||||
std::map<char, repeatModes> key_repeatModes_allOff {
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_short_allOff {
|
||||
{'o', SCENE_ALLOFF},
|
||||
/*{'=', KEYBOARD_PLAYPAUSE},*/ {'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
|
||||
{'u', KEYBOARD_UP},
|
||||
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
|
||||
{'d', KEYBOARD_DOWN},
|
||||
/* {'b', }, */ {'s', KEYBOARD_BACK},
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, {'^', SAMSUNG_CHANNEL_UP},
|
||||
{'-', YAMAHA_VOL_MINUS}, /* {'e', }, */ {'v', SAMSUNG_CHANNEL_DOWN},
|
||||
{'1', SCENE_TV}, {'2', SCENE_FIRETV}, {'3', SCENE_CHROMECAST}, {'4', YAMAHA_STANDARD},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_long_allOff {
|
||||
{'<', KEYBOARD_REWIND_LONG},
|
||||
{'>', KEYBOARD_FASTFORWARD_LONG},
|
||||
|
||||
|
||||
};
|
||||
|
||||
void scene_start_sequence_allOff(void) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#define SCENE_ALLOFF "Scene_allOff"
|
||||
|
||||
extern std::string scene_name_allOff;
|
||||
void register_scene_allOff(void);
|
||||
|
||||
#endif /*__SCENE_ALLOFF_H__*/
|
||||
|
|
|
@ -10,34 +10,34 @@
|
|||
#include "commandHandler.h"
|
||||
|
||||
std::map<char, repeatModes> key_repeatModes_chromecast {
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_short_chromecast {
|
||||
{'o', SCENE_ALLOFF},
|
||||
/*{'=', KEYBOARD_PLAYPAUSE},*/ {'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
|
||||
{'u', KEYBOARD_UP},
|
||||
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
|
||||
{'d', KEYBOARD_DOWN},
|
||||
/* {'b', }, */ {'s', KEYBOARD_BACK},
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, {'^', SAMSUNG_CHANNEL_UP},
|
||||
{'-', YAMAHA_VOL_MINUS}, /* {'e', }, */ {'v', SAMSUNG_CHANNEL_DOWN},
|
||||
{'1', SCENE_TV}, {'2', SCENE_FIRETV}, {'3', SCENE_CHROMECAST}, {'4', YAMAHA_STANDARD},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_long_chromecast {
|
||||
{'<', KEYBOARD_REWIND_LONG},
|
||||
{'>', KEYBOARD_FASTFORWARD_LONG},
|
||||
|
||||
|
||||
};
|
||||
|
||||
void scene_start_sequence_chromecast(void) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#define SCENE_CHROMECAST "Scene_chromecast"
|
||||
|
||||
extern std::string scene_name_chromecast;
|
||||
void register_scene_chromecast(void);
|
||||
|
||||
#endif /*__SCENE_CHROMECAST_H__*/
|
||||
|
|
|
@ -10,29 +10,29 @@
|
|||
#include "commandHandler.h"
|
||||
|
||||
std::map<char, repeatModes> key_repeatModes_fireTV {
|
||||
{'o', SHORT },
|
||||
{'=', SHORT }, {'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'b', SHORT }, {'s', SHORT },
|
||||
{'+', SHORT_REPEATED}, {'m', SHORT }, {'^', SHORT },
|
||||
{'-', SHORT_REPEATED}, {'e', SHORT }, {'v', SHORT },
|
||||
{'1', SHORT }, {'2', SHORT }, {'3', SHORT }, {'4', SHORT },
|
||||
|
||||
{'<', SHORTorLONG }, {'p', SHORT }, {'>', SHORTorLONG },
|
||||
{'c', SHORT }, {'i', SHORT },
|
||||
{'u', SHORT },
|
||||
{'l', SHORT }, {'k', SHORT }, {'r', SHORT },
|
||||
{'d', SHORT },
|
||||
{'s', SHORT },
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_short_fireTV {
|
||||
{'o', SCENE_ALLOFF},
|
||||
/*{'=', KEYBOARD_PLAYPAUSE},*/ {'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
|
||||
{'<', KEYBOARD_REWIND}, {'p', KEYBOARD_PLAYPAUSE}, {'>', KEYBOARD_FASTFORWARD},
|
||||
{'c', KEYBOARD_HOME}, {'i', KEYBOARD_MENU},
|
||||
{'u', KEYBOARD_UP},
|
||||
{'l', KEYBOARD_LEFT}, {'k', KEYBOARD_SELECT}, {'r', KEYBOARD_RIGHT},
|
||||
{'d', KEYBOARD_DOWN},
|
||||
/* {'b', }, */ {'s', KEYBOARD_BACK},
|
||||
{'+', YAMAHA_VOL_PLUS}, {'m', YAMAHA_MUTE_TOGGLE}, {'^', SAMSUNG_CHANNEL_UP},
|
||||
{'-', YAMAHA_VOL_MINUS}, /* {'e', }, */ {'v', SAMSUNG_CHANNEL_DOWN},
|
||||
{'1', SCENE_TV}, {'2', SCENE_FIRETV}, {'3', SCENE_CHROMECAST}, {'4', YAMAHA_STANDARD},
|
||||
{'s', KEYBOARD_BACK},
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::map<char, std::string> key_commands_long_fireTV {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#define SCENE_FIRETV "Scene_firetv"
|
||||
|
||||
extern std::string scene_name_fireTV;
|
||||
void register_scene_fireTV(void);
|
||||
|
||||
#endif /*__SCENE_FIRETV_H__*/
|
||||
|
|
Loading…
Add table
Reference in a new issue