2018-05-07 21:57:54 -04:00
|
|
|
//
|
2018-05-10 21:54:10 -04:00
|
|
|
// ActivityObserver.h
|
2018-05-07 21:57:54 -04:00
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 07/05/2018.
|
2018-05-13 15:19:52 -04:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-05-07 21:57:54 -04:00
|
|
|
//
|
|
|
|
|
2018-05-10 21:54:10 -04:00
|
|
|
#ifndef ActivityObserver_h
|
|
|
|
#define ActivityObserver_h
|
2018-05-07 21:57:54 -04:00
|
|
|
|
2023-05-25 23:06:13 +03:00
|
|
|
#include <cstdint>
|
2018-05-07 21:57:54 -04:00
|
|
|
#include <string>
|
|
|
|
|
2018-05-10 21:54:10 -04:00
|
|
|
namespace Activity {
|
|
|
|
|
2018-05-07 21:57:54 -04:00
|
|
|
/*!
|
|
|
|
Provides a purely virtual base class for anybody that wants to receive notifications of
|
2018-05-13 15:34:31 -04:00
|
|
|
'activity': any feedback from an emulated system which a user could perceive other than
|
2018-05-07 21:57:54 -04:00
|
|
|
through the machine's native audio and video outputs.
|
|
|
|
|
|
|
|
So: status LEDs, drive activity, etc. A receiver may choose to make appropriate noises
|
|
|
|
and/or to show or unshow status indicators.
|
|
|
|
*/
|
2018-05-10 21:54:10 -04:00
|
|
|
class Observer {
|
2018-05-07 21:57:54 -04:00
|
|
|
public:
|
2023-12-27 11:14:08 -05:00
|
|
|
virtual ~Observer() {}
|
|
|
|
|
2021-07-15 22:00:10 -04:00
|
|
|
/// Provides hints as to the sort of information presented on an LED.
|
2021-07-15 21:26:02 -04:00
|
|
|
enum LEDPresentation: uint8_t {
|
2021-07-15 22:00:10 -04:00
|
|
|
/// This LED informs the user of some sort of persistent state, e.g. scroll lock.
|
|
|
|
/// If this flag is absent then the LED describes an ephemeral state, such as media access.
|
2021-07-15 21:26:02 -04:00
|
|
|
Persistent = (1 << 0),
|
|
|
|
};
|
|
|
|
|
2018-05-07 21:57:54 -04:00
|
|
|
/// Announces to the receiver that there is an LED of name @c name.
|
2021-07-15 21:26:02 -04:00
|
|
|
virtual void register_led([[maybe_unused]] const std::string &name, [[maybe_unused]] uint8_t presentation = 0) {}
|
2018-05-07 21:57:54 -04:00
|
|
|
|
|
|
|
/// Announces to the receiver that there is a drive of name @c name.
|
2021-07-15 19:50:43 -04:00
|
|
|
///
|
|
|
|
/// If a drive has the same name as an LED, that LED goes with this drive.
|
2020-05-30 00:37:06 -04:00
|
|
|
virtual void register_drive([[maybe_unused]] const std::string &name) {}
|
2018-05-07 21:57:54 -04:00
|
|
|
|
|
|
|
/// Informs the receiver of the new state of the LED with name @c name.
|
2020-05-30 00:37:06 -04:00
|
|
|
virtual void set_led_status([[maybe_unused]] const std::string &name, [[maybe_unused]] bool lit) {}
|
2018-05-07 21:57:54 -04:00
|
|
|
|
|
|
|
enum class DriveEvent {
|
2018-05-11 21:44:08 -04:00
|
|
|
StepNormal,
|
2018-05-07 21:57:54 -04:00
|
|
|
StepBelowZero,
|
|
|
|
StepBeyondMaximum
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Informs the receiver that the named event just occurred for the drive with name @c name.
|
2020-05-30 00:37:06 -04:00
|
|
|
virtual void announce_drive_event([[maybe_unused]] const std::string &name, [[maybe_unused]] DriveEvent event) {}
|
2018-05-07 21:57:54 -04:00
|
|
|
|
|
|
|
/// Informs the receiver of the motor-on status of the drive with name @c name.
|
2020-05-30 00:37:06 -04:00
|
|
|
virtual void set_drive_motor_status([[maybe_unused]] const std::string &name, [[maybe_unused]] bool is_on) {}
|
2018-05-07 21:57:54 -04:00
|
|
|
};
|
|
|
|
|
2018-05-10 21:54:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* ActivityObserver_h */
|