Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Manager Class Reference

#include <Loom_Manager.h>

Public Member Functions

 Manager (const char *devName, uint32_t instanceNum)
 
void registerModule (Module *module)
 
DynamicJsonDocument & getDocument ()
 
template<typename T >
void addData (const char *moduleName, const char *dataName, T data)
 
void beginSerial (bool waitForSerial=true)
 
void initialize ()
 
void measure ()
 
void package ()
 
void power_up ()
 
void power_down ()
 
void display_data ()
 
void pause (const uint32_t ms) const
 
void getJSONString (char array[2000])
 
const char * get_device_name ()
 
void set_device_name (const char *name)
 
int get_instance_num ()
 
void set_instance_num (int num)
 
const char * get_serial_num ()
 
void useHypnos ()
 
void setEnableState (bool state)
 
JsonObject get_data_object (const char *moduleName)
 
int get_packet_number ()
 

Detailed Description

Unifies all the various sensors to allow for collection in unison This class manages the JSON document store of all sensor information

Author
Will Richards

Constructor & Destructor Documentation

◆ Manager()

Manager::Manager ( const char *  devName,
uint32_t  instanceNum 
)

Constructs a new Manager

Parameters
devNameDevice name to provided for logging purposes
instanceNumInstance number for logging purposes

Member Function Documentation

◆ addData()

template<typename T >
void Manager::addData ( const char *  moduleName,
const char *  dataName,
data 
)
inline

Add a random piece of data to the overall JSON package in the given module name with a name for the data

Parameters
moduleNameModule name to store the data under
dataNameKey name of the data we are inserting
dataThe data itself

◆ beginSerial()

void Manager::beginSerial ( bool  waitForSerial = true)

Start the Serial interface with some parameters, should we wait up to 20 seconds for the serial interface to open before continuing

Parameters
waitForSerialWhether or not we should wait 20 seconds for the user to open the serial monitor before continuing

◆ display_data()

void Manager::display_data ( )

Prints out the current JSON Document to the Serial bus

◆ get_data_object()

JsonObject Manager::get_data_object ( const char *  moduleName)

Get the JSON object to store the module data in

Parameters
moduleNameName of the module we are trying to store data for

◆ get_device_name()

const char * Manager::get_device_name ( )
inline

Gets the current device name set by the user

Returns
current device name

◆ get_instance_num()

int Manager::get_instance_num ( )
inline

Gets the current device instance number

Returns
current device instance number

◆ get_packet_number()

int Manager::get_packet_number ( )
inline

Get the current packet number that will be packaged by the manager

◆ get_serial_num()

const char * Manager::get_serial_num ( )
inline

Get the unique serial number of the Feather m0

Returns
Unique serial number

◆ getDocument()

DynamicJsonDocument & Manager::getDocument ( )

Get a reference to the JSON document that sensor data is stored in

Returns
reference to the main JSON document

◆ getJSONString()

void Manager::getJSONString ( char  array[2000])

Get a serialized version of the JSON packet as a string

Parameters
arrayArray to store the string in

◆ initialize()

void Manager::initialize ( )

Calls the initialization function on all added modules

◆ measure()

void Manager::measure ( )

Calls the measure function to pull data from the sensors on all added modules

◆ package()

void Manager::package ( )

Calls the package function to store all data from those sensors into a nice JSON package

◆ pause()

void Manager::pause ( const uint32_t  ms) const

Pause execution for a specified length of time

Parameters
msTime to wait for in milliseconds

◆ power_down()

void Manager::power_down ( )

Calls the power_down function on each module to safely enter sleep

◆ power_up()

void Manager::power_up ( )

Calls the power_up function on each module to re-init after sleep

◆ registerModule()

void Manager::registerModule ( Module module)

Registers a new sub-module to be controlled by the manager (Used on sensors so measure and package calls can all be called at once)

Parameters
modulePointer to a class the inherits from Module that we want to add

◆ set_device_name()

void Manager::set_device_name ( const char *  name)
inline

Set the device name at runtime

Parameters
nameNew name of the device

◆ set_instance_num()

void Manager::set_instance_num ( int  num)
inline

Set the instance number at runtime

Parameters
numNew instance number of the device

◆ setEnableState()

void Manager::setEnableState ( bool  state)
inline

Set the current state of the hypnos enable

Parameters
stateNew state of the hypnos board

◆ useHypnos()

void Manager::useHypnos ( )
inline

Called by the Hypnos on construction to tell the manager it is in use


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