Package frclib.archive
Class FrcEmic2TextToSpeech
java.lang.Object
trclib.archive.TrcEmic2TextToSpeech
frclib.archive.FrcEmic2TextToSpeech
This class implements a platform dependent Emic2 text to speech device that is connected to a Serial Port.
It extends the TrcEmicTextToSpeech class to provide platform dependent asynchronous access to the serial port.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.archive.TrcEmic2TextToSpeech
TrcEmic2TextToSpeech.DemoMsg, TrcEmic2TextToSpeech.Language, TrcEmic2TextToSpeech.Parser, TrcEmic2TextToSpeech.RequestId, TrcEmic2TextToSpeech.Voice
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final edu.wpi.first.wpilibj.SerialPort.Parity
static final edu.wpi.first.wpilibj.SerialPort.Port
static final edu.wpi.first.wpilibj.SerialPort.StopBits
Fields inherited from class trclib.archive.TrcEmic2TextToSpeech
MAX_VOLUME, MIN_VOLUME
-
Constructor Summary
ConstructorsConstructorDescriptionFrcEmic2TextToSpeech
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port) Constructor: Create an instance of the object.FrcEmic2TextToSpeech
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate) Constructor: Create an instance of the object.FrcEmic2TextToSpeech
(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate, int dataBits, edu.wpi.first.wpilibj.SerialPort.Parity parity, edu.wpi.first.wpilibj.SerialPort.StopBits stopBits) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
asyncReadString
(TrcEmic2TextToSpeech.RequestId requestId) This method issues an asynchronous read of a string from the device.void
asyncWriteString
(String text, boolean preemptive) This method writes the string to the device asynchronously.boolean
This method checks if the device is enabled.void
setEnabled
(boolean enabled) This method enables/disables the device to start/stop the communicationMethods inherited from class trclib.archive.TrcEmic2TextToSpeech
getCurrentConfig, getHelpMessage, getVersion, notify, playDemoMessage, revertDefaultConfig, selectParser, selectVoice, setLanguage, setSpeakingRate, setVolume, setVolume, speak, start, stopPlayback, togglePlayback, toString
-
Field Details
-
DEF_SERIAL_PORT
public static final edu.wpi.first.wpilibj.SerialPort.Port DEF_SERIAL_PORT -
DEF_BAUD_RATE
public static final int DEF_BAUD_RATE- See Also:
-
DEF_DATA_BITS
public static final int DEF_DATA_BITS- See Also:
-
DEF_PARITY
public static final edu.wpi.first.wpilibj.SerialPort.Parity DEF_PARITY -
DEF_STOP_BITS
public static final edu.wpi.first.wpilibj.SerialPort.StopBits DEF_STOP_BITS
-
-
Constructor Details
-
FrcEmic2TextToSpeech
public FrcEmic2TextToSpeech(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate, int dataBits, edu.wpi.first.wpilibj.SerialPort.Parity parity, edu.wpi.first.wpilibj.SerialPort.StopBits stopBits) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.baudRate
- specifies the baud rate.dataBits
- specifies the number of data bits.parity
- specifies the parity type.stopBits
- specifies the number of stop bits.
-
FrcEmic2TextToSpeech
public FrcEmic2TextToSpeech(String instanceName, edu.wpi.first.wpilibj.SerialPort.Port port, int baudRate) Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.baudRate
- specifies the baud rate.
-
FrcEmic2TextToSpeech
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.port
- specifies the serial port on the RoboRIO.
-
-
Method Details
-
isEnabled
public boolean isEnabled()This method checks if the device is enabled.- Returns:
- true if device is enabled, false otherwise.
-
setEnabled
public void setEnabled(boolean enabled) This method enables/disables the device to start/stop the communication- Parameters:
enabled
- specifies true to enable device, false to disable.
-
asyncReadString
This method issues an asynchronous read of a string from the device.- Specified by:
asyncReadString
in classTrcEmic2TextToSpeech
- Parameters:
requestId
- specifies the ID to identify the request. Can be null if none was provided.
-
asyncWriteString
This method writes the string to the device asynchronously.- Specified by:
asyncWriteString
in classTrcEmic2TextToSpeech
- Parameters:
text
- specifies the text string to be written to the device.preemptive
- specifies true for immediate write without queuing, false otherwise.
-