Password Card
This is an exclusive feature of DASH Pro. Check it out here.
Just like Text Input
card, Password card gives you the ability to take String input from user in a inconspicuous way and save them in your application.
This card is very useful for saving any kind of secret or password that requires the input value to be not visible on dashboard in plain text.
Initializer
/*
Password Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name)
*/
Card card1(&dashboard, PASSWORD_CARD, "Test Pass");
Callback
Password card requires a callback function which will be called when we receive a input from our dashboard. In setup block, we will be calling our attachCallback
function and provide a lambda (callback) function with a const char*
(character array) argument.
/*
We provide our attachCallback with a lambda function to handle incomming data
*/
card1.attachCallback([&](const char* value){
Serial.println("[Card1] Password Card Callback: "+String(value));
});
Updater
Password card doesn't require any updater as value is not passed back to dashboard.
Reference
This is a reference sketch showing positions for intializer and callback.
...
/* Password card initializer */
Card pass(&dashboard, PASSWORD_CARD, "Test Pass");
void setup() {
...
/* Password card callback */
pass.attachCallback([&](const char* value){
Serial.println("Password Callback Triggered: "+String(value));
});
}
void loop() {
...
}