Просмотр исходного кода

[FL-2279] IR doxygen, rename irda -> infrared (#1010)

* IR: Doxygen docs, some rename
* Rename irda -> infrared
* Rollback collateral renames

Co-authored-by: あく <alleteam@gmail.com>
Albert Kharisov 3 лет назад
Родитель
Сommit
052237f8c9
100 измененных файлов с 3084 добавлено и 2400 удалено
  1. 1 1
      .github/CODEOWNERS
  2. 1 1
      Makefile
  3. 2 2
      applications/ReadMe.md
  4. 9 9
      applications/applications.c
  5. 8 8
      applications/applications.mk
  6. 3 3
      applications/archive/helpers/archive_browser.h
  7. 1 1
      applications/archive/helpers/archive_files.h
  8. 1 1
      applications/archive/scenes/archive_scene_browser.c
  9. 2 2
      applications/archive/views/archive_browser_view.c
  10. 1 1
      applications/archive/views/archive_browser_view.h
  11. 2 2
      applications/gui/modules/button_menu.c
  12. 49 49
      applications/infrared/cli/infrared_cli.cpp
  13. 24 21
      applications/infrared/helpers/infrared_parser.cpp
  14. 48 0
      applications/infrared/helpers/infrared_parser.h
  15. 54 67
      applications/infrared/infrared_app.cpp
  16. 322 0
      applications/infrared/infrared_app.h
  17. 11 11
      applications/infrared/infrared_app_brute_force.cpp
  18. 67 0
      applications/infrared/infrared_app_brute_force.h
  19. 47 0
      applications/infrared/infrared_app_event.h
  20. 30 41
      applications/infrared/infrared_app_remote_manager.cpp
  21. 188 0
      applications/infrared/infrared_app_remote_manager.h
  22. 16 16
      applications/infrared/infrared_app_signal.cpp
  23. 134 0
      applications/infrared/infrared_app_signal.h
  24. 45 45
      applications/infrared/infrared_app_view_manager.cpp
  25. 164 0
      applications/infrared/infrared_app_view_manager.h
  26. 9 0
      applications/infrared/infrared_runner.cpp
  27. 305 0
      applications/infrared/scene/infrared_app_scene.h
  28. 15 15
      applications/infrared/scene/infrared_app_scene_ask_back.cpp
  29. 24 24
      applications/infrared/scene/infrared_app_scene_edit.cpp
  30. 20 20
      applications/infrared/scene/infrared_app_scene_edit_delete.cpp
  31. 38 0
      applications/infrared/scene/infrared_app_scene_edit_delete_done.cpp
  32. 57 0
      applications/infrared/scene/infrared_app_scene_edit_key_select.cpp
  33. 17 17
      applications/infrared/scene/infrared_app_scene_edit_rename.cpp
  34. 31 0
      applications/infrared/scene/infrared_app_scene_edit_rename_done.cpp
  35. 75 0
      applications/infrared/scene/infrared_app_scene_learn.cpp
  36. 10 10
      applications/infrared/scene/infrared_app_scene_learn_done.cpp
  37. 13 13
      applications/infrared/scene/infrared_app_scene_learn_enter_name.cpp
  38. 34 31
      applications/infrared/scene/infrared_app_scene_learn_success.cpp
  39. 37 37
      applications/infrared/scene/infrared_app_scene_remote.cpp
  40. 12 11
      applications/infrared/scene/infrared_app_scene_remote_list.cpp
  41. 14 14
      applications/infrared/scene/infrared_app_scene_start.cpp
  42. 14 14
      applications/infrared/scene/infrared_app_scene_universal.cpp
  43. 101 0
      applications/infrared/scene/infrared_app_scene_universal_common.cpp
  44. 20 11
      applications/infrared/scene/infrared_app_scene_universal_tv.cpp
  45. 25 23
      applications/infrared/view/infrared_progress_view.c
  46. 68 0
      applications/infrared/view/infrared_progress_view.h
  47. 140 0
      applications/infrared_monitor/infrared_monitor.c
  48. 0 13
      applications/irda/helpers/irda_parser.h
  49. 0 138
      applications/irda/irda_app.h
  50. 0 36
      applications/irda/irda_app_brute_force.h
  51. 0 28
      applications/irda/irda_app_event.h
  52. 0 76
      applications/irda/irda_app_remote_manager.h
  53. 0 68
      applications/irda/irda_app_signal.h
  54. 0 66
      applications/irda/irda_app_view_manager.h
  55. 0 9
      applications/irda/irda_runner.cpp
  56. 0 184
      applications/irda/scene/irda_app_scene.h
  57. 0 38
      applications/irda/scene/irda_app_scene_edit_delete_done.cpp
  58. 0 57
      applications/irda/scene/irda_app_scene_edit_key_select.cpp
  59. 0 31
      applications/irda/scene/irda_app_scene_edit_rename_done.cpp
  60. 0 75
      applications/irda/scene/irda_app_scene_learn.cpp
  61. 0 101
      applications/irda/scene/irda_app_scene_universal_common.cpp
  62. 0 25
      applications/irda/view/irda_progress_view.h
  63. 0 139
      applications/irda_monitor/irda_monitor.c
  64. 48 47
      applications/tests/infrared_decoder_encoder/infrared_decoder_encoder_test.c
  65. 160 160
      applications/tests/infrared_decoder_encoder/test_data/infrared_nec_test_data.srcdata
  66. 136 136
      applications/tests/infrared_decoder_encoder/test_data/infrared_necext_test_data.srcdata
  67. 57 57
      applications/tests/infrared_decoder_encoder/test_data/infrared_rc5_test_data.srcdata
  68. 61 61
      applications/tests/infrared_decoder_encoder/test_data/infrared_rc6_test_data.srcdata
  69. 69 69
      applications/tests/infrared_decoder_encoder/test_data/infrared_samsung_test_data.srcdata
  70. 214 214
      applications/tests/infrared_decoder_encoder/test_data/infrared_sirc_test_data.srcdata
  71. 1 1
      applications/tests/rpc/rpc_test.c
  72. 2 2
      applications/tests/test_index.c
  73. 6 27
      assets/compiled/assets_icons.c
  74. 13 13
      assets/compiled/assets_icons.h
  75. 0 0
      assets/icons/Infrared/Back_15x10.png
  76. 0 0
      assets/icons/Infrared/DolphinReadingSuccess_59x63.png
  77. 0 0
      assets/icons/Infrared/Down_25x27.png
  78. 0 0
      assets/icons/Infrared/Down_hvr_25x27.png
  79. 0 0
      assets/icons/Infrared/Fill-marker_7x7.png
  80. 0 0
      assets/icons/Infrared/InfraredArrowDown_4x8.png
  81. 0 0
      assets/icons/Infrared/InfraredArrowUp_4x8.png
  82. 0 0
      assets/icons/Infrared/InfraredLearnShort_128x31.png
  83. 0 0
      assets/icons/Infrared/InfraredLearn_128x64.png
  84. 0 0
      assets/icons/Infrared/InfraredSendShort_128x34.png
  85. 0 0
      assets/icons/Infrared/InfraredSend_128x64.png
  86. 0 0
      assets/icons/Infrared/Mute_25x27.png
  87. 0 0
      assets/icons/Infrared/Mute_hvr_25x27.png
  88. 0 0
      assets/icons/Infrared/Power_25x27.png
  89. 0 0
      assets/icons/Infrared/Power_hvr_25x27.png
  90. 0 0
      assets/icons/Infrared/Up_25x27.png
  91. 0 0
      assets/icons/Infrared/Up_hvr_25x27.png
  92. 0 0
      assets/icons/Infrared/Vol_down_25x27.png
  93. 0 0
      assets/icons/Infrared/Vol_down_hvr_25x27.png
  94. 0 0
      assets/icons/Infrared/Vol_up_25x27.png
  95. 0 0
      assets/icons/Infrared/Vol_up_hvr_25x27.png
  96. 0 0
      assets/resources/infrared/assets/tv.ir
  97. 2 2
      bootloader/targets/f6/furi_hal/furi_hal_resources.c
  98. 2 2
      bootloader/targets/f6/furi_hal/furi_hal_resources.h
  99. 2 2
      bootloader/targets/f7/furi_hal/furi_hal_resources.c
  100. 2 2
      bootloader/targets/f7/furi_hal/furi_hal_resources.h

+ 1 - 1
.github/CODEOWNERS

@@ -14,7 +14,7 @@ applications/gui/** @skotopes @DrZlo13
 applications/gui-test/** @skotopes @DrZlo13
 applications/ibutton/** @skotopes @DrZlo13
 applications/input/** @skotopes @DrZlo13
-applications/irda/** @skotopes @DrZlo13 @albkharisov
+applications/infrared/** @skotopes @DrZlo13
 applications/lf-rfid/** @skotopes @DrZlo13
 applications/menu/** @skotopes @DrZlo13
 applications/music-player/** @skotopes @DrZlo13

+ 1 - 1
Makefile

@@ -13,7 +13,7 @@ PROJECT_SOURCE_DIRECTORIES := \
 	$(PROJECT_ROOT)/lib/cyfral \
 	$(PROJECT_ROOT)/lib/drivers \
 	$(PROJECT_ROOT)/lib/flipper_file \
-	$(PROJECT_ROOT)/lib/irda \
+	$(PROJECT_ROOT)/lib/infrared \
 	$(PROJECT_ROOT)/lib/nfc_protocols \
 	$(PROJECT_ROOT)/lib/ST25RFAL002 \
 	$(PROJECT_ROOT)/lib/onewire \

+ 2 - 2
applications/ReadMe.md

@@ -15,8 +15,8 @@
 - `gui`                 - GUI service and API
 - `ibutton`             - iButton application, onewire keys and more
 - `input`               - Input service
-- `irda`                - Irda application, controls your IR devices
-- `irda_monitor`        - Irda debug tool
+- `infrared`            - Infrared application, controls your IR devices
+- `infrared_monitor`    - Infrared debug tool
 - `lfrfid`              - LF RFID application
 - `lfrfid_debug`        - LF RFID debug tool
 - `loader`              - Application loader service

+ 9 - 9
applications/applications.c

@@ -27,8 +27,8 @@ extern int32_t delay_test_app(void* p);
 extern int32_t display_test_app(void* p);
 extern int32_t gpio_app(void* p);
 extern int32_t ibutton_app(void* p);
-extern int32_t irda_app(void* p);
-extern int32_t irda_monitor_app(void* p);
+extern int32_t infrared_app(void* p);
+extern int32_t infrared_monitor_app(void* p);
 extern int32_t keypad_test_app(void* p);
 extern int32_t lfrfid_app(void* p);
 extern int32_t lfrfid_debug_app(void* p);
@@ -51,7 +51,7 @@ extern int32_t snake_game_app(void* p);
 extern void bt_on_system_start();
 extern void crypto_on_system_start();
 extern void ibutton_on_system_start();
-extern void irda_on_system_start();
+extern void infrared_on_system_start();
 extern void lfrfid_on_system_start();
 extern void nfc_on_system_start();
 extern void storage_on_system_start();
@@ -136,8 +136,8 @@ const FlipperApplication FLIPPER_APPS[] = {
     {.app = nfc_app, .name = "NFC", .stack_size = 4096, .icon = &A_NFC_14},
 #endif
 
-#ifdef APP_IRDA
-    {.app = irda_app, .name = "Infrared", .stack_size = 1024 * 3, .icon = &A_Infrared_14},
+#ifdef APP_INFRARED
+    {.app = infrared_app, .name = "Infrared", .stack_size = 1024 * 3, .icon = &A_Infrared_14},
 #endif
 
 #ifdef APP_GPIO
@@ -164,8 +164,8 @@ const size_t FLIPPER_APPS_COUNT = sizeof(FLIPPER_APPS) / sizeof(FlipperApplicati
 const FlipperOnStartHook FLIPPER_ON_SYSTEM_START[] = {
     crypto_on_system_start,
 
-#ifdef APP_IRDA
-    irda_on_system_start,
+#ifdef APP_INFRARED
+    infrared_on_system_start,
 #endif
 
 #ifdef APP_NFC
@@ -251,8 +251,8 @@ const FlipperApplication FLIPPER_DEBUG_APPS[] = {
     {.app = uart_echo_app, .name = "Uart Echo", .stack_size = 2048, .icon = NULL},
 #endif
 
-#ifdef APP_IRDA_MONITOR
-    {.app = irda_monitor_app, .name = "Irda Monitor", .stack_size = 1024, .icon = NULL},
+#ifdef APP_INFRARED_MONITOR
+    {.app = infrared_monitor_app, .name = "Infrared Monitor", .stack_size = 1024, .icon = NULL},
 #endif
 
 #ifdef APP_SCENED

+ 8 - 8
applications/applications.mk

@@ -26,7 +26,7 @@ SRV_DESKTOP	= 1
 APP_ARCHIVE	= 1
 APP_GPIO = 1
 APP_IBUTTON	= 1
-APP_IRDA	= 1
+APP_INFRARED	= 1
 APP_LF_RFID	= 1
 APP_NFC		= 1
 APP_SUBGHZ	= 1
@@ -40,7 +40,7 @@ APP_SNAKE_GAME = 1
 # Debug
 APP_ACCESSOR = 1
 APP_BLINK = 1
-APP_IRDA_MONITOR = 1
+APP_INFRARED_MONITOR = 1
 APP_KEYPAD_TEST = 1
 APP_SD_TEST	= 1
 APP_VIBRO_TEST = 1
@@ -59,9 +59,9 @@ endif
 # Prefix with APP_*
 
 
-APP_IRDA_MONITOR	?= 0
-ifeq ($(APP_IRDA_MONITOR), 1)
-CFLAGS		+= -DAPP_IRDA_MONITOR
+APP_INFRARED_MONITOR	?= 0
+ifeq ($(APP_INFRARED_MONITOR), 1)
+CFLAGS		+= -DAPP_INFRARED_MONITOR
 SRV_GUI		= 1
 endif
 
@@ -122,9 +122,9 @@ SRV_GUI		= 1
 endif
 
 
-APP_IRDA ?= 0
-ifeq ($(APP_IRDA), 1)
-CFLAGS		+= -DAPP_IRDA
+APP_INFRARED ?= 0
+ifeq ($(APP_INFRARED), 1)
+CFLAGS		+= -DAPP_INFRARED
 SRV_GUI		= 1
 endif
 

+ 3 - 3
applications/archive/helpers/archive_browser.h

@@ -10,7 +10,7 @@ static const char* tab_default_paths[] = {
     [ArchiveTabNFC] = "/any/nfc",
     [ArchiveTabSubGhz] = "/any/subghz",
     [ArchiveTabLFRFID] = "/any/lfrfid",
-    [ArchiveTabIrda] = "/any/irda",
+    [ArchiveTabInfrared] = "/any/infrared",
     [ArchiveTabBadUsb] = "/any/badusb",
     [ArchiveTabU2f] = "/app:u2f",
     [ArchiveTabBrowser] = "/any",
@@ -21,7 +21,7 @@ static const char* known_ext[] = {
     [ArchiveFileTypeNFC] = ".nfc",
     [ArchiveFileTypeSubGhz] = ".sub",
     [ArchiveFileTypeLFRFID] = ".rfid",
-    [ArchiveFileTypeIrda] = ".ir",
+    [ArchiveFileTypeInfrared] = ".ir",
     [ArchiveFileTypeBadUsb] = ".txt",
     [ArchiveFileTypeU2f] = "?",
     [ArchiveFileTypeFolder] = "?",
@@ -34,7 +34,7 @@ static const ArchiveFileTypeEnum known_type[] = {
     [ArchiveTabNFC] = ArchiveFileTypeNFC,
     [ArchiveTabSubGhz] = ArchiveFileTypeSubGhz,
     [ArchiveTabLFRFID] = ArchiveFileTypeLFRFID,
-    [ArchiveTabIrda] = ArchiveFileTypeIrda,
+    [ArchiveTabInfrared] = ArchiveFileTypeInfrared,
     [ArchiveTabBadUsb] = ArchiveFileTypeBadUsb,
     [ArchiveTabU2f] = ArchiveFileTypeU2f,
     [ArchiveTabBrowser] = ArchiveFileTypeUnknown,

+ 1 - 1
applications/archive/helpers/archive_files.h

@@ -8,7 +8,7 @@ typedef enum {
     ArchiveFileTypeNFC,
     ArchiveFileTypeSubGhz,
     ArchiveFileTypeLFRFID,
-    ArchiveFileTypeIrda,
+    ArchiveFileTypeInfrared,
     ArchiveFileTypeBadUsb,
     ArchiveFileTypeU2f,
     ArchiveFileTypeFolder,

+ 1 - 1
applications/archive/scenes/archive_scene_browser.c

@@ -12,7 +12,7 @@ static const char* flipper_app_name[] = {
     [ArchiveFileTypeNFC] = "NFC",
     [ArchiveFileTypeSubGhz] = "Sub-GHz",
     [ArchiveFileTypeLFRFID] = "125 kHz RFID",
-    [ArchiveFileTypeIrda] = "Infrared",
+    [ArchiveFileTypeInfrared] = "Infrared",
     [ArchiveFileTypeBadUsb] = "Bad USB",
     [ArchiveFileTypeU2f] = "U2F",
 };

+ 2 - 2
applications/archive/views/archive_browser_view.c

@@ -9,7 +9,7 @@ static const char* ArchiveTabNames[] = {
     [ArchiveTabNFC] = "NFC",
     [ArchiveTabSubGhz] = "Sub-GHz",
     [ArchiveTabLFRFID] = "RFID LF",
-    [ArchiveTabIrda] = "Infrared",
+    [ArchiveTabInfrared] = "Infrared",
     [ArchiveTabBadUsb] = "Bad USB",
     [ArchiveTabU2f] = "U2F",
     [ArchiveTabBrowser] = "Browser"};
@@ -19,7 +19,7 @@ static const Icon* ArchiveItemIcons[] = {
     [ArchiveFileTypeNFC] = &I_Nfc_10px,
     [ArchiveFileTypeSubGhz] = &I_sub1_10px,
     [ArchiveFileTypeLFRFID] = &I_125_10px,
-    [ArchiveFileTypeIrda] = &I_ir_10px,
+    [ArchiveFileTypeInfrared] = &I_ir_10px,
     [ArchiveFileTypeBadUsb] = &I_badusb_10px,
     [ArchiveFileTypeU2f] = &I_u2f_10px,
     [ArchiveFileTypeFolder] = &I_dir_10px,

+ 1 - 1
applications/archive/views/archive_browser_view.h

@@ -22,7 +22,7 @@ typedef enum {
     ArchiveTabSubGhz,
     ArchiveTabLFRFID,
     ArchiveTabNFC,
-    ArchiveTabIrda,
+    ArchiveTabInfrared,
     ArchiveTabIButton,
     ArchiveTabBadUsb,
     ArchiveTabU2f,

+ 2 - 2
applications/gui/modules/button_menu.c

@@ -108,11 +108,11 @@ static void button_menu_view_draw_callback(Canvas* canvas, void* _model) {
     ButtonMenuItemArray_it_t it;
 
     if(active_screen > 0) {
-        canvas_draw_icon(canvas, 28, 1, &I_IrdaArrowUp_4x8);
+        canvas_draw_icon(canvas, 28, 1, &I_InfraredArrowUp_4x8);
     }
 
     if(max_screen > active_screen) {
-        canvas_draw_icon(canvas, 28, 123, &I_IrdaArrowDown_4x8);
+        canvas_draw_icon(canvas, 28, 123, &I_InfraredArrowDown_4x8);
     }
 
     if(model->header) {

+ 49 - 49
applications/irda/cli/irda_cli.cpp → applications/infrared/cli/infrared_cli.cpp

@@ -1,52 +1,52 @@
 #include <furi_hal_delay.h>
-#include <irda.h>
+#include <infrared.h>
 #include <app_template.h>
 #include <cli/cli.h>
 #include <cmsis_os2.h>
-#include <irda_worker.h>
+#include <infrared_worker.h>
 #include <furi.h>
-#include <furi_hal_irda.h>
+#include <furi_hal_infrared.h>
 #include <sstream>
 #include <string>
 #include <m-string.h>
-#include <irda_transmit.h>
+#include <infrared_transmit.h>
 #include <sys/types.h>
-#include "../helpers/irda_parser.h"
+#include "../helpers/infrared_parser.h"
 
-static void irda_cli_start_ir_rx(Cli* cli, string_t args);
-static void irda_cli_start_ir_tx(Cli* cli, string_t args);
+static void infrared_cli_start_ir_rx(Cli* cli, string_t args);
+static void infrared_cli_start_ir_tx(Cli* cli, string_t args);
 
 static const struct {
     const char* cmd;
     void (*process_function)(Cli* cli, string_t args);
-} irda_cli_commands[] = {
-    {.cmd = "rx", .process_function = irda_cli_start_ir_rx},
-    {.cmd = "tx", .process_function = irda_cli_start_ir_tx},
+} infrared_cli_commands[] = {
+    {.cmd = "rx", .process_function = infrared_cli_start_ir_rx},
+    {.cmd = "tx", .process_function = infrared_cli_start_ir_tx},
 };
 
-static void signal_received_callback(void* context, IrdaWorkerSignal* received_signal) {
+static void signal_received_callback(void* context, InfraredWorkerSignal* received_signal) {
     furi_assert(received_signal);
     char buf[100];
     size_t buf_cnt;
     Cli* cli = (Cli*)context;
 
-    if(irda_worker_signal_is_decoded(received_signal)) {
-        const IrdaMessage* message = irda_worker_get_decoded_signal(received_signal);
+    if(infrared_worker_signal_is_decoded(received_signal)) {
+        const InfraredMessage* message = infrared_worker_get_decoded_signal(received_signal);
         buf_cnt = sniprintf(
             buf,
             sizeof(buf),
             "%s, A:0x%0*lX, C:0x%0*lX%s\r\n",
-            irda_get_protocol_name(message->protocol),
-            ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4),
+            infrared_get_protocol_name(message->protocol),
+            ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4),
             message->address,
-            ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
+            ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4),
             message->command,
             message->repeat ? " R" : "");
         cli_write(cli, (uint8_t*)buf, buf_cnt);
     } else {
         const uint32_t* timings;
         size_t timings_cnt;
-        irda_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
+        infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
 
         buf_cnt = sniprintf(buf, sizeof(buf), "RAW, %d samples:\r\n", timings_cnt);
         cli_write(cli, (uint8_t*)buf, buf_cnt);
@@ -59,39 +59,39 @@ static void signal_received_callback(void* context, IrdaWorkerSignal* received_s
     }
 }
 
-static void irda_cli_start_ir_rx(Cli* cli, string_t args) {
-    IrdaWorker* worker = irda_worker_alloc();
-    irda_worker_rx_start(worker);
-    irda_worker_rx_set_received_signal_callback(worker, signal_received_callback, cli);
+static void infrared_cli_start_ir_rx(Cli* cli, string_t args) {
+    InfraredWorker* worker = infrared_worker_alloc();
+    infrared_worker_rx_start(worker);
+    infrared_worker_rx_set_received_signal_callback(worker, signal_received_callback, cli);
 
-    printf("Receiving IRDA...\r\nPress Ctrl+C to abort\r\n");
+    printf("Receiving INFRARED...\r\nPress Ctrl+C to abort\r\n");
     while(!cli_cmd_interrupt_received(cli)) {
         delay(50);
     }
 
-    irda_worker_rx_stop(worker);
-    irda_worker_free(worker);
+    infrared_worker_rx_stop(worker);
+    infrared_worker_free(worker);
 }
 
-static void irda_cli_print_usage(void) {
+static void infrared_cli_print_usage(void) {
     printf("Usage:\r\n");
     printf("\tir rx\r\n");
     printf("\tir tx <protocol> <address> <command>\r\n");
     printf("\t<command> and <address> are hex-formatted\r\n");
     printf("\tAvailable protocols:");
-    for(int i = 0; irda_is_protocol_valid((IrdaProtocol)i); ++i) {
-        printf(" %s", irda_get_protocol_name((IrdaProtocol)i));
+    for(int i = 0; infrared_is_protocol_valid((InfraredProtocol)i); ++i) {
+        printf(" %s", infrared_get_protocol_name((InfraredProtocol)i));
     }
     printf("\r\n");
     printf("\tRaw format:\r\n");
     printf("\tir_tx RAW F:<frequency> DC:<duty_cycle> <sample0> <sample1>...\r\n");
     printf(
         "\tFrequency (%d - %d), Duty cycle (0 - 100), max 512 samples\r\n",
-        IRDA_MIN_FREQUENCY,
-        IRDA_MAX_FREQUENCY);
+        INFRARED_MIN_FREQUENCY,
+        INFRARED_MAX_FREQUENCY);
 }
 
-static bool parse_message(const char* str, IrdaMessage* message) {
+static bool parse_message(const char* str, InfraredMessage* message) {
     char protocol_name[32];
     int parsed = sscanf(str, "%31s %lX %lX", protocol_name, &message->address, &message->command);
 
@@ -99,10 +99,10 @@ static bool parse_message(const char* str, IrdaMessage* message) {
         return false;
     }
 
-    message->protocol = irda_get_protocol_by_name(protocol_name);
+    message->protocol = infrared_get_protocol_by_name(protocol_name);
     message->repeat = false;
 
-    return irda_parser_is_parsed_signal_valid(message);
+    return infrared_parser_is_parsed_signal_valid(message);
 }
 
 static bool parse_signal_raw(
@@ -136,11 +136,11 @@ static bool parse_signal_raw(
         ++*timings_cnt;
     }
 
-    return irda_parser_is_raw_signal_valid(*frequency, *duty_cycle, *timings_cnt);
+    return infrared_parser_is_raw_signal_valid(*frequency, *duty_cycle, *timings_cnt);
 }
 
-static void irda_cli_start_ir_tx(Cli* cli, string_t args) {
-    IrdaMessage message;
+static void infrared_cli_start_ir_tx(Cli* cli, string_t args) {
+    InfraredMessage message;
     const char* str = string_get_cstr(args);
     uint32_t frequency;
     float duty_cycle;
@@ -148,27 +148,27 @@ static void irda_cli_start_ir_tx(Cli* cli, string_t args) {
     uint32_t* timings = (uint32_t*)malloc(sizeof(uint32_t) * timings_cnt);
 
     if(parse_message(str, &message)) {
-        irda_send(&message, 1);
+        infrared_send(&message, 1);
     } else if(parse_signal_raw(str, timings, &timings_cnt, &duty_cycle, &frequency)) {
-        irda_send_raw_ext(timings, timings_cnt, true, frequency, duty_cycle);
+        infrared_send_raw_ext(timings, timings_cnt, true, frequency, duty_cycle);
     } else {
         printf("Wrong arguments.\r\n");
-        irda_cli_print_usage();
+        infrared_cli_print_usage();
     }
 
     free(timings);
 }
 
-static void irda_cli_start_ir(Cli* cli, string_t args, void* context) {
-    if(furi_hal_irda_is_busy()) {
-        printf("IRDA is busy. Exit.");
+static void infrared_cli_start_ir(Cli* cli, string_t args, void* context) {
+    if(furi_hal_infrared_is_busy()) {
+        printf("INFRARED is busy. Exit.");
         return;
     }
 
     size_t i = 0;
-    for(; i < COUNT_OF(irda_cli_commands); ++i) {
-        size_t size = strlen(irda_cli_commands[i].cmd);
-        bool cmd_found = !strncmp(string_get_cstr(args), irda_cli_commands[i].cmd, size);
+    for(; i < COUNT_OF(infrared_cli_commands); ++i) {
+        size_t size = strlen(infrared_cli_commands[i].cmd);
+        bool cmd_found = !strncmp(string_get_cstr(args), infrared_cli_commands[i].cmd, size);
         if(cmd_found) {
             if(string_size(args) == size) {
                 break;
@@ -180,17 +180,17 @@ static void irda_cli_start_ir(Cli* cli, string_t args, void* context) {
         }
     }
 
-    if(i < COUNT_OF(irda_cli_commands)) {
-        irda_cli_commands[i].process_function(cli, args);
+    if(i < COUNT_OF(infrared_cli_commands)) {
+        infrared_cli_commands[i].process_function(cli, args);
     } else {
-        irda_cli_print_usage();
+        infrared_cli_print_usage();
     }
 }
 
-extern "C" void irda_on_system_start() {
+extern "C" void infrared_on_system_start() {
 #ifdef SRV_CLI
     Cli* cli = (Cli*)furi_record_open("cli");
-    cli_add_command(cli, "ir", CliCommandFlagDefault, irda_cli_start_ir, NULL);
+    cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir, NULL);
     furi_record_close("cli");
 #endif
 }

+ 24 - 21
applications/irda/helpers/irda_parser.cpp → applications/infrared/helpers/infrared_parser.cpp

@@ -1,19 +1,19 @@
 
-#include "../irda_app_signal.h"
-#include "irda.h"
-#include "irda/helpers/irda_parser.h"
-#include "irda_worker.h"
+#include "../infrared_app_signal.h"
+#include "infrared.h"
+#include "infrared/helpers/infrared_parser.h"
+#include "infrared_worker.h"
 #include "m-string.h"
 #include <flipper_format/flipper_format.h>
 #include <memory>
 #include <string>
-#include <furi_hal_irda.h>
+#include <furi_hal_infrared.h>
 
-#define TAG "IrdaParser"
+#define TAG "InfraredParser"
 
-bool irda_parser_save_signal(
+bool infrared_parser_save_signal(
     FlipperFormat* ff,
-    const IrdaAppSignal& signal,
+    const InfraredAppSignal& signal,
     const std::string& name) {
     furi_assert(ff);
     furi_assert(!name.empty());
@@ -33,7 +33,7 @@ bool irda_parser_save_signal(
                 break;
         } else {
             auto parsed_signal = signal.get_message();
-            const char* protocol_name = irda_get_protocol_name(parsed_signal.protocol);
+            const char* protocol_name = infrared_get_protocol_name(parsed_signal.protocol);
             if(!flipper_format_write_string_cstr(ff, "type", "parsed")) break;
             if(!flipper_format_write_string_cstr(ff, "protocol", protocol_name)) break;
             if(!flipper_format_write_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4))
@@ -47,7 +47,7 @@ bool irda_parser_save_signal(
     return result;
 }
 
-bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::string& name) {
+bool infrared_parser_read_signal(FlipperFormat* ff, InfraredAppSignal& signal, std::string& name) {
     furi_assert(ff);
 
     bool result = false;
@@ -75,12 +75,12 @@ bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::stri
             }
             free(timings);
         } else if(!string_cmp_str(read_string, "parsed")) {
-            IrdaMessage parsed_signal;
+            InfraredMessage parsed_signal;
             if(!flipper_format_read_string(ff, "protocol", read_string)) break;
-            parsed_signal.protocol = irda_get_protocol_by_name(string_get_cstr(read_string));
+            parsed_signal.protocol = infrared_get_protocol_by_name(string_get_cstr(read_string));
             if(!flipper_format_read_hex(ff, "address", (uint8_t*)&parsed_signal.address, 4)) break;
             if(!flipper_format_read_hex(ff, "command", (uint8_t*)&parsed_signal.command, 4)) break;
-            if(!irda_parser_is_parsed_signal_valid(&parsed_signal)) break;
+            if(!infrared_parser_is_parsed_signal_valid(&parsed_signal)) break;
             signal.set_message(&parsed_signal);
             result = true;
         } else {
@@ -92,17 +92,17 @@ bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::stri
     return result;
 }
 
-bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal) {
+bool infrared_parser_is_parsed_signal_valid(const InfraredMessage* signal) {
     furi_assert(signal);
     bool result = true;
 
-    if(!irda_is_protocol_valid(signal->protocol)) {
+    if(!infrared_is_protocol_valid(signal->protocol)) {
         FURI_LOG_E(TAG, "Unknown protocol");
         result = false;
     }
 
     if(result) {
-        uint32_t address_length = irda_get_protocol_address_length(signal->protocol);
+        uint32_t address_length = infrared_get_protocol_address_length(signal->protocol);
         uint32_t address_mask = (1LU << address_length) - 1;
         if(signal->address != (signal->address & address_mask)) {
             FURI_LOG_E(
@@ -115,7 +115,7 @@ bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal) {
     }
 
     if(result) {
-        uint32_t command_length = irda_get_protocol_command_length(signal->protocol);
+        uint32_t command_length = infrared_get_protocol_command_length(signal->protocol);
         uint32_t command_mask = (1LU << command_length) - 1;
         if(signal->command != (signal->command & command_mask)) {
             FURI_LOG_E(
@@ -130,15 +130,18 @@ bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal) {
     return result;
 }
 
-bool irda_parser_is_raw_signal_valid(uint32_t frequency, float duty_cycle, uint32_t timings_cnt) {
+bool infrared_parser_is_raw_signal_valid(
+    uint32_t frequency,
+    float duty_cycle,
+    uint32_t timings_cnt) {
     bool result = true;
 
-    if((frequency > IRDA_MAX_FREQUENCY) || (frequency < IRDA_MIN_FREQUENCY)) {
+    if((frequency > INFRARED_MAX_FREQUENCY) || (frequency < INFRARED_MIN_FREQUENCY)) {
         FURI_LOG_E(
             TAG,
             "Frequency is out of range (%lX - %lX): %lX",
-            IRDA_MIN_FREQUENCY,
-            IRDA_MAX_FREQUENCY,
+            INFRARED_MIN_FREQUENCY,
+            INFRARED_MAX_FREQUENCY,
             frequency);
         result = false;
     } else if((duty_cycle <= 0) || (duty_cycle > 1)) {

+ 48 - 0
applications/infrared/helpers/infrared_parser.h

@@ -0,0 +1,48 @@
+/**
+  * @file infrared_parser.h
+  * Infrared: Helper file for conversion Flipper File Format
+  *     to Infrared signal class, and backwards
+  */
+#pragma once
+
+#include "../infrared_app_signal.h"
+#include <flipper_format/flipper_format.h>
+#include <string>
+
+/** Save Infrared signal into file
+ *
+ * @param ff - Flipper File Format instance
+ * @param signal - Infrared signal to save
+ * @param name - name for saved signal. Every
+ *      signal on disk has name.
+ */
+bool infrared_parser_save_signal(
+    FlipperFormat* ff,
+    const InfraredAppSignal& signal,
+    const std::string& name);
+
+/** Read Infrared signal from file
+ *
+ * @param ff - Flipper File Format instance
+ * @param signal - Infrared signal to read to
+ * @param name - name for saved signal. Every
+ *      signal in file has name.
+ */
+bool infrared_parser_read_signal(FlipperFormat* ff, InfraredAppSignal& signal, std::string& name);
+
+/** Validate parsed signal
+ *
+ * @signal - signal to validate
+ * @retval true if valid, false otherwise
+ */
+bool infrared_parser_is_parsed_signal_valid(const InfraredMessage* signal);
+
+/** Validate raw signal
+ *
+ * @signal - signal to validate
+ * @retval true if valid, false otherwise
+ */
+bool infrared_parser_is_raw_signal_valid(
+    uint32_t frequency,
+    float duty_cycle,
+    uint32_t timings_cnt);

+ 54 - 67
applications/irda/irda_app.cpp → applications/infrared/infrared_app.cpp

@@ -1,13 +1,13 @@
-#include "irda_app.h"
-#include <irda_worker.h>
+#include "infrared_app.h"
+#include <infrared_worker.h>
 #include <furi.h>
 #include <gui/gui.h>
 #include <input/input.h>
 #include <stdio.h>
 #include <callback-connector.h>
 
-int32_t IrdaApp::run(void* args) {
-    IrdaAppEvent event;
+int32_t InfraredApp::run(void* args) {
+    InfraredAppEvent event;
     bool consumed;
     bool exit = false;
 
@@ -17,7 +17,7 @@ int32_t IrdaApp::run(void* args) {
         remote_name.erase(remote_name.find_last_of('.'));
         bool result = remote_manager.load(remote_name);
         if(result) {
-            current_scene = IrdaApp::Scene::Remote;
+            current_scene = InfraredApp::Scene::Remote;
         } else {
             printf("Failed to load remote \'%s\'\r\n", remote_name.c_str());
             return -1;
@@ -29,12 +29,12 @@ int32_t IrdaApp::run(void* args) {
     while(!exit) {
         view_manager.receive_event(&event);
 
-        if(event.type == IrdaAppEvent::Type::Exit) break;
+        if(event.type == InfraredAppEvent::Type::Exit) break;
 
         consumed = scenes[current_scene]->on_event(this, &event);
 
         if(!consumed) {
-            if(event.type == IrdaAppEvent::Type::Back) {
+            if(event.type == InfraredAppEvent::Type::Back) {
                 exit = switch_to_previous_scene();
             }
         }
@@ -45,36 +45,36 @@ int32_t IrdaApp::run(void* args) {
     return 0;
 };
 
-IrdaApp::IrdaApp() {
-    furi_check(IrdaAppRemoteManager::max_button_name_length < get_text_store_size());
+InfraredApp::InfraredApp() {
+    furi_check(InfraredAppRemoteManager::max_button_name_length < get_text_store_size());
     notification = static_cast<NotificationApp*>(furi_record_open("notification"));
-    irda_worker = irda_worker_alloc();
+    infrared_worker = infrared_worker_alloc();
 }
 
-IrdaApp::~IrdaApp() {
-    irda_worker_free(irda_worker);
+InfraredApp::~InfraredApp() {
+    infrared_worker_free(infrared_worker);
     furi_record_close("notification");
     for(auto& [key, scene] : scenes) delete scene;
 }
 
-IrdaAppViewManager* IrdaApp::get_view_manager() {
+InfraredAppViewManager* InfraredApp::get_view_manager() {
     return &view_manager;
 }
 
-void IrdaApp::set_learn_new_remote(bool value) {
+void InfraredApp::set_learn_new_remote(bool value) {
     learn_new_remote = value;
 }
 
-bool IrdaApp::get_learn_new_remote() {
+bool InfraredApp::get_learn_new_remote() {
     return learn_new_remote;
 }
 
-void IrdaApp::switch_to_next_scene(Scene next_scene) {
+void InfraredApp::switch_to_next_scene(Scene next_scene) {
     previous_scenes_list.push_front(current_scene);
     switch_to_next_scene_without_saving(next_scene);
 }
 
-void IrdaApp::switch_to_next_scene_without_saving(Scene next_scene) {
+void InfraredApp::switch_to_next_scene_without_saving(Scene next_scene) {
     if(next_scene != Scene::Exit) {
         scenes[current_scene]->on_exit(this);
         current_scene = next_scene;
@@ -83,7 +83,8 @@ void IrdaApp::switch_to_next_scene_without_saving(Scene next_scene) {
     }
 }
 
-void IrdaApp::search_and_switch_to_previous_scene(const std::initializer_list<Scene>& scenes_list) {
+void InfraredApp::search_and_switch_to_previous_scene(
+    const std::initializer_list<Scene>& scenes_list) {
     Scene previous_scene = Scene::Start;
     bool scene_found = false;
 
@@ -101,8 +102,8 @@ void IrdaApp::search_and_switch_to_previous_scene(const std::initializer_list<Sc
     }
 
     if(previous_scene == Scene::Exit) {
-        IrdaAppEvent event;
-        event.type = IrdaAppEvent::Type::Exit;
+        InfraredAppEvent event;
+        event.type = InfraredAppEvent::Type::Exit;
         view_manager.send_event(&event);
     } else {
         scenes[current_scene]->on_exit(this);
@@ -112,7 +113,7 @@ void IrdaApp::search_and_switch_to_previous_scene(const std::initializer_list<Sc
     }
 }
 
-bool IrdaApp::switch_to_previous_scene(uint8_t count) {
+bool InfraredApp::switch_to_previous_scene(uint8_t count) {
     Scene previous_scene = Scene::Start;
 
     for(uint8_t i = 0; i < count; i++) previous_scene = get_previous_scene();
@@ -126,7 +127,7 @@ bool IrdaApp::switch_to_previous_scene(uint8_t count) {
     return false;
 }
 
-IrdaApp::Scene IrdaApp::get_previous_scene() {
+InfraredApp::Scene InfraredApp::get_previous_scene() {
     Scene scene = Scene::Exit;
 
     if(!previous_scenes_list.empty()) {
@@ -137,11 +138,11 @@ IrdaApp::Scene IrdaApp::get_previous_scene() {
     return scene;
 }
 
-IrdaAppRemoteManager* IrdaApp::get_remote_manager() {
+InfraredAppRemoteManager* InfraredApp::get_remote_manager() {
     return &remote_manager;
 }
 
-void IrdaApp::set_text_store(uint8_t index, const char* text...) {
+void InfraredApp::set_text_store(uint8_t index, const char* text...) {
     furi_check(index < text_store_max);
 
     va_list args;
@@ -152,77 +153,63 @@ void IrdaApp::set_text_store(uint8_t index, const char* text...) {
     va_end(args);
 }
 
-char* IrdaApp::get_text_store(uint8_t index) {
+char* InfraredApp::get_text_store(uint8_t index) {
     furi_check(index < text_store_max);
 
     return text_store[index];
 }
 
-uint8_t IrdaApp::get_text_store_size() {
+uint8_t InfraredApp::get_text_store_size() {
     return text_store_size;
 }
 
-void IrdaApp::text_input_callback(void* context) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
-    event.type = IrdaAppEvent::Type::TextEditDone;
+void InfraredApp::text_input_callback(void* context) {
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
+    event.type = InfraredAppEvent::Type::TextEditDone;
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaApp::popup_callback(void* context) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
-    event.type = IrdaAppEvent::Type::PopupTimer;
+void InfraredApp::popup_callback(void* context) {
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
+    event.type = InfraredAppEvent::Type::PopupTimer;
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaApp::set_edit_element(IrdaApp::EditElement value) {
+void InfraredApp::set_edit_element(InfraredApp::EditElement value) {
     element = value;
 }
 
-IrdaApp::EditElement IrdaApp::get_edit_element(void) {
+InfraredApp::EditElement InfraredApp::get_edit_element(void) {
     return element;
 }
 
-void IrdaApp::set_edit_action(IrdaApp::EditAction value) {
+void InfraredApp::set_edit_action(InfraredApp::EditAction value) {
     action = value;
 }
 
-IrdaApp::EditAction IrdaApp::get_edit_action(void) {
+InfraredApp::EditAction InfraredApp::get_edit_action(void) {
     return action;
 }
 
-void IrdaApp::set_current_button(int value) {
+void InfraredApp::set_current_button(int value) {
     current_button = value;
 }
 
-int IrdaApp::get_current_button() {
+int InfraredApp::get_current_button() {
     return current_button;
 }
 
-void IrdaApp::notify_success() {
+void InfraredApp::notify_success() {
     notification_message(notification, &sequence_success);
 }
 
-void IrdaApp::notify_red_blink() {
+void InfraredApp::notify_red_blink() {
     notification_message(notification, &sequence_blink_red_10);
 }
 
-void IrdaApp::notify_sent_just_learnt() {
-    static const NotificationSequence sequence = {
-        &message_green_0,
-        &message_vibro_on,
-        &message_delay_50,
-        &message_vibro_off,
-        &message_green_255,
-        &message_do_not_reset,
-        NULL,
-    };
-
-    notification_message_block(notification, &sequence);
-}
-
-void IrdaApp::notify_click() {
+void InfraredApp::notify_click() {
     static const NotificationSequence sequence = {
         &message_click,
         &message_delay_1,
@@ -233,7 +220,7 @@ void IrdaApp::notify_click() {
     notification_message_block(notification, &sequence);
 }
 
-void IrdaApp::notify_click_and_green_blink() {
+void InfraredApp::notify_click_and_green_blink() {
     static const NotificationSequence sequence = {
         &message_click,
         &message_delay_1,
@@ -248,7 +235,7 @@ void IrdaApp::notify_click_and_green_blink() {
     notification_message_block(notification, &sequence);
 }
 
-void IrdaApp::notify_blink_green() {
+void InfraredApp::notify_blink_green() {
     static const NotificationSequence sequence = {
         &message_green_255,
         &message_delay_10,
@@ -260,27 +247,27 @@ void IrdaApp::notify_blink_green() {
     notification_message(notification, &sequence);
 }
 
-void IrdaApp::notify_green_on() {
+void InfraredApp::notify_green_on() {
     notification_message(notification, &sequence_set_only_green_255);
 }
 
-void IrdaApp::notify_green_off() {
+void InfraredApp::notify_green_off() {
     notification_message(notification, &sequence_reset_green);
 }
 
-IrdaWorker* IrdaApp::get_irda_worker() {
-    return irda_worker;
+InfraredWorker* InfraredApp::get_infrared_worker() {
+    return infrared_worker;
 }
 
-const IrdaAppSignal& IrdaApp::get_received_signal() const {
+const InfraredAppSignal& InfraredApp::get_received_signal() const {
     return received_signal;
 }
 
-void IrdaApp::set_received_signal(const IrdaAppSignal& signal) {
+void InfraredApp::set_received_signal(const InfraredAppSignal& signal) {
     received_signal = signal;
 }
 
-void IrdaApp::signal_sent_callback(void* context) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
+void InfraredApp::signal_sent_callback(void* context) {
+    InfraredApp* app = static_cast<InfraredApp*>(context);
     app->notify_blink_green();
 }

+ 322 - 0
applications/infrared/infrared_app.h

@@ -0,0 +1,322 @@
+/**
+  * @file infrared_app.h
+  * Infrared: Main infrared application class
+  */
+#pragma once
+#include <map>
+#include <infrared.h>
+#include <furi.h>
+#include <forward_list>
+#include <stdint.h>
+#include <notification/notification_messages.h>
+#include <infrared_worker.h>
+
+#include "scene/infrared_app_scene.h"
+#include "scene/infrared_app_scene.h"
+#include "infrared_app_view_manager.h"
+#include "infrared_app_remote_manager.h"
+#include "infrared_app_view_manager.h"
+
+/** Main Infrared application class */
+class InfraredApp {
+public:
+    /** Enum to save scene state: edit element */
+    enum class EditElement : uint8_t {
+        Button,
+        Remote,
+    };
+    /** Enum to save scene state: edit action */
+    enum class EditAction : uint8_t {
+        Rename,
+        Delete,
+    };
+    /** List of scenes for Infrared application */
+    enum class Scene : uint8_t {
+        Exit,
+        Start,
+        Universal,
+        UniversalTV,
+        UniversalAudio,
+        UniversalAirConditioner,
+        Learn,
+        LearnSuccess,
+        LearnEnterName,
+        LearnDone,
+        AskBack,
+        Remote,
+        RemoteList,
+        Edit,
+        EditKeySelect,
+        EditRename,
+        EditDelete,
+        EditRenameDone,
+        EditDeleteDone,
+    };
+
+    /** Start application
+ *
+ * @param args - application arguments.
+ *      Allowed argument is path to remote file.
+ * @retval 0 on success, error code otherwise
+ */
+    int32_t run(void* args);
+
+    /** Switch to next scene. Put current scene number on stack.
+ * Doesn't save scene state.
+ *
+ * @param index - next scene index
+ */
+    void switch_to_next_scene(Scene index);
+
+    /** Switch to next scene, but don't put current scene on
+ * stack. Thus calling switch_to_previous_scene() doesn't return
+ * to current scene.
+ *
+ * @param index - next scene index
+ */
+    void switch_to_next_scene_without_saving(Scene index);
+
+    /** Switch to previous scene. Pop scenes from stack and switch to last one.
+ *
+ * @param count - how many scenes should be popped
+ * @retval false on failed, true on success
+ */
+    bool switch_to_previous_scene(uint8_t count = 1);
+
+    /** Get previous scene in scene stack
+ *
+ * @retval previous scene
+ */
+    Scene get_previous_scene();
+
+    /** Get view manager instance
+ *
+ * @retval view manager instance
+ */
+    InfraredAppViewManager* get_view_manager();
+
+    /** Set one of text stores
+ *
+ * @param index - index of text store
+ * @param text - text to set
+ */
+    void set_text_store(uint8_t index, const char* text...);
+
+    /** Get value in text store
+ *
+ * @param index - index of text store
+ * @retval value in text_store
+ */
+    char* get_text_store(uint8_t index);
+
+    /** Get text store size
+ *
+ * @retval size of text store
+ */
+    uint8_t get_text_store_size();
+
+    /** Get remote manager instance
+ *
+ * @retval remote manager instance
+ */
+    InfraredAppRemoteManager* get_remote_manager();
+
+    /** Get infrared worker instance
+ *
+ * @retval infrared worker instance
+ */
+    InfraredWorker* get_infrared_worker();
+
+    /** Get signal, previously got on Learn scene
+ *
+ * @retval received signal
+ */
+    const InfraredAppSignal& get_received_signal() const;
+
+    /** Set received signal
+ *
+ * @param signal - signal
+ */
+    void set_received_signal(const InfraredAppSignal& signal);
+
+    /** Switch to previous scene in one of provided in list.
+ * Pop scene stack, and find first scene from list.
+ *
+ * @param scenes_list - list of scenes
+ */
+    void search_and_switch_to_previous_scene(const std::initializer_list<Scene>& scenes_list);
+
+    /** Set edit element value. It is used on edit scene to determine
+ * what should be deleted - remote or button.
+ *
+ * @param value - value to set
+ */
+    void set_edit_element(EditElement value);
+
+    /** Get edit element
+ *
+ * @retval edit element value
+ */
+    EditElement get_edit_element(void);
+
+    /** Set edit action value. It is used on edit scene to determine
+ * what action to perform - deletion or renaming.
+ *
+ * @param value - value to set
+ */
+    void set_edit_action(EditAction value);
+
+    /** Get edit action
+ *
+ * @retval edit action value
+ */
+    EditAction get_edit_action(void);
+
+    /** Get state of learning new signal.
+ * Adding new remote with 1 button from start scene and
+ * learning 1 additional button to remote have very similar
+ * flow, so they are joined. Difference in flow is handled
+ * by this boolean flag.
+ *
+ * @retval false if flow is in learning new remote, true if
+ *      adding signal to created remote
+ *
+ */
+    bool get_learn_new_remote();
+
+    /** Set state of learning new signal.
+ * Adding new remote with 1 button from start scene and
+ * learning 1 additional button to remote have very similar
+ * flow, so they are joined. Difference in flow is handled
+ * by this boolean flag.
+ *
+ * @param value - false if flow is in learning new remote, true if
+ *      adding signal to created remote
+ */
+    void set_learn_new_remote(bool value);
+
+    /** Button is not assigned value
+ */
+    enum : int {
+        ButtonNA = -1,
+    };
+
+    /** Get current button index
+ *
+ * @retval current button index
+ */
+    int get_current_button();
+
+    /** Set current button index
+ *
+ * @param current button index
+ */
+    void set_current_button(int value);
+
+    /** Play success notification */
+    void notify_success();
+    /** Play red blink notification */
+    void notify_red_blink();
+    /** Light green */
+    void notify_green_on();
+    /** Disable green light */
+    void notify_green_off();
+    /** Play click sound */
+    void notify_click();
+    /** Play click and green notification */
+    void notify_click_and_green_blink();
+    /** Blink green light */
+    void notify_blink_green();
+
+    /** Text input callback
+ *
+ * @param context - context to pass to callback
+ */
+    static void text_input_callback(void* context);
+
+    /** Popup callback
+ *
+ * @param context - context to pass to callback
+ */
+    static void popup_callback(void* context);
+
+    /** Signal sent callback
+ *
+ * @param context - context to pass to callback
+ */
+    static void signal_sent_callback(void* context);
+
+    /** Main class constructor, initializes all critical objects */
+    InfraredApp();
+    /** Main class destructor, deinitializes all critical objects */
+    ~InfraredApp();
+
+    /** Path to Infrared directory */
+    static constexpr const char* infrared_directory = "/any/infrared";
+    /** Infrared files extension (remote files and universal databases) */
+    static constexpr const char* infrared_extension = ".ir";
+    /** Max Raw timings in signal */
+    static constexpr const uint32_t max_raw_timings_in_signal = 512;
+    /** Max line length in Infrared file */
+    static constexpr const uint32_t max_line_length =
+        (9 + 1) * InfraredApp::max_raw_timings_in_signal + 100;
+
+private:
+    /** Text store size */
+    static constexpr const uint8_t text_store_size = 128;
+    /** Amount of text stores */
+    static constexpr const uint8_t text_store_max = 2;
+    /** Store text here, for some views, because they doesn't
+ * hold ownership of text */
+    char text_store[text_store_max][text_store_size + 1];
+    /**
+ * Flag to control adding new signal flow.
+ * Adding new remote with 1 button from start scene and
+ * learning 1 additional button to remote have very similar
+ * flow, so they are joined. Difference in flow is handled
+ * by this boolean flag.
+ */
+    bool learn_new_remote;
+    /** Value to control edit scene */
+    EditElement element;
+    /** Value to control edit scene */
+    EditAction action;
+    /** Selected button index */
+    uint32_t current_button;
+
+    /** Notification instance */
+    NotificationApp* notification;
+    /** View manager instance */
+    InfraredAppViewManager view_manager;
+    /** Remote manager instance */
+    InfraredAppRemoteManager remote_manager;
+    /** Infrared worker instance */
+    InfraredWorker* infrared_worker;
+    /** Signal received on Learn scene */
+    InfraredAppSignal received_signal;
+
+    /** Stack of previous scenes */
+    std::forward_list<Scene> previous_scenes_list;
+    /** Now acting scene */
+    Scene current_scene = Scene::Start;
+
+    /** Map of index/scene objects */
+    std::map<Scene, InfraredAppScene*> scenes = {
+        {Scene::Start, new InfraredAppSceneStart()},
+        {Scene::Universal, new InfraredAppSceneUniversal()},
+        {Scene::UniversalTV, new InfraredAppSceneUniversalTV()},
+        {Scene::Learn, new InfraredAppSceneLearn()},
+        {Scene::LearnSuccess, new InfraredAppSceneLearnSuccess()},
+        {Scene::LearnEnterName, new InfraredAppSceneLearnEnterName()},
+        {Scene::LearnDone, new InfraredAppSceneLearnDone()},
+        {Scene::AskBack, new InfraredAppSceneAskBack()},
+        {Scene::Remote, new InfraredAppSceneRemote()},
+        {Scene::RemoteList, new InfraredAppSceneRemoteList()},
+        {Scene::Edit, new InfraredAppSceneEdit()},
+        {Scene::EditKeySelect, new InfraredAppSceneEditKeySelect()},
+        {Scene::EditRename, new InfraredAppSceneEditRename()},
+        {Scene::EditDelete, new InfraredAppSceneEditDelete()},
+        {Scene::EditRenameDone, new InfraredAppSceneEditRenameDone()},
+        {Scene::EditDeleteDone, new InfraredAppSceneEditDeleteDone()},
+    };
+};

+ 11 - 11
applications/irda/irda_app_brute_force.cpp → applications/infrared/infrared_app_brute_force.cpp

@@ -1,18 +1,18 @@
 
-#include "helpers/irda_parser.h"
-#include "irda_app_brute_force.h"
-#include "irda_app_signal.h"
+#include "helpers/infrared_parser.h"
+#include "infrared_app_brute_force.h"
+#include "infrared_app_signal.h"
 #include <memory>
 #include <m-string.h>
 #include <furi.h>
 #include <file_worker_cpp.h>
 
-void IrdaAppBruteForce::add_record(int index, const char* name) {
+void InfraredAppBruteForce::add_record(int index, const char* name) {
     records[name].index = index;
     records[name].amount = 0;
 }
 
-bool IrdaAppBruteForce::calculate_messages() {
+bool InfraredAppBruteForce::calculate_messages() {
     bool result = false;
 
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
@@ -20,7 +20,7 @@ bool IrdaAppBruteForce::calculate_messages() {
     result = flipper_format_file_open_existing(ff, universal_db_filename);
 
     if(result) {
-        IrdaAppSignal signal;
+        InfraredAppSignal signal;
 
         string_t signal_name;
         string_init(signal_name);
@@ -38,7 +38,7 @@ bool IrdaAppBruteForce::calculate_messages() {
     return result;
 }
 
-void IrdaAppBruteForce::stop_bruteforce() {
+void InfraredAppBruteForce::stop_bruteforce() {
     furi_assert((current_record.size()));
 
     if(current_record.size()) {
@@ -49,15 +49,15 @@ void IrdaAppBruteForce::stop_bruteforce() {
     }
 }
 
-bool IrdaAppBruteForce::send_next_bruteforce(void) {
+bool InfraredAppBruteForce::send_next_bruteforce(void) {
     furi_assert(current_record.size());
     furi_assert(ff);
 
-    IrdaAppSignal signal;
+    InfraredAppSignal signal;
     std::string signal_name;
     bool result = false;
     do {
-        result = irda_parser_read_signal(ff, signal, signal_name);
+        result = infrared_parser_read_signal(ff, signal, signal_name);
     } while(result && current_record.compare(signal_name));
 
     if(result) {
@@ -66,7 +66,7 @@ bool IrdaAppBruteForce::send_next_bruteforce(void) {
     return result;
 }
 
-bool IrdaAppBruteForce::start_bruteforce(int index, int& record_amount) {
+bool InfraredAppBruteForce::start_bruteforce(int index, int& record_amount) {
     bool result = false;
     record_amount = 0;
 

+ 67 - 0
applications/infrared/infrared_app_brute_force.h

@@ -0,0 +1,67 @@
+/**
+  * @file infrared_app_brute_force.h
+  * Infrared: Brute Force class description
+  */
+#pragma once
+
+#include <unordered_map>
+#include <memory>
+#include <flipper_format/flipper_format.h>
+
+/** Class handles brute force mechanic */
+class InfraredAppBruteForce {
+    /** Universal database filename */
+    const char* universal_db_filename;
+
+    /** Current record name (POWER, MUTE, VOL+, etc).
+     * This is the name of signal to brute force. */
+    std::string current_record;
+
+    /** Flipper File Format instance */
+    FlipperFormat* ff;
+
+    /** Data about every record - index in button panel view
+     * and amount of signals, which is need for correct
+     * progress bar displaying. */
+    typedef struct {
+        /** Index of record in button panel view model */
+        int index;
+        /** Amount of signals of that type (POWER, MUTE, etc) */
+        int amount;
+    } Record;
+
+    /** Container to hold Record info.
+     * 'key' is record name, because we have to search by both, index and name,
+     * but index search has place once per button press, and should not be
+     * noticed, but name search should occur during entering universal menu,
+     * and will go through container for every record in file, that's why
+     * more critical to have faster search by record name.
+     */
+    std::unordered_map<std::string, Record> records;
+
+public:
+    /** Calculate messages. Walk through the file ('universal_db_name')
+     * and calculate amount of records of certain type. */
+    bool calculate_messages();
+
+    /** Start brute force */
+    bool start_bruteforce(int index, int& record_amount);
+
+    /** Stop brute force */
+    void stop_bruteforce();
+
+    /** Send next signal during brute force */
+    bool send_next_bruteforce();
+
+    /** Add record to container of records */
+    void add_record(int index, const char* name);
+
+    /** Initialize class, set db file */
+    InfraredAppBruteForce(const char* filename)
+        : universal_db_filename(filename) {
+    }
+
+    /** Deinitialize class */
+    ~InfraredAppBruteForce() {
+    }
+};

+ 47 - 0
applications/infrared/infrared_app_event.h

@@ -0,0 +1,47 @@
+/**
+  * @file infrared_app_event.h
+  * Infrared: Scene events description
+  */
+#pragma once
+#include <infrared.h>
+#include <gui/modules/dialog_ex.h>
+
+/** Infrared events class */
+class InfraredAppEvent {
+public:
+    /** Type of event enum */
+    enum class Type : uint8_t {
+        /** Tick event come after no other events came in 100 ms */
+        Tick,
+        /** Exit application event */
+        Exit,
+        /** Back event */
+        Back,
+        /** Menu selected event type. Provided with payload value. */
+        MenuSelected,
+        /** Button press event. Need for continuous signal sending. */
+        MenuSelectedPress,
+        /** Button release event. Need for continuous signal sending. */
+        MenuSelectedRelease,
+        /** Events from DialogEx view module */
+        DialogExSelected,
+        /** Infrared signal received event */
+        InfraredMessageReceived,
+        /** Text edit done event */
+        TextEditDone,
+        /** Popup timer finished event */
+        PopupTimer,
+        /** Button panel pressed event */
+        ButtonPanelPressed,
+    };
+
+    union {
+        /** Menu selected event type payload. Selected index. */
+        int32_t menu_index;
+        /** DialogEx view module event type payload */
+        DialogExResult dialog_ex_result;
+    } payload;
+
+    /** Type of event */
+    Type type;
+};

+ 30 - 41
applications/irda/irda_app_remote_manager.cpp → applications/infrared/infrared_app_remote_manager.cpp

@@ -1,25 +1,26 @@
 #include <file_worker_cpp.h>
 #include <flipper_format/flipper_format.h>
-#include "irda_app_remote_manager.h"
-#include "irda/helpers/irda_parser.h"
-#include "irda/irda_app_signal.h"
+#include "infrared_app_remote_manager.h"
+#include "infrared/helpers/infrared_parser.h"
+#include "infrared/infrared_app_signal.h"
 
 #include <utility>
 
-#include <irda.h>
+#include <infrared.h>
 #include <cstdio>
 #include <furi.h>
 #include <gui/modules/button_menu.h>
 #include <storage/storage.h>
-#include "irda_app.h"
+#include "infrared_app.h"
 
 static const std::string default_remote_name = "remote";
 
-std::string IrdaAppRemoteManager::make_full_name(const std::string& remote_name) const {
-    return std::string("") + IrdaApp::irda_directory + "/" + remote_name + IrdaApp::irda_extension;
+std::string InfraredAppRemoteManager::make_full_name(const std::string& remote_name) const {
+    return std::string("") + InfraredApp::infrared_directory + "/" + remote_name +
+           InfraredApp::infrared_extension;
 }
 
-std::string IrdaAppRemoteManager::find_vacant_remote_name(const std::string& name) {
+std::string InfraredAppRemoteManager::find_vacant_remote_name(const std::string& name) {
     bool exist = true;
     FileWorkerCpp file_worker;
 
@@ -41,14 +42,14 @@ std::string IrdaAppRemoteManager::find_vacant_remote_name(const std::string& nam
     return !exist ? name + std::to_string(i) : std::string();
 }
 
-bool IrdaAppRemoteManager::add_button(const char* button_name, const IrdaAppSignal& signal) {
+bool InfraredAppRemoteManager::add_button(const char* button_name, const InfraredAppSignal& signal) {
     remote->buttons.emplace_back(button_name, signal);
     return store();
 }
 
-bool IrdaAppRemoteManager::add_remote_with_button(
+bool InfraredAppRemoteManager::add_remote_with_button(
     const char* button_name,
-    const IrdaAppSignal& signal) {
+    const InfraredAppSignal& signal) {
     furi_check(button_name != nullptr);
 
     auto new_name = find_vacant_remote_name(default_remote_name);
@@ -56,11 +57,11 @@ bool IrdaAppRemoteManager::add_remote_with_button(
         return false;
     }
 
-    remote = std::make_unique<IrdaAppRemote>(new_name);
+    remote = std::make_unique<InfraredAppRemote>(new_name);
     return add_button(button_name, signal);
 }
 
-std::vector<std::string> IrdaAppRemoteManager::get_button_list(void) const {
+std::vector<std::string> InfraredAppRemoteManager::get_button_list(void) const {
     std::vector<std::string> name_vector;
     name_vector.reserve(remote->buttons.size());
 
@@ -72,7 +73,7 @@ std::vector<std::string> IrdaAppRemoteManager::get_button_list(void) const {
     return name_vector;
 }
 
-const IrdaAppSignal& IrdaAppRemoteManager::get_button_data(size_t index) const {
+const InfraredAppSignal& InfraredAppRemoteManager::get_button_data(size_t index) const {
     furi_check(remote.get() != nullptr);
     auto& buttons = remote->buttons;
     furi_check(index < buttons.size());
@@ -80,7 +81,7 @@ const IrdaAppSignal& IrdaAppRemoteManager::get_button_data(size_t index) const {
     return buttons.at(index).signal;
 }
 
-bool IrdaAppRemoteManager::delete_remote() {
+bool InfraredAppRemoteManager::delete_remote() {
     bool result;
     FileWorkerCpp file_worker;
     result = file_worker.remove(make_full_name(remote->name).c_str());
@@ -89,11 +90,11 @@ bool IrdaAppRemoteManager::delete_remote() {
     return result;
 }
 
-void IrdaAppRemoteManager::reset_remote() {
+void InfraredAppRemoteManager::reset_remote() {
     remote.reset();
 }
 
-bool IrdaAppRemoteManager::delete_button(uint32_t index) {
+bool InfraredAppRemoteManager::delete_button(uint32_t index) {
     furi_check(remote.get() != nullptr);
     auto& buttons = remote->buttons;
     furi_check(index < buttons.size());
@@ -102,30 +103,18 @@ bool IrdaAppRemoteManager::delete_button(uint32_t index) {
     return store();
 }
 
-std::string IrdaAppRemoteManager::get_button_name(uint32_t index) {
+std::string InfraredAppRemoteManager::get_button_name(uint32_t index) {
     furi_check(remote.get() != nullptr);
     auto& buttons = remote->buttons;
     furi_check(index < buttons.size());
     return buttons[index].name.c_str();
 }
 
-std::string IrdaAppRemoteManager::get_remote_name() {
+std::string InfraredAppRemoteManager::get_remote_name() {
     return remote.get() ? remote->name : std::string();
 }
 
-int IrdaAppRemoteManager::find_remote_name(const std::vector<std::string>& strings) {
-    furi_assert(remote.get() != nullptr);
-    int i = 0;
-    for(const auto& str : strings) {
-        if(!str.compare(remote->name)) {
-            return i;
-        }
-        ++i;
-    }
-    return -1;
-}
-
-bool IrdaAppRemoteManager::rename_remote(const char* str) {
+bool InfraredAppRemoteManager::rename_remote(const char* str) {
     furi_check(str != nullptr);
     furi_check(remote.get() != nullptr);
 
@@ -148,7 +137,7 @@ bool IrdaAppRemoteManager::rename_remote(const char* str) {
     return result;
 }
 
-bool IrdaAppRemoteManager::rename_button(uint32_t index, const char* str) {
+bool InfraredAppRemoteManager::rename_button(uint32_t index, const char* str) {
     furi_check(remote.get() != nullptr);
     auto& buttons = remote->buttons;
     furi_check(index < buttons.size());
@@ -157,16 +146,16 @@ bool IrdaAppRemoteManager::rename_button(uint32_t index, const char* str) {
     return store();
 }
 
-size_t IrdaAppRemoteManager::get_number_of_buttons() {
+size_t InfraredAppRemoteManager::get_number_of_buttons() {
     furi_check(remote.get() != nullptr);
     return remote->buttons.size();
 }
 
-bool IrdaAppRemoteManager::store(void) {
+bool InfraredAppRemoteManager::store(void) {
     bool result = false;
     FileWorkerCpp file_worker;
 
-    if(!file_worker.mkdir(IrdaApp::irda_directory)) return false;
+    if(!file_worker.mkdir(InfraredApp::infrared_directory)) return false;
 
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
     FlipperFormat* ff = flipper_format_file_alloc(storage);
@@ -178,7 +167,7 @@ bool IrdaAppRemoteManager::store(void) {
     }
     if(result) {
         for(const auto& button : remote->buttons) {
-            result = irda_parser_save_signal(ff, button.signal, button.name.c_str());
+            result = infrared_parser_save_signal(ff, button.signal, button.name.c_str());
             if(!result) {
                 break;
             }
@@ -190,7 +179,7 @@ bool IrdaAppRemoteManager::store(void) {
     return result;
 }
 
-bool IrdaAppRemoteManager::load(const std::string& remote_name) {
+bool InfraredAppRemoteManager::load(const std::string& remote_name) {
     bool result = false;
     Storage* storage = static_cast<Storage*>(furi_record_open("storage"));
     FlipperFormat* ff = flipper_format_file_alloc(storage);
@@ -208,10 +197,10 @@ bool IrdaAppRemoteManager::load(const std::string& remote_name) {
         string_clear(header);
     }
     if(result) {
-        remote = std::make_unique<IrdaAppRemote>(remote_name);
-        IrdaAppSignal signal;
+        remote = std::make_unique<InfraredAppRemote>(remote_name);
+        InfraredAppSignal signal;
         std::string signal_name;
-        while(irda_parser_read_signal(ff, signal, signal_name)) {
+        while(infrared_parser_read_signal(ff, signal, signal_name)) {
             remote->buttons.emplace_back(signal_name.c_str(), std::move(signal));
         }
     }

+ 188 - 0
applications/infrared/infrared_app_remote_manager.h

@@ -0,0 +1,188 @@
+/**
+  * @file infrared_app_remote_manager.h
+  * Infrared: Remote manager class.
+  * It holds remote, can load/save/rename remote,
+  * add/remove/rename buttons.
+  */
+#pragma once
+
+#include "infrared_app_signal.h"
+
+#include <infrared_worker.h>
+#include <infrared.h>
+
+#include <cstdint>
+#include <string>
+#include <memory>
+#include <vector>
+
+/** Class to handle remote button */
+class InfraredAppRemoteButton {
+    /** Allow field access */
+    friend class InfraredAppRemoteManager;
+    /** Name of signal */
+    std::string name;
+    /** Signal data */
+    InfraredAppSignal signal;
+
+public:
+    /** Initialize remote button
+     *
+     * @param name - button name
+     * @param signal - signal to copy for remote button
+     */
+    InfraredAppRemoteButton(const char* name, const InfraredAppSignal& signal)
+        : name(name)
+        , signal(signal) {
+    }
+
+    /** Initialize remote button
+     *
+     * @param name - button name
+     * @param signal - signal to move for remote button
+     */
+    InfraredAppRemoteButton(const char* name, InfraredAppSignal&& signal)
+        : name(name)
+        , signal(std::move(signal)) {
+    }
+
+    /** Deinitialize remote button */
+    ~InfraredAppRemoteButton() {
+    }
+};
+
+/** Class to handle remote */
+class InfraredAppRemote {
+    /** Allow field access */
+    friend class InfraredAppRemoteManager;
+    /** Button container */
+    std::vector<InfraredAppRemoteButton> buttons;
+    /** Name of remote */
+    std::string name;
+
+public:
+    /** Initialize new remote
+     *
+     * @param name - new remote name
+     */
+    InfraredAppRemote(const std::string& name)
+        : name(name) {
+    }
+};
+
+/** Class to handle remote manager */
+class InfraredAppRemoteManager {
+    /** Remote instance. There can be 1 remote loaded at a time. */
+    std::unique_ptr<InfraredAppRemote> remote;
+    /** Make full name from remote name
+     *
+     * @param remote_name name of remote
+     * @retval full name of remote on disk
+     */
+    std::string make_full_name(const std::string& remote_name) const;
+
+public:
+    /** Restriction to button name length. Buttons larger are ignored. */
+    static constexpr const uint32_t max_button_name_length = 22;
+
+    /** Restriction to remote name length. Remotes larger are ignored. */
+    static constexpr const uint32_t max_remote_name_length = 22;
+
+    /** Construct button from signal, and create remote
+     *
+     * @param button_name - name of button to create
+     * @param signal - signal to create button from
+     * @retval true for success, false otherwise
+     * */
+    bool add_remote_with_button(const char* button_name, const InfraredAppSignal& signal);
+
+    /** Add button to current remote
+     *
+     * @param button_name - name of button to create
+     * @param signal - signal to create button from
+     * @retval true for success, false otherwise
+     * */
+    bool add_button(const char* button_name, const InfraredAppSignal& signal);
+
+    /** Rename button in current remote
+     *
+     * @param index - index of button to rename
+     * @param str - new button name
+     */
+    bool rename_button(uint32_t index, const char* str);
+
+    /** Rename current remote
+     *
+     * @param str - new remote name
+     */
+    bool rename_remote(const char* str);
+
+    /** Find vacant remote name. If suggested name is occupied,
+     * incremented digit(2,3,4,etc) added to name and check repeated.
+     *
+     * @param name - suggested remote name
+     * @retval garanteed free remote name, prefixed with suggested
+     */
+    std::string find_vacant_remote_name(const std::string& name);
+
+    /** Get button list
+     *
+     * @retval container of button names
+     */
+    std::vector<std::string> get_button_list() const;
+
+    /** Get button name by index
+     *
+     * @param index - index of button to get name from
+     * @retval button name
+     */
+    std::string get_button_name(uint32_t index);
+
+    /** Get remote name
+     *
+     * @retval remote name
+     */
+    std::string get_remote_name();
+
+    /** Get number of buttons
+     *
+     * @retval number of buttons
+     */
+    size_t get_number_of_buttons();
+
+    /** Get button's signal
+     *
+     * @param index - index of interested button
+     * @retval signal
+     */
+    const InfraredAppSignal& get_button_data(size_t index) const;
+
+    /** Delete button
+     *
+     * @param index - index of interested button
+     * @retval true if success, false otherwise
+     */
+    bool delete_button(uint32_t index);
+
+    /** Delete remote
+     *
+     * @retval true if success, false otherwise
+     */
+    bool delete_remote();
+
+    /** Clean all loaded info in current remote */
+    void reset_remote();
+
+    /** Store current remote data on disk
+     *
+     * @retval true if success, false otherwise
+     */
+    bool store();
+
+    /** Load data from disk into current remote
+     *
+     * @param name - name of remote to load
+     * @retval true if success, false otherwise
+     */
+    bool load(const std::string& name);
+};

+ 16 - 16
applications/irda/irda_app_signal.cpp → applications/infrared/infrared_app_signal.cpp

@@ -1,7 +1,7 @@
-#include "irda_app_signal.h"
-#include <irda_transmit.h>
+#include "infrared_app_signal.h"
+#include <infrared_transmit.h>
 
-void IrdaAppSignal::copy_raw_signal(
+void InfraredAppSignal::copy_raw_signal(
     const uint32_t* timings,
     size_t size,
     uint32_t frequency,
@@ -18,7 +18,7 @@ void IrdaAppSignal::copy_raw_signal(
     }
 }
 
-void IrdaAppSignal::clear_timings() {
+void InfraredAppSignal::clear_timings() {
     if(raw_signal) {
         delete[] payload.raw.timings;
         payload.raw.timings_cnt = 0;
@@ -26,7 +26,7 @@ void IrdaAppSignal::clear_timings() {
     }
 }
 
-IrdaAppSignal::IrdaAppSignal(
+InfraredAppSignal::InfraredAppSignal(
     const uint32_t* timings,
     size_t timings_cnt,
     uint32_t frequency,
@@ -35,12 +35,12 @@ IrdaAppSignal::IrdaAppSignal(
     copy_raw_signal(timings, timings_cnt, frequency, duty_cycle);
 }
 
-IrdaAppSignal::IrdaAppSignal(const IrdaMessage* irda_message) {
+InfraredAppSignal::InfraredAppSignal(const InfraredMessage* infrared_message) {
     raw_signal = false;
-    payload.message = *irda_message;
+    payload.message = *infrared_message;
 }
 
-IrdaAppSignal& IrdaAppSignal::operator=(const IrdaAppSignal& other) {
+InfraredAppSignal& InfraredAppSignal::operator=(const InfraredAppSignal& other) {
     clear_timings();
     raw_signal = other.raw_signal;
     if(!raw_signal) {
@@ -56,7 +56,7 @@ IrdaAppSignal& IrdaAppSignal::operator=(const IrdaAppSignal& other) {
     return *this;
 }
 
-IrdaAppSignal::IrdaAppSignal(const IrdaAppSignal& other) {
+InfraredAppSignal::InfraredAppSignal(const InfraredAppSignal& other) {
     raw_signal = other.raw_signal;
     if(!raw_signal) {
         payload.message = other.payload.message;
@@ -69,7 +69,7 @@ IrdaAppSignal::IrdaAppSignal(const IrdaAppSignal& other) {
     }
 }
 
-IrdaAppSignal::IrdaAppSignal(IrdaAppSignal&& other) {
+InfraredAppSignal::InfraredAppSignal(InfraredAppSignal&& other) {
     raw_signal = other.raw_signal;
     if(!raw_signal) {
         payload.message = other.payload.message;
@@ -86,13 +86,13 @@ IrdaAppSignal::IrdaAppSignal(IrdaAppSignal&& other) {
     }
 }
 
-void IrdaAppSignal::set_message(const IrdaMessage* irda_message) {
+void InfraredAppSignal::set_message(const InfraredMessage* infrared_message) {
     clear_timings();
     raw_signal = false;
-    payload.message = *irda_message;
+    payload.message = *infrared_message;
 }
 
-void IrdaAppSignal::set_raw_signal(
+void InfraredAppSignal::set_raw_signal(
     uint32_t* timings,
     size_t timings_cnt,
     uint32_t frequency,
@@ -102,11 +102,11 @@ void IrdaAppSignal::set_raw_signal(
     copy_raw_signal(timings, timings_cnt, frequency, duty_cycle);
 }
 
-void IrdaAppSignal::transmit() const {
+void InfraredAppSignal::transmit() const {
     if(!raw_signal) {
-        irda_send(&payload.message, 1);
+        infrared_send(&payload.message, 1);
     } else {
-        irda_send_raw_ext(
+        infrared_send_raw_ext(
             payload.raw.timings,
             payload.raw.timings_cnt,
             true,

+ 134 - 0
applications/infrared/infrared_app_signal.h

@@ -0,0 +1,134 @@
+/**
+  * @file infrared_app_signal.h
+  * Infrared: Signal class
+  */
+#pragma once
+#include <infrared_worker.h>
+#include <stdint.h>
+#include <string>
+#include <infrared.h>
+
+/** Infrared application signal class */
+class InfraredAppSignal {
+public:
+    /** Raw signal structure */
+    typedef struct {
+        /** Timings amount */
+        size_t timings_cnt;
+        /** Samples of raw signal in ms */
+        uint32_t* timings;
+        /** PWM Frequency of raw signal */
+        uint32_t frequency;
+        /** PWM Duty cycle of raw signal */
+        float duty_cycle;
+    } RawSignal;
+
+private:
+    /** if true - signal is raw, if false - signal is parsed */
+    bool raw_signal;
+    /** signal data, either raw or parsed */
+    union {
+        /** signal data for parsed signal */
+        InfraredMessage message;
+        /** raw signal data */
+        RawSignal raw;
+    } payload;
+
+    /** Copy raw signal into object
+     *
+     * @param timings - timings (samples) of raw signal
+     * @param size - number of timings
+     * @frequency - PWM frequency of raw signal
+     * @duty_cycle - PWM duty cycle
+     */
+    void
+        copy_raw_signal(const uint32_t* timings, size_t size, uint32_t frequency, float duty_cycle);
+    /** Clear and free timings data */
+    void clear_timings();
+
+public:
+    /** Construct Infrared signal class */
+    InfraredAppSignal() {
+        raw_signal = false;
+        payload.message.protocol = InfraredProtocolUnknown;
+    }
+
+    /** Destruct signal class and free all allocated data */
+    ~InfraredAppSignal() {
+        clear_timings();
+    }
+
+    /** Construct object with raw signal
+     *
+     * @param timings - timings (samples) of raw signal
+     * @param size - number of timings
+     * @frequency - PWM frequency of raw signal
+     * @duty_cycle - PWM duty cycle
+     */
+    InfraredAppSignal(
+        const uint32_t* timings,
+        size_t timings_cnt,
+        uint32_t frequency,
+        float duty_cycle);
+
+    /** Construct object with parsed signal
+     *
+     * @param infrared_message - parsed_signal to construct from
+     */
+    InfraredAppSignal(const InfraredMessage* infrared_message);
+
+    /** Copy constructor */
+    InfraredAppSignal(const InfraredAppSignal& other);
+    /** Move constructor */
+    InfraredAppSignal(InfraredAppSignal&& other);
+
+    /** Assignment operator */
+    InfraredAppSignal& operator=(const InfraredAppSignal& signal);
+
+    /** Set object to parsed signal
+     *
+     * @param infrared_message - parsed_signal to construct from
+     */
+    void set_message(const InfraredMessage* infrared_message);
+
+    /** Set object to raw signal
+     *
+     * @param timings - timings (samples) of raw signal
+     * @param size - number of timings
+     * @frequency - PWM frequency of raw signal
+     * @duty_cycle - PWM duty cycle
+     */
+    void
+        set_raw_signal(uint32_t* timings, size_t timings_cnt, uint32_t frequency, float duty_cycle);
+
+    /** Transmit held signal (???) */
+    void transmit() const;
+
+    /** Show is held signal raw
+     *
+     * @retval true if signal is raw, false if signal is parsed
+     */
+    bool is_raw(void) const {
+        return raw_signal;
+    }
+
+    /** Get parsed signal.
+     * User must check is_raw() signal before calling this function.
+     *
+     * @retval parsed signal pointer
+     */
+    const InfraredMessage& get_message(void) const {
+        furi_assert(!raw_signal);
+        return payload.message;
+    }
+
+    /** Get raw signal.
+     * User must check is_raw() signal before calling this function.
+     *
+     * @retval raw signal
+     */
+    const RawSignal& get_raw_signal(void) const {
+        furi_assert(raw_signal);
+        return payload.raw;
+    }
+};

+ 45 - 45
applications/irda/irda_app_view_manager.cpp → applications/infrared/infrared_app_view_manager.cpp

@@ -6,16 +6,16 @@
 #include <furi.h>
 #include <callback-connector.h>
 
-#include "irda/irda_app_view_manager.h"
-#include "irda/view/irda_progress_view.h"
-#include "irda_app.h"
-#include "irda/irda_app_event.h"
+#include "infrared/infrared_app_view_manager.h"
+#include "infrared/view/infrared_progress_view.h"
+#include "infrared_app.h"
+#include "infrared/infrared_app_event.h"
 
-IrdaAppViewManager::IrdaAppViewManager() {
-    event_queue = osMessageQueueNew(10, sizeof(IrdaAppEvent), NULL);
+InfraredAppViewManager::InfraredAppViewManager() {
+    event_queue = osMessageQueueNew(10, sizeof(InfraredAppEvent), NULL);
 
     view_dispatcher = view_dispatcher_alloc();
-    auto callback = cbc::obtain_connector(this, &IrdaAppViewManager::previous_view_callback);
+    auto callback = cbc::obtain_connector(this, &InfraredAppViewManager::previous_view_callback);
 
     gui = static_cast<Gui*>(furi_record_open("gui"));
     view_dispatcher_attach_to_gui(view_dispatcher, gui, ViewDispatcherTypeFullscreen);
@@ -26,18 +26,18 @@ IrdaAppViewManager::IrdaAppViewManager() {
     dialog_ex = dialog_ex_alloc();
     text_input = text_input_alloc();
     button_panel = button_panel_alloc();
-    progress_view = irda_progress_view_alloc();
+    progress_view = infrared_progress_view_alloc();
     loading_view = loading_alloc();
     universal_view_stack = view_stack_alloc();
     view_stack_add_view(universal_view_stack, button_panel_get_view(button_panel));
     view_set_orientation(view_stack_get_view(universal_view_stack), ViewOrientationVertical);
 
-    add_view(ViewType::UniversalRemote, view_stack_get_view(universal_view_stack));
-    add_view(ViewType::ButtonMenu, button_menu_get_view(button_menu));
-    add_view(ViewType::Submenu, submenu_get_view(submenu));
-    add_view(ViewType::Popup, popup_get_view(popup));
-    add_view(ViewType::DialogEx, dialog_ex_get_view(dialog_ex));
-    add_view(ViewType::TextInput, text_input_get_view(text_input));
+    add_view(ViewId::UniversalRemote, view_stack_get_view(universal_view_stack));
+    add_view(ViewId::ButtonMenu, button_menu_get_view(button_menu));
+    add_view(ViewId::Submenu, submenu_get_view(submenu));
+    add_view(ViewId::Popup, popup_get_view(popup));
+    add_view(ViewId::DialogEx, dialog_ex_get_view(dialog_ex));
+    add_view(ViewId::TextInput, text_input_get_view(text_input));
 
     view_set_previous_callback(view_stack_get_view(universal_view_stack), callback);
     view_set_previous_callback(button_menu_get_view(button_menu), callback);
@@ -47,19 +47,19 @@ IrdaAppViewManager::IrdaAppViewManager() {
     view_set_previous_callback(text_input_get_view(text_input), callback);
 }
 
-IrdaAppViewManager::~IrdaAppViewManager() {
+InfraredAppViewManager::~InfraredAppViewManager() {
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::UniversalRemote));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::UniversalRemote));
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::ButtonMenu));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::ButtonMenu));
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::TextInput));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::TextInput));
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::DialogEx));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::DialogEx));
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::Submenu));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::Submenu));
     view_dispatcher_remove_view(
-        view_dispatcher, static_cast<uint32_t>(IrdaAppViewManager::ViewType::Popup));
+        view_dispatcher, static_cast<uint32_t>(InfraredAppViewManager::ViewId::Popup));
 
     view_stack_remove_view(universal_view_stack, button_panel_get_view(button_panel));
     view_stack_free(universal_view_stack);
@@ -69,7 +69,7 @@ IrdaAppViewManager::~IrdaAppViewManager() {
     button_menu_free(button_menu);
     dialog_ex_free(dialog_ex);
     text_input_free(text_input);
-    irda_progress_view_free(progress_view);
+    infrared_progress_view_free(progress_view);
     loading_free(loading_view);
 
     view_dispatcher_free(view_dispatcher);
@@ -77,70 +77,70 @@ IrdaAppViewManager::~IrdaAppViewManager() {
     osMessageQueueDelete(event_queue);
 }
 
-void IrdaAppViewManager::switch_to(ViewType type) {
+void InfraredAppViewManager::switch_to(ViewId type) {
     view_dispatcher_switch_to_view(view_dispatcher, static_cast<uint32_t>(type));
 }
 
-TextInput* IrdaAppViewManager::get_text_input() {
+TextInput* InfraredAppViewManager::get_text_input() {
     return text_input;
 }
 
-DialogEx* IrdaAppViewManager::get_dialog_ex() {
+DialogEx* InfraredAppViewManager::get_dialog_ex() {
     return dialog_ex;
 }
 
-Submenu* IrdaAppViewManager::get_submenu() {
+Submenu* InfraredAppViewManager::get_submenu() {
     return submenu;
 }
 
-Popup* IrdaAppViewManager::get_popup() {
+Popup* InfraredAppViewManager::get_popup() {
     return popup;
 }
 
-ButtonMenu* IrdaAppViewManager::get_button_menu() {
+ButtonMenu* InfraredAppViewManager::get_button_menu() {
     return button_menu;
 }
 
-ButtonPanel* IrdaAppViewManager::get_button_panel() {
+ButtonPanel* InfraredAppViewManager::get_button_panel() {
     return button_panel;
 }
 
-IrdaProgressView* IrdaAppViewManager::get_progress() {
+InfraredProgressView* InfraredAppViewManager::get_progress() {
     return progress_view;
 }
 
-Loading* IrdaAppViewManager::get_loading() {
+Loading* InfraredAppViewManager::get_loading() {
     return loading_view;
 }
 
-ViewStack* IrdaAppViewManager::get_universal_view_stack() {
+ViewStack* InfraredAppViewManager::get_universal_view_stack() {
     return universal_view_stack;
 }
 
-osMessageQueueId_t IrdaAppViewManager::get_event_queue() {
+osMessageQueueId_t InfraredAppViewManager::get_event_queue() {
     return event_queue;
 }
 
-void IrdaAppViewManager::clear_events() {
-    IrdaAppEvent event;
+void InfraredAppViewManager::clear_events() {
+    InfraredAppEvent event;
     while(osMessageQueueGet(event_queue, &event, NULL, 0) == osOK)
         ;
 }
 
-void IrdaAppViewManager::receive_event(IrdaAppEvent* event) {
+void InfraredAppViewManager::receive_event(InfraredAppEvent* event) {
     if(osMessageQueueGet(event_queue, event, NULL, 100) != osOK) {
-        event->type = IrdaAppEvent::Type::Tick;
+        event->type = InfraredAppEvent::Type::Tick;
     }
 }
 
-void IrdaAppViewManager::send_event(IrdaAppEvent* event) {
+void InfraredAppViewManager::send_event(InfraredAppEvent* event) {
     uint32_t timeout = 0;
     /* Rapid button hammering on signal send scenes causes queue overflow - ignore it,
-     * but try to keep button release event - it switches off IRDA DMA sending. */
-    if(event->type == IrdaAppEvent::Type::MenuSelectedRelease) {
+     * but try to keep button release event - it switches off INFRARED DMA sending. */
+    if(event->type == InfraredAppEvent::Type::MenuSelectedRelease) {
         timeout = 200;
     }
-    if((event->type == IrdaAppEvent::Type::DialogExSelected) &&
+    if((event->type == InfraredAppEvent::Type::DialogExSelected) &&
        (event->payload.dialog_ex_result == DialogExReleaseCenter)) {
         timeout = 200;
     }
@@ -148,16 +148,16 @@ void IrdaAppViewManager::send_event(IrdaAppEvent* event) {
     osMessageQueuePut(event_queue, event, 0, timeout);
 }
 
-uint32_t IrdaAppViewManager::previous_view_callback(void* context) {
+uint32_t InfraredAppViewManager::previous_view_callback(void* context) {
     if(event_queue != NULL) {
-        IrdaAppEvent event;
-        event.type = IrdaAppEvent::Type::Back;
+        InfraredAppEvent event;
+        event.type = InfraredAppEvent::Type::Back;
         send_event(&event);
     }
 
     return VIEW_IGNORE;
 }
 
-void IrdaAppViewManager::add_view(ViewType view_type, View* view) {
+void InfraredAppViewManager::add_view(ViewId view_type, View* view) {
     view_dispatcher_add_view(view_dispatcher, static_cast<uint32_t>(view_type), view);
 }

+ 164 - 0
applications/infrared/infrared_app_view_manager.h

@@ -0,0 +1,164 @@
+/**
+  * @file infrared_app_view_manager.h
+  * Infrared: Scene events description
+  */
+#pragma once
+#include <gui/modules/button_menu.h>
+#include <gui/modules/text_input.h>
+#include <gui/view_stack.h>
+#include <gui/modules/button_panel.h>
+#include <furi.h>
+#include <gui/view_dispatcher.h>
+#include <gui/modules/dialog_ex.h>
+#include <gui/modules/submenu.h>
+#include <gui/modules/popup.h>
+#include <gui/modules/loading.h>
+
+#include "infrared_app_event.h"
+#include "view/infrared_progress_view.h"
+
+/** Infrared View manager class */
+class InfraredAppViewManager {
+public:
+    /** Infrared View Id enum, it is used
+     * to identify added views */
+    enum class ViewId : uint8_t {
+        DialogEx,
+        TextInput,
+        Submenu,
+        ButtonMenu,
+        UniversalRemote,
+        Popup,
+    };
+
+    /** Class constructor */
+    InfraredAppViewManager();
+    /** Class destructor */
+    ~InfraredAppViewManager();
+
+    /** Switch to another view
+     *
+     * @param id - view id to switch to
+     */
+    void switch_to(ViewId id);
+
+    /** Receive event from queue
+     *
+     * @param event - received event
+     */
+    void receive_event(InfraredAppEvent* event);
+
+    /** Send event to queue
+     *
+     * @param event - event to send
+     */
+    void send_event(InfraredAppEvent* event);
+
+    /** Clear events that already in queue
+     *
+     * @param event - event to send
+     */
+    void clear_events();
+
+    /** Get dialog_ex view module
+     *
+     * @retval dialog_ex view module
+     */
+    DialogEx* get_dialog_ex();
+
+    /** Get submenu view module
+     *
+     * @retval submenu view module
+     */
+    Submenu* get_submenu();
+
+    /** Get popup view module
+     *
+     * @retval popup view module
+     */
+    Popup* get_popup();
+
+    /** Get text_input view module
+     *
+     * @retval text_input view module
+     */
+    TextInput* get_text_input();
+
+    /** Get button_menu view module
+     *
+     * @retval button_menu view module
+     */
+    ButtonMenu* get_button_menu();
+
+    /** Get button_panel view module
+     *
+     * @retval button_panel view module
+     */
+    ButtonPanel* get_button_panel();
+
+    /** Get view_stack view module used in universal remote
+     *
+     * @retval view_stack view module
+     */
+    ViewStack* get_universal_view_stack();
+
+    /** Get progress view module
+     *
+     * @retval progress view module
+     */
+    InfraredProgressView* get_progress();
+
+    /** Get loading view module
+     *
+     * @retval loading view module
+     */
+    Loading* get_loading();
+
+    /** Get event queue
+     *
+     * @retval event queue
+     */
+    osMessageQueueId_t get_event_queue();
+
+    /** Callback to handle back button
+     *
+     * @param context - context to pass to callback
+     * @retval always returns VIEW_IGNORE
+     */
+    uint32_t previous_view_callback(void* context);
+
+private:
+    /** View Dispatcher instance.
+     * It handles view switching */
+    ViewDispatcher* view_dispatcher;
+    /** Gui instance */
+    Gui* gui;
+    /** Text input view module instance */
+    TextInput* text_input;
+    /** DialogEx view module instance */
+    DialogEx* dialog_ex;
+    /** Submenu view module instance */
+    Submenu* submenu;
+    /** Popup view module instance */
+    Popup* popup;
+    /** ButtonMenu view module instance */
+    ButtonMenu* button_menu;
+    /** ButtonPanel view module instance */
+    ButtonPanel* button_panel;
+    /** ViewStack view module instance */
+    ViewStack* universal_view_stack;
+    /** ProgressView view module instance */
+    InfraredProgressView* progress_view;
+    /** Loading view module instance */
+    Loading* loading_view;
+
+    /** Queue to handle events, which are processed in scenes */
+    osMessageQueueId_t event_queue;
+
+    /** Add View to pull of views
+     *
+     * @param view_id - id to identify view
+     * @param view - view to add
+     */
+    void add_view(ViewId view_id, View* view);
+};

+ 9 - 0
applications/infrared/infrared_runner.cpp

@@ -0,0 +1,9 @@
+#include "infrared_app.h"
+
+extern "C" int32_t infrared_app(void* p) {
+    InfraredApp* app = new InfraredApp();
+    int32_t result = app->run(p);
+    delete app;
+
+    return result;
+}

+ 305 - 0
applications/infrared/scene/infrared_app_scene.h

@@ -0,0 +1,305 @@
+/**
+ * @file infrared_app_scene.h
+ * Infrared: Application scenes
+ */
+#pragma once
+#include "../infrared_app_event.h"
+#include <furi_hal_infrared.h>
+#include "infrared.h"
+#include <vector>
+#include <string>
+#include "../infrared_app_brute_force.h"
+
+/** Anonymous class */
+class InfraredApp;
+
+/** Base Scene class */
+class InfraredAppScene {
+public:
+    /** Called when enter scene */
+    virtual void on_enter(InfraredApp* app) = 0;
+    /** Events handler callback */
+    virtual bool on_event(InfraredApp* app, InfraredAppEvent* event) = 0;
+    /** Called when exit scene */
+    virtual void on_exit(InfraredApp* app) = 0;
+    /** Virtual destructor of base class */
+    virtual ~InfraredAppScene(){};
+
+private:
+};
+
+/** Start scene
+ * Main Infrared application menu
+ */
+class InfraredAppSceneStart : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** Save previously selected submenu index
+     * to highlight it when get back */
+    uint32_t submenu_item_selected = 0;
+};
+
+/** Universal menu scene
+ * Scene to select universal remote
+ */
+class InfraredAppSceneUniversal : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** Save previously selected submenu index
+     * to highlight it when get back */
+    uint32_t submenu_item_selected = 0;
+};
+
+/** Learn new signal scene
+ * On this scene catching new IR signal performed.
+ */
+class InfraredAppSceneLearn : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+/** New signal learn succeeded scene
+ */
+class InfraredAppSceneLearnSuccess : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+    bool button_pressed = false;
+};
+
+/** Scene to enter name for new button in remote
+ */
+class InfraredAppSceneLearnEnterName : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+/** Scene where signal is learnt
+ */
+class InfraredAppSceneLearnDone : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+/** Remote interface scene
+ * On this scene you can send IR signals from selected remote
+ */
+class InfraredAppSceneRemote : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** container of button names in current remote. */
+    std::vector<std::string> buttons_names;
+    /** Save previously selected index
+     * to highlight it when get back */
+    uint32_t buttonmenu_item_selected = 0;
+    /** state flag to show button is pressed.
+     * As long as send-signal button pressed no other button
+     * events are handled. */
+    bool button_pressed = false;
+};
+
+/** List of remotes scene
+ * Every remote is a file, located on internal/external storage.
+ * Every file has same format, and same extension.
+ * Files are parsed as you enter 'Remote scene' and showed
+ * as a buttons.
+ */
+class InfraredAppSceneRemoteList : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** Save previously selected index
+     * to highlight it when get back */
+    uint32_t submenu_item_selected = 0;
+    /** Remote names to show them in submenu */
+    std::vector<std::string> remote_names;
+};
+
+class InfraredAppSceneAskBack : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+class InfraredAppSceneEdit : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** Save previously selected index
+     * to highlight it when get back */
+    uint32_t submenu_item_selected = 0;
+};
+
+class InfraredAppSceneEditKeySelect : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+private:
+    /** Button names to show them in submenu */
+    std::vector<std::string> buttons_names;
+};
+
+class InfraredAppSceneEditRename : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+class InfraredAppSceneEditDelete : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+class InfraredAppSceneEditRenameDone : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+class InfraredAppSceneEditDeleteDone : public InfraredAppScene {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+};
+
+class InfraredAppSceneUniversalCommon : public InfraredAppScene {
+    /** Brute force started flag */
+    bool brute_force_started = false;
+
+protected:
+    /** Events handler callback */
+    bool on_event(InfraredApp* app, InfraredAppEvent* event) final;
+    /** Called when exit scene */
+    void on_exit(InfraredApp* app) final;
+
+    /** Show popup window
+     *
+     * @param app - application instance
+     */
+    void show_popup(InfraredApp* app, int record_amount);
+
+    /** Hide popup window
+     *
+     * @param app - application instance
+     */
+    void hide_popup(InfraredApp* app);
+
+    /** Propagate progress in popup window
+     *
+     * @param app - application instance
+     */
+    bool progress_popup(InfraredApp* app);
+
+    /** Item selected callback
+     *
+     * @param context - context
+     * @param index - selected item index
+     */
+    static void infrared_app_item_callback(void* context, uint32_t index);
+
+    /** Brute Force instance */
+    InfraredAppBruteForce brute_force;
+
+    /** Constructor */
+    InfraredAppSceneUniversalCommon(const char* filename)
+        : brute_force(filename) {
+    }
+
+    /** Destructor */
+    ~InfraredAppSceneUniversalCommon() {
+    }
+};
+
+class InfraredAppSceneUniversalTV : public InfraredAppSceneUniversalCommon {
+public:
+    /** Called when enter scene */
+    void on_enter(InfraredApp* app) final;
+
+    /** Constructor
+     * Specifies path to brute force db library */
+    InfraredAppSceneUniversalTV()
+        : InfraredAppSceneUniversalCommon("/ext/infrared/assets/tv.ir") {
+    }
+
+    /** Destructor */
+    ~InfraredAppSceneUniversalTV() {
+    }
+};

+ 15 - 15
applications/irda/scene/irda_app_scene_ask_back.cpp → applications/infrared/scene/infrared_app_scene_ask_back.cpp

@@ -1,21 +1,21 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 #include "gui/modules/dialog_ex.h"
-#include "irda.h"
-#include "irda/scene/irda_app_scene.h"
+#include "infrared.h"
+#include "infrared/scene/infrared_app_scene.h"
 #include <string>
 
 static void dialog_result_callback(DialogExResult result, void* context) {
-    auto app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    auto app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::DialogExSelected;
+    event.type = InfraredAppEvent::Type::DialogExSelected;
     event.payload.dialog_ex_result = result;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneAskBack::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneAskBack::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     DialogEx* dialog_ex = view_manager->get_dialog_ex();
 
     if(app->get_learn_new_remote()) {
@@ -33,21 +33,21 @@ void IrdaAppSceneAskBack::on_enter(IrdaApp* app) {
     dialog_ex_set_result_callback(dialog_ex, dialog_result_callback);
     dialog_ex_set_context(dialog_ex, app);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::DialogEx);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::DialogEx);
 }
 
-bool IrdaAppSceneAskBack::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneAskBack::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::DialogExSelected) {
+    if(event->type == InfraredAppEvent::Type::DialogExSelected) {
         switch(event->payload.dialog_ex_result) {
         case DialogExResultLeft:
             consumed = true;
             if(app->get_learn_new_remote()) {
-                app->search_and_switch_to_previous_scene({IrdaApp::Scene::Start});
+                app->search_and_switch_to_previous_scene({InfraredApp::Scene::Start});
             } else {
                 app->search_and_switch_to_previous_scene(
-                    {IrdaApp::Scene::Edit, IrdaApp::Scene::Remote});
+                    {InfraredApp::Scene::Edit, InfraredApp::Scene::Remote});
             }
             break;
         case DialogExResultCenter:
@@ -62,12 +62,12 @@ bool IrdaAppSceneAskBack::on_event(IrdaApp* app, IrdaAppEvent* event) {
         }
     }
 
-    if(event->type == IrdaAppEvent::Type::Back) {
+    if(event->type == InfraredAppEvent::Type::Back) {
         consumed = true;
     }
 
     return consumed;
 }
 
-void IrdaAppSceneAskBack::on_exit(IrdaApp* app) {
+void InfraredAppSceneAskBack::on_exit(InfraredApp* app) {
 }

+ 24 - 24
applications/irda/scene/irda_app_scene_edit.cpp → applications/infrared/scene/infrared_app_scene_edit.cpp

@@ -1,4 +1,4 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 #include "gui/modules/submenu.h"
 
 typedef enum {
@@ -10,17 +10,17 @@ typedef enum {
 } SubmenuIndex;
 
 static void submenu_callback(void* context, uint32_t index) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::MenuSelected;
+    event.type = InfraredAppEvent::Type::MenuSelected;
     event.payload.menu_index = index;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneEdit::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneEdit::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     submenu_add_item(submenu, "Add key", SubmenuIndexAddKey, submenu_callback, app);
@@ -31,38 +31,38 @@ void IrdaAppSceneEdit::on_enter(IrdaApp* app) {
     submenu_set_selected_item(submenu, submenu_item_selected);
     submenu_item_selected = 0;
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Submenu);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Submenu);
 }
 
-bool IrdaAppSceneEdit::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneEdit::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::MenuSelected) {
+    if(event->type == InfraredAppEvent::Type::MenuSelected) {
         submenu_item_selected = event->payload.menu_index;
         switch(event->payload.menu_index) {
         case SubmenuIndexAddKey:
             app->set_learn_new_remote(false);
-            app->switch_to_next_scene(IrdaApp::Scene::Learn);
+            app->switch_to_next_scene(InfraredApp::Scene::Learn);
             break;
         case SubmenuIndexRenameKey:
-            app->set_edit_action(IrdaApp::EditAction::Rename);
-            app->set_edit_element(IrdaApp::EditElement::Button);
-            app->switch_to_next_scene(IrdaApp::Scene::EditKeySelect);
+            app->set_edit_action(InfraredApp::EditAction::Rename);
+            app->set_edit_element(InfraredApp::EditElement::Button);
+            app->switch_to_next_scene(InfraredApp::Scene::EditKeySelect);
             break;
         case SubmenuIndexDeleteKey:
-            app->set_edit_action(IrdaApp::EditAction::Delete);
-            app->set_edit_element(IrdaApp::EditElement::Button);
-            app->switch_to_next_scene(IrdaApp::Scene::EditKeySelect);
+            app->set_edit_action(InfraredApp::EditAction::Delete);
+            app->set_edit_element(InfraredApp::EditElement::Button);
+            app->switch_to_next_scene(InfraredApp::Scene::EditKeySelect);
             break;
         case SubmenuIndexRenameRemote:
-            app->set_edit_action(IrdaApp::EditAction::Rename);
-            app->set_edit_element(IrdaApp::EditElement::Remote);
-            app->switch_to_next_scene(IrdaApp::Scene::EditRename);
+            app->set_edit_action(InfraredApp::EditAction::Rename);
+            app->set_edit_element(InfraredApp::EditElement::Remote);
+            app->switch_to_next_scene(InfraredApp::Scene::EditRename);
             break;
         case SubmenuIndexDeleteRemote:
-            app->set_edit_action(IrdaApp::EditAction::Delete);
-            app->set_edit_element(IrdaApp::EditElement::Remote);
-            app->switch_to_next_scene(IrdaApp::Scene::EditDelete);
+            app->set_edit_action(InfraredApp::EditAction::Delete);
+            app->set_edit_element(InfraredApp::EditElement::Remote);
+            app->switch_to_next_scene(InfraredApp::Scene::EditDelete);
             break;
         }
         consumed = true;
@@ -71,8 +71,8 @@ bool IrdaAppSceneEdit::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneEdit::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneEdit::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     submenu_reset(submenu);

+ 20 - 20
applications/irda/scene/irda_app_scene_edit_delete.cpp → applications/infrared/scene/infrared_app_scene_edit_delete.cpp

@@ -1,25 +1,25 @@
-#include "../irda_app.h"
-#include "irda.h"
-#include "irda/scene/irda_app_scene.h"
+#include "../infrared_app.h"
+#include "infrared.h"
+#include "infrared/scene/infrared_app_scene.h"
 #include <string>
 
 static void dialog_result_callback(DialogExResult result, void* context) {
-    auto app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    auto app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::DialogExSelected;
+    event.type = InfraredAppEvent::Type::DialogExSelected;
     event.payload.dialog_ex_result = result;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneEditDelete::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneEditDelete::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     DialogEx* dialog_ex = view_manager->get_dialog_ex();
 
     auto remote_manager = app->get_remote_manager();
 
-    if(app->get_edit_element() == IrdaApp::EditElement::Button) {
+    if(app->get_edit_element() == InfraredApp::EditElement::Button) {
         auto signal = remote_manager->get_button_data(app->get_current_button());
         dialog_ex_set_header(dialog_ex, "Delete button?", 64, 0, AlignCenter, AlignTop);
         if(!signal.is_raw()) {
@@ -28,10 +28,10 @@ void IrdaAppSceneEditDelete::on_enter(IrdaApp* app) {
                 0,
                 "%s\n%s\nA=0x%0*lX C=0x%0*lX",
                 remote_manager->get_button_name(app->get_current_button()).c_str(),
-                irda_get_protocol_name(message->protocol),
-                ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4),
+                infrared_get_protocol_name(message->protocol),
+                ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4),
                 message->address,
-                ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
+                ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4),
                 message->command);
         } else {
             app->set_text_store(
@@ -56,13 +56,13 @@ void IrdaAppSceneEditDelete::on_enter(IrdaApp* app) {
     dialog_ex_set_result_callback(dialog_ex, dialog_result_callback);
     dialog_ex_set_context(dialog_ex, app);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::DialogEx);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::DialogEx);
 }
 
-bool IrdaAppSceneEditDelete::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneEditDelete::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::DialogExSelected) {
+    if(event->type == InfraredAppEvent::Type::DialogExSelected) {
         switch(event->payload.dialog_ex_result) {
         case DialogExResultLeft:
             app->switch_to_previous_scene();
@@ -73,18 +73,18 @@ bool IrdaAppSceneEditDelete::on_event(IrdaApp* app, IrdaAppEvent* event) {
         case DialogExResultRight: {
             auto remote_manager = app->get_remote_manager();
             bool result = false;
-            if(app->get_edit_element() == IrdaApp::EditElement::Remote) {
+            if(app->get_edit_element() == InfraredApp::EditElement::Remote) {
                 result = remote_manager->delete_remote();
             } else {
                 result = remote_manager->delete_button(app->get_current_button());
-                app->set_current_button(IrdaApp::ButtonNA);
+                app->set_current_button(InfraredApp::ButtonNA);
             }
 
             if(!result) {
                 app->search_and_switch_to_previous_scene(
-                    {IrdaApp::Scene::RemoteList, IrdaApp::Scene::Start});
+                    {InfraredApp::Scene::RemoteList, InfraredApp::Scene::Start});
             } else {
-                app->switch_to_next_scene(IrdaApp::Scene::EditDeleteDone);
+                app->switch_to_next_scene(InfraredApp::Scene::EditDeleteDone);
             }
             break;
         }
@@ -96,5 +96,5 @@ bool IrdaAppSceneEditDelete::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneEditDelete::on_exit(IrdaApp* app) {
+void InfraredAppSceneEditDelete::on_exit(InfraredApp* app) {
 }

+ 38 - 0
applications/infrared/scene/infrared_app_scene_edit_delete_done.cpp

@@ -0,0 +1,38 @@
+#include "../infrared_app.h"
+
+void InfraredAppSceneEditDeleteDone::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    Popup* popup = view_manager->get_popup();
+
+    popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62);
+    popup_set_header(popup, "Deleted", 83, 19, AlignLeft, AlignBottom);
+
+    popup_set_callback(popup, InfraredApp::popup_callback);
+    popup_set_context(popup, app);
+    popup_set_timeout(popup, 1500);
+    popup_enable_timeout(popup);
+
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Popup);
+}
+
+bool InfraredAppSceneEditDeleteDone::on_event(InfraredApp* app, InfraredAppEvent* event) {
+    bool consumed = false;
+
+    if(event->type == InfraredAppEvent::Type::PopupTimer) {
+        if(app->get_edit_element() == InfraredApp::EditElement::Remote) {
+            app->search_and_switch_to_previous_scene(
+                {InfraredApp::Scene::Start, InfraredApp::Scene::RemoteList});
+        } else {
+            app->search_and_switch_to_previous_scene({InfraredApp::Scene::Remote});
+        }
+        consumed = true;
+    }
+
+    return consumed;
+}
+
+void InfraredAppSceneEditDeleteDone::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    Popup* popup = view_manager->get_popup();
+    popup_set_header(popup, nullptr, 0, 0, AlignLeft, AlignTop);
+}

+ 57 - 0
applications/infrared/scene/infrared_app_scene_edit_key_select.cpp

@@ -0,0 +1,57 @@
+#include "../infrared_app.h"
+#include "gui/modules/submenu.h"
+
+static void submenu_callback(void* context, uint32_t index) {
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
+
+    event.type = InfraredAppEvent::Type::MenuSelected;
+    event.payload.menu_index = index;
+
+    app->get_view_manager()->send_event(&event);
+}
+
+void InfraredAppSceneEditKeySelect::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    Submenu* submenu = view_manager->get_submenu();
+    int item_number = 0;
+
+    const char* header =
+        app->get_edit_action() == InfraredApp::EditAction::Rename ? "Rename key:" : "Delete key:";
+    submenu_set_header(submenu, header);
+
+    auto remote_manager = app->get_remote_manager();
+    buttons_names = remote_manager->get_button_list();
+    for(const auto& it : buttons_names) {
+        submenu_add_item(submenu, it.c_str(), item_number++, submenu_callback, app);
+    }
+    if((item_number > 0) && (app->get_current_button() != InfraredApp::ButtonNA)) {
+        submenu_set_selected_item(submenu, app->get_current_button());
+        app->set_current_button(InfraredApp::ButtonNA);
+    }
+
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Submenu);
+}
+
+bool InfraredAppSceneEditKeySelect::on_event(InfraredApp* app, InfraredAppEvent* event) {
+    bool consumed = false;
+
+    if(event->type == InfraredAppEvent::Type::MenuSelected) {
+        app->set_current_button(event->payload.menu_index);
+        consumed = true;
+        if(app->get_edit_action() == InfraredApp::EditAction::Rename) {
+            app->switch_to_next_scene(InfraredApp::Scene::EditRename);
+        } else {
+            app->switch_to_next_scene(InfraredApp::Scene::EditDelete);
+        }
+    }
+
+    return consumed;
+}
+
+void InfraredAppSceneEditKeySelect::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    Submenu* submenu = view_manager->get_submenu();
+
+    submenu_reset(submenu);
+}

+ 17 - 17
applications/irda/scene/irda_app_scene_edit_rename.cpp → applications/infrared/scene/infrared_app_scene_edit_rename.cpp

@@ -1,16 +1,16 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 
-void IrdaAppSceneEditRename::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneEditRename::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     TextInput* text_input = view_manager->get_text_input();
     size_t enter_name_length = 0;
 
     auto remote_manager = app->get_remote_manager();
-    if(app->get_edit_element() == IrdaApp::EditElement::Button) {
-        furi_assert(app->get_current_button() != IrdaApp::ButtonNA);
+    if(app->get_edit_element() == InfraredApp::EditElement::Button) {
+        furi_assert(app->get_current_button() != InfraredApp::ButtonNA);
         auto button_name = remote_manager->get_button_name(app->get_current_button());
         char* buffer_str = app->get_text_store(0);
-        size_t max_len = IrdaAppRemoteManager::max_button_name_length;
+        size_t max_len = InfraredAppRemoteManager::max_button_name_length;
         strncpy(buffer_str, button_name.c_str(), max_len);
         buffer_str[max_len + 1] = 0;
         enter_name_length = max_len;
@@ -18,43 +18,43 @@ void IrdaAppSceneEditRename::on_enter(IrdaApp* app) {
     } else {
         auto remote_name = remote_manager->get_remote_name();
         strncpy(app->get_text_store(0), remote_name.c_str(), app->get_text_store_size());
-        enter_name_length = IrdaAppRemoteManager::max_remote_name_length;
+        enter_name_length = InfraredAppRemoteManager::max_remote_name_length;
         text_input_set_header_text(text_input, "Name the remote");
 
         ValidatorIsFile* validator_is_file =
-            validator_is_file_alloc_init(app->irda_directory, app->irda_extension);
+            validator_is_file_alloc_init(app->infrared_directory, app->infrared_extension);
         text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
     }
 
     text_input_set_result_callback(
         text_input,
-        IrdaApp::text_input_callback,
+        InfraredApp::text_input_callback,
         app,
         app->get_text_store(0),
         enter_name_length,
         false);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::TextInput);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::TextInput);
 }
 
-bool IrdaAppSceneEditRename::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneEditRename::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::TextEditDone) {
+    if(event->type == InfraredAppEvent::Type::TextEditDone) {
         auto remote_manager = app->get_remote_manager();
         bool result = false;
-        if(app->get_edit_element() == IrdaApp::EditElement::Button) {
+        if(app->get_edit_element() == InfraredApp::EditElement::Button) {
             result =
                 remote_manager->rename_button(app->get_current_button(), app->get_text_store(0));
-            app->set_current_button(IrdaApp::ButtonNA);
+            app->set_current_button(InfraredApp::ButtonNA);
         } else {
             result = remote_manager->rename_remote(app->get_text_store(0));
         }
         if(!result) {
             app->search_and_switch_to_previous_scene(
-                {IrdaApp::Scene::Start, IrdaApp::Scene::RemoteList});
+                {InfraredApp::Scene::Start, InfraredApp::Scene::RemoteList});
         } else {
-            app->switch_to_next_scene_without_saving(IrdaApp::Scene::EditRenameDone);
+            app->switch_to_next_scene_without_saving(InfraredApp::Scene::EditRenameDone);
         }
         consumed = true;
     }
@@ -62,7 +62,7 @@ bool IrdaAppSceneEditRename::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneEditRename::on_exit(IrdaApp* app) {
+void InfraredAppSceneEditRename::on_exit(InfraredApp* app) {
     TextInput* text_input = app->get_view_manager()->get_text_input();
 
     void* validator_context = text_input_get_validator_callback_context(text_input);

+ 31 - 0
applications/infrared/scene/infrared_app_scene_edit_rename_done.cpp

@@ -0,0 +1,31 @@
+#include "../infrared_app.h"
+
+void InfraredAppSceneEditRenameDone::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    Popup* popup = view_manager->get_popup();
+
+    popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
+
+    popup_set_header(popup, "Saved!", 5, 7, AlignLeft, AlignTop);
+
+    popup_set_callback(popup, InfraredApp::popup_callback);
+    popup_set_context(popup, app);
+    popup_set_timeout(popup, 1500);
+    popup_enable_timeout(popup);
+
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Popup);
+}
+
+bool InfraredAppSceneEditRenameDone::on_event(InfraredApp* app, InfraredAppEvent* event) {
+    bool consumed = false;
+
+    if(event->type == InfraredAppEvent::Type::PopupTimer) {
+        app->switch_to_next_scene(InfraredApp::Scene::Remote);
+        consumed = true;
+    }
+
+    return consumed;
+}
+
+void InfraredAppSceneEditRenameDone::on_exit(InfraredApp* app) {
+}

+ 75 - 0
applications/infrared/scene/infrared_app_scene_learn.cpp

@@ -0,0 +1,75 @@
+#include "../infrared_app.h"
+#include "../infrared_app_event.h"
+#include "infrared.h"
+#include <infrared_worker.h>
+
+static void signal_received_callback(void* context, InfraredWorkerSignal* received_signal) {
+    furi_assert(context);
+    furi_assert(received_signal);
+
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+
+    if(infrared_worker_signal_is_decoded(received_signal)) {
+        InfraredAppSignal signal(infrared_worker_get_decoded_signal(received_signal));
+        app->set_received_signal(signal);
+    } else {
+        const uint32_t* timings;
+        size_t timings_cnt;
+        infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
+        InfraredAppSignal signal(
+            timings, timings_cnt, INFRARED_COMMON_CARRIER_FREQUENCY, INFRARED_COMMON_DUTY_CYCLE);
+        app->set_received_signal(signal);
+    }
+
+    infrared_worker_rx_set_received_signal_callback(app->get_infrared_worker(), NULL, NULL);
+    InfraredAppEvent event;
+    event.type = InfraredAppEvent::Type::InfraredMessageReceived;
+    auto view_manager = app->get_view_manager();
+    view_manager->send_event(&event);
+}
+
+void InfraredAppSceneLearn::on_enter(InfraredApp* app) {
+    auto view_manager = app->get_view_manager();
+    auto popup = view_manager->get_popup();
+
+    auto worker = app->get_infrared_worker();
+    infrared_worker_rx_set_received_signal_callback(worker, signal_received_callback, app);
+    infrared_worker_rx_start(worker);
+
+    popup_set_icon(popup, 0, 32, &I_InfraredLearnShort_128x31);
+    popup_set_text(
+        popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
+    popup_set_callback(popup, NULL);
+
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Popup);
+}
+
+bool InfraredAppSceneLearn::on_event(InfraredApp* app, InfraredAppEvent* event) {
+    bool consumed = false;
+
+    switch(event->type) {
+    case InfraredAppEvent::Type::Tick:
+        consumed = true;
+        app->notify_red_blink();
+        break;
+    case InfraredAppEvent::Type::InfraredMessageReceived:
+        app->notify_success();
+        app->switch_to_next_scene_without_saving(InfraredApp::Scene::LearnSuccess);
+        break;
+    case InfraredAppEvent::Type::Back:
+        consumed = true;
+        app->switch_to_previous_scene();
+        break;
+    default:
+        furi_assert(0);
+    }
+
+    return consumed;
+}
+
+void InfraredAppSceneLearn::on_exit(InfraredApp* app) {
+    infrared_worker_rx_stop(app->get_infrared_worker());
+    auto view_manager = app->get_view_manager();
+    auto popup = view_manager->get_popup();
+    popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignCenter);
+}

+ 10 - 10
applications/irda/scene/irda_app_scene_learn_done.cpp → applications/infrared/scene/infrared_app_scene_learn_done.cpp

@@ -1,8 +1,8 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 #include <dolphin/dolphin.h>
 
-void IrdaAppSceneLearnDone::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneLearnDone::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Popup* popup = view_manager->get_popup();
 
     popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
@@ -14,28 +14,28 @@ void IrdaAppSceneLearnDone::on_enter(IrdaApp* app) {
         popup_set_header(popup, "Saved!", 5, 7, AlignLeft, AlignTop);
     }
 
-    popup_set_callback(popup, IrdaApp::popup_callback);
+    popup_set_callback(popup, InfraredApp::popup_callback);
     popup_set_context(popup, app);
     popup_set_timeout(popup, 1500);
     popup_enable_timeout(popup);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Popup);
 }
 
-bool IrdaAppSceneLearnDone::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneLearnDone::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::PopupTimer) {
-        app->switch_to_next_scene(IrdaApp::Scene::Remote);
+    if(event->type == InfraredAppEvent::Type::PopupTimer) {
+        app->switch_to_next_scene(InfraredApp::Scene::Remote);
         consumed = true;
     }
 
     return consumed;
 }
 
-void IrdaAppSceneLearnDone::on_exit(IrdaApp* app) {
+void InfraredAppSceneLearnDone::on_exit(InfraredApp* app) {
     app->set_learn_new_remote(false);
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Popup* popup = view_manager->get_popup();
     popup_set_header(popup, nullptr, 0, 0, AlignLeft, AlignTop);
 }

+ 13 - 13
applications/irda/scene/irda_app_scene_learn_enter_name.cpp → applications/infrared/scene/infrared_app_scene_learn_enter_name.cpp

@@ -1,8 +1,8 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 #include "gui/modules/text_input.h"
 
-void IrdaAppSceneLearnEnterName::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneLearnEnterName::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     TextInput* text_input = view_manager->get_text_input();
 
     auto signal = app->get_received_signal();
@@ -12,8 +12,8 @@ void IrdaAppSceneLearnEnterName::on_enter(IrdaApp* app) {
         app->set_text_store(
             0,
             "%.4s_%0*lX",
-            irda_get_protocol_name(message->protocol),
-            ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
+            infrared_get_protocol_name(message->protocol),
+            ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4),
             message->command);
     } else {
         auto raw_signal = signal.get_raw_signal();
@@ -23,19 +23,19 @@ void IrdaAppSceneLearnEnterName::on_enter(IrdaApp* app) {
     text_input_set_header_text(text_input, "Name the key");
     text_input_set_result_callback(
         text_input,
-        IrdaApp::text_input_callback,
+        InfraredApp::text_input_callback,
         app,
         app->get_text_store(0),
-        IrdaAppRemoteManager::max_button_name_length,
+        InfraredAppRemoteManager::max_button_name_length,
         true);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::TextInput);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::TextInput);
 }
 
-bool IrdaAppSceneLearnEnterName::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneLearnEnterName::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::TextEditDone) {
+    if(event->type == InfraredAppEvent::Type::TextEditDone) {
         auto remote_manager = app->get_remote_manager();
         bool result = false;
         if(app->get_learn_new_remote()) {
@@ -48,13 +48,13 @@ bool IrdaAppSceneLearnEnterName::on_event(IrdaApp* app, IrdaAppEvent* event) {
 
         if(!result) {
             app->search_and_switch_to_previous_scene(
-                {IrdaApp::Scene::Start, IrdaApp::Scene::RemoteList});
+                {InfraredApp::Scene::Start, InfraredApp::Scene::RemoteList});
         } else {
-            app->switch_to_next_scene_without_saving(IrdaApp::Scene::LearnDone);
+            app->switch_to_next_scene_without_saving(InfraredApp::Scene::LearnDone);
         }
     }
     return consumed;
 }
 
-void IrdaAppSceneLearnEnterName::on_exit(IrdaApp* app) {
+void InfraredAppSceneLearnEnterName::on_exit(InfraredApp* app) {
 }

+ 34 - 31
applications/irda/scene/irda_app_scene_learn_success.cpp → applications/infrared/scene/infrared_app_scene_learn_success.cpp

@@ -3,42 +3,44 @@
 #include <memory>
 #include <dolphin/dolphin.h>
 
-#include "../irda_app.h"
-#include "irda.h"
+#include "../infrared_app.h"
+#include "infrared.h"
 
 static void dialog_result_callback(DialogExResult result, void* context) {
-    auto app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    auto app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::DialogExSelected;
+    event.type = InfraredAppEvent::Type::DialogExSelected;
     event.payload.dialog_ex_result = result;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneLearnSuccess::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneLearnSuccess::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     DialogEx* dialog_ex = view_manager->get_dialog_ex();
 
     DOLPHIN_DEED(DolphinDeedIrLearnSuccess);
     app->notify_green_on();
 
-    irda_worker_tx_set_get_signal_callback(
-        app->get_irda_worker(), irda_worker_tx_get_signal_steady_callback, app);
-    irda_worker_tx_set_signal_sent_callback(
-        app->get_irda_worker(), IrdaApp::signal_sent_callback, app);
+    infrared_worker_tx_set_get_signal_callback(
+        app->get_infrared_worker(), infrared_worker_tx_get_signal_steady_callback, app);
+    infrared_worker_tx_set_signal_sent_callback(
+        app->get_infrared_worker(), InfraredApp::signal_sent_callback, app);
 
     auto signal = app->get_received_signal();
 
     if(!signal.is_raw()) {
         auto message = &signal.get_message();
-        uint8_t adr_digits = ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4);
-        uint8_t cmd_digits = ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4);
+        uint8_t adr_digits =
+            ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4);
+        uint8_t cmd_digits =
+            ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4);
         uint8_t max_digits = MAX(adr_digits, cmd_digits);
         max_digits = MIN(max_digits, 7);
         size_t label_x_offset = 63 + (7 - max_digits) * 3;
 
-        app->set_text_store(0, "%s", irda_get_protocol_name(message->protocol));
+        app->set_text_store(0, "%s", infrared_get_protocol_name(message->protocol));
         app->set_text_store(
             1,
             "A: 0x%0*lX\nC: 0x%0*lX\n",
@@ -64,24 +66,24 @@ void IrdaAppSceneLearnSuccess::on_enter(IrdaApp* app) {
     dialog_ex_set_context(dialog_ex, app);
     dialog_ex_enable_extended_events(dialog_ex);
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::DialogEx);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::DialogEx);
 }
 
-bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneLearnSuccess::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
-    if(event->type == IrdaAppEvent::Type::Tick) {
+    if(event->type == InfraredAppEvent::Type::Tick) {
         /* Send event every tick to suppress any switching off green light */
         if(!button_pressed) {
             app->notify_green_on();
         }
     }
 
-    if(event->type == IrdaAppEvent::Type::DialogExSelected) {
+    if(event->type == InfraredAppEvent::Type::DialogExSelected) {
         switch(event->payload.dialog_ex_result) {
         case DialogExResultLeft:
             consumed = true;
             if(!button_pressed) {
-                app->switch_to_next_scene_without_saving(IrdaApp::Scene::Learn);
+                app->switch_to_next_scene_without_saving(InfraredApp::Scene::Learn);
             }
             break;
         case DialogExResultRight: {
@@ -89,7 +91,7 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
             FileWorkerCpp file_worker;
             if(!button_pressed) {
                 if(file_worker.check_errors()) {
-                    app->switch_to_next_scene(IrdaApp::Scene::LearnEnterName);
+                    app->switch_to_next_scene(InfraredApp::Scene::LearnEnterName);
                 } else {
                     app->switch_to_previous_scene();
                 }
@@ -103,21 +105,22 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
 
                 auto signal = app->get_received_signal();
                 if(signal.is_raw()) {
-                    irda_worker_set_raw_signal(
-                        app->get_irda_worker(),
+                    infrared_worker_set_raw_signal(
+                        app->get_infrared_worker(),
                         signal.get_raw_signal().timings,
                         signal.get_raw_signal().timings_cnt);
                 } else {
-                    irda_worker_set_decoded_signal(app->get_irda_worker(), &signal.get_message());
+                    infrared_worker_set_decoded_signal(
+                        app->get_infrared_worker(), &signal.get_message());
                 }
 
-                irda_worker_tx_start(app->get_irda_worker());
+                infrared_worker_tx_start(app->get_infrared_worker());
             }
             break;
         case DialogExReleaseCenter:
             if(button_pressed) {
                 button_pressed = false;
-                irda_worker_tx_stop(app->get_irda_worker());
+                infrared_worker_tx_stop(app->get_infrared_worker());
                 app->notify_green_off();
             }
             break;
@@ -126,9 +129,9 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
         }
     }
 
-    if(event->type == IrdaAppEvent::Type::Back) {
+    if(event->type == InfraredAppEvent::Type::Back) {
         if(!button_pressed) {
-            app->switch_to_next_scene(IrdaApp::Scene::AskBack);
+            app->switch_to_next_scene(InfraredApp::Scene::AskBack);
         }
         consumed = true;
     }
@@ -136,11 +139,11 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneLearnSuccess::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneLearnSuccess::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     DialogEx* dialog_ex = view_manager->get_dialog_ex();
     dialog_ex_reset(dialog_ex);
     app->notify_green_off();
-    irda_worker_tx_set_get_signal_callback(app->get_irda_worker(), nullptr, nullptr);
-    irda_worker_tx_set_signal_sent_callback(app->get_irda_worker(), nullptr, nullptr);
+    infrared_worker_tx_set_get_signal_callback(app->get_infrared_worker(), nullptr, nullptr);
+    infrared_worker_tx_set_signal_sent_callback(app->get_infrared_worker(), nullptr, nullptr);
 }

+ 37 - 37
applications/irda/scene/irda_app_scene_remote.cpp → applications/infrared/scene/infrared_app_scene_remote.cpp

@@ -1,9 +1,9 @@
 #include <gui/modules/button_menu.h>
 #include <input/input.h>
-#include <irda_worker.h>
+#include <infrared_worker.h>
 #include <dolphin/dolphin.h>
-#include "../irda_app.h"
-#include "../irda_app_view_manager.h"
+#include "../infrared_app.h"
+#include "../infrared_app_view_manager.h"
 
 typedef enum {
     ButtonIndexPlus = -2,
@@ -12,15 +12,15 @@ typedef enum {
 } ButtonIndex;
 
 static void button_menu_callback(void* context, int32_t index, InputType type) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
     if(type == InputTypePress) {
-        event.type = IrdaAppEvent::Type::MenuSelectedPress;
+        event.type = InfraredAppEvent::Type::MenuSelectedPress;
     } else if(type == InputTypeRelease) {
-        event.type = IrdaAppEvent::Type::MenuSelectedRelease;
+        event.type = InfraredAppEvent::Type::MenuSelectedRelease;
     } else if(type == InputTypeShort) {
-        event.type = IrdaAppEvent::Type::MenuSelected;
+        event.type = InfraredAppEvent::Type::MenuSelected;
     } else {
         furi_assert(0);
     }
@@ -30,17 +30,17 @@ static void button_menu_callback(void* context, int32_t index, InputType type) {
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneRemote::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneRemote::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     ButtonMenu* button_menu = view_manager->get_button_menu();
     auto remote_manager = app->get_remote_manager();
     int i = 0;
     button_pressed = false;
 
-    irda_worker_tx_set_get_signal_callback(
-        app->get_irda_worker(), irda_worker_tx_get_signal_steady_callback, app);
-    irda_worker_tx_set_signal_sent_callback(
-        app->get_irda_worker(), IrdaApp::signal_sent_callback, app);
+    infrared_worker_tx_set_get_signal_callback(
+        app->get_infrared_worker(), infrared_worker_tx_get_signal_steady_callback, app);
+    infrared_worker_tx_set_signal_sent_callback(
+        app->get_infrared_worker(), InfraredApp::signal_sent_callback, app);
     buttons_names = remote_manager->get_button_list();
 
     i = 0;
@@ -60,32 +60,32 @@ void IrdaAppSceneRemote::on_enter(IrdaApp* app) {
         button_menu_set_selected_item(button_menu, buttonmenu_item_selected);
         buttonmenu_item_selected = ButtonIndexNA;
     }
-    view_manager->switch_to(IrdaAppViewManager::ViewType::ButtonMenu);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::ButtonMenu);
 }
 
-bool IrdaAppSceneRemote::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneRemote::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = true;
 
-    if((event->type == IrdaAppEvent::Type::MenuSelected) ||
-       (event->type == IrdaAppEvent::Type::MenuSelectedPress) ||
-       (event->type == IrdaAppEvent::Type::MenuSelectedRelease)) {
+    if((event->type == InfraredAppEvent::Type::MenuSelected) ||
+       (event->type == InfraredAppEvent::Type::MenuSelectedPress) ||
+       (event->type == InfraredAppEvent::Type::MenuSelectedRelease)) {
         switch(event->payload.menu_index) {
         case ButtonIndexPlus:
-            furi_assert(event->type == IrdaAppEvent::Type::MenuSelected);
+            furi_assert(event->type == InfraredAppEvent::Type::MenuSelected);
             app->notify_click();
             buttonmenu_item_selected = event->payload.menu_index;
             app->set_learn_new_remote(false);
-            app->switch_to_next_scene(IrdaApp::Scene::Learn);
+            app->switch_to_next_scene(InfraredApp::Scene::Learn);
             break;
         case ButtonIndexEdit:
-            furi_assert(event->type == IrdaAppEvent::Type::MenuSelected);
+            furi_assert(event->type == InfraredAppEvent::Type::MenuSelected);
             app->notify_click();
             buttonmenu_item_selected = event->payload.menu_index;
-            app->switch_to_next_scene(IrdaApp::Scene::Edit);
+            app->switch_to_next_scene(InfraredApp::Scene::Edit);
             break;
         default:
-            furi_assert(event->type != IrdaAppEvent::Type::MenuSelected);
-            bool pressed = (event->type == IrdaAppEvent::Type::MenuSelectedPress);
+            furi_assert(event->type != InfraredAppEvent::Type::MenuSelected);
+            bool pressed = (event->type == InfraredAppEvent::Type::MenuSelectedPress);
 
             if(pressed && !button_pressed) {
                 button_pressed = true;
@@ -94,28 +94,28 @@ bool IrdaAppSceneRemote::on_event(IrdaApp* app, IrdaAppEvent* event) {
                 auto button_signal =
                     app->get_remote_manager()->get_button_data(event->payload.menu_index);
                 if(button_signal.is_raw()) {
-                    irda_worker_set_raw_signal(
-                        app->get_irda_worker(),
+                    infrared_worker_set_raw_signal(
+                        app->get_infrared_worker(),
                         button_signal.get_raw_signal().timings,
                         button_signal.get_raw_signal().timings_cnt);
                 } else {
-                    irda_worker_set_decoded_signal(
-                        app->get_irda_worker(), &button_signal.get_message());
+                    infrared_worker_set_decoded_signal(
+                        app->get_infrared_worker(), &button_signal.get_message());
                 }
 
                 DOLPHIN_DEED(DolphinDeedIrSend);
-                irda_worker_tx_start(app->get_irda_worker());
+                infrared_worker_tx_start(app->get_infrared_worker());
             } else if(!pressed && button_pressed) {
                 button_pressed = false;
-                irda_worker_tx_stop(app->get_irda_worker());
+                infrared_worker_tx_stop(app->get_infrared_worker());
                 app->notify_green_off();
             }
             break;
         }
-    } else if(event->type == IrdaAppEvent::Type::Back) {
+    } else if(event->type == InfraredAppEvent::Type::Back) {
         if(!button_pressed) {
             app->search_and_switch_to_previous_scene(
-                {IrdaApp::Scene::Start, IrdaApp::Scene::RemoteList});
+                {InfraredApp::Scene::Start, InfraredApp::Scene::RemoteList});
         }
     } else {
         consumed = false;
@@ -124,10 +124,10 @@ bool IrdaAppSceneRemote::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneRemote::on_exit(IrdaApp* app) {
-    irda_worker_tx_set_get_signal_callback(app->get_irda_worker(), nullptr, nullptr);
-    irda_worker_tx_set_signal_sent_callback(app->get_irda_worker(), nullptr, nullptr);
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneRemote::on_exit(InfraredApp* app) {
+    infrared_worker_tx_set_get_signal_callback(app->get_infrared_worker(), nullptr, nullptr);
+    infrared_worker_tx_set_signal_sent_callback(app->get_infrared_worker(), nullptr, nullptr);
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     ButtonMenu* button_menu = view_manager->get_button_menu();
 
     button_menu_reset(button_menu);

+ 12 - 11
applications/irda/scene/irda_app_scene_remote_list.cpp → applications/infrared/scene/infrared_app_scene_remote_list.cpp

@@ -1,9 +1,9 @@
-#include "../irda_app.h"
-#include "irda/irda_app_event.h"
+#include "../infrared_app.h"
+#include "infrared/infrared_app_event.h"
 #include <text_store.h>
 #include <file_worker_cpp.h>
 
-void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
+void InfraredAppSceneRemoteList::on_enter(InfraredApp* app) {
     furi_assert(app);
 
     FileWorkerCpp file_worker;
@@ -13,23 +13,24 @@ void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
     auto last_selected_remote = remote_manager->get_remote_name();
     const char* last_selected_remote_name =
         last_selected_remote.size() ? last_selected_remote.c_str() : nullptr;
-    auto filename_ts = std::make_unique<TextStore>(IrdaAppRemoteManager::max_remote_name_length);
+    auto filename_ts =
+        std::make_unique<TextStore>(InfraredAppRemoteManager::max_remote_name_length);
 
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     ButtonMenu* button_menu = view_manager->get_button_menu();
     button_menu_reset(button_menu);
-    view_manager->switch_to(IrdaAppViewManager::ViewType::ButtonMenu);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::ButtonMenu);
 
     file_select_result = file_worker.file_select(
-        IrdaApp::irda_directory,
-        IrdaApp::irda_extension,
+        InfraredApp::infrared_directory,
+        InfraredApp::infrared_extension,
         filename_ts->text,
         filename_ts->text_size,
         last_selected_remote_name);
 
     if(file_select_result) {
         if(remote_manager->load(std::string(filename_ts->text))) {
-            app->switch_to_next_scene(IrdaApp::Scene::Remote);
+            app->switch_to_next_scene(InfraredApp::Scene::Remote);
             result = true;
         }
     }
@@ -39,11 +40,11 @@ void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
     }
 }
 
-bool IrdaAppSceneRemoteList::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneRemoteList::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
     return consumed;
 }
 
-void IrdaAppSceneRemoteList::on_exit(IrdaApp* app) {
+void InfraredAppSceneRemoteList::on_exit(InfraredApp* app) {
 }

+ 14 - 14
applications/irda/scene/irda_app_scene_start.cpp → applications/infrared/scene/infrared_app_scene_start.cpp

@@ -1,4 +1,4 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 
 typedef enum {
     SubmenuIndexUniversalLibrary,
@@ -7,17 +7,17 @@ typedef enum {
 } SubmenuIndex;
 
 static void submenu_callback(void* context, uint32_t index) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::MenuSelected;
+    event.type = InfraredAppEvent::Type::MenuSelected;
     event.payload.menu_index = index;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneStart::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneStart::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     submenu_add_item(
@@ -28,24 +28,24 @@ void IrdaAppSceneStart::on_enter(IrdaApp* app) {
     submenu_set_selected_item(submenu, submenu_item_selected);
     submenu_item_selected = 0;
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Submenu);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Submenu);
 }
 
-bool IrdaAppSceneStart::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneStart::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::MenuSelected) {
+    if(event->type == InfraredAppEvent::Type::MenuSelected) {
         submenu_item_selected = event->payload.menu_index;
         switch(event->payload.menu_index) {
         case SubmenuIndexUniversalLibrary:
-            app->switch_to_next_scene(IrdaApp::Scene::Universal);
+            app->switch_to_next_scene(InfraredApp::Scene::Universal);
             break;
         case SubmenuIndexLearnNewRemote:
             app->set_learn_new_remote(true);
-            app->switch_to_next_scene(IrdaApp::Scene::Learn);
+            app->switch_to_next_scene(InfraredApp::Scene::Learn);
             break;
         case SubmenuIndexSavedRemotes:
-            app->switch_to_next_scene(IrdaApp::Scene::RemoteList);
+            app->switch_to_next_scene(InfraredApp::Scene::RemoteList);
             break;
         default:
             furi_assert(0);
@@ -57,8 +57,8 @@ bool IrdaAppSceneStart::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneStart::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneStart::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     app->get_remote_manager()->reset_remote();

+ 14 - 14
applications/irda/scene/irda_app_scene_universal.cpp → applications/infrared/scene/infrared_app_scene_universal.cpp

@@ -1,4 +1,4 @@
-#include "../irda_app.h"
+#include "../infrared_app.h"
 
 typedef enum {
     SubmenuIndexUniversalTV,
@@ -7,40 +7,40 @@ typedef enum {
 } SubmenuIndex;
 
 static void submenu_callback(void* context, uint32_t index) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
 
-    event.type = IrdaAppEvent::Type::MenuSelected;
+    event.type = InfraredAppEvent::Type::MenuSelected;
     event.payload.menu_index = index;
 
     app->get_view_manager()->send_event(&event);
 }
 
-void IrdaAppSceneUniversal::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneUniversal::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     submenu_add_item(submenu, "TV's", SubmenuIndexUniversalTV, submenu_callback, app);
     submenu_set_selected_item(submenu, submenu_item_selected);
     submenu_item_selected = 0;
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Submenu);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::Submenu);
 }
 
-bool IrdaAppSceneUniversal::on_event(IrdaApp* app, IrdaAppEvent* event) {
+bool InfraredAppSceneUniversal::on_event(InfraredApp* app, InfraredAppEvent* event) {
     bool consumed = false;
 
-    if(event->type == IrdaAppEvent::Type::MenuSelected) {
+    if(event->type == InfraredAppEvent::Type::MenuSelected) {
         submenu_item_selected = event->payload.menu_index;
         switch(event->payload.menu_index) {
         case SubmenuIndexUniversalTV:
-            app->switch_to_next_scene(IrdaApp::Scene::UniversalTV);
+            app->switch_to_next_scene(InfraredApp::Scene::UniversalTV);
             break;
         case SubmenuIndexUniversalAudio:
-            //            app->switch_to_next_scene(IrdaApp::Scene::UniversalAudio);
+            //            app->switch_to_next_scene(InfraredApp::Scene::UniversalAudio);
             break;
         case SubmenuIndexUniversalAirConditioner:
-            //            app->switch_to_next_scene(IrdaApp::Scene::UniversalAirConditioner);
+            //            app->switch_to_next_scene(InfraredApp::Scene::UniversalAirConditioner);
             break;
         }
         consumed = true;
@@ -49,8 +49,8 @@ bool IrdaAppSceneUniversal::on_event(IrdaApp* app, IrdaAppEvent* event) {
     return consumed;
 }
 
-void IrdaAppSceneUniversal::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneUniversal::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     Submenu* submenu = view_manager->get_submenu();
 
     submenu_reset(submenu);

+ 101 - 0
applications/infrared/scene/infrared_app_scene_universal_common.cpp

@@ -0,0 +1,101 @@
+#include <dolphin/dolphin.h>
+#include <gui/modules/button_menu.h>
+#include <gui/modules/button_panel.h>
+#include <gui/view.h>
+#include <gui/view_stack.h>
+
+#include "../infrared_app.h"
+#include "infrared/infrared_app_event.h"
+#include "infrared/infrared_app_view_manager.h"
+#include "infrared/scene/infrared_app_scene.h"
+#include "../view/infrared_progress_view.h"
+
+void InfraredAppSceneUniversalCommon::infrared_app_item_callback(void* context, uint32_t index) {
+    InfraredApp* app = static_cast<InfraredApp*>(context);
+    InfraredAppEvent event;
+
+    event.type = InfraredAppEvent::Type::ButtonPanelPressed;
+    event.payload.menu_index = index;
+
+    app->get_view_manager()->send_event(&event);
+}
+
+static void infrared_progress_back_callback(void* context) {
+    furi_assert(context);
+    auto app = static_cast<InfraredApp*>(context);
+
+    InfraredAppEvent infrared_event = {
+        .type = InfraredAppEvent::Type::Back,
+    };
+    app->get_view_manager()->clear_events();
+    app->get_view_manager()->send_event(&infrared_event);
+}
+
+void InfraredAppSceneUniversalCommon::hide_popup(InfraredApp* app) {
+    auto stack_view = app->get_view_manager()->get_universal_view_stack();
+    auto progress_view = app->get_view_manager()->get_progress();
+    view_stack_remove_view(stack_view, infrared_progress_view_get_view(progress_view));
+}
+
+void InfraredAppSceneUniversalCommon::show_popup(InfraredApp* app, int record_amount) {
+    auto stack_view = app->get_view_manager()->get_universal_view_stack();
+    auto progress_view = app->get_view_manager()->get_progress();
+    infrared_progress_view_set_progress_total(progress_view, record_amount);
+    infrared_progress_view_set_back_callback(progress_view, infrared_progress_back_callback, app);
+    view_stack_add_view(stack_view, infrared_progress_view_get_view(progress_view));
+}
+
+bool InfraredAppSceneUniversalCommon::progress_popup(InfraredApp* app) {
+    auto progress_view = app->get_view_manager()->get_progress();
+    return infrared_progress_view_increase_progress(progress_view);
+}
+
+bool InfraredAppSceneUniversalCommon::on_event(InfraredApp* app, InfraredAppEvent* event) {
+    bool consumed = false;
+
+    if(brute_force_started) {
+        if(event->type == InfraredAppEvent::Type::Tick) {
+            auto view_manager = app->get_view_manager();
+            InfraredAppEvent tick_event = {.type = InfraredAppEvent::Type::Tick};
+            view_manager->send_event(&tick_event);
+            bool result = brute_force.send_next_bruteforce();
+            if(result) {
+                result = progress_popup(app);
+            }
+            if(!result) {
+                brute_force.stop_bruteforce();
+                brute_force_started = false;
+                hide_popup(app);
+            }
+            consumed = true;
+        } else if(event->type == InfraredAppEvent::Type::Back) {
+            brute_force_started = false;
+            brute_force.stop_bruteforce();
+            hide_popup(app);
+            consumed = true;
+        }
+    } else {
+        if(event->type == InfraredAppEvent::Type::ButtonPanelPressed) {
+            int record_amount = 0;
+            if(brute_force.start_bruteforce(event->payload.menu_index, record_amount)) {
+                DOLPHIN_DEED(DolphinDeedIrBruteForce);
+                brute_force_started = true;
+                show_popup(app, record_amount);
+            } else {
+                app->switch_to_previous_scene();
+            }
+            consumed = true;
+        } else if(event->type == InfraredAppEvent::Type::Back) {
+            app->switch_to_previous_scene();
+            consumed = true;
+        }
+    }
+
+    return consumed;
+}
+
+void InfraredAppSceneUniversalCommon::on_exit(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
+    ButtonPanel* button_panel = view_manager->get_button_panel();
+    button_panel_reset(button_panel);
+}

+ 20 - 11
applications/irda/scene/irda_app_scene_universal_tv.cpp → applications/infrared/scene/infrared_app_scene_universal_tv.cpp

@@ -1,11 +1,11 @@
 #include <stdint.h>
 #include <gui/modules/loading.h>
 #include <gui/view_stack.h>
-#include "irda/scene/irda_app_scene.h"
-#include "irda/irda_app.h"
+#include "infrared/scene/infrared_app_scene.h"
+#include "infrared/infrared_app.h"
 
-void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
+void InfraredAppSceneUniversalTV::on_enter(InfraredApp* app) {
+    InfraredAppViewManager* view_manager = app->get_view_manager();
     ButtonPanel* button_panel = view_manager->get_button_panel();
     button_panel_reserve(button_panel, 2, 3);
 
@@ -19,7 +19,7 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
         19,
         &I_Power_25x27,
         &I_Power_hvr_25x27,
-        irda_app_item_callback,
+        infrared_app_item_callback,
         app);
     brute_force.add_record(i, "POWER");
     ++i;
@@ -32,7 +32,7 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
         19,
         &I_Mute_25x27,
         &I_Mute_hvr_25x27,
-        irda_app_item_callback,
+        infrared_app_item_callback,
         app);
     brute_force.add_record(i, "MUTE");
     ++i;
@@ -45,12 +45,21 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
         66,
         &I_Vol_up_25x27,
         &I_Vol_up_hvr_25x27,
-        irda_app_item_callback,
+        infrared_app_item_callback,
         app);
     brute_force.add_record(i, "VOL+");
     ++i;
     button_panel_add_item(
-        button_panel, i, 1, 1, 36, 66, &I_Up_25x27, &I_Up_hvr_25x27, irda_app_item_callback, app);
+        button_panel,
+        i,
+        1,
+        1,
+        36,
+        66,
+        &I_Up_25x27,
+        &I_Up_hvr_25x27,
+        infrared_app_item_callback,
+        app);
     brute_force.add_record(i, "CH+");
     ++i;
     button_panel_add_item(
@@ -62,7 +71,7 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
         98,
         &I_Vol_down_25x27,
         &I_Vol_down_hvr_25x27,
-        irda_app_item_callback,
+        infrared_app_item_callback,
         app);
     brute_force.add_record(i, "VOL-");
     ++i;
@@ -75,7 +84,7 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
         98,
         &I_Down_25x27,
         &I_Down_hvr_25x27,
-        irda_app_item_callback,
+        infrared_app_item_callback,
         app);
     brute_force.add_record(i, "CH-");
 
@@ -83,7 +92,7 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
     button_panel_add_label(button_panel, 9, 64, FontSecondary, "Vol");
     button_panel_add_label(button_panel, 43, 64, FontSecondary, "Ch");
 
-    view_manager->switch_to(IrdaAppViewManager::ViewType::UniversalRemote);
+    view_manager->switch_to(InfraredAppViewManager::ViewId::UniversalRemote);
 
     auto stack_view = app->get_view_manager()->get_universal_view_stack();
     auto loading_view = app->get_view_manager()->get_loading();

+ 25 - 23
applications/irda/view/irda_progress_view.c → applications/infrared/view/infrared_progress_view.c

@@ -7,26 +7,26 @@
 #include "m-string.h"
 #include <gui/elements.h>
 #include <furi.h>
-#include "irda_progress_view.h"
+#include "infrared_progress_view.h"
 #include "gui/modules/button_panel.h"
 #include <stdint.h>
 
-struct IrdaProgressView {
+struct InfraredProgressView {
     View* view;
-    IrdaProgressViewBackCallback back_callback;
+    InfraredProgressViewBackCallback back_callback;
     void* context;
 };
 
 typedef struct {
     size_t progress;
     size_t progress_total;
-} IrdaProgressViewModel;
+} InfraredProgressViewModel;
 
-bool irda_progress_view_increase_progress(IrdaProgressView* progress) {
+bool infrared_progress_view_increase_progress(InfraredProgressView* progress) {
     furi_assert(progress);
     bool result = false;
 
-    IrdaProgressViewModel* model = view_get_model(progress->view);
+    InfraredProgressViewModel* model = view_get_model(progress->view);
     if(model->progress < model->progress_total) {
         ++model->progress;
         result = model->progress < model->progress_total;
@@ -36,8 +36,8 @@ bool irda_progress_view_increase_progress(IrdaProgressView* progress) {
     return result;
 }
 
-static void irda_progress_view_draw_callback(Canvas* canvas, void* _model) {
-    IrdaProgressViewModel* model = (IrdaProgressViewModel*)_model;
+static void infrared_progress_view_draw_callback(Canvas* canvas, void* _model) {
+    InfraredProgressViewModel* model = (InfraredProgressViewModel*)_model;
 
     uint8_t x = 0;
     uint8_t y = 36;
@@ -63,16 +63,18 @@ static void irda_progress_view_draw_callback(Canvas* canvas, void* _model) {
     canvas_draw_str(canvas, x + 30, y + height - 6, "= stop");
 }
 
-void irda_progress_view_set_progress_total(IrdaProgressView* progress, uint16_t progress_total) {
+void infrared_progress_view_set_progress_total(
+    InfraredProgressView* progress,
+    uint16_t progress_total) {
     furi_assert(progress);
-    IrdaProgressViewModel* model = view_get_model(progress->view);
+    InfraredProgressViewModel* model = view_get_model(progress->view);
     model->progress = 0;
     model->progress_total = progress_total;
     view_commit_model(progress->view, false);
 }
 
-bool irda_progress_view_input_callback(InputEvent* event, void* context) {
-    IrdaProgressView* instance = context;
+bool infrared_progress_view_input_callback(InputEvent* event, void* context) {
+    InfraredProgressView* instance = context;
 
     if((event->type == InputTypeShort) && (event->key == InputKeyBack)) {
         if(instance->back_callback) {
@@ -83,36 +85,36 @@ bool irda_progress_view_input_callback(InputEvent* event, void* context) {
     return true;
 }
 
-IrdaProgressView* irda_progress_view_alloc(void) {
-    IrdaProgressView* instance = malloc(sizeof(IrdaProgressView));
+InfraredProgressView* infrared_progress_view_alloc(void) {
+    InfraredProgressView* instance = malloc(sizeof(InfraredProgressView));
     instance->view = view_alloc();
-    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(IrdaProgressViewModel));
-    IrdaProgressViewModel* model = view_get_model(instance->view);
+    view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(InfraredProgressViewModel));
+    InfraredProgressViewModel* model = view_get_model(instance->view);
     model->progress = 0;
     model->progress_total = 0;
     view_commit_model(instance->view, false);
-    view_set_draw_callback(instance->view, irda_progress_view_draw_callback);
-    view_set_input_callback(instance->view, irda_progress_view_input_callback);
+    view_set_draw_callback(instance->view, infrared_progress_view_draw_callback);
+    view_set_input_callback(instance->view, infrared_progress_view_input_callback);
     view_set_context(instance->view, instance);
 
     return instance;
 }
 
-void irda_progress_view_free(IrdaProgressView* progress) {
+void infrared_progress_view_free(InfraredProgressView* progress) {
     view_free(progress->view);
     free(progress);
 }
 
-void irda_progress_view_set_back_callback(
-    IrdaProgressView* instance,
-    IrdaProgressViewBackCallback callback,
+void infrared_progress_view_set_back_callback(
+    InfraredProgressView* instance,
+    InfraredProgressViewBackCallback callback,
     void* context) {
     furi_assert(instance);
     instance->back_callback = callback;
     instance->context = context;
 }
 
-View* irda_progress_view_get_view(IrdaProgressView* instance) {
+View* infrared_progress_view_get_view(InfraredProgressView* instance) {
     furi_assert(instance);
     furi_assert(instance->view);
     return instance->view;

+ 68 - 0
applications/infrared/view/infrared_progress_view.h

@@ -0,0 +1,68 @@
+/**
+  * @file infrared_progress_view.h
+  * Infrared: Custom Infrared view module.
+  * It shows popup progress bar during brute force.
+  */
+#pragma once
+#include <gui/view.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Anonumous instance */
+typedef struct InfraredProgressView InfraredProgressView;
+
+/** Callback for back button handling */
+typedef void (*InfraredProgressViewBackCallback)(void*);
+
+/** Allocate and initialize Infrared view
+ *
+ * @retval new allocated instance
+ */
+InfraredProgressView* infrared_progress_view_alloc();
+
+/** Free previously allocated Progress view module instance
+ *
+ * @param instance to free
+ */
+void infrared_progress_view_free(InfraredProgressView* instance);
+
+/** Get progress view module view
+ *
+ * @param instance view module
+ * @retval view
+ */
+View* infrared_progress_view_get_view(InfraredProgressView* instance);
+
+/** Increase progress on progress view module
+ *
+ * @param instance view module
+ * @retval true - value is incremented and maximum is reached,
+ *      false - value is incremented and maximum is not reached
+ */
+bool infrared_progress_view_increase_progress(InfraredProgressView* instance);
+
+/** Set maximum progress value
+ *
+ * @param instance - view module
+ * @param progress_max - maximum value of progress
+ */
+void infrared_progress_view_set_progress_total(
+    InfraredProgressView* instance,
+    uint16_t progress_max);
+
+/** Set back button callback
+ *
+ * @param instance - view module
+ * @param callback - callback to call for back button
+ * @param context - context to pass to callback
+ */
+void infrared_progress_view_set_back_callback(
+    InfraredProgressView* instance,
+    InfraredProgressViewBackCallback callback,
+    void* context);
+
+#ifdef __cplusplus
+}
+#endif

+ 140 - 0
applications/infrared_monitor/infrared_monitor.c

@@ -0,0 +1,140 @@
+#include <gui/canvas.h>
+#include <input/input.h>
+#include <infrared.h>
+#include <infrared_worker.h>
+#include <stdio.h>
+#include <furi.h>
+#include <furi_hal_infrared.h>
+#include <furi_hal.h>
+#include <gui/view_port.h>
+#include <gui/gui.h>
+#include <gui/elements.h>
+
+#define INFRARED_TIMINGS_SIZE 700
+
+typedef struct {
+    uint32_t timing_cnt;
+    struct {
+        uint8_t level;
+        uint32_t duration;
+    } timing[INFRARED_TIMINGS_SIZE];
+} InfraredDelaysArray;
+
+typedef struct {
+    char display_text[64];
+    osMessageQueueId_t event_queue;
+    InfraredDelaysArray delays;
+    InfraredWorker* worker;
+    ViewPort* view_port;
+} InfraredMonitor;
+
+void infrared_monitor_input_callback(InputEvent* input_event, void* ctx) {
+    furi_assert(ctx);
+    InfraredMonitor* infrared_monitor = (InfraredMonitor*)ctx;
+
+    if((input_event->type == InputTypeShort) && (input_event->key == InputKeyBack)) {
+        osMessageQueuePut(infrared_monitor->event_queue, input_event, 0, 0);
+    }
+}
+
+static void infrared_monitor_draw_callback(Canvas* canvas, void* ctx) {
+    furi_assert(canvas);
+    furi_assert(ctx);
+    InfraredMonitor* infrared_monitor = (InfraredMonitor*)ctx;
+
+    canvas_clear(canvas);
+    canvas_set_font(canvas, FontPrimary);
+    elements_multiline_text_aligned(canvas, 64, 0, AlignCenter, AlignTop, "INFRARED monitor\n");
+    canvas_set_font(canvas, FontKeyboard);
+    if(strlen(infrared_monitor->display_text)) {
+        elements_multiline_text_aligned(
+            canvas, 64, 43, AlignCenter, AlignCenter, infrared_monitor->display_text);
+    }
+}
+
+static void signal_received_callback(void* context, InfraredWorkerSignal* received_signal) {
+    furi_assert(context);
+    furi_assert(received_signal);
+    InfraredMonitor* infrared_monitor = context;
+
+    if(infrared_worker_signal_is_decoded(received_signal)) {
+        const InfraredMessage* message = infrared_worker_get_decoded_signal(received_signal);
+        snprintf(
+            infrared_monitor->display_text,
+            sizeof(infrared_monitor->display_text),
+            "%s\nA:0x%0*lX\nC:0x%0*lX\n%s\n",
+            infrared_get_protocol_name(message->protocol),
+            ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4),
+            message->address,
+            ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4),
+            message->command,
+            message->repeat ? " R" : "");
+        view_port_update(infrared_monitor->view_port);
+        printf(
+            "== %s, A:0x%0*lX, C:0x%0*lX%s ==\r\n",
+            infrared_get_protocol_name(message->protocol),
+            ROUND_UP_TO(infrared_get_protocol_address_length(message->protocol), 4),
+            message->address,
+            ROUND_UP_TO(infrared_get_protocol_command_length(message->protocol), 4),
+            message->command,
+            message->repeat ? " R" : "");
+    } else {
+        const uint32_t* timings;
+        size_t timings_cnt;
+        infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
+        snprintf(
+            infrared_monitor->display_text,
+            sizeof(infrared_monitor->display_text),
+            "RAW\n%d samples\n",
+            timings_cnt);
+        view_port_update(infrared_monitor->view_port);
+        printf("RAW, %d samples:\r\n", timings_cnt);
+        for(size_t i = 0; i < timings_cnt; ++i) {
+            printf("%lu ", timings[i]);
+        }
+        printf("\r\n");
+    }
+}
+
+int32_t infrared_monitor_app(void* p) {
+    (void)p;
+
+    InfraredMonitor* infrared_monitor = malloc(sizeof(InfraredMonitor));
+    infrared_monitor->display_text[0] = 0;
+    infrared_monitor->event_queue = osMessageQueueNew(1, sizeof(InputEvent), NULL);
+    infrared_monitor->view_port = view_port_alloc();
+    Gui* gui = furi_record_open("gui");
+
+    view_port_draw_callback_set(
+        infrared_monitor->view_port, infrared_monitor_draw_callback, infrared_monitor);
+    view_port_input_callback_set(
+        infrared_monitor->view_port, infrared_monitor_input_callback, infrared_monitor);
+
+    gui_add_view_port(gui, infrared_monitor->view_port, GuiLayerFullscreen);
+
+    infrared_monitor->worker = infrared_worker_alloc();
+    infrared_worker_rx_start(infrared_monitor->worker);
+    infrared_worker_rx_set_received_signal_callback(
+        infrared_monitor->worker, signal_received_callback, infrared_monitor);
+    infrared_worker_rx_enable_blink_on_receiving(infrared_monitor->worker, true);
+
+    while(1) {
+        InputEvent event;
+        if(osOK == osMessageQueueGet(infrared_monitor->event_queue, &event, NULL, 50)) {
+            if((event.type == InputTypeShort) && (event.key == InputKeyBack)) {
+                break;
+            }
+        }
+    }
+
+    infrared_worker_rx_stop(infrared_monitor->worker);
+    infrared_worker_free(infrared_monitor->worker);
+    osMessageQueueDelete(infrared_monitor->event_queue);
+    view_port_enabled_set(infrared_monitor->view_port, false);
+    gui_remove_view_port(gui, infrared_monitor->view_port);
+    view_port_free(infrared_monitor->view_port);
+    furi_record_close("gui");
+    free(infrared_monitor);
+
+    return 0;
+}

+ 0 - 13
applications/irda/helpers/irda_parser.h

@@ -1,13 +0,0 @@
-#pragma once
-
-#include "../irda_app_signal.h"
-#include <flipper_format/flipper_format.h>
-#include <string>
-
-bool irda_parser_save_signal(
-    FlipperFormat* ff,
-    const IrdaAppSignal& signal,
-    const std::string& name);
-bool irda_parser_read_signal(FlipperFormat* ff, IrdaAppSignal& signal, std::string& name);
-bool irda_parser_is_parsed_signal_valid(const IrdaMessage* signal);
-bool irda_parser_is_raw_signal_valid(uint32_t frequency, float duty_cycle, uint32_t timings_cnt);

+ 0 - 138
applications/irda/irda_app.h

@@ -1,138 +0,0 @@
-#pragma once
-#include <map>
-#include <irda.h>
-#include <furi.h>
-#include "scene/irda_app_scene.h"
-#include "scene/irda_app_scene.h"
-#include "irda_app_view_manager.h"
-#include "irda_app_remote_manager.h"
-#include <forward_list>
-#include <stdint.h>
-#include <notification/notification_messages.h>
-#include <irda_worker.h>
-#include "irda_app_view_manager.h"
-
-class IrdaApp {
-public:
-    enum class EditElement : uint8_t {
-        Button,
-        Remote,
-    };
-    enum class EditAction : uint8_t {
-        Rename,
-        Delete,
-    };
-    enum class Scene : uint8_t {
-        Exit,
-        Start,
-        Universal,
-        UniversalTV,
-        UniversalAudio,
-        UniversalAirConditioner,
-        Learn,
-        LearnSuccess,
-        LearnEnterName,
-        LearnDone,
-        AskBack,
-        Remote,
-        RemoteList,
-        Edit,
-        EditKeySelect,
-        EditRename,
-        EditDelete,
-        EditRenameDone,
-        EditDeleteDone,
-    };
-
-    int32_t run(void* args);
-    void switch_to_next_scene(Scene index);
-    void switch_to_next_scene_without_saving(Scene index);
-    bool switch_to_previous_scene(uint8_t count = 1);
-    Scene get_previous_scene();
-    IrdaAppViewManager* get_view_manager();
-    void set_text_store(uint8_t index, const char* text...);
-    char* get_text_store(uint8_t index);
-    uint8_t get_text_store_size();
-    IrdaAppRemoteManager* get_remote_manager();
-
-    IrdaWorker* get_irda_worker();
-    const IrdaAppSignal& get_received_signal() const;
-    void set_received_signal(const IrdaAppSignal& signal);
-
-    void search_and_switch_to_previous_scene(const std::initializer_list<Scene>& scenes_list);
-
-    void set_edit_element(EditElement value);
-    EditElement get_edit_element(void);
-
-    void set_edit_action(EditAction value);
-    EditAction get_edit_action(void);
-
-    bool get_learn_new_remote();
-    void set_learn_new_remote(bool value);
-
-    enum : int {
-        ButtonNA = -1,
-    };
-    int get_current_button();
-    void set_current_button(int value);
-
-    void notify_success();
-    void notify_red_blink();
-    void notify_sent_just_learnt();
-    void notify_green_on();
-    void notify_green_off();
-    void notify_click();
-    void notify_click_and_green_blink();
-    void notify_blink_green();
-
-    static void text_input_callback(void* context);
-    static void popup_callback(void* context);
-    static void signal_sent_callback(void* context);
-
-    IrdaApp();
-    ~IrdaApp();
-
-    static constexpr const char* irda_directory = "/any/irda";
-    static constexpr const char* irda_extension = ".ir";
-    static constexpr const uint32_t max_raw_timings_in_signal = 512;
-    static constexpr const uint32_t max_line_length =
-        (9 + 1) * IrdaApp::max_raw_timings_in_signal + 100;
-
-private:
-    static constexpr const uint8_t text_store_size = 128;
-    static constexpr const uint8_t text_store_max = 2;
-    char text_store[text_store_max][text_store_size + 1];
-    bool learn_new_remote;
-    EditElement element;
-    EditAction action;
-    uint32_t current_button;
-
-    NotificationApp* notification;
-    IrdaAppViewManager view_manager;
-    IrdaAppRemoteManager remote_manager;
-    IrdaWorker* irda_worker;
-    IrdaAppSignal received_signal;
-
-    std::forward_list<Scene> previous_scenes_list;
-    Scene current_scene = Scene::Start;
-
-    std::map<Scene, IrdaAppScene*> scenes = {
-        {Scene::Start, new IrdaAppSceneStart()},
-        {Scene::Universal, new IrdaAppSceneUniversal()},
-        {Scene::UniversalTV, new IrdaAppSceneUniversalTV()},
-        //        {Scene::UniversalAudio, new IrdaAppSceneUniversalAudio()},
-        {Scene::Learn, new IrdaAppSceneLearn()},
-        {Scene::LearnSuccess, new IrdaAppSceneLearnSuccess()},
-        {Scene::LearnEnterName, new IrdaAppSceneLearnEnterName()},
-        {Scene::LearnDone, new IrdaAppSceneLearnDone()},
-        {Scene::AskBack, new IrdaAppSceneAskBack()},
-        {Scene::Remote, new IrdaAppSceneRemote()},
-        {Scene::RemoteList, new IrdaAppSceneRemoteList()},
-        {Scene::Edit, new IrdaAppSceneEdit()},
-        {Scene::EditKeySelect, new IrdaAppSceneEditKeySelect()},
-        {Scene::EditRename, new IrdaAppSceneEditRename()},
-        {Scene::EditDelete, new IrdaAppSceneEditDelete()},
-        {Scene::EditRenameDone, new IrdaAppSceneEditRenameDone()},
-        {Scene::EditDeleteDone, new IrdaAppSceneEditDeleteDone()},
-    };
-};

+ 0 - 36
applications/irda/irda_app_brute_force.h

@@ -1,36 +0,0 @@
-#pragma once
-
-#include <unordered_map>
-#include <memory>
-#include <flipper_format/flipper_format.h>
-
-class IrdaAppBruteForce {
-    const char* universal_db_filename;
-    std::string current_record;
-    FlipperFormat* ff;
-
-    typedef struct {
-        int index;
-        int amount;
-    } Record;
-
-    // 'key' is record name, because we have to search by both, index and name,
-    // but index search has place once per button press, and should not be
-    // noticed, but name search should occur during entering universal menu,
-    // and will go through container for every record in file, that's why
-    // more critical to have faster search by record name.
-    std::unordered_map<std::string, Record> records;
-
-public:
-    bool calculate_messages();
-    void stop_bruteforce();
-    bool send_next_bruteforce();
-    bool start_bruteforce(int index, int& record_amount);
-    void add_record(int index, const char* name);
-
-    IrdaAppBruteForce(const char* filename)
-        : universal_db_filename(filename) {
-    }
-    ~IrdaAppBruteForce() {
-    }
-};

+ 0 - 28
applications/irda/irda_app_event.h

@@ -1,28 +0,0 @@
-#pragma once
-#include <irda.h>
-#include <gui/modules/dialog_ex.h>
-
-class IrdaAppEvent {
-public:
-    enum class Type : uint8_t {
-        Tick,
-        Exit,
-        Back,
-        MenuSelected,
-        MenuSelectedPress,
-        MenuSelectedRelease,
-        DialogExSelected,
-        NextScene,
-        IrdaMessageReceived,
-        TextEditDone,
-        PopupTimer,
-        ButtonPanelPressed,
-    };
-
-    union {
-        int32_t menu_index;
-        DialogExResult dialog_ex_result;
-    } payload;
-
-    Type type;
-};

+ 0 - 76
applications/irda/irda_app_remote_manager.h

@@ -1,76 +0,0 @@
-#pragma once
-
-#include "irda_app_signal.h"
-
-#include <irda_worker.h>
-#include <irda.h>
-
-#include <cstdint>
-#include <string>
-#include <memory>
-#include <vector>
-
-class IrdaAppRemoteButton {
-    friend class IrdaAppRemoteManager;
-    std::string name;
-    IrdaAppSignal signal;
-
-public:
-    IrdaAppRemoteButton(const char* name, const IrdaAppSignal& signal)
-        : name(name)
-        , signal(signal) {
-    }
-
-    IrdaAppRemoteButton(const char* name, IrdaAppSignal&& signal)
-        : name(name)
-        , signal(std::move(signal)) {
-    }
-    ~IrdaAppRemoteButton() {
-    }
-};
-
-class IrdaAppRemote {
-    friend class IrdaAppRemoteManager;
-    std::vector<IrdaAppRemoteButton> buttons;
-    std::string name;
-
-public:
-    IrdaAppRemote(const std::string& name)
-        : name(name) {
-    }
-
-    IrdaAppRemote& operator=(std::string& new_name) noexcept {
-        name = new_name;
-        buttons.clear();
-        return *this;
-    }
-};
-
-class IrdaAppRemoteManager {
-    std::unique_ptr<IrdaAppRemote> remote;
-    std::string make_full_name(const std::string& remote_name) const;
-    std::string make_remote_name(const std::string& full_name) const;
-
-public:
-    static constexpr const uint32_t max_button_name_length = 22;
-    static constexpr const uint32_t max_remote_name_length = 22;
-    bool add_remote_with_button(const char* button_name, const IrdaAppSignal& signal);
-    bool add_button(const char* button_name, const IrdaAppSignal& signal);
-
-    int find_remote_name(const std::vector<std::string>& strings);
-    bool rename_button(uint32_t index, const char* str);
-    bool rename_remote(const char* str);
-    std::string find_vacant_remote_name(const std::string& name);
-
-    std::vector<std::string> get_button_list() const;
-    std::string get_button_name(uint32_t index);
-    std::string get_remote_name();
-    size_t get_number_of_buttons();
-    const IrdaAppSignal& get_button_data(size_t index) const;
-    bool delete_button(uint32_t index);
-    bool delete_remote();
-    void reset_remote();
-
-    bool store();
-    bool load(const std::string& name);
-};

+ 0 - 68
applications/irda/irda_app_signal.h

@@ -1,68 +0,0 @@
-#pragma once
-#include <irda_worker.h>
-#include <stdint.h>
-#include <string>
-#include <irda.h>
-
-class IrdaAppSignal {
-public:
-    typedef struct {
-        size_t timings_cnt;
-        uint32_t* timings;
-        uint32_t frequency;
-        float duty_cycle;
-    } RawSignal;
-
-private:
-    bool raw_signal;
-    union {
-        IrdaMessage message;
-        RawSignal raw;
-    } payload;
-
-    void
-        copy_raw_signal(const uint32_t* timings, size_t size, uint32_t frequency, float duty_cycle);
-    void clear_timings();
-
-public:
-    IrdaAppSignal() {
-        raw_signal = false;
-        payload.message.protocol = IrdaProtocolUnknown;
-    }
-
-    ~IrdaAppSignal() {
-        clear_timings();
-    }
-
-    IrdaAppSignal(
-        const uint32_t* timings,
-        size_t timings_cnt,
-        uint32_t frequency,
-        float duty_cycle);
-    IrdaAppSignal(const IrdaMessage* irda_message);
-
-    IrdaAppSignal(const IrdaAppSignal& other);
-    IrdaAppSignal(IrdaAppSignal&& other);
-
-    IrdaAppSignal& operator=(const IrdaAppSignal& signal);
-
-    void set_message(const IrdaMessage* irda_message);
-    void
-        set_raw_signal(uint32_t* timings, size_t timings_cnt, uint32_t frequency, float duty_cycle);
-
-    void transmit() const;
-
-    bool is_raw(void) const {
-        return raw_signal;
-    }
-
-    const IrdaMessage& get_message(void) const {
-        furi_assert(!raw_signal);
-        return payload.message;
-    }
-
-    const RawSignal& get_raw_signal(void) const {
-        furi_assert(raw_signal);
-        return payload.raw;
-    }
-};

+ 0 - 66
applications/irda/irda_app_view_manager.h

@@ -1,66 +0,0 @@
-#pragma once
-#include <gui/modules/button_menu.h>
-#include <gui/modules/text_input.h>
-#include <gui/view_stack.h>
-#include <gui/modules/button_panel.h>
-#include <furi.h>
-#include <gui/view_dispatcher.h>
-#include <gui/modules/dialog_ex.h>
-#include <gui/modules/submenu.h>
-#include <gui/modules/popup.h>
-#include <gui/modules/loading.h>
-
-#include "irda_app_event.h"
-#include "view/irda_progress_view.h"
-
-class IrdaAppViewManager {
-public:
-    enum class ViewType : uint8_t {
-        DialogEx,
-        TextInput,
-        Submenu,
-        ButtonMenu,
-        UniversalRemote,
-        Popup,
-    };
-
-    IrdaAppViewManager();
-    ~IrdaAppViewManager();
-
-    void switch_to(ViewType type);
-
-    void receive_event(IrdaAppEvent* event);
-    void send_event(IrdaAppEvent* event);
-    void clear_events();
-
-    DialogEx* get_dialog_ex();
-    Submenu* get_submenu();
-    Popup* get_popup();
-    TextInput* get_text_input();
-    ButtonMenu* get_button_menu();
-    ButtonPanel* get_button_panel();
-    ViewStack* get_universal_view_stack();
-    IrdaProgressView* get_progress();
-    Loading* get_loading();
-
-    osMessageQueueId_t get_event_queue();
-
-    uint32_t previous_view_callback(void* context);
-
-private:
-    ViewDispatcher* view_dispatcher;
-    Gui* gui;
-    TextInput* text_input;
-    DialogEx* dialog_ex;
-    Submenu* submenu;
-    Popup* popup;
-    ButtonMenu* button_menu;
-    ButtonPanel* button_panel;
-    ViewStack* universal_view_stack;
-    IrdaProgressView* progress_view;
-    Loading* loading_view;
-
-    osMessageQueueId_t event_queue;
-
-    void add_view(ViewType view_type, View* view);
-};

+ 0 - 9
applications/irda/irda_runner.cpp

@@ -1,9 +0,0 @@
-#include "irda_app.h"
-
-extern "C" int32_t irda_app(void* p) {
-    IrdaApp* app = new IrdaApp();
-    int32_t result = app->run(p);
-    delete app;
-
-    return result;
-}

+ 0 - 184
applications/irda/scene/irda_app_scene.h

@@ -1,184 +0,0 @@
-#pragma once
-#include "../irda_app_event.h"
-#include <furi_hal_irda.h>
-#include "irda.h"
-#include <vector>
-#include <string>
-#include "../irda_app_brute_force.h"
-
-class IrdaApp;
-
-class IrdaAppScene {
-public:
-    virtual void on_enter(IrdaApp* app) = 0;
-    virtual bool on_event(IrdaApp* app, IrdaAppEvent* event) = 0;
-    virtual void on_exit(IrdaApp* app) = 0;
-    virtual ~IrdaAppScene(){};
-
-private:
-};
-
-class IrdaAppSceneStart : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    uint32_t submenu_item_selected = 0;
-};
-
-class IrdaAppSceneUniversal : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    uint32_t submenu_item_selected = 0;
-};
-
-class IrdaAppSceneLearn : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneLearnSuccess : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-    bool button_pressed = false;
-};
-
-class IrdaAppSceneLearnEnterName : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneLearnDone : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneRemote : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    std::vector<std::string> buttons_names;
-    uint32_t buttonmenu_item_selected = 0;
-    bool button_pressed = false;
-};
-
-class IrdaAppSceneRemoteList : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    uint32_t submenu_item_selected = 0;
-    std::vector<std::string> remote_names;
-};
-
-class IrdaAppSceneAskBack : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneEdit : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    uint32_t submenu_item_selected = 0;
-};
-
-class IrdaAppSceneEditKeySelect : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-
-private:
-    std::vector<std::string> buttons_names;
-};
-
-class IrdaAppSceneEditRename : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneEditDelete : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneEditRenameDone : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneEditDeleteDone : public IrdaAppScene {
-public:
-    void on_enter(IrdaApp* app) final;
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-};
-
-class IrdaAppSceneUniversalCommon : public IrdaAppScene {
-    bool brute_force_started = false;
-
-protected:
-    bool on_event(IrdaApp* app, IrdaAppEvent* event) final;
-    void on_exit(IrdaApp* app) final;
-    IrdaAppBruteForce brute_force;
-    void remove_popup(IrdaApp* app);
-    void show_popup(IrdaApp* app, int record_amount);
-    bool progress_popup(IrdaApp* app);
-    static void irda_app_item_callback(void* context, uint32_t index);
-    IrdaAppSceneUniversalCommon(const char* filename)
-        : brute_force(filename) {
-    }
-    ~IrdaAppSceneUniversalCommon() {
-    }
-};
-
-class IrdaAppSceneUniversalTV : public IrdaAppSceneUniversalCommon {
-public:
-    void on_enter(IrdaApp* app) final;
-    IrdaAppSceneUniversalTV()
-        : IrdaAppSceneUniversalCommon("/ext/irda/assets/tv.ir") {
-    }
-    ~IrdaAppSceneUniversalTV() {
-    }
-};
-
-class IrdaAppSceneUniversalAudio : public IrdaAppSceneUniversalCommon {
-public:
-    void on_enter(IrdaApp* app) final;
-    IrdaAppSceneUniversalAudio()
-        : IrdaAppSceneUniversalCommon("/ext/irda/assets/audio.ir") {
-    }
-    ~IrdaAppSceneUniversalAudio() {
-    }
-};

+ 0 - 38
applications/irda/scene/irda_app_scene_edit_delete_done.cpp

@@ -1,38 +0,0 @@
-#include "../irda_app.h"
-
-void IrdaAppSceneEditDeleteDone::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    Popup* popup = view_manager->get_popup();
-
-    popup_set_icon(popup, 0, 2, &I_DolphinMafia_115x62);
-    popup_set_header(popup, "Deleted", 83, 19, AlignLeft, AlignBottom);
-
-    popup_set_callback(popup, IrdaApp::popup_callback);
-    popup_set_context(popup, app);
-    popup_set_timeout(popup, 1500);
-    popup_enable_timeout(popup);
-
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
-}
-
-bool IrdaAppSceneEditDeleteDone::on_event(IrdaApp* app, IrdaAppEvent* event) {
-    bool consumed = false;
-
-    if(event->type == IrdaAppEvent::Type::PopupTimer) {
-        if(app->get_edit_element() == IrdaApp::EditElement::Remote) {
-            app->search_and_switch_to_previous_scene(
-                {IrdaApp::Scene::Start, IrdaApp::Scene::RemoteList});
-        } else {
-            app->search_and_switch_to_previous_scene({IrdaApp::Scene::Remote});
-        }
-        consumed = true;
-    }
-
-    return consumed;
-}
-
-void IrdaAppSceneEditDeleteDone::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    Popup* popup = view_manager->get_popup();
-    popup_set_header(popup, nullptr, 0, 0, AlignLeft, AlignTop);
-}

+ 0 - 57
applications/irda/scene/irda_app_scene_edit_key_select.cpp

@@ -1,57 +0,0 @@
-#include "../irda_app.h"
-#include "gui/modules/submenu.h"
-
-static void submenu_callback(void* context, uint32_t index) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
-
-    event.type = IrdaAppEvent::Type::MenuSelected;
-    event.payload.menu_index = index;
-
-    app->get_view_manager()->send_event(&event);
-}
-
-void IrdaAppSceneEditKeySelect::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    Submenu* submenu = view_manager->get_submenu();
-    int item_number = 0;
-
-    const char* header = app->get_edit_action() == IrdaApp::EditAction::Rename ? "Rename key:" :
-                                                                                 "Delete key:";
-    submenu_set_header(submenu, header);
-
-    auto remote_manager = app->get_remote_manager();
-    buttons_names = remote_manager->get_button_list();
-    for(const auto& it : buttons_names) {
-        submenu_add_item(submenu, it.c_str(), item_number++, submenu_callback, app);
-    }
-    if((item_number > 0) && (app->get_current_button() != IrdaApp::ButtonNA)) {
-        submenu_set_selected_item(submenu, app->get_current_button());
-        app->set_current_button(IrdaApp::ButtonNA);
-    }
-
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Submenu);
-}
-
-bool IrdaAppSceneEditKeySelect::on_event(IrdaApp* app, IrdaAppEvent* event) {
-    bool consumed = false;
-
-    if(event->type == IrdaAppEvent::Type::MenuSelected) {
-        app->set_current_button(event->payload.menu_index);
-        consumed = true;
-        if(app->get_edit_action() == IrdaApp::EditAction::Rename) {
-            app->switch_to_next_scene(IrdaApp::Scene::EditRename);
-        } else {
-            app->switch_to_next_scene(IrdaApp::Scene::EditDelete);
-        }
-    }
-
-    return consumed;
-}
-
-void IrdaAppSceneEditKeySelect::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    Submenu* submenu = view_manager->get_submenu();
-
-    submenu_reset(submenu);
-}

+ 0 - 31
applications/irda/scene/irda_app_scene_edit_rename_done.cpp

@@ -1,31 +0,0 @@
-#include "../irda_app.h"
-
-void IrdaAppSceneEditRenameDone::on_enter(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    Popup* popup = view_manager->get_popup();
-
-    popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
-
-    popup_set_header(popup, "Saved!", 5, 7, AlignLeft, AlignTop);
-
-    popup_set_callback(popup, IrdaApp::popup_callback);
-    popup_set_context(popup, app);
-    popup_set_timeout(popup, 1500);
-    popup_enable_timeout(popup);
-
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
-}
-
-bool IrdaAppSceneEditRenameDone::on_event(IrdaApp* app, IrdaAppEvent* event) {
-    bool consumed = false;
-
-    if(event->type == IrdaAppEvent::Type::PopupTimer) {
-        app->switch_to_next_scene(IrdaApp::Scene::Remote);
-        consumed = true;
-    }
-
-    return consumed;
-}
-
-void IrdaAppSceneEditRenameDone::on_exit(IrdaApp* app) {
-}

+ 0 - 75
applications/irda/scene/irda_app_scene_learn.cpp

@@ -1,75 +0,0 @@
-#include "../irda_app.h"
-#include "../irda_app_event.h"
-#include "irda.h"
-#include <irda_worker.h>
-
-static void signal_received_callback(void* context, IrdaWorkerSignal* received_signal) {
-    furi_assert(context);
-    furi_assert(received_signal);
-
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-
-    if(irda_worker_signal_is_decoded(received_signal)) {
-        IrdaAppSignal signal(irda_worker_get_decoded_signal(received_signal));
-        app->set_received_signal(signal);
-    } else {
-        const uint32_t* timings;
-        size_t timings_cnt;
-        irda_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
-        IrdaAppSignal signal(
-            timings, timings_cnt, IRDA_COMMON_CARRIER_FREQUENCY, IRDA_COMMON_DUTY_CYCLE);
-        app->set_received_signal(signal);
-    }
-
-    irda_worker_rx_set_received_signal_callback(app->get_irda_worker(), NULL, NULL);
-    IrdaAppEvent event;
-    event.type = IrdaAppEvent::Type::IrdaMessageReceived;
-    auto view_manager = app->get_view_manager();
-    view_manager->send_event(&event);
-}
-
-void IrdaAppSceneLearn::on_enter(IrdaApp* app) {
-    auto view_manager = app->get_view_manager();
-    auto popup = view_manager->get_popup();
-
-    auto worker = app->get_irda_worker();
-    irda_worker_rx_set_received_signal_callback(worker, signal_received_callback, app);
-    irda_worker_rx_start(worker);
-
-    popup_set_icon(popup, 0, 32, &I_IrdaLearnShort_128x31);
-    popup_set_text(
-        popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
-    popup_set_callback(popup, NULL);
-
-    view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
-}
-
-bool IrdaAppSceneLearn::on_event(IrdaApp* app, IrdaAppEvent* event) {
-    bool consumed = false;
-
-    switch(event->type) {
-    case IrdaAppEvent::Type::Tick:
-        consumed = true;
-        app->notify_red_blink();
-        break;
-    case IrdaAppEvent::Type::IrdaMessageReceived:
-        app->notify_success();
-        app->switch_to_next_scene_without_saving(IrdaApp::Scene::LearnSuccess);
-        break;
-    case IrdaAppEvent::Type::Back:
-        consumed = true;
-        app->switch_to_previous_scene();
-        break;
-    default:
-        furi_assert(0);
-    }
-
-    return consumed;
-}
-
-void IrdaAppSceneLearn::on_exit(IrdaApp* app) {
-    irda_worker_rx_stop(app->get_irda_worker());
-    auto view_manager = app->get_view_manager();
-    auto popup = view_manager->get_popup();
-    popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignCenter);
-}

+ 0 - 101
applications/irda/scene/irda_app_scene_universal_common.cpp

@@ -1,101 +0,0 @@
-#include <dolphin/dolphin.h>
-#include <gui/modules/button_menu.h>
-#include <gui/modules/button_panel.h>
-#include <gui/view.h>
-#include <gui/view_stack.h>
-
-#include "../irda_app.h"
-#include "irda/irda_app_event.h"
-#include "irda/irda_app_view_manager.h"
-#include "irda/scene/irda_app_scene.h"
-#include "../view/irda_progress_view.h"
-
-void IrdaAppSceneUniversalCommon::irda_app_item_callback(void* context, uint32_t index) {
-    IrdaApp* app = static_cast<IrdaApp*>(context);
-    IrdaAppEvent event;
-
-    event.type = IrdaAppEvent::Type::ButtonPanelPressed;
-    event.payload.menu_index = index;
-
-    app->get_view_manager()->send_event(&event);
-}
-
-static void irda_progress_back_callback(void* context) {
-    furi_assert(context);
-    auto app = static_cast<IrdaApp*>(context);
-
-    IrdaAppEvent irda_event = {
-        .type = IrdaAppEvent::Type::Back,
-    };
-    app->get_view_manager()->clear_events();
-    app->get_view_manager()->send_event(&irda_event);
-}
-
-void IrdaAppSceneUniversalCommon::remove_popup(IrdaApp* app) {
-    auto stack_view = app->get_view_manager()->get_universal_view_stack();
-    auto progress_view = app->get_view_manager()->get_progress();
-    view_stack_remove_view(stack_view, irda_progress_view_get_view(progress_view));
-}
-
-void IrdaAppSceneUniversalCommon::show_popup(IrdaApp* app, int record_amount) {
-    auto stack_view = app->get_view_manager()->get_universal_view_stack();
-    auto progress_view = app->get_view_manager()->get_progress();
-    irda_progress_view_set_progress_total(progress_view, record_amount);
-    irda_progress_view_set_back_callback(progress_view, irda_progress_back_callback, app);
-    view_stack_add_view(stack_view, irda_progress_view_get_view(progress_view));
-}
-
-bool IrdaAppSceneUniversalCommon::progress_popup(IrdaApp* app) {
-    auto progress_view = app->get_view_manager()->get_progress();
-    return irda_progress_view_increase_progress(progress_view);
-}
-
-bool IrdaAppSceneUniversalCommon::on_event(IrdaApp* app, IrdaAppEvent* event) {
-    bool consumed = false;
-
-    if(brute_force_started) {
-        if(event->type == IrdaAppEvent::Type::Tick) {
-            auto view_manager = app->get_view_manager();
-            IrdaAppEvent tick_event = {.type = IrdaAppEvent::Type::Tick};
-            view_manager->send_event(&tick_event);
-            bool result = brute_force.send_next_bruteforce();
-            if(result) {
-                result = progress_popup(app);
-            }
-            if(!result) {
-                brute_force.stop_bruteforce();
-                brute_force_started = false;
-                remove_popup(app);
-            }
-            consumed = true;
-        } else if(event->type == IrdaAppEvent::Type::Back) {
-            brute_force_started = false;
-            brute_force.stop_bruteforce();
-            remove_popup(app);
-            consumed = true;
-        }
-    } else {
-        if(event->type == IrdaAppEvent::Type::ButtonPanelPressed) {
-            int record_amount = 0;
-            if(brute_force.start_bruteforce(event->payload.menu_index, record_amount)) {
-                DOLPHIN_DEED(DolphinDeedIrBruteForce);
-                brute_force_started = true;
-                show_popup(app, record_amount);
-            } else {
-                app->switch_to_previous_scene();
-            }
-            consumed = true;
-        } else if(event->type == IrdaAppEvent::Type::Back) {
-            app->switch_to_previous_scene();
-            consumed = true;
-        }
-    }
-
-    return consumed;
-}
-
-void IrdaAppSceneUniversalCommon::on_exit(IrdaApp* app) {
-    IrdaAppViewManager* view_manager = app->get_view_manager();
-    ButtonPanel* button_panel = view_manager->get_button_panel();
-    button_panel_reset(button_panel);
-}

+ 0 - 25
applications/irda/view/irda_progress_view.h

@@ -1,25 +0,0 @@
-#pragma once
-#include <gui/view.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct IrdaProgressView IrdaProgressView;
-
-typedef void (*IrdaProgressViewBackCallback)(void*);
-
-IrdaProgressView* irda_progress_view_alloc();
-void irda_progress_view_free(IrdaProgressView* progress);
-View* irda_progress_view_get_view(IrdaProgressView* progress);
-
-bool irda_progress_view_increase_progress(IrdaProgressView* progress);
-void irda_progress_view_set_progress_total(IrdaProgressView* progress, uint16_t progress_max);
-void irda_progress_view_set_back_callback(
-    IrdaProgressView* instance,
-    IrdaProgressViewBackCallback callback,
-    void* context);
-
-#ifdef __cplusplus
-}
-#endif

+ 0 - 139
applications/irda_monitor/irda_monitor.c

@@ -1,139 +0,0 @@
-#include <gui/canvas.h>
-#include <input/input.h>
-#include <irda.h>
-#include <irda_worker.h>
-#include <stdio.h>
-#include <furi.h>
-#include <furi_hal_irda.h>
-#include <furi_hal.h>
-#include <gui/view_port.h>
-#include <gui/gui.h>
-#include <gui/elements.h>
-
-#define IRDA_TIMINGS_SIZE 700
-
-typedef struct {
-    uint32_t timing_cnt;
-    struct {
-        uint8_t level;
-        uint32_t duration;
-    } timing[IRDA_TIMINGS_SIZE];
-} IrdaDelaysArray;
-
-typedef struct {
-    char display_text[64];
-    osMessageQueueId_t event_queue;
-    IrdaDelaysArray delays;
-    IrdaWorker* worker;
-    ViewPort* view_port;
-} IrdaMonitor;
-
-void irda_monitor_input_callback(InputEvent* input_event, void* ctx) {
-    furi_assert(ctx);
-    IrdaMonitor* irda_monitor = (IrdaMonitor*)ctx;
-
-    if((input_event->type == InputTypeShort) && (input_event->key == InputKeyBack)) {
-        osMessageQueuePut(irda_monitor->event_queue, input_event, 0, 0);
-    }
-}
-
-static void irda_monitor_draw_callback(Canvas* canvas, void* ctx) {
-    furi_assert(canvas);
-    furi_assert(ctx);
-    IrdaMonitor* irda_monitor = (IrdaMonitor*)ctx;
-
-    canvas_clear(canvas);
-    canvas_set_font(canvas, FontPrimary);
-    elements_multiline_text_aligned(canvas, 64, 0, AlignCenter, AlignTop, "IRDA monitor\n");
-    canvas_set_font(canvas, FontKeyboard);
-    if(strlen(irda_monitor->display_text)) {
-        elements_multiline_text_aligned(
-            canvas, 64, 43, AlignCenter, AlignCenter, irda_monitor->display_text);
-    }
-}
-
-static void signal_received_callback(void* context, IrdaWorkerSignal* received_signal) {
-    furi_assert(context);
-    furi_assert(received_signal);
-    IrdaMonitor* irda_monitor = context;
-
-    if(irda_worker_signal_is_decoded(received_signal)) {
-        const IrdaMessage* message = irda_worker_get_decoded_signal(received_signal);
-        snprintf(
-            irda_monitor->display_text,
-            sizeof(irda_monitor->display_text),
-            "%s\nA:0x%0*lX\nC:0x%0*lX\n%s\n",
-            irda_get_protocol_name(message->protocol),
-            ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4),
-            message->address,
-            ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
-            message->command,
-            message->repeat ? " R" : "");
-        view_port_update(irda_monitor->view_port);
-        printf(
-            "== %s, A:0x%0*lX, C:0x%0*lX%s ==\r\n",
-            irda_get_protocol_name(message->protocol),
-            ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4),
-            message->address,
-            ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
-            message->command,
-            message->repeat ? " R" : "");
-    } else {
-        const uint32_t* timings;
-        size_t timings_cnt;
-        irda_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
-        snprintf(
-            irda_monitor->display_text,
-            sizeof(irda_monitor->display_text),
-            "RAW\n%d samples\n",
-            timings_cnt);
-        view_port_update(irda_monitor->view_port);
-        printf("RAW, %d samples:\r\n", timings_cnt);
-        for(size_t i = 0; i < timings_cnt; ++i) {
-            printf("%lu ", timings[i]);
-        }
-        printf("\r\n");
-    }
-}
-
-int32_t irda_monitor_app(void* p) {
-    (void)p;
-
-    IrdaMonitor* irda_monitor = malloc(sizeof(IrdaMonitor));
-    irda_monitor->display_text[0] = 0;
-    irda_monitor->event_queue = osMessageQueueNew(1, sizeof(InputEvent), NULL);
-    irda_monitor->view_port = view_port_alloc();
-    Gui* gui = furi_record_open("gui");
-
-    view_port_draw_callback_set(irda_monitor->view_port, irda_monitor_draw_callback, irda_monitor);
-    view_port_input_callback_set(
-        irda_monitor->view_port, irda_monitor_input_callback, irda_monitor);
-
-    gui_add_view_port(gui, irda_monitor->view_port, GuiLayerFullscreen);
-
-    irda_monitor->worker = irda_worker_alloc();
-    irda_worker_rx_start(irda_monitor->worker);
-    irda_worker_rx_set_received_signal_callback(
-        irda_monitor->worker, signal_received_callback, irda_monitor);
-    irda_worker_rx_enable_blink_on_receiving(irda_monitor->worker, true);
-
-    while(1) {
-        InputEvent event;
-        if(osOK == osMessageQueueGet(irda_monitor->event_queue, &event, NULL, 50)) {
-            if((event.type == InputTypeShort) && (event.key == InputKeyBack)) {
-                break;
-            }
-        }
-    }
-
-    irda_worker_rx_stop(irda_monitor->worker);
-    irda_worker_free(irda_monitor->worker);
-    osMessageQueueDelete(irda_monitor->event_queue);
-    view_port_enabled_set(irda_monitor->view_port, false);
-    gui_remove_view_port(gui, irda_monitor->view_port);
-    view_port_free(irda_monitor->view_port);
-    furi_record_close("gui");
-    free(irda_monitor);
-
-    return 0;
-}

+ 48 - 47
applications/tests/irda_decoder_encoder/irda_decoder_encoder_test.c → applications/tests/infrared_decoder_encoder/infrared_decoder_encoder_test.c

@@ -1,13 +1,13 @@
 #include <furi.h>
 #include "../minunit.h"
-#include "irda.h"
-#include "common/irda_common_i.h"
-#include "test_data/irda_nec_test_data.srcdata"
-#include "test_data/irda_necext_test_data.srcdata"
-#include "test_data/irda_samsung_test_data.srcdata"
-#include "test_data/irda_rc6_test_data.srcdata"
-#include "test_data/irda_rc5_test_data.srcdata"
-#include "test_data/irda_sirc_test_data.srcdata"
+#include "infrared.h"
+#include "common/infrared_common_i.h"
+#include "test_data/infrared_nec_test_data.srcdata"
+#include "test_data/infrared_necext_test_data.srcdata"
+#include "test_data/infrared_samsung_test_data.srcdata"
+#include "test_data/infrared_rc6_test_data.srcdata"
+#include "test_data/infrared_rc5_test_data.srcdata"
+#include "test_data/infrared_sirc_test_data.srcdata"
 
 #define RUN_ENCODER(data, expected) \
     run_encoder((data), COUNT_OF(data), (expected), COUNT_OF(expected))
@@ -17,28 +17,28 @@
 
 #define RUN_ENCODER_DECODER(data) run_encoder_decoder((data), COUNT_OF(data))
 
-static IrdaDecoderHandler* decoder_handler;
-static IrdaEncoderHandler* encoder_handler;
+static InfraredDecoderHandler* decoder_handler;
+static InfraredEncoderHandler* encoder_handler;
 
 static void test_setup(void) {
-    decoder_handler = irda_alloc_decoder();
-    encoder_handler = irda_alloc_encoder();
+    decoder_handler = infrared_alloc_decoder();
+    encoder_handler = infrared_alloc_encoder();
 }
 
 static void test_teardown(void) {
-    irda_free_decoder(decoder_handler);
-    irda_free_encoder(encoder_handler);
+    infrared_free_decoder(decoder_handler);
+    infrared_free_encoder(encoder_handler);
 }
 
 static void compare_message_results(
-    const IrdaMessage* message_decoded,
-    const IrdaMessage* message_expected) {
+    const InfraredMessage* message_decoded,
+    const InfraredMessage* message_expected) {
     mu_check(message_decoded->protocol == message_expected->protocol);
     mu_check(message_decoded->command == message_expected->command);
     mu_check(message_decoded->address == message_expected->address);
-    if((message_expected->protocol == IrdaProtocolSIRC) ||
-       (message_expected->protocol == IrdaProtocolSIRC15) ||
-       (message_expected->protocol == IrdaProtocolSIRC20)) {
+    if((message_expected->protocol == InfraredProtocolSIRC) ||
+       (message_expected->protocol == InfraredProtocolSIRC15) ||
+       (message_expected->protocol == InfraredProtocolSIRC20)) {
         mu_check(message_decoded->repeat == false);
     } else {
         mu_check(message_decoded->repeat == message_expected->repeat);
@@ -47,19 +47,19 @@ static void compare_message_results(
 
 /* Encodes signal and merges same levels (high+high, low+low) */
 static void run_encoder_fill_array(
-    IrdaEncoderHandler* handler,
+    InfraredEncoderHandler* handler,
     uint32_t* timings,
     uint32_t* timings_len,
     bool* start_level) {
     uint32_t duration = 0;
     bool level = false;
     bool level_read;
-    IrdaStatus status = IrdaStatusError;
+    InfraredStatus status = InfraredStatusError;
     int i = 0;
     bool first = true;
 
     while(1) {
-        status = irda_encode(handler, &duration, &level_read);
+        status = infrared_encode(handler, &duration, &level_read);
         if(first) {
             if(start_level) *start_level = level_read;
             first = false;
@@ -72,8 +72,8 @@ static void run_encoder_fill_array(
         level = level_read;
         timings[i] += duration;
 
-        furi_check((status == IrdaStatusOk) || (status == IrdaStatusDone));
-        if(status == IrdaStatusDone) break;
+        furi_check((status == InfraredStatusOk) || (status == InfraredStatusDone));
+        if(status == InfraredStatusDone) break;
     }
 
     *timings_len = i + 1;
@@ -81,7 +81,7 @@ static void run_encoder_fill_array(
 
 // messages in input array for encoder should have one protocol
 static void run_encoder(
-    const IrdaMessage input_messages[],
+    const InfraredMessage input_messages[],
     uint32_t input_messages_len,
     const uint32_t expected_timings[],
     uint32_t expected_timings_len) {
@@ -91,9 +91,9 @@ static void run_encoder(
     timings = malloc(sizeof(uint32_t) * timings_len);
 
     for(uint32_t message_counter = 0; message_counter < input_messages_len; ++message_counter) {
-        const IrdaMessage* message = &input_messages[message_counter];
+        const InfraredMessage* message = &input_messages[message_counter];
         if(!message->repeat) {
-            irda_reset_encoder(encoder_handler, message);
+            infrared_reset_encoder(encoder_handler, message);
         }
 
         timings_len = 200;
@@ -109,25 +109,26 @@ static void run_encoder(
     mu_assert(j == expected_timings_len, "encoded less timings than expected");
 }
 
-static void run_encoder_decoder(const IrdaMessage input_messages[], uint32_t input_messages_len) {
+static void
+    run_encoder_decoder(const InfraredMessage input_messages[], uint32_t input_messages_len) {
     uint32_t* timings = 0;
     uint32_t timings_len = 200;
     bool level = false;
     timings = malloc(sizeof(uint32_t) * timings_len);
 
     for(uint32_t message_counter = 0; message_counter < input_messages_len; ++message_counter) {
-        const IrdaMessage* message_encoded = &input_messages[message_counter];
+        const InfraredMessage* message_encoded = &input_messages[message_counter];
         if(!message_encoded->repeat) {
-            irda_reset_encoder(encoder_handler, message_encoded);
+            infrared_reset_encoder(encoder_handler, message_encoded);
         }
 
         timings_len = 200;
         run_encoder_fill_array(encoder_handler, timings, &timings_len, &level);
         furi_check(timings_len <= 200);
 
-        const IrdaMessage* message_decoded = 0;
+        const InfraredMessage* message_decoded = 0;
         for(int i = 0; i < timings_len; ++i) {
-            message_decoded = irda_decode(decoder_handler, level, timings[i]);
+            message_decoded = infrared_decode(decoder_handler, level, timings[i]);
             if((i == timings_len - 2) && level && message_decoded) {
                 /* In case we end with space timing - message can be decoded at last mark */
                 break;
@@ -135,7 +136,7 @@ static void run_encoder_decoder(const IrdaMessage input_messages[], uint32_t inp
                 mu_check(!message_decoded);
             } else {
                 if(!message_decoded) {
-                    message_decoded = irda_check_decoder_ready(decoder_handler);
+                    message_decoded = infrared_check_decoder_ready(decoder_handler);
                 }
                 mu_check(message_decoded);
             }
@@ -153,32 +154,32 @@ static void run_encoder_decoder(const IrdaMessage input_messages[], uint32_t inp
 static void run_decoder(
     const uint32_t* input_delays,
     uint32_t input_delays_len,
-    const IrdaMessage* message_expected,
+    const InfraredMessage* message_expected,
     uint32_t message_expected_len) {
-    IrdaMessage message_decoded_check_local;
+    InfraredMessage message_decoded_check_local;
     bool level = 0;
     uint32_t message_counter = 0;
-    const IrdaMessage* message_decoded = 0;
+    const InfraredMessage* message_decoded = 0;
 
     for(uint32_t i = 0; i < input_delays_len; ++i) {
-        const IrdaMessage* message_decoded_check = 0;
+        const InfraredMessage* message_decoded_check = 0;
 
-        if(input_delays[i] > IRDA_RAW_RX_TIMING_DELAY_US) {
-            message_decoded_check = irda_check_decoder_ready(decoder_handler);
+        if(input_delays[i] > INFRARED_RAW_RX_TIMING_DELAY_US) {
+            message_decoded_check = infrared_check_decoder_ready(decoder_handler);
             if(message_decoded_check) {
-                /* irda_decode() can reset message, but we have to call irda_decode() to perform real
-                 * simulation: irda_check() by timeout, then irda_decode() when meet edge */
+                /* infrared_decode() can reset message, but we have to call infrared_decode() to perform real
+                 * simulation: infrared_check() by timeout, then infrared_decode() when meet edge */
                 message_decoded_check_local = *message_decoded_check;
                 message_decoded_check = &message_decoded_check_local;
             }
         }
 
-        message_decoded = irda_decode(decoder_handler, level, input_delays[i]);
+        message_decoded = infrared_decode(decoder_handler, level, input_delays[i]);
 
         if(message_decoded_check || message_decoded) {
             mu_assert(
                 !(message_decoded_check && message_decoded),
-                "both messages decoded: check_ready() and irda_decode()");
+                "both messages decoded: check_ready() and infrared_decode()");
 
             if(message_decoded_check) {
                 message_decoded = message_decoded_check;
@@ -192,7 +193,7 @@ static void run_decoder(
         level = !level;
     }
 
-    message_decoded = irda_check_decoder_ready(decoder_handler);
+    message_decoded = infrared_check_decoder_ready(decoder_handler);
     if(message_decoded) {
         compare_message_results(message_decoded, &message_expected[message_counter]);
         ++message_counter;
@@ -304,7 +305,7 @@ MU_TEST(test_encoder_decoder_all) {
     RUN_ENCODER_DECODER(test_sirc);
 }
 
-MU_TEST_SUITE(test_irda_decoder_encoder) {
+MU_TEST_SUITE(test_infrared_decoder_encoder) {
     MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
 
     MU_RUN_TEST(test_encoder_sirc);
@@ -323,8 +324,8 @@ MU_TEST_SUITE(test_irda_decoder_encoder) {
     MU_RUN_TEST(test_encoder_decoder_all);
 }
 
-int run_minunit_test_irda_decoder_encoder() {
-    MU_RUN_SUITE(test_irda_decoder_encoder);
+int run_minunit_test_infrared_decoder_encoder() {
+    MU_RUN_SUITE(test_infrared_decoder_encoder);
 
     return MU_EXIT_CODE;
 }

+ 160 - 160
applications/tests/irda_decoder_encoder/test_data/irda_nec_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_nec_test_data.srcdata

@@ -10,10 +10,10 @@ const uint32_t test_decoder_nec_input1[] = {
 /* message */
 1415838, 9080, 4436, 611, 494, 600, 505, 578, 500, 608, 501, 602, 502, 580, 498, 606, 508, 605, 500, 583, 1633, 608, 1608, 611, 1631, 578, 1638, 602, 1614, 606, 1637, 583, 1633, 607, 1609, 611, 494, 600, 505, 570, 500, 604, 501, 602, 502, 581, 497, 606, 499, 605, 499, 583, 1633, 617, 1608, 611, 1631, 579, 1638, 602};
 
-const IrdaMessage test_decoder_nec_expected1[] = {
-    {IrdaProtocolNEC,     0x00,      0,  false},
-    {IrdaProtocolNEC,     0x00,      0,  true},
-    {IrdaProtocolNEC,     0x00,      0,  false},
+const InfraredMessage test_decoder_nec_expected1[] = {
+    {InfraredProtocolNEC,     0x00,      0,  false},
+    {InfraredProtocolNEC,     0x00,      0,  true},
+    {InfraredProtocolNEC,     0x00,      0,  false},
 };
 
 const uint32_t test_decoder_nec_input2[] = {
@@ -123,59 +123,59 @@ const uint32_t test_decoder_nec_input2[] = {
 40069,9025,2221,588
 };
 
-const IrdaMessage test_decoder_nec_expected2[] = {
-    {IrdaProtocolNEC,     0x00,      0x02,   false},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   false},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x02,   true},
-    {IrdaProtocolNEC,     0x00,      0x06,   false},
-    {IrdaProtocolNEC,     0x00,      0x06,   true},
-    {IrdaProtocolNEC,     0x00,      0x04,   false},
-    {IrdaProtocolNEC,     0x00,      0x04,   true},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   true},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   true},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x09,   false},
-    {IrdaProtocolNEC,     0x00,      0x09,   false},
-    {IrdaProtocolNEC,     0x00,      0x09,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x0A,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   true},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   true},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x0A,   false},
-    {IrdaProtocolNEC,     0x00,      0x08,   false},
-    {IrdaProtocolNEC,     0x00,      0x0A,   false},
-    {IrdaProtocolNEC,     0x00,      0x0A,   true},
+const InfraredMessage test_decoder_nec_expected2[] = {
+    {InfraredProtocolNEC,     0x00,      0x02,   false},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   false},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x02,   true},
+    {InfraredProtocolNEC,     0x00,      0x06,   false},
+    {InfraredProtocolNEC,     0x00,      0x06,   true},
+    {InfraredProtocolNEC,     0x00,      0x04,   false},
+    {InfraredProtocolNEC,     0x00,      0x04,   true},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   true},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   true},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x09,   false},
+    {InfraredProtocolNEC,     0x00,      0x09,   false},
+    {InfraredProtocolNEC,     0x00,      0x09,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x0A,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   true},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   true},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x0A,   false},
+    {InfraredProtocolNEC,     0x00,      0x08,   false},
+    {InfraredProtocolNEC,     0x00,      0x0A,   false},
+    {InfraredProtocolNEC,     0x00,      0x0A,   true},
 };
 
 const uint32_t test_decoder_nec_input3[] = {
@@ -198,112 +198,112 @@ const uint32_t test_decoder_nec_input3[] = {
     92592,      8861, 4414, 538,
 };
 
-const IrdaMessage test_decoder_nec_expected3[] = {
-    {IrdaProtocolNECext,    0x286,      0xB649,     false},
-    {IrdaProtocolNECext,    0x286,      0xB649,     false},
-    {IrdaProtocolNECext,    0x6880,     0xB649,     false},
-    {IrdaProtocolNECext,    0x6880,     0xB649,     false},
-    {IrdaProtocolNECext,    0x6380,     0x150F,     false},
-    {IrdaProtocolNECext,    0x6380,     0x150F,     false},
-    {IrdaProtocolNECext,    0x6480,     0x849,      false},
-    {IrdaProtocolNECext,    0x6480,     0x849,      false},
-    {IrdaProtocolNECext,    0x7A83,     0x8,        false},
-    {IrdaProtocolNECext,    0x7A83,     0x8,        false},
-    {IrdaProtocolNEC,       0x71,       0x4A,       false},
-    {IrdaProtocolNEC,       0x71,       0x4A,       false},
-    {IrdaProtocolNEC42,     0x7B,       0x0,        false},
-    {IrdaProtocolNEC42,     0x7B,       0x0,        false},
-    {IrdaProtocolNEC42,     0x11C,      0x12,       false},
+const InfraredMessage test_decoder_nec_expected3[] = {
+    {InfraredProtocolNECext,    0x286,      0xB649,     false},
+    {InfraredProtocolNECext,    0x286,      0xB649,     false},
+    {InfraredProtocolNECext,    0x6880,     0xB649,     false},
+    {InfraredProtocolNECext,    0x6880,     0xB649,     false},
+    {InfraredProtocolNECext,    0x6380,     0x150F,     false},
+    {InfraredProtocolNECext,    0x6380,     0x150F,     false},
+    {InfraredProtocolNECext,    0x6480,     0x849,      false},
+    {InfraredProtocolNECext,    0x6480,     0x849,      false},
+    {InfraredProtocolNECext,    0x7A83,     0x8,        false},
+    {InfraredProtocolNECext,    0x7A83,     0x8,        false},
+    {InfraredProtocolNEC,       0x71,       0x4A,       false},
+    {InfraredProtocolNEC,       0x71,       0x4A,       false},
+    {InfraredProtocolNEC42,     0x7B,       0x0,        false},
+    {InfraredProtocolNEC42,     0x7B,       0x0,        false},
+    {InfraredProtocolNEC42,     0x11C,      0x12,       false},
 };
 
 
-const IrdaMessage test_nec[] = {
-    {IrdaProtocolNEC,     0x00,      0x00,  false},
-    {IrdaProtocolNEC,     0x01,      0x00,  false},
-    {IrdaProtocolNEC,     0x01,      0x80,  false},
-    {IrdaProtocolNEC,     0x00,      0x80,  false},
-    {IrdaProtocolNEC,     0x00,      0x00,  false},
-    {IrdaProtocolNEC,     0x00,      0x00,  true},
-    {IrdaProtocolNEC,     0x00,      0x00,  false},
-    {IrdaProtocolNEC,     0x00,      0x00,  true},
-    {IrdaProtocolNEC,     0xFF,      0xFF,  false},
-    {IrdaProtocolNEC,     0xFE,      0xFF,  false},
-    {IrdaProtocolNEC,     0xFE,      0x7F,  false},
-    {IrdaProtocolNEC,     0xFF,      0x7F,  false},
-    {IrdaProtocolNEC,     0xFF,      0xFF,  false},
-    {IrdaProtocolNEC,     0xFF,      0xFF,  true},
-    {IrdaProtocolNEC,     0xAA,      0x55,  false},
-    {IrdaProtocolNEC,     0x55,      0xAA,  false},
-    {IrdaProtocolNEC,     0x55,      0x55,  false},
-    {IrdaProtocolNEC,     0xAA,      0xAA,  false},
-    {IrdaProtocolNEC,     0xAA,      0xAA,  true},
-
-    {IrdaProtocolNEC,     0xAA,      0xAA,  false},
-    {IrdaProtocolNEC,     0xAA,      0xAA,  true},
-    {IrdaProtocolNEC,     0xAA,      0xAA,  true},
-
-    {IrdaProtocolNEC,     0x55,      0x55,  false},
-    {IrdaProtocolNEC,     0x55,      0x55,  true},
-    {IrdaProtocolNEC,     0x55,      0x55,  true},
-    {IrdaProtocolNEC,     0x55,      0x55,  true},
+const InfraredMessage test_nec[] = {
+    {InfraredProtocolNEC,     0x00,      0x00,  false},
+    {InfraredProtocolNEC,     0x01,      0x00,  false},
+    {InfraredProtocolNEC,     0x01,      0x80,  false},
+    {InfraredProtocolNEC,     0x00,      0x80,  false},
+    {InfraredProtocolNEC,     0x00,      0x00,  false},
+    {InfraredProtocolNEC,     0x00,      0x00,  true},
+    {InfraredProtocolNEC,     0x00,      0x00,  false},
+    {InfraredProtocolNEC,     0x00,      0x00,  true},
+    {InfraredProtocolNEC,     0xFF,      0xFF,  false},
+    {InfraredProtocolNEC,     0xFE,      0xFF,  false},
+    {InfraredProtocolNEC,     0xFE,      0x7F,  false},
+    {InfraredProtocolNEC,     0xFF,      0x7F,  false},
+    {InfraredProtocolNEC,     0xFF,      0xFF,  false},
+    {InfraredProtocolNEC,     0xFF,      0xFF,  true},
+    {InfraredProtocolNEC,     0xAA,      0x55,  false},
+    {InfraredProtocolNEC,     0x55,      0xAA,  false},
+    {InfraredProtocolNEC,     0x55,      0x55,  false},
+    {InfraredProtocolNEC,     0xAA,      0xAA,  false},
+    {InfraredProtocolNEC,     0xAA,      0xAA,  true},
+
+    {InfraredProtocolNEC,     0xAA,      0xAA,  false},
+    {InfraredProtocolNEC,     0xAA,      0xAA,  true},
+    {InfraredProtocolNEC,     0xAA,      0xAA,  true},
+
+    {InfraredProtocolNEC,     0x55,      0x55,  false},
+    {InfraredProtocolNEC,     0x55,      0x55,  true},
+    {InfraredProtocolNEC,     0x55,      0x55,  true},
+    {InfraredProtocolNEC,     0x55,      0x55,  true},
 };
 
-const IrdaMessage test_nec42[] = {
-    {IrdaProtocolNEC42,     0x0000,      0x00,  false},
-    {IrdaProtocolNEC42,     0x0001,      0x00,  false},
-    {IrdaProtocolNEC42,     0x0001,      0x80,  false},
-    {IrdaProtocolNEC42,     0x0000,      0x80,  false},
-    {IrdaProtocolNEC42,     0x0000,      0x00,  false},
-    {IrdaProtocolNEC42,     0x0000,      0x00,  true},
-    {IrdaProtocolNEC42,     0x0000,      0x00,  false},
-    {IrdaProtocolNEC42,     0x0000,      0x00,  true},
-    {IrdaProtocolNEC42,     0x1FFF,      0xFF,  false},
-    {IrdaProtocolNEC42,     0x1FFE,      0xFF,  false},
-    {IrdaProtocolNEC42,     0x1FFE,      0x7F,  false},
-    {IrdaProtocolNEC42,     0x1FFF,      0x7F,  false},
-    {IrdaProtocolNEC42,     0x1FFF,      0xFF,  false},
-    {IrdaProtocolNEC42,     0x1FFF,      0xFF,  true},
-    {IrdaProtocolNEC42,     0x0AAA,      0x55,  false},
-    {IrdaProtocolNEC42,     0x1555,      0xAA,  false},
-    {IrdaProtocolNEC42,     0x1555,      0x55,  false},
-    {IrdaProtocolNEC42,     0x0AAA,      0xAA,  false},
-    {IrdaProtocolNEC42,     0x0AAA,      0xAA,  true},
-    {IrdaProtocolNEC42,     0x0AAA,      0xAA,  false},
-    {IrdaProtocolNEC42,     0x0AAA,      0xAA,  true},
-    {IrdaProtocolNEC42,     0x0AAA,      0xAA,  true},
-    {IrdaProtocolNEC42,     0x1555,      0x55,  false},
-    {IrdaProtocolNEC42,     0x1555,      0x55,  true},
-    {IrdaProtocolNEC42,     0x1555,      0x55,  true},
-    {IrdaProtocolNEC42,     0x1555,      0x55,  true},
+const InfraredMessage test_nec42[] = {
+    {InfraredProtocolNEC42,     0x0000,      0x00,  false},
+    {InfraredProtocolNEC42,     0x0001,      0x00,  false},
+    {InfraredProtocolNEC42,     0x0001,      0x80,  false},
+    {InfraredProtocolNEC42,     0x0000,      0x80,  false},
+    {InfraredProtocolNEC42,     0x0000,      0x00,  false},
+    {InfraredProtocolNEC42,     0x0000,      0x00,  true},
+    {InfraredProtocolNEC42,     0x0000,      0x00,  false},
+    {InfraredProtocolNEC42,     0x0000,      0x00,  true},
+    {InfraredProtocolNEC42,     0x1FFF,      0xFF,  false},
+    {InfraredProtocolNEC42,     0x1FFE,      0xFF,  false},
+    {InfraredProtocolNEC42,     0x1FFE,      0x7F,  false},
+    {InfraredProtocolNEC42,     0x1FFF,      0x7F,  false},
+    {InfraredProtocolNEC42,     0x1FFF,      0xFF,  false},
+    {InfraredProtocolNEC42,     0x1FFF,      0xFF,  true},
+    {InfraredProtocolNEC42,     0x0AAA,      0x55,  false},
+    {InfraredProtocolNEC42,     0x1555,      0xAA,  false},
+    {InfraredProtocolNEC42,     0x1555,      0x55,  false},
+    {InfraredProtocolNEC42,     0x0AAA,      0xAA,  false},
+    {InfraredProtocolNEC42,     0x0AAA,      0xAA,  true},
+    {InfraredProtocolNEC42,     0x0AAA,      0xAA,  false},
+    {InfraredProtocolNEC42,     0x0AAA,      0xAA,  true},
+    {InfraredProtocolNEC42,     0x0AAA,      0xAA,  true},
+    {InfraredProtocolNEC42,     0x1555,      0x55,  false},
+    {InfraredProtocolNEC42,     0x1555,      0x55,  true},
+    {InfraredProtocolNEC42,     0x1555,      0x55,  true},
+    {InfraredProtocolNEC42,     0x1555,      0x55,  true},
 };
 
-const IrdaMessage test_nec42ext[] = {
-    {IrdaProtocolNEC42ext,     0x0000000,      0x0000,  false},
-    {IrdaProtocolNEC42ext,     0x0000001,      0x0000,  false},
-    {IrdaProtocolNEC42ext,     0x0000001,      0x8000,  false},
-    {IrdaProtocolNEC42ext,     0x0000000,      0x8000,  false},
-    {IrdaProtocolNEC42ext,     0x0000000,      0x0000,  false},
-    {IrdaProtocolNEC42ext,     0x0000000,      0x0000,  true},
-    {IrdaProtocolNEC42ext,     0x0000000,      0x0000,  false},
-    {IrdaProtocolNEC42ext,     0x0000000,      0x0000,  true},
-    {IrdaProtocolNEC42ext,     0x3F000FF,      0xF00F,  false},
-    {IrdaProtocolNEC42ext,     0x3F000FE,      0xF00F,  false},
-    {IrdaProtocolNEC42ext,     0x3F000FE,      0x700F,  false},
-    {IrdaProtocolNEC42ext,     0x3F000FF,      0x700F,  false},
-    {IrdaProtocolNEC42ext,     0x3F000FF,      0xF00F,  false},
-    {IrdaProtocolNEC42ext,     0x3F000FF,      0xF00F,  true},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0x5555,  false},
-    {IrdaProtocolNEC42ext,     0x1555555,      0xAAAA,  false},
-    {IrdaProtocolNEC42ext,     0x1555555,      0x5555,  false},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  false},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  false},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
-    {IrdaProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
-    {IrdaProtocolNEC42ext,     0x1555555,      0x5555,  false},
-    {IrdaProtocolNEC42ext,     0x1555555,      0x5555,  true},
-    {IrdaProtocolNEC42ext,     0x1555555,      0x5555,  true},
-    {IrdaProtocolNEC42ext,     0x1555555,      0x5555,  true},
+const InfraredMessage test_nec42ext[] = {
+    {InfraredProtocolNEC42ext,     0x0000000,      0x0000,  false},
+    {InfraredProtocolNEC42ext,     0x0000001,      0x0000,  false},
+    {InfraredProtocolNEC42ext,     0x0000001,      0x8000,  false},
+    {InfraredProtocolNEC42ext,     0x0000000,      0x8000,  false},
+    {InfraredProtocolNEC42ext,     0x0000000,      0x0000,  false},
+    {InfraredProtocolNEC42ext,     0x0000000,      0x0000,  true},
+    {InfraredProtocolNEC42ext,     0x0000000,      0x0000,  false},
+    {InfraredProtocolNEC42ext,     0x0000000,      0x0000,  true},
+    {InfraredProtocolNEC42ext,     0x3F000FF,      0xF00F,  false},
+    {InfraredProtocolNEC42ext,     0x3F000FE,      0xF00F,  false},
+    {InfraredProtocolNEC42ext,     0x3F000FE,      0x700F,  false},
+    {InfraredProtocolNEC42ext,     0x3F000FF,      0x700F,  false},
+    {InfraredProtocolNEC42ext,     0x3F000FF,      0xF00F,  false},
+    {InfraredProtocolNEC42ext,     0x3F000FF,      0xF00F,  true},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0x5555,  false},
+    {InfraredProtocolNEC42ext,     0x1555555,      0xAAAA,  false},
+    {InfraredProtocolNEC42ext,     0x1555555,      0x5555,  false},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  false},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  false},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
+    {InfraredProtocolNEC42ext,     0x2AAAAAA,      0xAAAA,  true},
+    {InfraredProtocolNEC42ext,     0x1555555,      0x5555,  false},
+    {InfraredProtocolNEC42ext,     0x1555555,      0x5555,  true},
+    {InfraredProtocolNEC42ext,     0x1555555,      0x5555,  true},
+    {InfraredProtocolNEC42ext,     0x1555555,      0x5555,  true},
 };
 
 const uint32_t test_decoder_nec42ext_input1[] = {
@@ -331,11 +331,11 @@ const uint32_t test_decoder_nec42ext_input2[] = {
                         560, 560, 560, 560, 560, 10000, 560,                                                // 42 OK + 1 failed
 };
 
-const IrdaMessage test_decoder_nec42ext_expected1[] = {
-    {IrdaProtocolNEC42ext,     0x00,      0,  false},
+const InfraredMessage test_decoder_nec42ext_expected1[] = {
+    {InfraredProtocolNEC42ext,     0x00,      0,  false},
 };
 
-const IrdaMessage test_decoder_nec42ext_expected2[] = {
-    {IrdaProtocolNEC42ext,     0x00,      0,  false},
+const InfraredMessage test_decoder_nec42ext_expected2[] = {
+    {InfraredProtocolNEC42ext,     0x00,      0,  false},
 };
 

+ 136 - 136
applications/tests/irda_decoder_encoder/test_data/irda_necext_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_necext_test_data.srcdata

@@ -110,146 +110,146 @@ const uint32_t test_decoder_necext_input1[] = {
 261924, 8965, 4465, 585, 529, 588, 525, 592, 1638, 588, 525, 592, 523, 584, 530, 587, 526, 591, 1639, 587, 1642, 583, 529, 587, 527, 590, 1639, 587, 1643, 584, 1646, 590,
 };
 
-const IrdaMessage test_decoder_necext_expected1[] = {
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  false},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
-    {IrdaProtocolNECext,     0x7984,    0xed12,  true},
+const InfraredMessage test_decoder_necext_expected1[] = {
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  false},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
+    {InfraredProtocolNECext,     0x7984,    0xed12,  true},
 };
 
-const IrdaMessage test_necext[] = {
-    {IrdaProtocolNECext,     0x0000,      0x0000,  false},
-    {IrdaProtocolNECext,     0x0001,      0x0000,  false},
-    {IrdaProtocolNECext,     0x0001,      0x8000,  false},
-    {IrdaProtocolNECext,     0x0000,      0x8000,  false},
-    {IrdaProtocolNECext,     0x0000,      0x0000,  false},
-    {IrdaProtocolNECext,     0x0000,      0x0000,  true},
-    {IrdaProtocolNECext,     0x0000,      0x0000,  false},
-    {IrdaProtocolNECext,     0x0000,      0x0000,  true},
-    {IrdaProtocolNECext,     0xFFFF,      0xFFFF,  false},
-    {IrdaProtocolNECext,     0xFFFE,      0xFFFF,  false},
-    {IrdaProtocolNECext,     0xFFFE,      0x7FFF,  false},
-    {IrdaProtocolNECext,     0xFFFF,      0x7FFF,  false},
-    {IrdaProtocolNECext,     0xFFFF,      0xFFFF,  false},
-    {IrdaProtocolNECext,     0xFFFF,      0xFFFF,  true},
-    {IrdaProtocolNECext,     0xAAAA,      0x5555,  false},
-    {IrdaProtocolNECext,     0x5555,      0xAAAA,  false},
-    {IrdaProtocolNECext,     0x5555,      0x5555,  false},
-    {IrdaProtocolNECext,     0xAAAA,      0xAAAA,  false},
-    {IrdaProtocolNECext,     0xAAAA,      0xAAAA,  true},
+const InfraredMessage test_necext[] = {
+    {InfraredProtocolNECext,     0x0000,      0x0000,  false},
+    {InfraredProtocolNECext,     0x0001,      0x0000,  false},
+    {InfraredProtocolNECext,     0x0001,      0x8000,  false},
+    {InfraredProtocolNECext,     0x0000,      0x8000,  false},
+    {InfraredProtocolNECext,     0x0000,      0x0000,  false},
+    {InfraredProtocolNECext,     0x0000,      0x0000,  true},
+    {InfraredProtocolNECext,     0x0000,      0x0000,  false},
+    {InfraredProtocolNECext,     0x0000,      0x0000,  true},
+    {InfraredProtocolNECext,     0xFFFF,      0xFFFF,  false},
+    {InfraredProtocolNECext,     0xFFFE,      0xFFFF,  false},
+    {InfraredProtocolNECext,     0xFFFE,      0x7FFF,  false},
+    {InfraredProtocolNECext,     0xFFFF,      0x7FFF,  false},
+    {InfraredProtocolNECext,     0xFFFF,      0xFFFF,  false},
+    {InfraredProtocolNECext,     0xFFFF,      0xFFFF,  true},
+    {InfraredProtocolNECext,     0xAAAA,      0x5555,  false},
+    {InfraredProtocolNECext,     0x5555,      0xAAAA,  false},
+    {InfraredProtocolNECext,     0x5555,      0x5555,  false},
+    {InfraredProtocolNECext,     0xAAAA,      0xAAAA,  false},
+    {InfraredProtocolNECext,     0xAAAA,      0xAAAA,  true},
 
-    {IrdaProtocolNECext,     0xAAAA,      0xAAAA,  false},
-    {IrdaProtocolNECext,     0xAAAA,      0xAAAA,  true},
-    {IrdaProtocolNECext,     0xAAAA,      0xAAAA,  true},
+    {InfraredProtocolNECext,     0xAAAA,      0xAAAA,  false},
+    {InfraredProtocolNECext,     0xAAAA,      0xAAAA,  true},
+    {InfraredProtocolNECext,     0xAAAA,      0xAAAA,  true},
 
-    {IrdaProtocolNECext,     0x5555,      0x5555,  false},
-    {IrdaProtocolNECext,     0x5555,      0x5555,  true},
-    {IrdaProtocolNECext,     0x5555,      0x5555,  true},
-    {IrdaProtocolNECext,     0x5555,      0x5555,  true},
+    {InfraredProtocolNECext,     0x5555,      0x5555,  false},
+    {InfraredProtocolNECext,     0x5555,      0x5555,  true},
+    {InfraredProtocolNECext,     0x5555,      0x5555,  true},
+    {InfraredProtocolNECext,     0x5555,      0x5555,  true},
 };
 
 

+ 57 - 57
applications/tests/irda_decoder_encoder/test_data/irda_rc5_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_rc5_test_data.srcdata

@@ -8,8 +8,8 @@ const uint32_t test_decoder_rc5x_input1[] = {
 27000 + 888, 1776, 888, 888, 1776, 1776, 888, 888, 1776, 888, 888, 1776, 1776, 1776, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5x_expected1[] = {
-    {IrdaProtocolRC5X,     0x13,      0x10,  false}, // toggle 0
+const InfraredMessage test_decoder_rc5x_expected1[] = {
+    {InfraredProtocolRC5X,     0x13,      0x10,  false}, // toggle 0
 };
 
 /*
@@ -22,8 +22,8 @@ const uint32_t test_decoder_rc5_input1[] = {
 27000 + 888, 888, 888, 1776, 1776, 1776, 888, 888, 1776, 888, 888, 1776, 1776, 1776, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected1[] = {
-    {IrdaProtocolRC5,     0x13,      0x10,  false}, // toggle 0
+const InfraredMessage test_decoder_rc5_expected1[] = {
+    {InfraredProtocolRC5,     0x13,      0x10,  false}, // toggle 0
 };
 
 
@@ -37,8 +37,8 @@ const uint32_t test_decoder_rc5_input2[] = {
 27000 + 888, 888, 888, 888, 888, 888, 888, 1776, 888, 888, 1776, 888, 888, 1776, 1776, 1776, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected2[] = {
-    {IrdaProtocolRC5,     0x13,      0x10,  false}, // toggle 1
+const InfraredMessage test_decoder_rc5_expected2[] = {
+    {InfraredProtocolRC5,     0x13,      0x10,  false}, // toggle 1
 };
 
 /*
@@ -51,8 +51,8 @@ const uint32_t test_decoder_rc5_input3[] = {
 27000 + 888, 888, 888, 1776, 1776, 1776, 888, 888, 1776, 888, 888, 1776, 1776, 1776, 888, 888, 888, 888, 1776, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected3[] = {
-    {IrdaProtocolRC5,     0x13,      0x11,  false}, // toggle 0
+const InfraredMessage test_decoder_rc5_expected3[] = {
+    {InfraredProtocolRC5,     0x13,      0x11,  false}, // toggle 0
 };
 
 
@@ -66,8 +66,8 @@ const uint32_t test_decoder_rc5_input4[] = {
 27000 + 888, 888, 888, 888, 888, 888, 888, 1776, 888, 888, 1776, 888, 888, 1776, 1776, 1776, 888, 888, 888, 888, 1776, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected4[] = {
-    {IrdaProtocolRC5,     0x13,      0x11,  false}, // toggle 1
+const InfraredMessage test_decoder_rc5_expected4[] = {
+    {InfraredProtocolRC5,     0x13,      0x11,  false}, // toggle 1
 };
 
 /*
@@ -80,8 +80,8 @@ const uint32_t test_decoder_rc5_input5[] = {
 27000 + 888, 888, 888, 1776, 1776, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected5[] = {
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false}, // toggle 0
+const InfraredMessage test_decoder_rc5_expected5[] = {
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false}, // toggle 0
 };
 
 /*
@@ -94,8 +94,8 @@ const uint32_t test_decoder_rc5_input6[] = {
 27000 + 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected6[] = {
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false}, // toggle 1
+const InfraredMessage test_decoder_rc5_expected6[] = {
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false}, // toggle 1
 };
 
 
@@ -113,48 +113,48 @@ const uint32_t test_decoder_rc5_input_all_repeats[] = {
 27000 + 888, 888, 888, 1776, 1776, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, 888,
 };
 
-const IrdaMessage test_decoder_rc5_expected_all_repeats[] = {
-    {IrdaProtocolRC5,     0x13,      0x11,  false}, // toggle 0
-    {IrdaProtocolRC5,     0x13,      0x11,  false}, // toggle 1
-    {IrdaProtocolRC5,     0x13,      0x11,  true},  // toggle 1
-    {IrdaProtocolRC5,     0x13,      0x11,  true},  // toggle 1
-    {IrdaProtocolRC5,     0x13,      0x11,  false}, // toggle 0
-    {IrdaProtocolRC5,     0x13,      0x10,  false}, // toggle 1
-    {IrdaProtocolRC5,     0x13,      0x10,  false}, // toggle 0
-    {IrdaProtocolRC5,     0x13,      0x10,  true},  // toggle 0
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false}, // toggle 1
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false}, // toggle 0
-    {IrdaProtocolRC5,     0x1F,      0x3F,  true},  // toggle 0
-};
-
-
-const IrdaMessage test_rc5[] = {
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false},
-    {IrdaProtocolRC5,     0x00,      0x00,  false},
-    {IrdaProtocolRC5,     0x10,      0x01,  false},
-    {IrdaProtocolRC5,     0x01,      0x20,  false},
-    {IrdaProtocolRC5,     0x01,      0x20,  false},
-    {IrdaProtocolRC5,     0x01,      0x20,  true},
-    {IrdaProtocolRC5,     0x01,      0x20,  true},
-    {IrdaProtocolRC5,     0x01,      0x20,  true},
-    {IrdaProtocolRC5,     0x01,      0x20,  true},
-    {IrdaProtocolRC5,     0x1F,      0x3F,  false},
-    {IrdaProtocolRC5,     0x0A,      0x2A,  false},
-    {IrdaProtocolRC5,     0x15,      0x15,  false},
-    {IrdaProtocolRC5,     0x15,      0x15,  true},
-
-    {IrdaProtocolRC5X,     0x1F,      0x3F,  false},
-    {IrdaProtocolRC5X,     0x00,      0x00,  false},
-    {IrdaProtocolRC5X,     0x10,      0x01,  false},
-    {IrdaProtocolRC5X,     0x01,      0x20,  false},
-    {IrdaProtocolRC5X,     0x01,      0x20,  false},
-    {IrdaProtocolRC5X,     0x01,      0x20,  true},
-    {IrdaProtocolRC5X,     0x01,      0x20,  true},
-    {IrdaProtocolRC5X,     0x01,      0x20,  true},
-    {IrdaProtocolRC5X,     0x01,      0x20,  true},
-    {IrdaProtocolRC5X,     0x1F,      0x3F,  false},
-    {IrdaProtocolRC5X,     0x0A,      0x2A,  false},
-    {IrdaProtocolRC5X,     0x15,      0x15,  false},
-    {IrdaProtocolRC5X,     0x15,      0x15,  true},
+const InfraredMessage test_decoder_rc5_expected_all_repeats[] = {
+    {InfraredProtocolRC5,     0x13,      0x11,  false}, // toggle 0
+    {InfraredProtocolRC5,     0x13,      0x11,  false}, // toggle 1
+    {InfraredProtocolRC5,     0x13,      0x11,  true},  // toggle 1
+    {InfraredProtocolRC5,     0x13,      0x11,  true},  // toggle 1
+    {InfraredProtocolRC5,     0x13,      0x11,  false}, // toggle 0
+    {InfraredProtocolRC5,     0x13,      0x10,  false}, // toggle 1
+    {InfraredProtocolRC5,     0x13,      0x10,  false}, // toggle 0
+    {InfraredProtocolRC5,     0x13,      0x10,  true},  // toggle 0
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false}, // toggle 1
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false}, // toggle 0
+    {InfraredProtocolRC5,     0x1F,      0x3F,  true},  // toggle 0
+};
+
+
+const InfraredMessage test_rc5[] = {
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false},
+    {InfraredProtocolRC5,     0x00,      0x00,  false},
+    {InfraredProtocolRC5,     0x10,      0x01,  false},
+    {InfraredProtocolRC5,     0x01,      0x20,  false},
+    {InfraredProtocolRC5,     0x01,      0x20,  false},
+    {InfraredProtocolRC5,     0x01,      0x20,  true},
+    {InfraredProtocolRC5,     0x01,      0x20,  true},
+    {InfraredProtocolRC5,     0x01,      0x20,  true},
+    {InfraredProtocolRC5,     0x01,      0x20,  true},
+    {InfraredProtocolRC5,     0x1F,      0x3F,  false},
+    {InfraredProtocolRC5,     0x0A,      0x2A,  false},
+    {InfraredProtocolRC5,     0x15,      0x15,  false},
+    {InfraredProtocolRC5,     0x15,      0x15,  true},
+
+    {InfraredProtocolRC5X,     0x1F,      0x3F,  false},
+    {InfraredProtocolRC5X,     0x00,      0x00,  false},
+    {InfraredProtocolRC5X,     0x10,      0x01,  false},
+    {InfraredProtocolRC5X,     0x01,      0x20,  false},
+    {InfraredProtocolRC5X,     0x01,      0x20,  false},
+    {InfraredProtocolRC5X,     0x01,      0x20,  true},
+    {InfraredProtocolRC5X,     0x01,      0x20,  true},
+    {InfraredProtocolRC5X,     0x01,      0x20,  true},
+    {InfraredProtocolRC5X,     0x01,      0x20,  true},
+    {InfraredProtocolRC5X,     0x1F,      0x3F,  false},
+    {InfraredProtocolRC5X,     0x0A,      0x2A,  false},
+    {InfraredProtocolRC5X,     0x15,      0x15,  false},
+    {InfraredProtocolRC5X,     0x15,      0x15,  true},
 };
 

+ 61 - 61
applications/tests/irda_decoder_encoder/test_data/irda_rc6_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_rc6_test_data.srcdata

@@ -79,28 +79,28 @@ const uint32_t test_decoder_rc6_input1[] = {
 27000, 2666, 889, 444, 888, 444, 444, 444, 444, 444 + 888, 888, 444, 888, 444, 444, 888, 888, 888, 888, 888, 444, 444, 888, 888, 888, 444, 444, 444, 444, 444, 444, 444, 444, 444,
 };
 
-const IrdaMessage test_decoder_rc6_expected1[] = {
-    {IrdaProtocolRC6,     0x94,      0xA0,  false}, // toggle 0
-    {IrdaProtocolRC6,     0x93,      0xA0,  false}, // toggle 1
-//    {IrdaProtocolRC6,     0x95,      0xA0,  false},       failed
-    {IrdaProtocolRC6,     0x93,      0xA0,  false}, // toggle 0
-    {IrdaProtocolRC6,     0x94,      0xA0,  false}, // toggle 1
-    {IrdaProtocolRC6,     0x95,      0xA0,  false}, // toggle 0
-//    {IrdaProtocolRC6,     0x93,      0xA0,  false},       failed
-//    {IrdaProtocolRC6,     0x93,      0xA0,  false},       failed
-//    {IrdaProtocolRC6,     0x93,      0xA0,  false},       failed
-    {IrdaProtocolRC6,     0x95,      0xA0,  false}, // toggle 1
+const InfraredMessage test_decoder_rc6_expected1[] = {
+    {InfraredProtocolRC6,     0x94,      0xA0,  false}, // toggle 0
+    {InfraredProtocolRC6,     0x93,      0xA0,  false}, // toggle 1
+//    {InfraredProtocolRC6,     0x95,      0xA0,  false},       failed
+    {InfraredProtocolRC6,     0x93,      0xA0,  false}, // toggle 0
+    {InfraredProtocolRC6,     0x94,      0xA0,  false}, // toggle 1
+    {InfraredProtocolRC6,     0x95,      0xA0,  false}, // toggle 0
+//    {InfraredProtocolRC6,     0x93,      0xA0,  false},       failed
+//    {InfraredProtocolRC6,     0x93,      0xA0,  false},       failed
+//    {InfraredProtocolRC6,     0x93,      0xA0,  false},       failed
+    {InfraredProtocolRC6,     0x95,      0xA0,  false}, // toggle 1
 };
 
-const IrdaMessage test_encoder_rc6_input1[] = {
-    {IrdaProtocolRC6,     0x93,      0xA0,  false}, // Toggle 0
-    {IrdaProtocolRC6,     0x93,      0xA0,  true},  // Toggle 0
-    {IrdaProtocolRC6,     0x93,      0xA1,  false}, // Toggle 1
-    {IrdaProtocolRC6,     0x93,      0xA1,  true},  // Toggle 1
-    {IrdaProtocolRC6,     0x93,      0xA1,  true},  // Toggle 1
-    {IrdaProtocolRC6,     0x93,      0xA0,  false}, // Toggle 0
-    {IrdaProtocolRC6,     0x93,      0xA0,  false}, // Toggle 1
-    {IrdaProtocolRC6,     0x93,      0xA0,  true},  // Toggle 1
+const InfraredMessage test_encoder_rc6_input1[] = {
+    {InfraredProtocolRC6,     0x93,      0xA0,  false}, // Toggle 0
+    {InfraredProtocolRC6,     0x93,      0xA0,  true},  // Toggle 0
+    {InfraredProtocolRC6,     0x93,      0xA1,  false}, // Toggle 1
+    {InfraredProtocolRC6,     0x93,      0xA1,  true},  // Toggle 1
+    {InfraredProtocolRC6,     0x93,      0xA1,  true},  // Toggle 1
+    {InfraredProtocolRC6,     0x93,      0xA0,  false}, // Toggle 0
+    {InfraredProtocolRC6,     0x93,      0xA0,  false}, // Toggle 1
+    {InfraredProtocolRC6,     0x93,      0xA0,  true},  // Toggle 1
 };
 
 const uint32_t test_encoder_rc6_expected1[] = {
@@ -115,48 +115,48 @@ const uint32_t test_encoder_rc6_expected1[] = {
 };
 
 
-const IrdaMessage test_rc6[] = {
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 0
-    {IrdaProtocolRC6,     0x80,      0x00,  false},     // t 1
-    {IrdaProtocolRC6,     0x80,      0x01,  false},     // t 0
-    {IrdaProtocolRC6,     0x00,      0x01,  false},     // t 1
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 0
-    {IrdaProtocolRC6,     0x00,      0x00,  true},      // t 0
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 1
-    {IrdaProtocolRC6,     0x00,      0x00,  true},      // t 1
-    {IrdaProtocolRC6,     0xFF,      0xFF,  false},     // t 0
-    {IrdaProtocolRC6,     0x7F,      0xFF,  false},     // t 1
-    {IrdaProtocolRC6,     0x7F,      0xFE,  false},     // t 0
-    {IrdaProtocolRC6,     0xFF,      0xFE,  false},     // t 1
-    {IrdaProtocolRC6,     0xFF,      0xFF,  false},     // t 0
-    {IrdaProtocolRC6,     0xFF,      0xFF,  true},      // t 0
-    {IrdaProtocolRC6,     0xAA,      0x55,  false},     // t 1
-    {IrdaProtocolRC6,     0x55,      0xAA,  false},     // t 0
-    {IrdaProtocolRC6,     0x55,      0x55,  false},     // t 1
-    {IrdaProtocolRC6,     0xAA,      0xAA,  false},     // t 0
-    {IrdaProtocolRC6,     0xAA,      0xAA,  true},      // t 0
+const InfraredMessage test_rc6[] = {
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 0
+    {InfraredProtocolRC6,     0x80,      0x00,  false},     // t 1
+    {InfraredProtocolRC6,     0x80,      0x01,  false},     // t 0
+    {InfraredProtocolRC6,     0x00,      0x01,  false},     // t 1
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 0
+    {InfraredProtocolRC6,     0x00,      0x00,  true},      // t 0
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 1
+    {InfraredProtocolRC6,     0x00,      0x00,  true},      // t 1
+    {InfraredProtocolRC6,     0xFF,      0xFF,  false},     // t 0
+    {InfraredProtocolRC6,     0x7F,      0xFF,  false},     // t 1
+    {InfraredProtocolRC6,     0x7F,      0xFE,  false},     // t 0
+    {InfraredProtocolRC6,     0xFF,      0xFE,  false},     // t 1
+    {InfraredProtocolRC6,     0xFF,      0xFF,  false},     // t 0
+    {InfraredProtocolRC6,     0xFF,      0xFF,  true},      // t 0
+    {InfraredProtocolRC6,     0xAA,      0x55,  false},     // t 1
+    {InfraredProtocolRC6,     0x55,      0xAA,  false},     // t 0
+    {InfraredProtocolRC6,     0x55,      0x55,  false},     // t 1
+    {InfraredProtocolRC6,     0xAA,      0xAA,  false},     // t 0
+    {InfraredProtocolRC6,     0xAA,      0xAA,  true},      // t 0
 // same with inverted toggle bit
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 1
-    {IrdaProtocolRC6,     0x80,      0x00,  false},     // t 0
-    {IrdaProtocolRC6,     0x80,      0x01,  false},     // t 1
-    {IrdaProtocolRC6,     0x00,      0x01,  false},     // t 0
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 1
-    {IrdaProtocolRC6,     0x00,      0x00,  true},      // t 1
-    {IrdaProtocolRC6,     0x00,      0x00,  false},     // t 0
-    {IrdaProtocolRC6,     0x00,      0x00,  true},      // t 0
-    {IrdaProtocolRC6,     0xFF,      0xFF,  false},     // t 1
-    {IrdaProtocolRC6,     0x7F,      0xFF,  false},     // t 0
-    {IrdaProtocolRC6,     0x7F,      0xFE,  false},     // t 1
-    {IrdaProtocolRC6,     0xFF,      0xFE,  false},     // t 0
-    {IrdaProtocolRC6,     0xFF,      0xFF,  false},     // t 1
-    {IrdaProtocolRC6,     0xFF,      0xFF,  true},      // t 1
-    {IrdaProtocolRC6,     0xAA,      0x55,  false},     // t 0
-    {IrdaProtocolRC6,     0x55,      0xAA,  false},     // t 1
-    {IrdaProtocolRC6,     0x55,      0x55,  false},     // t 0
-    {IrdaProtocolRC6,     0xAA,      0xAA,  false},     // t 1
-    {IrdaProtocolRC6,     0xAA,      0xAA,  true},      // t 1
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 1
+    {InfraredProtocolRC6,     0x80,      0x00,  false},     // t 0
+    {InfraredProtocolRC6,     0x80,      0x01,  false},     // t 1
+    {InfraredProtocolRC6,     0x00,      0x01,  false},     // t 0
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 1
+    {InfraredProtocolRC6,     0x00,      0x00,  true},      // t 1
+    {InfraredProtocolRC6,     0x00,      0x00,  false},     // t 0
+    {InfraredProtocolRC6,     0x00,      0x00,  true},      // t 0
+    {InfraredProtocolRC6,     0xFF,      0xFF,  false},     // t 1
+    {InfraredProtocolRC6,     0x7F,      0xFF,  false},     // t 0
+    {InfraredProtocolRC6,     0x7F,      0xFE,  false},     // t 1
+    {InfraredProtocolRC6,     0xFF,      0xFE,  false},     // t 0
+    {InfraredProtocolRC6,     0xFF,      0xFF,  false},     // t 1
+    {InfraredProtocolRC6,     0xFF,      0xFF,  true},      // t 1
+    {InfraredProtocolRC6,     0xAA,      0x55,  false},     // t 0
+    {InfraredProtocolRC6,     0x55,      0xAA,  false},     // t 1
+    {InfraredProtocolRC6,     0x55,      0x55,  false},     // t 0
+    {InfraredProtocolRC6,     0xAA,      0xAA,  false},     // t 1
+    {InfraredProtocolRC6,     0xAA,      0xAA,  true},      // t 1
 
-    {IrdaProtocolRC6,     0x93,      0xA0,  false},     // t 0
-    {IrdaProtocolRC6,     0x93,      0xA1,  false},     // t 1
+    {InfraredProtocolRC6,     0x93,      0xA0,  false},     // t 0
+    {InfraredProtocolRC6,     0x93,      0xA1,  false},     // t 1
 };
 

+ 69 - 69
applications/tests/irda_decoder_encoder/test_data/irda_samsung_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_samsung_test_data.srcdata

@@ -179,76 +179,76 @@ const uint32_t test_decoder_samsung32_input1[] = {
     532,     584,
 };
 
-const IrdaMessage test_decoder_samsung32_expected1[] = {
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, false}, {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x81, false}, {IrdaProtocolSamsung32, 0x0E, 0x81, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x02, false}, {IrdaProtocolSamsung32, 0x0E, 0x02, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x03, false}, {IrdaProtocolSamsung32, 0x0E, 0x03, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, false}, {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, false}, {IrdaProtocolSamsung32, 0x0E, 0x0C, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, false}, {IrdaProtocolSamsung32, 0x0E, 0x0C, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, false}, {IrdaProtocolSamsung32, 0x0E, 0x0C, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x0C, true},  {IrdaProtocolSamsung32, 0x0E, 0x0C, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, true},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, true},  {IrdaProtocolSamsung32, 0x0E, 0x01, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, true},  {IrdaProtocolSamsung32, 0x0E, 0x01, false},
-    {IrdaProtocolSamsung32, 0x0E, 0x01, false}, {IrdaProtocolSamsung32, 0x0E, 0x01, true},
+const InfraredMessage test_decoder_samsung32_expected1[] = {
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, false}, {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x81, false}, {InfraredProtocolSamsung32, 0x0E, 0x81, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x02, false}, {InfraredProtocolSamsung32, 0x0E, 0x02, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x03, false}, {InfraredProtocolSamsung32, 0x0E, 0x03, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, false}, {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, false}, {InfraredProtocolSamsung32, 0x0E, 0x0C, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, false}, {InfraredProtocolSamsung32, 0x0E, 0x0C, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, false}, {InfraredProtocolSamsung32, 0x0E, 0x0C, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x0C, true},  {InfraredProtocolSamsung32, 0x0E, 0x0C, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, true},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, true},  {InfraredProtocolSamsung32, 0x0E, 0x01, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, true},  {InfraredProtocolSamsung32, 0x0E, 0x01, false},
+    {InfraredProtocolSamsung32, 0x0E, 0x01, false}, {InfraredProtocolSamsung32, 0x0E, 0x01, true},
 };
 
-const IrdaMessage test_samsung32[] = {
-    {IrdaProtocolSamsung32,     0x00,      0x00,  false},
-    {IrdaProtocolSamsung32,     0x01,      0x00,  false},
-    {IrdaProtocolSamsung32,     0x01,      0x80,  false},
-    {IrdaProtocolSamsung32,     0x00,      0x80,  false},
-    {IrdaProtocolSamsung32,     0x00,      0x00,  false},
-    {IrdaProtocolSamsung32,     0x00,      0x00,  true},
-    {IrdaProtocolSamsung32,     0x00,      0x00,  false},
-    {IrdaProtocolSamsung32,     0x00,      0x00,  true},
-    {IrdaProtocolSamsung32,     0xFF,      0xFF,  false},
-    {IrdaProtocolSamsung32,     0xFE,      0xFF,  false},
-    {IrdaProtocolSamsung32,     0xFE,      0x7F,  false},
-    {IrdaProtocolSamsung32,     0xFF,      0x7F,  false},
-    {IrdaProtocolSamsung32,     0xFF,      0xFF,  false},
-    {IrdaProtocolSamsung32,     0xFF,      0xFF,  true},
-    {IrdaProtocolSamsung32,     0xAA,      0x55,  false},
-    {IrdaProtocolSamsung32,     0x55,      0xAA,  false},
-    {IrdaProtocolSamsung32,     0x55,      0x55,  false},
-    {IrdaProtocolSamsung32,     0xAA,      0xAA,  false},
-    {IrdaProtocolSamsung32,     0xAA,      0xAA,  true},
-
-    {IrdaProtocolSamsung32,     0xAA,      0xAA,  false},
-    {IrdaProtocolSamsung32,     0xAA,      0xAA,  true},
-    {IrdaProtocolSamsung32,     0xAA,      0xAA,  true},
-
-    {IrdaProtocolSamsung32,     0x55,      0x55,  false},
-    {IrdaProtocolSamsung32,     0x55,      0x55,  true},
-    {IrdaProtocolSamsung32,     0x55,      0x55,  true},
-    {IrdaProtocolSamsung32,     0x55,      0x55,  true},
+const InfraredMessage test_samsung32[] = {
+    {InfraredProtocolSamsung32,     0x00,      0x00,  false},
+    {InfraredProtocolSamsung32,     0x01,      0x00,  false},
+    {InfraredProtocolSamsung32,     0x01,      0x80,  false},
+    {InfraredProtocolSamsung32,     0x00,      0x80,  false},
+    {InfraredProtocolSamsung32,     0x00,      0x00,  false},
+    {InfraredProtocolSamsung32,     0x00,      0x00,  true},
+    {InfraredProtocolSamsung32,     0x00,      0x00,  false},
+    {InfraredProtocolSamsung32,     0x00,      0x00,  true},
+    {InfraredProtocolSamsung32,     0xFF,      0xFF,  false},
+    {InfraredProtocolSamsung32,     0xFE,      0xFF,  false},
+    {InfraredProtocolSamsung32,     0xFE,      0x7F,  false},
+    {InfraredProtocolSamsung32,     0xFF,      0x7F,  false},
+    {InfraredProtocolSamsung32,     0xFF,      0xFF,  false},
+    {InfraredProtocolSamsung32,     0xFF,      0xFF,  true},
+    {InfraredProtocolSamsung32,     0xAA,      0x55,  false},
+    {InfraredProtocolSamsung32,     0x55,      0xAA,  false},
+    {InfraredProtocolSamsung32,     0x55,      0x55,  false},
+    {InfraredProtocolSamsung32,     0xAA,      0xAA,  false},
+    {InfraredProtocolSamsung32,     0xAA,      0xAA,  true},
+
+    {InfraredProtocolSamsung32,     0xAA,      0xAA,  false},
+    {InfraredProtocolSamsung32,     0xAA,      0xAA,  true},
+    {InfraredProtocolSamsung32,     0xAA,      0xAA,  true},
+
+    {InfraredProtocolSamsung32,     0x55,      0x55,  false},
+    {InfraredProtocolSamsung32,     0x55,      0x55,  true},
+    {InfraredProtocolSamsung32,     0x55,      0x55,  true},
+    {InfraredProtocolSamsung32,     0x55,      0x55,  true},
 };
 

+ 214 - 214
applications/tests/irda_decoder_encoder/test_data/irda_sirc_test_data.srcdata → applications/tests/infrared_decoder_encoder/test_data/infrared_sirc_test_data.srcdata

@@ -124,128 +124,128 @@ const uint32_t test_decoder_sirc_input1[] = {  /* 121 timings */
     26263,  2414, 611, 1192, 607, 544, 606, 1197, 602, 569, 606, 1197, 602, 539, 611, 540, 635, 1168, 606, 565, 610, 541, 608, 563, 587, 564,
 };
 
-const IrdaMessage test_decoder_sirc_expected1[] = {
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x60, false},
-    {IrdaProtocolSIRC,         0x10,   0x60, false},
-    {IrdaProtocolSIRC,         0x10,   0x60, false},
-    {IrdaProtocolSIRC,         0x10,   0x65, false},
-    {IrdaProtocolSIRC,         0x10,   0x65, false},
-    {IrdaProtocolSIRC,         0x10,   0x65, false},
-    {IrdaProtocolSIRC20,       0x410,  0x17, false},
-    {IrdaProtocolSIRC20,       0x410,  0x17, false},
-    {IrdaProtocolSIRC20,       0x410,  0x17, false},
-    {IrdaProtocolSIRC,         0x10,   0x21, false},
-    {IrdaProtocolSIRC,         0x10,   0x21, false},
-    {IrdaProtocolSIRC,         0x10,   0x21, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7B, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7B, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7B, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x78, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x78, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x78, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x79, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x79, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x79, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7A, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7C, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7D, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7D, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x7D, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x73, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x73, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x73, false},
-    {IrdaProtocolSIRC,         0x10,   0x13, false},
-    {IrdaProtocolSIRC,         0x10,   0x13, false},
-    {IrdaProtocolSIRC,         0x10,   0x13, false},
-    {IrdaProtocolSIRC,         0x10,   0x13, false},
-    {IrdaProtocolSIRC,         0x10,   0x12, false},
-    {IrdaProtocolSIRC,         0x10,   0x12, false},
-    {IrdaProtocolSIRC,         0x10,   0x12, false},
-    {IrdaProtocolSIRC,         0x10,   0x12, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x30, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x30, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x30, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x39, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x39, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x39, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x31, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x31, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x31, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x34, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x34, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x34, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x32, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x32, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x32, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x33, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x33, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x33, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x0F, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x0F, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x0F, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x38, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x38, false},
-    {IrdaProtocolSIRC20,       0x73A,  0x38, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x10,   0x15, false},
-    {IrdaProtocolSIRC,         0x01,   0x2F, false},
-    {IrdaProtocolSIRC,         0x01,   0x2F, false},
-    {IrdaProtocolSIRC,         0x01,   0x15, false},
-    {IrdaProtocolSIRC,         0x01,   0x15, false},
-    {IrdaProtocolSIRC,         0x01,   0x15, false},
-    {IrdaProtocolSIRC,         0x01,   0x15, false},
+const InfraredMessage test_decoder_sirc_expected1[] = {
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x60, false},
+    {InfraredProtocolSIRC,         0x10,   0x60, false},
+    {InfraredProtocolSIRC,         0x10,   0x60, false},
+    {InfraredProtocolSIRC,         0x10,   0x65, false},
+    {InfraredProtocolSIRC,         0x10,   0x65, false},
+    {InfraredProtocolSIRC,         0x10,   0x65, false},
+    {InfraredProtocolSIRC20,       0x410,  0x17, false},
+    {InfraredProtocolSIRC20,       0x410,  0x17, false},
+    {InfraredProtocolSIRC20,       0x410,  0x17, false},
+    {InfraredProtocolSIRC,         0x10,   0x21, false},
+    {InfraredProtocolSIRC,         0x10,   0x21, false},
+    {InfraredProtocolSIRC,         0x10,   0x21, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7B, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7B, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7B, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x78, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x78, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x78, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x79, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x79, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x79, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7A, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7C, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7D, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7D, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x7D, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x73, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x73, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x73, false},
+    {InfraredProtocolSIRC,         0x10,   0x13, false},
+    {InfraredProtocolSIRC,         0x10,   0x13, false},
+    {InfraredProtocolSIRC,         0x10,   0x13, false},
+    {InfraredProtocolSIRC,         0x10,   0x13, false},
+    {InfraredProtocolSIRC,         0x10,   0x12, false},
+    {InfraredProtocolSIRC,         0x10,   0x12, false},
+    {InfraredProtocolSIRC,         0x10,   0x12, false},
+    {InfraredProtocolSIRC,         0x10,   0x12, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x30, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x30, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x30, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x39, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x39, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x39, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x31, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x31, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x31, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x34, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x34, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x34, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x32, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x32, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x32, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x33, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x33, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x33, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x0F, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x0F, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x0F, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x38, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x38, false},
+    {InfraredProtocolSIRC20,       0x73A,  0x38, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x10,   0x15, false},
+    {InfraredProtocolSIRC,         0x01,   0x2F, false},
+    {InfraredProtocolSIRC,         0x01,   0x2F, false},
+    {InfraredProtocolSIRC,         0x01,   0x15, false},
+    {InfraredProtocolSIRC,         0x01,   0x15, false},
+    {InfraredProtocolSIRC,         0x01,   0x15, false},
+    {InfraredProtocolSIRC,         0x01,   0x15, false},
 };
 
 
@@ -284,23 +284,23 @@ const uint32_t test_decoder_sirc_input2[] = {
 1000000, 2400, 600, 1200, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600,
 };
 
-const IrdaMessage test_decoder_sirc_expected2[] = {
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
+const InfraredMessage test_decoder_sirc_expected2[] = {
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
     /* failed - 13 data bits */
 
-    {IrdaProtocolSIRC, 0x1F, 0x7F, false},
+    {InfraredProtocolSIRC, 0x1F, 0x7F, false},
     /* failed - 2 data bits */
-    {IrdaProtocolSIRC, 0x1F, 0x7F, false},
+    {InfraredProtocolSIRC, 0x1F, 0x7F, false},
     /* failed - sudden end */
-    {IrdaProtocolSIRC, 0x1F, 0x7F, false},
+    {InfraredProtocolSIRC, 0x1F, 0x7F, false},
     /* failed */
-    {IrdaProtocolSIRC, 0x0A, 0x55, false},
+    {InfraredProtocolSIRC, 0x0A, 0x55, false},
 
-    {IrdaProtocolSIRC, 0x00, 0x00, false},
+    {InfraredProtocolSIRC, 0x00, 0x00, false},
 
-    {IrdaProtocolSIRC, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC, 0x0D, 0x53, false},
 };
 
 
@@ -334,18 +334,18 @@ const uint32_t test_decoder_sirc_input3[] = {
   10000, 2400, 600, 1200, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 1200,
 };
 
-const IrdaMessage test_decoder_sirc_expected3[] = {
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x0D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x0D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x0D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x0D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x0D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0xFD, 0x13, false},
+const InfraredMessage test_decoder_sirc_expected3[] = {
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x0D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0xFD, 0x13, false},
 };
 
 const uint32_t test_decoder_sirc_input4[] = {
@@ -357,13 +357,13 @@ const uint32_t test_decoder_sirc_input4[] = {
 1000000, 2400, 600, 1200, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 600,
 };
 
-const IrdaMessage test_decoder_sirc_expected4[] = {
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},      //    {IrdaProtocolSIRC20, 0x15, 0x3ED3, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
+const InfraredMessage test_decoder_sirc_expected4[] = {
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},      //    {InfraredProtocolSIRC20, 0x15, 0x3ED3, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
 };
 
 const uint32_t test_decoder_sirc_input5[] = {
@@ -396,48 +396,48 @@ const uint32_t test_decoder_sirc_input5[] = {
 10000, 2400, 600, 1200, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 600,
 };
 
-const IrdaMessage test_decoder_sirc_expected5[] = {
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC20, 0xFB5, 0x53, false},
+const InfraredMessage test_decoder_sirc_expected5[] = {
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC20, 0xFB5, 0x53, false},
 };
 
-const IrdaMessage test_encoder_sirc_input1[] = {
-    {IrdaProtocolSIRC, 0xA, 0x55, false},
+const InfraredMessage test_encoder_sirc_input1[] = {
+    {InfraredProtocolSIRC, 0xA, 0x55, false},
 };
 
 const uint32_t test_encoder_sirc_expected1[] = {
 10000, 2400, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 600,
 };
 
-const IrdaMessage test_encoder_sirc_input2[] = {
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, true},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, true},
+const InfraredMessage test_encoder_sirc_input2[] = {
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, true},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, true},
 };
 
 const uint32_t test_encoder_sirc_expected2[] = {
@@ -446,34 +446,34 @@ const uint32_t test_encoder_sirc_expected2[] = {
     18600, 2400, 600, 1200, 600, 1200, 600, 600, 600, 600, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 600, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 1200, 600, 600,
 };
 
-const IrdaMessage test_sirc[] = {
-    {IrdaProtocolSIRC20, 0x1FFF, 0x7F, false},
-    {IrdaProtocolSIRC20, 0x1FFF, 0x7F, true},
-    {IrdaProtocolSIRC20, 0x1FFF, 0x7F, true},
-    {IrdaProtocolSIRC, 0x00, 0x00, false},
-    {IrdaProtocolSIRC, 0x00, 0x00, true},
-    {IrdaProtocolSIRC, 0x00, 0x00, true},
-
-    {IrdaProtocolSIRC, 0x1A, 0x22, false},
-    {IrdaProtocolSIRC, 0x1A, 0x22, true},
-    {IrdaProtocolSIRC, 0x1A, 0x22, true},
-    {IrdaProtocolSIRC, 0x17, 0x0A, false},
-
-    {IrdaProtocolSIRC15, 0x7D, 0x53, false},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, true},
-    {IrdaProtocolSIRC15, 0x7D, 0x53, true},
-    {IrdaProtocolSIRC15, 0x71, 0x0, false},
-    {IrdaProtocolSIRC15, 0x15, 0x01, false},
-    {IrdaProtocolSIRC15, 0x01, 0x15, false},
-
-    {IrdaProtocolSIRC20, 0xAA, 0x55, false},
-    {IrdaProtocolSIRC20, 0x331, 0x71, false},
-
-    {IrdaProtocolSIRC, 0x00, 0x00, false},
-    {IrdaProtocolSIRC, 0x1F, 0x7F, false},
-    {IrdaProtocolSIRC15, 0x00, 0x00, false},
-    {IrdaProtocolSIRC15, 0xFF, 0x7F, false},
-    {IrdaProtocolSIRC20, 0x00, 0x00, false},
-    {IrdaProtocolSIRC20, 0x1FFF, 0x7F, false},
+const InfraredMessage test_sirc[] = {
+    {InfraredProtocolSIRC20, 0x1FFF, 0x7F, false},
+    {InfraredProtocolSIRC20, 0x1FFF, 0x7F, true},
+    {InfraredProtocolSIRC20, 0x1FFF, 0x7F, true},
+    {InfraredProtocolSIRC, 0x00, 0x00, false},
+    {InfraredProtocolSIRC, 0x00, 0x00, true},
+    {InfraredProtocolSIRC, 0x00, 0x00, true},
+
+    {InfraredProtocolSIRC, 0x1A, 0x22, false},
+    {InfraredProtocolSIRC, 0x1A, 0x22, true},
+    {InfraredProtocolSIRC, 0x1A, 0x22, true},
+    {InfraredProtocolSIRC, 0x17, 0x0A, false},
+
+    {InfraredProtocolSIRC15, 0x7D, 0x53, false},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, true},
+    {InfraredProtocolSIRC15, 0x7D, 0x53, true},
+    {InfraredProtocolSIRC15, 0x71, 0x0, false},
+    {InfraredProtocolSIRC15, 0x15, 0x01, false},
+    {InfraredProtocolSIRC15, 0x01, 0x15, false},
+
+    {InfraredProtocolSIRC20, 0xAA, 0x55, false},
+    {InfraredProtocolSIRC20, 0x331, 0x71, false},
+
+    {InfraredProtocolSIRC, 0x00, 0x00, false},
+    {InfraredProtocolSIRC, 0x1F, 0x7F, false},
+    {InfraredProtocolSIRC15, 0x00, 0x00, false},
+    {InfraredProtocolSIRC15, 0xFF, 0x7F, false},
+    {InfraredProtocolSIRC20, 0x00, 0x00, false},
+    {InfraredProtocolSIRC20, 0x1FFF, 0x7F, false},
 };
 

+ 1 - 1
applications/tests/rpc/rpc_test.c

@@ -651,7 +651,7 @@ MU_TEST(test_storage_list) {
 
     test_rpc_storage_list_run("/int", ++command_id);
     test_rpc_storage_list_run("/ext", ++command_id);
-    test_rpc_storage_list_run("/ext/irda", ++command_id);
+    test_rpc_storage_list_run("/ext/infrared", ++command_id);
     test_rpc_storage_list_run("/ext/ibutton", ++command_id);
     test_rpc_storage_list_run("/ext/lfrfid", ++command_id);
     test_rpc_storage_list_run("error_path", ++command_id);

+ 2 - 2
applications/tests/test_index.c

@@ -11,7 +11,7 @@
 #define TAG "UnitTests"
 
 int run_minunit();
-int run_minunit_test_irda_decoder_encoder();
+int run_minunit_test_infrared_decoder_encoder();
 int run_minunit_test_rpc();
 int run_minunit_test_flipper_format();
 int run_minunit_test_flipper_format_string();
@@ -53,7 +53,7 @@ void unit_tests_cli(Cli* cli, string_t args, void* context) {
         uint32_t cycle_counter = DWT->CYCCNT;
 
         test_result |= run_minunit();
-        test_result |= run_minunit_test_irda_decoder_encoder();
+        test_result |= run_minunit_test_infrared_decoder_encoder();
         test_result |= run_minunit_test_rpc();
         test_result |= run_minunit_test_stream();
         test_result |= run_minunit_test_flipper_format();

Разница между файлами не показана из-за своего большого размера
+ 6 - 27
assets/compiled/assets_icons.c


+ 13 - 13
assets/compiled/assets_icons.h

@@ -59,24 +59,17 @@ extern const Icon I_ArrowDownEmpty_14x15;
 extern const Icon I_ArrowDownFilled_14x15;
 extern const Icon I_ArrowUpEmpty_14x15;
 extern const Icon I_ArrowUpFilled_14x15;
-extern const Icon I_Back3_45x8;
-extern const Icon I_DoorLeft_70x55;
-extern const Icon I_DoorLocked_10x56;
-extern const Icon I_DoorRight_70x55;
-extern const Icon I_PassportBottom_128x17;
-extern const Icon I_PassportLeft_6x47;
-extern const Icon I_WarningDolphin_45x42;
 extern const Icon I_Back_15x10;
 extern const Icon I_DolphinReadingSuccess_59x63;
 extern const Icon I_Down_25x27;
 extern const Icon I_Down_hvr_25x27;
 extern const Icon I_Fill_marker_7x7;
-extern const Icon I_IrdaArrowDown_4x8;
-extern const Icon I_IrdaArrowUp_4x8;
-extern const Icon I_IrdaLearnShort_128x31;
-extern const Icon I_IrdaLearn_128x64;
-extern const Icon I_IrdaSendShort_128x34;
-extern const Icon I_IrdaSend_128x64;
+extern const Icon I_InfraredArrowDown_4x8;
+extern const Icon I_InfraredArrowUp_4x8;
+extern const Icon I_InfraredLearnShort_128x31;
+extern const Icon I_InfraredLearn_128x64;
+extern const Icon I_InfraredSendShort_128x34;
+extern const Icon I_InfraredSend_128x64;
 extern const Icon I_Mute_25x27;
 extern const Icon I_Mute_hvr_25x27;
 extern const Icon I_Power_25x27;
@@ -87,6 +80,13 @@ extern const Icon I_Vol_down_25x27;
 extern const Icon I_Vol_down_hvr_25x27;
 extern const Icon I_Vol_up_25x27;
 extern const Icon I_Vol_up_hvr_25x27;
+extern const Icon I_Back3_45x8;
+extern const Icon I_DoorLeft_70x55;
+extern const Icon I_DoorLocked_10x56;
+extern const Icon I_DoorRight_70x55;
+extern const Icon I_PassportBottom_128x17;
+extern const Icon I_PassportLeft_6x47;
+extern const Icon I_WarningDolphin_45x42;
 extern const Icon I_KeyBackspaceSelected_16x9;
 extern const Icon I_KeyBackspace_16x9;
 extern const Icon I_KeySaveSelected_24x11;

+ 0 - 0
assets/icons/Irda/Back_15x10.png → assets/icons/Infrared/Back_15x10.png


+ 0 - 0
assets/icons/Irda/DolphinReadingSuccess_59x63.png → assets/icons/Infrared/DolphinReadingSuccess_59x63.png


+ 0 - 0
assets/icons/Irda/Down_25x27.png → assets/icons/Infrared/Down_25x27.png


+ 0 - 0
assets/icons/Irda/Down_hvr_25x27.png → assets/icons/Infrared/Down_hvr_25x27.png


+ 0 - 0
assets/icons/Irda/Fill-marker_7x7.png → assets/icons/Infrared/Fill-marker_7x7.png


+ 0 - 0
assets/icons/Irda/IrdaArrowDown_4x8.png → assets/icons/Infrared/InfraredArrowDown_4x8.png


+ 0 - 0
assets/icons/Irda/IrdaArrowUp_4x8.png → assets/icons/Infrared/InfraredArrowUp_4x8.png


+ 0 - 0
assets/icons/Irda/IrdaLearnShort_128x31.png → assets/icons/Infrared/InfraredLearnShort_128x31.png


+ 0 - 0
assets/icons/Irda/IrdaLearn_128x64.png → assets/icons/Infrared/InfraredLearn_128x64.png


+ 0 - 0
assets/icons/Irda/IrdaSendShort_128x34.png → assets/icons/Infrared/InfraredSendShort_128x34.png


+ 0 - 0
assets/icons/Irda/IrdaSend_128x64.png → assets/icons/Infrared/InfraredSend_128x64.png


+ 0 - 0
assets/icons/Irda/Mute_25x27.png → assets/icons/Infrared/Mute_25x27.png


+ 0 - 0
assets/icons/Irda/Mute_hvr_25x27.png → assets/icons/Infrared/Mute_hvr_25x27.png


+ 0 - 0
assets/icons/Irda/Power_25x27.png → assets/icons/Infrared/Power_25x27.png


+ 0 - 0
assets/icons/Irda/Power_hvr_25x27.png → assets/icons/Infrared/Power_hvr_25x27.png


+ 0 - 0
assets/icons/Irda/Up_25x27.png → assets/icons/Infrared/Up_25x27.png


+ 0 - 0
assets/icons/Irda/Up_hvr_25x27.png → assets/icons/Infrared/Up_hvr_25x27.png


+ 0 - 0
assets/icons/Irda/Vol_down_25x27.png → assets/icons/Infrared/Vol_down_25x27.png


+ 0 - 0
assets/icons/Irda/Vol_down_hvr_25x27.png → assets/icons/Infrared/Vol_down_hvr_25x27.png


+ 0 - 0
assets/icons/Irda/Vol_up_25x27.png → assets/icons/Infrared/Vol_up_25x27.png


+ 0 - 0
assets/icons/Irda/Vol_up_hvr_25x27.png → assets/icons/Infrared/Vol_up_hvr_25x27.png


+ 0 - 0
assets/resources/irda/assets/tv.ir → assets/resources/infrared/assets/tv.ir


+ 2 - 2
bootloader/targets/f6/furi_hal/furi_hal_resources.c

@@ -34,8 +34,8 @@ const GpioPin gpio_rfid_pull = {.port = RFID_PULL_GPIO_Port, .pin = RFID_PULL_Pi
 const GpioPin gpio_rfid_carrier_out = {.port = RFID_OUT_GPIO_Port, .pin = RFID_OUT_Pin};
 const GpioPin gpio_rfid_data_in = {.port = RFID_RF_IN_GPIO_Port, .pin = RFID_RF_IN_Pin};
 
-const GpioPin gpio_irda_rx = {.port = IR_RX_GPIO_Port, .pin = IR_RX_Pin};
-const GpioPin gpio_irda_tx = {.port = IR_TX_GPIO_Port, .pin = IR_TX_Pin};
+const GpioPin gpio_infrared_rx = {.port = IR_RX_GPIO_Port, .pin = IR_RX_Pin};
+const GpioPin gpio_infrared_tx = {.port = IR_TX_GPIO_Port, .pin = IR_TX_Pin};
 
 const GpioPin gpio_usart_tx = {.port = USART1_TX_Port, .pin = USART1_TX_Pin};
 const GpioPin gpio_usart_rx = {.port = USART1_RX_Port, .pin = USART1_RX_Pin};

+ 2 - 2
bootloader/targets/f6/furi_hal/furi_hal_resources.h

@@ -59,8 +59,8 @@ extern const GpioPin gpio_rfid_pull;
 extern const GpioPin gpio_rfid_carrier_out;
 extern const GpioPin gpio_rfid_data_in;
 
-extern const GpioPin gpio_irda_rx;
-extern const GpioPin gpio_irda_tx;
+extern const GpioPin gpio_infrared_rx;
+extern const GpioPin gpio_infrared_tx;
 
 extern const GpioPin gpio_usart_tx;
 extern const GpioPin gpio_usart_rx;

+ 2 - 2
bootloader/targets/f7/furi_hal/furi_hal_resources.c

@@ -34,8 +34,8 @@ const GpioPin gpio_rfid_pull = {.port = RFID_PULL_GPIO_Port, .pin = RFID_PULL_Pi
 const GpioPin gpio_rfid_carrier_out = {.port = RFID_OUT_GPIO_Port, .pin = RFID_OUT_Pin};
 const GpioPin gpio_rfid_data_in = {.port = RFID_RF_IN_GPIO_Port, .pin = RFID_RF_IN_Pin};
 
-const GpioPin gpio_irda_rx = {.port = IR_RX_GPIO_Port, .pin = IR_RX_Pin};
-const GpioPin gpio_irda_tx = {.port = IR_TX_GPIO_Port, .pin = IR_TX_Pin};
+const GpioPin gpio_infrared_rx = {.port = IR_RX_GPIO_Port, .pin = IR_RX_Pin};
+const GpioPin gpio_infrared_tx = {.port = IR_TX_GPIO_Port, .pin = IR_TX_Pin};
 
 const GpioPin gpio_usart_tx = {.port = USART1_TX_Port, .pin = USART1_TX_Pin};
 const GpioPin gpio_usart_rx = {.port = USART1_RX_Port, .pin = USART1_RX_Pin};

+ 2 - 2
bootloader/targets/f7/furi_hal/furi_hal_resources.h

@@ -59,8 +59,8 @@ extern const GpioPin gpio_rfid_pull;
 extern const GpioPin gpio_rfid_carrier_out;
 extern const GpioPin gpio_rfid_data_in;
 
-extern const GpioPin gpio_irda_rx;
-extern const GpioPin gpio_irda_tx;
+extern const GpioPin gpio_infrared_rx;
+extern const GpioPin gpio_infrared_tx;
 
 extern const GpioPin gpio_usart_tx;
 extern const GpioPin gpio_usart_rx;

Некоторые файлы не были показаны из-за большого количества измененных файлов