EasyVR Library
1.2
|
Public Types | |
enum | ModuleId { VRBOT, EASYVR } |
enum | Language { ENGLISH, ITALIAN, JAPANESE, GERMAN, SPANISH, FRENCH } |
enum | Group { TRIGGER, PASSWORD } |
enum | Wordset { TRIGGER_SET, ACTION_SET, DIRECTION_SET, NUMBER_SET } |
enum | Knob { LOOSER, LOOSE, TYPICAL, STRICT, STRICTER } |
enum | Level { EASY, NORMAL, HARD, HARDER, HARDEST } |
enum | Baudrate { B115200, B57600, B38400, B19200, B9600 } |
enum | WakeMode { WAKE_ON_CHAR, WAKE_ON_WHISTLE, WAKE_ON_LOUDSOUND, WAKE_ON_2CLAPS, WAKE_ON_3CLAPS } |
enum | ClapSense { CLAP_SENSE_LOW, CLAP_SENSE_MID, CLAP_SENSE_HIGH } |
enum | PinConfig { OUTPUT_LOW, OUTPUT_HIGH, INPUT_HIZ, INPUT_STRONG, INPUT_WEAK } |
enum | PinNumber { IO1, IO2, IO3 } |
enum | SoundVolume { VOL_MIN, VOL_HALF, VOL_FULL, VOL_DOUBLE } |
enum | SoundIndex { BEEP } |
Public Member Functions | |
EasyVR (Stream &s) | |
bool | detect () |
bool | stop () |
int8_t | getID () |
bool | setLanguage (int8_t lang) |
bool | setTimeout (int8_t seconds) |
bool | setKnob (int8_t knob) |
bool | setLevel (int8_t level) |
bool | setDelay (uint16_t millis) |
bool | changeBaudrate (int8_t baud) |
bool | sleep (int8_t mode) |
bool | addCommand (int8_t group, int8_t index) |
bool | removeCommand (int8_t group, int8_t index) |
bool | setCommandLabel (int8_t group, int8_t index, const char *name) |
bool | eraseCommand (int8_t group, int8_t index) |
bool | getGroupMask (uint32_t &mask) |
int8_t | getCommandCount (int8_t group) |
bool | dumpCommand (int8_t group, int8_t index, char *name, uint8_t &training) |
void | trainCommand (int8_t group, int8_t index) |
void | recognizeCommand (int8_t group) |
void | recognizeWord (int8_t wordset) |
bool | hasFinished () |
int8_t | getCommand () |
int8_t | getWord () |
int16_t | getError () |
bool | isTimeout () |
bool | isConflict () |
bool | isMemoryFull () |
bool | setPinOutput (int8_t pin, int8_t value) |
int8_t | getPinInput (int8_t pin, int8_t config) |
void | playSoundAsync (int16_t index, int8_t volume) |
bool | playSound (int16_t index, int8_t volume) |
bool | dumpSoundTable (char *name, int16_t &count) |
bool | resetAll () |
An implementation of the EasyVR communication protocol.
enum ModuleId |
Module identification number (firmware version)
VRBOT |
Identifies a VRbot module |
EASYVR |
Identifies an EasyVR module |
enum Language |
enum Group |
enum Wordset |
enum Knob |
Confidence thresholds for the knob settings,
used for recognition of built-in words (except trigger)
enum Level |
Strictness values for the level settings,
used for recognition of custom commands (except triggers)
enum Baudrate |
enum WakeMode |
Constants for choosing wake-up method in sleep mode
enum ClapSense |
Hands-clap sensitivity for wakeup from sleep mode.
Use in combination with WAKE_ON_2CLAPS or WAKE_ON_3CLAPS
enum PinConfig |
enum PinNumber |
enum SoundVolume |
enum SoundIndex |
EasyVR | ( | Stream & | s | ) |
bool detect | ( | ) |
Detects an EasyVR module, waking it from sleep mode and checking it responds correctly.
is | true if a compatible module has been found |
bool stop | ( | ) |
Interrupts pending recognition or playback operations.
is | true if the request is satisfied and the module is back to ready |
int8_t getID | ( | ) |
Gets the module identification number (firmware version).
is | one of the values in ModuleId |
bool setLanguage | ( | int8_t | lang | ) |
Sets the language to use for recognition of built-in words.
lang | (0-5) is one of values in Language |
is | true if the operation is successful |
bool setTimeout | ( | int8_t | seconds | ) |
Sets the timeout to use for any recognition task.
seconds | (0-31) is the maximum time the module keep listening for a word or a command |
is | true if the operation is successful |
bool setKnob | ( | int8_t | knob | ) |
Sets the confidence threshold to use for recognition of built-in words.
knob | (0-4) is one of values in Knob |
is | true if the operation is successful |
bool setLevel | ( | int8_t | level | ) |
Sets the strictness level to use for recognition of custom commands.
level | (1-5) is one of values in Level |
is | true if the operation is successful |
bool setDelay | ( | uint16_t | millis | ) |
Sets the delay before any reply of the module.
millis | (0-1000) is the delay duration in milliseconds, rounded to 10 units in range 10-100 and to 100 units in range 100-1000. |
is | true if the operation is successful |
bool changeBaudrate | ( | int8_t | baud | ) |
Sets the new communication speed. You need to modify the baudrate of the underlying Stream object accordingly, after the function returns successfully.
baud | is one of values in Baudrate |
is | true if the operation is successful |
bool sleep | ( | int8_t | mode | ) |
bool addCommand | ( | int8_t | group, |
int8_t | index | ||
) |
Adds a new custom command to a group.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
is | true if the operation is successful |
bool removeCommand | ( | int8_t | group, |
int8_t | index | ||
) |
Removes a custom command from a group.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
is | true if the operation is successful |
bool setCommandLabel | ( | int8_t | group, |
int8_t | index, | ||
const char * | name | ||
) |
Sets the name of a custom command.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
is | true if the operation is successful |
bool eraseCommand | ( | int8_t | group, |
int8_t | index | ||
) |
Erases the training data of a custom command.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
is | true if the operation is successful |
bool getGroupMask | ( | uint32_t & | mask | ) |
Gets a bit mask of groups that contain at least one command.
mask | is a variable to hold the group mask when the function returns |
is | true if the operation is successful |
int8_t getCommandCount | ( | int8_t | group | ) |
Gets the number of commands in the specified group.
group | (0-16) is the target group, or one of the values in #Groups |
is | the count of commands |
bool dumpCommand | ( | int8_t | group, |
int8_t | index, | ||
char * | name, | ||
uint8_t & | training | ||
) |
Retrieves the name and training data of a custom command.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
name | points to an array of at least 32 characters that holds the command label when the function returns |
training | is a variable that holds the training count when the function returns. Additional information about training is available through the functions isConflict() and getWord() or getCommand() |
is | true if the operation is successful |
void trainCommand | ( | int8_t | group, |
int8_t | index | ||
) |
Starts training of a custom command. Results are available after hasFinished() returns true.
group | (0-16) is the target group, or one of the values in #Groups |
index | (0-31) is the index of the command within the selected group |
void recognizeCommand | ( | int8_t | group | ) |
Starts recognition of a custom command. Results are available after hasFinished() returns true.
group | (0-16) is the target group, or one of the values in #Groups |
void recognizeWord | ( | int8_t | wordset | ) |
Starts recognition of a built-in word. Results are available after hasFinished() returns true.
wordset | (0-3) is the target word set, or one of the values in Wordset |
bool hasFinished | ( | ) |
Polls the status of on-going recognition, training or asynchronous playback tasks.
is | true if the operation has completed |
int8_t getCommand | ( | ) |
Gets the recognised command index if any.
(0-31) | is the command index if recognition is successful, (-1) if no command has been recognized or an error occured |
int8_t getWord | ( | ) |
Gets the recognised built-in word index if any.
(0-31) | is the command index if recognition is successful, (-1) if no built-in word has been recognized or an error occured |
int16_t getError | ( | ) |
Gets the last error code if any.
(0-255) | is the error code, (-1) if no error occured |
bool isTimeout | ( | ) |
Retrieves the timeout indicator.
is | true if a timeout occurred |
bool isConflict | ( | ) |
Retrieves the conflict indicator.
is | true is a conflict occurred during training. To know what caused the conflict, use getCommand() and getWord() (only valid for triggers) |
bool isMemoryFull | ( | ) |
Retrieves the memory full indicator (only valid after addCommand() returned false).
is | true if a command could not be added because of memory size constaints (up to 32 custom commands can be created) |
bool setPinOutput | ( | int8_t | pin, |
int8_t | value | ||
) |
int8_t getPinInput | ( | int8_t | pin, |
int8_t | config | ||
) |
void playSoundAsync | ( | int16_t | index, |
int8_t | volume | ||
) |
Starts playback of a sound from the sound table. Manually check for completion with hasFinished().
index | is the index of the target sound in the sound table |
volume | (0-31) may be one of the values in SoundVolume |
bool playSound | ( | int16_t | index, |
int8_t | volume | ||
) |
Plays a sound from the sound table and waits for completion
index | is the index of the target sound in the sound table |
volume | (0-31) may be one of the values in SoundVolume |
is | true if the operation is successful |
bool dumpSoundTable | ( | char * | name, |
int16_t & | count | ||
) |
Retrieves the name of the sound table and the number of sounds it contains
name | points to an array of at least 32 characters that holds the sound table label when the function returns |
count | is a variable that holds the number of sounds when the function returns |
is | true if the operation is successful |
bool resetAll | ( | ) |
Empties internal memory for custom commands and groups.
is | true if the operation is successful |