[FL-1237] Notifications app (#476)

* Notification app: init
* Notification app: separate message sequences
* Notification app: rename notifications to notification
* Notification app: rework api
* Notification app: new sequences for charger
* Power app: add state for better led handling
* Power app: NotificationSequence type, notification led process
* Blink app: use notifications
* Notification app: sound and vibro notifications
* Notification app: note messages
* Notification app: more messages
* Notification app: update note message generator
* Blink app: fix state counter
* Notification app: fix delay event
* App sd-filesystem: notifications
* App notifications: headers c++ compatibility
* App notifications: Cmaj success chord sequence
* App iButton: use notifications
* App notification: display backlight notifications
* App notification: add "display on" message to success and error sequences
* App accessor: use notifications
* App ibutton: guard onewire key read
* Lib-RFAL: remove api_hal_light usage
* App notification: add blocking mode, rework display api
* Cli led command: use internal notification instead of direc access to leds.
* App unit test: use notifications
* App lfrfid: use notifications
* Apps: close notification record
* App subghz: rough use of notifications
* App notificaton: ignore reset flag
* App strobe: removed
* Lib irda decoder: fix nec decoding
* App irda: fix assert, use notifications
* Apps: use notifications
* Fix IRDA tests
* Cli: better var naming
* App notification: readable sources

Co-authored-by: Albert Kharisov <albert@flipperdevices.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
SG
2021-05-24 23:44:14 +10:00
committed by GitHub
parent eac8626c8c
commit 2daf65b62b
40 changed files with 1993 additions and 365 deletions

View File

@@ -4,6 +4,7 @@
#include <rtc.h>
#include <task-control-block.h>
#include <time.h>
#include <notification/notification-messages.h>
void cli_command_help(Cli* cli, string_t args, void* context) {
(void)args;
@@ -106,9 +107,13 @@ void cli_command_hw_info(Cli* cli, string_t args, void* context) {
void cli_command_vibro(Cli* cli, string_t args, void* context) {
if(!string_cmp(args, "0")) {
api_hal_vibro_on(false);
NotificationApp* notification = furi_record_open("notification");
notification_message_block(notification, &sequence_reset_vibro);
furi_record_close("notification");
} else if(!string_cmp(args, "1")) {
api_hal_vibro_on(true);
NotificationApp* notification = furi_record_open("notification");
notification_message_block(notification, &sequence_set_vibro_on);
furi_record_close("notification");
} else {
printf("Wrong input");
}
@@ -116,7 +121,7 @@ void cli_command_vibro(Cli* cli, string_t args, void* context) {
void cli_command_led(Cli* cli, string_t args, void* context) {
// Get first word as light name
Light light;
NotificationMessage notification_led_message;
string_t light_name;
string_init(light_name);
size_t ws = string_search_char(args, ' ');
@@ -131,13 +136,13 @@ void cli_command_led(Cli* cli, string_t args, void* context) {
}
// Check light name
if(!string_cmp(light_name, "r")) {
light = LightRed;
notification_led_message.type = NotificationMessageTypeLedRed;
} else if(!string_cmp(light_name, "g")) {
light = LightGreen;
notification_led_message.type = NotificationMessageTypeLedGreen;
} else if(!string_cmp(light_name, "b")) {
light = LightBlue;
notification_led_message.type = NotificationMessageTypeLedBlue;
} else if(!string_cmp(light_name, "bl")) {
light = LightBacklight;
notification_led_message.type = NotificationMessageTypeLedDisplay;
} else {
printf("Wrong argument");
string_clear(light_name);
@@ -151,7 +156,20 @@ void cli_command_led(Cli* cli, string_t args, void* context) {
printf("Wrong argument");
return;
}
api_hal_light_set(light, value);
// Set led value
notification_led_message.data.led.value = value;
// Form notification sequence
const NotificationSequence notification_sequence = {
&notification_led_message,
NULL,
};
// Send notification
NotificationApp* notification = furi_record_open("notification");
notification_internal_message_block(notification, &notification_sequence);
furi_record_close("notification");
}
void cli_command_gpio_set(Cli* cli, string_t args, void* context) {