|
Voffcon Esp32 device server
|
This class stores GPin objects which connect the server to device hardware pins para/> More...
Public Member Functions | |
| int | addPin (const char *strPinName, PINTYPE pinType, int pinNumber, int pinValue) |
| Adds a pin More... | |
| boolean | setValue (int pinNumber, int newValue) |
| Sets the value of a pin with the given number. More... | |
| boolean | exists (int pinNumber) |
| Checks if a pin with a given number exits. More... | |
| GPin * | get (int pinNumber) |
| Gets a pointer to a GPin More... | |
| int | getValue (int pinNumber) |
| Gets a value of a pin More... | |
| int | count () |
| Gets the number of pins. More... | |
| String | toJson () |
| Returns all pin values in a json array a key-value Json object with the '{' and '}' around it. where first key is the first in the index with the key as the GPO key and the value is the last value set to that key. More... | |
| String | JsonPinout () |
| Creates a JSON object containg all pins name and their number. More... | |
| GPins () | |
| Constructor for the GPins Object More... | |
This class stores GPin objects which connect the server to device hardware pins para/>
| GPins::GPins | ( | ) |
Constructor for the GPins Object
| int GPins::addPin | ( | const char * | strPinName, |
| PINTYPE | pinType, | ||
| int | pinNumber, | ||
| int | pinValue | ||
| ) |
Adds a pin
| strPinName | The name of the pin |
| pinType | Type of the pin |
Possible types of a pin are:
PINTYPE_INPUT_ANALOG : "Read method analogRead shall be used"
PINTYPE_INPUT_DIGITAL : "Read method digitalRead shall be used"
PINTYPE_OUTPUT_ANALOG : "Write method analogWrite shall be used"
PINTYPE_OUTPUT_DIGITAL : "Write method digitalWrite shall be used"
PINTYPE_OUTPUT_VIRTUAL : "A pin not connected to hardware, but can store values"
| pinNumber | Number of the pin (GPIO number) |
| pinValue | Starting value of the pin. If the pin type is an input pin then the value will be read from the hardware and this value ignored. |
| boolean GPins::exists | ( | int | pinNumber | ) |
Checks if a pin with a given number exits.
| pinNumber |
| GPin * GPins::get | ( | int | pinNumber | ) |
| int GPins::getValue | ( | int | pinNumber | ) |
Gets a value of a pin
| pinNumber | The pin to get the value from |
The value of the given pin.
Returns -1 if pinNumber was not found
| String GPins::JsonPinout | ( | ) |
Creates a JSON object containg all pins name and their number.
| boolean GPins::setValue | ( | int | pinNumber, |
| int | newValue | ||
| ) |
Sets the value of a pin with the given number.
| pinNumber | The number of the pin to search for |
| newValue | The new value to be set |
| String GPins::toJson | ( | ) |