Loom
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Attributes | List of all members
Loom_Relay Class Reference

Relay actuator module. More...

#include <Relay.h>

Inheritance diagram for Loom_Relay:
Inheritance graph
[legend]

Public Member Functions

CONSTRUCTORS / DESTRUCTOR
 Loom_Relay (LoomManager *manager, const byte pin=10)
 Constructor. More...
 
 Loom_Relay (LoomManager *manager, JsonArrayConst p)
 Constructor that takes Json Array, extracts args and delegates to regular constructor. More...
 
 ~Loom_Relay ()=default
 Destructor. More...
 
OPERATION
void package (JsonObject json) override
 Not all actuators need a package method, implement with empty body. More...
 
bool dispatch (JsonObject json) override
 Route command to driver. More...
 
void add_config (JsonObject json) override
 Add configuration information to JsonObject. More...
 
void set (const bool state)
 Set relay state. More...
 
PRINT INFORMATION
void print_state () const override
 Display current state of the module. More...
 
- Public Member Functions inherited from LoomActuator
 LoomActuator (LoomManager *manager, const char *module_name, const LoomModule::Type module_type)
 Constructor. More...
 
virtual ~LoomActuator ()=default
 Destructor. More...
 
- Public Member Functions inherited from LoomModule
 LoomModule (LoomManager *manager, const char *module_name="Unknown", const Type module_type=Type::Unknown)
 Constructor. More...
 
virtual ~LoomModule ()=default
 Destructor. More...
 
virtual void second_stage_ctor ()
 Second stage construction. More...
 
virtual void power_down ()
 Turn off any hardware. More...
 
virtual void power_up ()
 Turn on any hardware. More...
 
Type get_module_type () const
 Get module type. More...
 
LoomManagerget_device_manager () const
 Get the device manager class if linked. More...
 
void get_module_name (char *buf) const
 Copy module name into buffer. More...
 
const char * get_module_name () const
 Get module name. More...
 
Verbosity get_print_verbosity () const
 Get print verbosity. More...
 
Verbosity get_package_verbosity () const
 Get package verbosity. More...
 
bool get_active () const
 Get whether or not the module should be treated as active. More...
 
Category category () const
 Get the category of the module. More...
 
virtual void link_device_manager (LoomManager *LM)
 Add pointer back to device manager. More...
 
void set_print_verbosity (const Verbosity v)
 Set print verbosity Controlls level of detail included in debug prints. More...
 
void set_package_verbosity (const Verbosity v)
 Set package verbosity. More...
 
void set_active (const bool enable)
 Set whether or not the module should be treated as active. More...
 
virtual void print_config () const
 Display the configuration settings of the module. More...
 

Protected Attributes

byte pin
 The digital pin the relay is connect to. More...
 
bool on
 Whether the relay is on or off. More...
 
- Protected Attributes inherited from LoomModule
const Type module_type
 Module type. More...
 
LoomManagerdevice_manager
 Pointer to manager. More...
 
const String module_name_base
 The name of the module (Should have a DEFAULT but can be overriden if provided to constructor) More...
 
const char * module_name
 
bool active
 Whether or not the module should be treated as active. More...
 
Verbosity print_verbosity
 Print verbosity. More...
 
Verbosity package_verbosity
 Package verbosity. More...
 

Additional Inherited Members

- Public Types inherited from LoomModule
enum  Type {
  Type::Unknown = 0, Type::Other =1000, Type::Interrupt_Manager, Type::Sleep_Manager,
  Type::Multiplexer, Type::NTP, Type::TempSync, Type::WarmUp_Manager,
  Type::Sensor =2000, Type::Analog, Type::Digital, Type::I2C =2100,
  Type::ADS1115, Type::AS7262, Type::AS7263, Type::AS7265X,
  Type::FXAS21002, Type::FXOS8700, Type::LIS3DH, Type::MB1232,
  Type::MMA8451, Type::MPU6050, Type::MS5803, Type::SHT31D,
  Type::TMP007, Type::TSL2561, Type::TSL2591, Type::ZXGesture,
  Type::STEMMA, Type::SDI12 =2200, Type::Decagon5TM, Type::DecagonGS3,
  Type::SPI =2300, Type::MAX31855, Type::MAX31856, Type::L_SERIAL =2400,
  Type::K30, Type::L_RTC =3000, Type::DS3231, Type::PCF8523,
  Type::Actuator =4000, Type::Neopixel, Type::Relay, Type::Servo,
  Type::Stepper, Type::LogPlat =5000, Type::OLED, Type::SDCARD,
  Type::BATCHSD, Type::CommPlat =6000, Type::LoRa, Type::nRF,
  Type::Bluetooth, Type::InternetPlat =7000, Type::Ethernet, Type::WiFi,
  Type::LTE, Type::PublishPlat =8000, Type::GoogleSheets, Type::MaxPub,
  Type::SpoolPub, Type::SubscribePlats =9000, Type::MaxSub
}
 Enum to check against to when finding individual component managed by a LoomManager. More...
 
enum  Category {
  Category::Unknown =0, Category::Other =1, Category::Sensor =2, Category::L_RTC =3,
  Category::Actuator =4, Category::LogPlat =5, Category::CommPlat =6, Category::InternetPlat =7,
  Category::PublishPlat =8, Category::SubscribePlat =9
}
 Enum to classify modules. More...
 
- Static Public Member Functions inherited from LoomModule
static const char * enum_verbosity_string (const Verbosity v)
 Get string of name associated with verbosity enum. More...
 
static const char * enum_category_string (const Category c)
 Get string of the category associated with a Category. More...
 
- Protected Member Functions inherited from LoomModule
void print_module_label () const
 Print the module name as a label. More...
 

Detailed Description

Relay actuator module.

Resources

Constructor & Destructor Documentation

Loom_Relay::Loom_Relay ( LoomManager manager,
const byte  pin = 10 
)

Constructor.

Parameters
[in]pinSet(Int) | <10> | {5, 6, 9, 10, 11, 12, 13, 14("A0"), 15("A1"), 16("A2"), 17("A3"), 18("A4"), 19("A5")} | Which pin should be used to control the relay
Loom_Relay::Loom_Relay ( LoomManager manager,
JsonArrayConst  p 
)

Constructor that takes Json Array, extracts args and delegates to regular constructor.

Parameters
[in]pThe array of constuctor args to expand
Loom_Relay::~Loom_Relay ( )
default

Destructor.

Member Function Documentation

void Loom_Relay::add_config ( JsonObject  json)
overridevirtual

Add configuration information to JsonObject.

LoomManager iterates over modules to build complete configuration

Parameters
[in]jsonJson configuration object to add to

Reimplemented from LoomModule.

bool Loom_Relay::dispatch ( JsonObject  json)
overridevirtual

Route command to driver.

Reimplemented from LoomModule.

void Loom_Relay::package ( JsonObject  json)
overridevirtual

Not all actuators need a package method, implement with empty body.

Reimplemented from LoomActuator.

void Loom_Relay::print_state ( ) const
overridevirtual

Display current state of the module.

Reimplemented from LoomModule.

void Loom_Relay::set ( const bool  state)

Set relay state.

Parameters
[in]stateThe state to set relay to (True=HIGH, False=LOW)

Member Data Documentation

bool Loom_Relay::on
protected

Whether the relay is on or off.

byte Loom_Relay::pin
protected

The digital pin the relay is connect to.


The documentation for this class was generated from the following files: