#ifndef SHUTTER_CONTROLLER_H
#define SHUTTER_CONTROLLER_H
///
/// Interface for camera shutter control operations.
/// Defines the contract for controlling camera focus and shutter functionality.
///
class IShutterController
{
public:
virtual ~IShutterController() = default;
///
/// Performs a half press of the shutter to initiate focus.
/// This is equivalent to pressing the shutter button halfway down.
///
virtual void halfPress() = 0;
///
/// Performs a full press of the shutter to take a photo.
/// Automatically calls halfPress() if not already pressed.
///
virtual void fullPress() = 0;
///
/// Releases the shutter and returns to neutral position.
/// Resets focus state and shutter pin to LOW.
///
virtual void unPress() = 0;
///
/// Presses the shutter fully, waits for specified delay, then releases.
///
/// Delay in milliseconds between full press and release
virtual void pressFullWithDelay(int ms) = 0;
///
/// Takes multiple photos in sequence with configurable timing.
///
/// Duration of each full press in milliseconds
/// Number of photos to take
/// Delay between consecutive shots in milliseconds
virtual void multipleShoot(int ms, int count, int delayMs) = 0;
};
///
/// Implementation of camera shutter control for Minolta remote.
/// Controls focus and shutter via GPIO pins to simulate button presses.
///
class ShutterController : public IShutterController
{
private:
/// GPIO pin number for focus control
uint8_t focusPin;
/// GPIO pin number for shutter control
uint8_t shutterPin;
/// Flag indicating whether focus is currently pressed
bool isFocusPressed;
public:
///
/// Constructs a ShutterController instance.
///
/// GPIO pin for focus control (e.g., D1/GPIO5)
/// GPIO pin for shutter control (e.g., D2/GPIO4)
ShutterController(uint8_t focusPin, uint8_t shutterPin);
///
/// Performs a half press of the shutter to initiate focus.
///
void halfPress() override;
///
/// Performs a full press of the shutter to take a photo.
///
void fullPress() override;
///
/// Releases the shutter and returns to neutral position.
///
void unPress() override;
///
/// Presses the shutter fully, waits for specified delay, then releases.
///
/// Delay in milliseconds between full press and release
void pressFullWithDelay(int ms) override;
///
/// Takes multiple photos in sequence with configurable timing.
///
/// Duration of each full press in milliseconds
/// Number of photos to take
/// Delay between consecutive shots in milliseconds
void multipleShoot(int ms, int count, int delayMs) override;
///
/// Gets the current focus press state.
///
/// True if focus is currently pressed, false otherwise
bool getFocusPressedState() const;
};
#endif // SHUTTER_CONTROLLER_H