meshtastic / protobufs

Protobuf definitions for the Meshtastic project
https://meshtastic.org
GNU General Public License v3.0
77 stars 115 forks source link

Flexible configuration for the external notification module #398

Open haxney opened 10 months ago

haxney commented 10 months ago

With multiple different triggers and actions, the number of fields in the ExternalNotificationConfig was starting to grow large, and the interactions between the different fields was complicated.

Example

For example, if someone wanted the configuration

start the buzzer and vibra when receiving a direct message containing a bell character

then the ExternalNotificationConfig message would need a field:

bool alert_bell_direct_message_buzzer = 16;
bool alert_bell_direct_message_vibra = 17;

And so on for each combination of conditions and actions.

This commit

This commit introduces the ExternalNotificationCase message, which separates the condition (when to trigger an external notification) from the action (which pin to activate). The previous example would look like this:

case {
  condition {
    dest_direct: {}
    content_bell: {}
  }
  actions {
    output_buzzer: {}
  }
  actions {
    output_vibra: {}
  }
}

Adding new conditions (such as a message text containing a string prefix or being sent by a particular node) and actions (such as a fourth output pin) does not result in a combinatorial explosion of fields and keeps the implementation simpler.

CLAassistant commented 10 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.