-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Strosel/notification
feat: Wrapper over notification API
- Loading branch information
Showing
11 changed files
with
698 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use super::{messages, NotificationSequence}; | ||
use crate::notification_sequence; | ||
|
||
pub const RESET_DISPLAY: NotificationSequence = | ||
notification_sequence![messages::DISPLAY_BACKLIGHT_OFF]; | ||
|
||
pub const DISPLAY_BACKLIGHT_ON: NotificationSequence = | ||
notification_sequence![messages::DISPLAY_BACKLIGHT_ON]; | ||
pub const DISPLAY_BACKLIGHT_OFF: NotificationSequence = | ||
notification_sequence![messages::DISPLAY_BACKLIGHT_OFF]; | ||
|
||
pub const DISPLAY_BACKLIGHT_ENFORCE_ON: NotificationSequence = | ||
notification_sequence![messages::DISPLAY_BACKLIGHT_ENFORCE_ON]; | ||
pub const DISPLAY_BACKLIGHT_ENFORCE_AUTO: NotificationSequence = | ||
notification_sequence![messages::DISPLAY_BACKLIGHT_ENFORCE_AUTO]; | ||
|
||
pub const DISPLAY_BACKLIGHT_OFF_DELAY_1000: NotificationSequence = | ||
notification_sequence![messages::DELAY_1000, messages::DISPLAY_BACKLIGHT_OFF]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use super::{messages, sounds, NotificationSequence}; | ||
use crate::notification_sequence; | ||
|
||
pub const CHARGING: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::GREEN_0]; | ||
pub const CHARGED: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::RED_0]; | ||
pub const NOT_CHARGING: NotificationSequence = | ||
notification_sequence![messages::RED_0, messages::GREEN_0]; | ||
|
||
pub const SUCCESS: NotificationSequence = notification_sequence![ | ||
messages::DISPLAY_BACKLIGHT_ON, | ||
messages::GREEN_255, | ||
messages::VIBRO_ON, | ||
sounds::C5, | ||
messages::DELAY_50, | ||
messages::VIBRO_OFF, | ||
sounds::E5, | ||
messages::DELAY_50, | ||
sounds::G5, | ||
messages::DELAY_50, | ||
sounds::C6, | ||
messages::DELAY_50, | ||
messages::SOUND_OFF, | ||
]; | ||
|
||
pub const ERROR: NotificationSequence = notification_sequence![ | ||
messages::DISPLAY_BACKLIGHT_ON, | ||
messages::RED_255, | ||
messages::VIBRO_ON, | ||
sounds::C5, | ||
messages::DELAY_100, | ||
messages::VIBRO_OFF, | ||
messages::SOUND_OFF, | ||
messages::DELAY_100, | ||
messages::VIBRO_ON, | ||
sounds::C5, | ||
messages::DELAY_100, | ||
messages::VIBRO_OFF, | ||
messages::SOUND_OFF, | ||
]; | ||
|
||
pub const AUDIO_VISUAL_ALERT: NotificationSequence = notification_sequence![ | ||
messages::FORCE_SPEAKER_VOLUME_SETTING_1, | ||
messages::FORCE_VIBRO_SETTING_ON, | ||
messages::FORCE_DISPLAY_BRIGHTNESS_SETTING_1, | ||
messages::VIBRO_ON, | ||
messages::DISPLAY_BACKLIGHT_ON, | ||
sounds::C7, | ||
messages::DELAY_250, | ||
messages::DISPLAY_BACKLIGHT_OFF, | ||
sounds::C4, | ||
messages::DELAY_250, | ||
messages::DISPLAY_BACKLIGHT_ON, | ||
sounds::C7, | ||
messages::DELAY_250, | ||
messages::DISPLAY_BACKLIGHT_OFF, | ||
sounds::C4, | ||
messages::DELAY_250, | ||
messages::DISPLAY_BACKLIGHT_ON, | ||
sounds::C7, | ||
messages::DELAY_250, | ||
messages::DISPLAY_BACKLIGHT_OFF, | ||
sounds::C4, | ||
messages::DELAY_250, | ||
messages::SOUND_OFF, | ||
messages::VIBRO_OFF, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
use super::{messages, NotificationSequence}; | ||
use crate::notification_sequence; | ||
|
||
pub const RESET_RED: NotificationSequence = notification_sequence![messages::RED_0]; | ||
pub const RESET_GREEN: NotificationSequence = notification_sequence![messages::GREEN_0]; | ||
pub const RESET_BLUE: NotificationSequence = notification_sequence![messages::BLUE_0]; | ||
pub const RESET_RGB: NotificationSequence = | ||
notification_sequence![messages::RED_0, messages::GREEN_0, messages::BLUE_0]; | ||
|
||
pub const ONLY_RED: NotificationSequence = notification_sequence![ | ||
messages::RED_255, | ||
messages::GREEN_0, | ||
messages::BLUE_0, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const ONLY_GREEN: NotificationSequence = notification_sequence![ | ||
messages::RED_0, | ||
messages::GREEN_255, | ||
messages::BLUE_0, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const ONLY_BLUE: NotificationSequence = notification_sequence![ | ||
messages::RED_0, | ||
messages::GREEN_0, | ||
messages::BLUE_255, | ||
messages::DO_NOT_RESET, | ||
]; | ||
|
||
pub const SET_RED: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::DO_NOT_RESET]; | ||
pub const SET_GREEN: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::DO_NOT_RESET]; | ||
pub const SET_BLUE: NotificationSequence = | ||
notification_sequence![messages::BLUE_255, messages::DO_NOT_RESET]; | ||
|
||
pub const SOLID_YELLOW: NotificationSequence = notification_sequence![ | ||
messages::RED_255, | ||
messages::GREEN_255, | ||
messages::BLUE_0, | ||
messages::DO_NOT_RESET, | ||
]; | ||
|
||
pub const BLINK_RED_10: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::DELAY_10]; | ||
pub const BLINK_GREEN_10: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::DELAY_10]; | ||
pub const BLINK_BLUE_10: NotificationSequence = | ||
notification_sequence![messages::BLUE_255, messages::DELAY_10]; | ||
pub const BLINK_YELLOW_10: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::GREEN_255, messages::DELAY_10,]; | ||
pub const BLINK_CYAN_10: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::BLUE_255, messages::DELAY_10,]; | ||
pub const BLINK_MAGNENTA_10: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::BLUE_255, messages::DELAY_10]; | ||
|
||
pub const BLINK_RED_100: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::DELAY_100]; | ||
pub const BLINK_GREEN_100: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::DELAY_100]; | ||
pub const BLINK_BLUE_100: NotificationSequence = | ||
notification_sequence![messages::BLUE_255, messages::DELAY_100]; | ||
pub const BLINK_YELLOW_100: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::GREEN_255, messages::DELAY_100,]; | ||
pub const BLINK_CYAN_100: NotificationSequence = | ||
notification_sequence![messages::GREEN_255, messages::BLUE_255, messages::DELAY_100,]; | ||
pub const BLINK_MAGNENTA_100: NotificationSequence = | ||
notification_sequence![messages::RED_255, messages::BLUE_255, messages::DELAY_100,]; | ||
|
||
pub const BLINK_START_RED: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_RED, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_START_GREEN: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_GREEN, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_START_BLUE: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_BLUE, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_START_YELLOW: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_YELLOW, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_START_CYAN: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_CYAN, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_START_MAGENTA: NotificationSequence = notification_sequence![ | ||
messages::BLINK_START_10, | ||
messages::BLINK_SET_COLOR_MAGENTA, | ||
messages::DO_NOT_RESET, | ||
]; | ||
pub const BLINK_STOP: NotificationSequence = notification_sequence![messages::BLINK_STOP]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use super::{Light, NotificationMessage}; | ||
|
||
pub const DISPLAY_BACKLIGHT_ON: NotificationMessage = NotificationMessage::display_backlight(0xFF); | ||
pub const DISPLAY_BACKLIGHT_OFF: NotificationMessage = NotificationMessage::display_backlight(0x00); | ||
pub const DISPLAY_BACKLIGHT_ENFORCE_ON: NotificationMessage = | ||
NotificationMessage::display_backlight_enforce_on(); | ||
pub const DISPLAY_BACKLIGHT_ENFORCE_AUTO: NotificationMessage = | ||
NotificationMessage::display_backlight_enforce_auto(); | ||
|
||
pub const RED_255: NotificationMessage = NotificationMessage::led_red(255); | ||
pub const GREEN_255: NotificationMessage = NotificationMessage::led_green(255); | ||
pub const BLUE_255: NotificationMessage = NotificationMessage::led_blue(255); | ||
pub const RED_0: NotificationMessage = NotificationMessage::led_red(0); | ||
pub const GREEN_0: NotificationMessage = NotificationMessage::led_green(0); | ||
pub const BLUE_0: NotificationMessage = NotificationMessage::led_blue(0); | ||
|
||
pub const BLINK_START_10: NotificationMessage = | ||
NotificationMessage::led_blink_start(10, 100, Light::OFF); | ||
pub const BLINK_START_100: NotificationMessage = | ||
NotificationMessage::led_blink_start(100, 1000, Light::OFF); | ||
pub const BLINK_STOP: NotificationMessage = NotificationMessage::led_blink_stop(); | ||
|
||
pub const BLINK_SET_COLOR_RED: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::RED); | ||
pub const BLINK_SET_COLOR_GREEN: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::GREEN); | ||
pub const BLINK_SET_COLOR_BLUE: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::BLUE); | ||
pub const BLINK_SET_COLOR_CYAN: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::CYAN); | ||
pub const BLINK_SET_COLOR_MAGENTA: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::MAGENTA); | ||
pub const BLINK_SET_COLOR_YELLOW: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::YELLOW); | ||
pub const BLINK_SET_COLOR_WHITE: NotificationMessage = | ||
NotificationMessage::led_blink_color(Light::WHITE); | ||
|
||
pub const DELAY_1: NotificationMessage = NotificationMessage::delay(1); | ||
pub const DELAY_10: NotificationMessage = NotificationMessage::delay(10); | ||
pub const DELAY_25: NotificationMessage = NotificationMessage::delay(25); | ||
pub const DELAY_50: NotificationMessage = NotificationMessage::delay(50); | ||
pub const DELAY_100: NotificationMessage = NotificationMessage::delay(100); | ||
pub const DELAY_250: NotificationMessage = NotificationMessage::delay(250); | ||
pub const DELAY_500: NotificationMessage = NotificationMessage::delay(500); | ||
pub const DELAY_1000: NotificationMessage = NotificationMessage::delay(1000); | ||
|
||
pub const SOUND_OFF: NotificationMessage = NotificationMessage::sound_off(); | ||
|
||
pub const VIBRO_ON: NotificationMessage = NotificationMessage::vibro(true); | ||
pub const VIBRO_OFF: NotificationMessage = NotificationMessage::vibro(false); | ||
|
||
pub const DO_NOT_RESET: NotificationMessage = NotificationMessage::do_not_reset(); | ||
|
||
pub const FORCE_SPEAKER_VOLUME_SETTING_1: NotificationMessage = | ||
NotificationMessage::force_speaker_volume_setting(1.0); | ||
pub const FORCE_VIBRO_SETTING_ON: NotificationMessage = | ||
NotificationMessage::force_vibro_setting(true); | ||
pub const FORCE_VIBRO_SETTING_OFF: NotificationMessage = | ||
NotificationMessage::force_vibro_setting(false); | ||
pub const FORCE_DISPLAY_BRIGHTNESS_SETTING_1: NotificationMessage = | ||
NotificationMessage::force_display_bightness_setting(1.0); |
Oops, something went wrong.