|
LRAUV
revA
|
Sensor component to interface with the ESP. More...
#include <ESPComponent.h>


Public Member Functions | |
| ESPComponent (const Module *module) | |
| Testing with simulators on bufflehead and tethyssim: More... | |
| virtual | ~ESPComponent () |
| virtual void | run () |
| The actual "payload" of the component. More... | |
| virtual RunState | start () |
| Do what needs to be done to run Similar to initialize, in old init/run/uninit sequence. More... | |
| virtual RunState | starting () |
| Might follow a STOP...START sequence. More... | |
| virtual RunState | pause () |
| Pause for a short period (indicated by pauseTime) More... | |
| virtual RunState | paused () |
| Should eventually follow a PAUSE request: should set continueTime. More... | |
| virtual RunState | resume () |
| Resume from PAUSE. More... | |
| virtual RunState | resuming () |
| Might follow a PAUSE...RESUME sequence. More... | |
| virtual RunState | runnable () |
| Should eventually follow a START request or RESETTING. More... | |
| virtual RunState | resetting () |
| Might occur in case of Error. More... | |
| virtual RunState | stop () |
| Initial state – can be later followed by START. More... | |
| virtual RunState | stopping () |
| Might follow a STOP request. More... | |
| virtual RunState | stopped () |
| Initial state – can be later followed by START. More... | |
| void | uninitialize () |
| Provide a space for uninitialization. More... | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption) const |
| Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc. More... | |
Public Member Functions inherited from SyncComponent | |
| CycleOrder | getCycleOrder (void) |
| Getter function for controlThreadOrderPreference. More... | |
| void | setRepeating (bool repeating) |
| int | getDivisor () const |
| int | getModulo () const |
| bool | isRepeater () |
| bool | isRepeating () |
Public Member Functions inherited from Component | |
| virtual | ~Component () |
| Destructor cleans up readers_ and writers_. More... | |
| void | registerReader (DataReader *reader) |
| void | unregisterReader (DataReader *reader) |
| void | registerWriter (DataWriter *writer) |
| void | unregisterWriter (DataWriter *writer) |
| void | disableMetering (void) |
| FlexArray< DataReader * > & | getReaderList (void) |
| FlexArray< DataWriter * > & | getWriterList (void) |
| const Module * | getModule () |
| virtual void | initialize () |
| Provide a space for initialization before being run. More... | |
| virtual void | configure () |
| Read (or re-read!) configuration settings. More... | |
| virtual void | execute (void) |
| bool | isActive () const |
| Indicates if the component is active. More... | |
| const CodedStr & | getName (void) const |
| Returns the name. More... | |
| const Timestamp & | getTimeOfLastRun (void) const |
| ComponentState | getState (void) |
| Return the component's current state. More... | |
| void | setState (ComponentState state) |
| RunState | getRunState (void) |
| Return the component's run state. More... | |
| bool | isUsingRunState () |
| Return true if using runState. More... | |
| void | requestData (bool requestingData) |
| Tell the component to start (or stop) sending data. More... | |
| void | requestStart () |
| Tell the component to start runnning. More... | |
| void | requestPause (const Timespan expectedPauseTime) |
| Tell the component to pause runnning. More... | |
| void | requestResume () |
| Tell the component resume from pause. More... | |
| void | requestStop () |
| Tell the component to stop runnning. More... | |
| virtual RunState | satisfied () |
| Possible return value of a Behavior. More... | |
| virtual RunState | pausing () |
| Might follow a PAUSE request. More... | |
| void | setCriticalFailureReported (bool boolVal) |
| void | setRecoveringFromCritical (bool boolVal) |
| void | setFailureReported (bool boolVal) |
| bool | isFailureUninitialized () |
| void | setFailureUninitialized (bool boolVal) |
| void | setRetryTimeout (const Timespan &timeout) |
| virtual bool | isCompleted (void) |
| Query if this component is completed. More... | |
| void | setPeriod (const Timespan &period) |
| Set the period of this component... used if it is periodic. More... | |
| const Timespan & | getPeriod (void) |
| Returns the component's period (regardless of whether it is periodic) More... | |
| ComponentType | getComponentType () |
| Getter function for ComponentType. More... | |
| virtual bool | isFailed (void) const |
| virtual FailureMode::FailType | getFailureType (void) const |
| virtual bool | getCriticalFailureReported (void) const |
| virtual bool | getFailureReported (void) const |
| virtual Timespan | getRetryTimeout (void) const |
| virtual FailureMode::FailType | setFailure (FailureMode::FailType failureType) |
| virtual int | getFailCount (void) const |
| virtual bool | isFailureMissionCritical () |
| virtual int | getAllowableFailures (void) const |
| virtual void | setAllowableFailures (int fails) |
| Logger & | getLogger (void) |
| virtual int | incrementFailCount (void) |
| virtual void | resetFailCount (void) |
| virtual int | getSkippedRunsSinceFail (void) const |
| virtual int | incrementSkippedRunsSinceFail (void) |
| virtual void | logVoltage (float voltage, float averageVoltage) |
| virtual void | logCurrent (float current, float averageCurrent) |
| const Timestamp & | getWriteTimestamp (void) |
| void | setWriteTimestamp (const Timestamp &writeTimestamp) |
| BlobReader * | newBlobReader (const BlobURI &blobURI) |
| BlobReader * | newBlobReaderFromUniversal (const Str &componentName, const UniversalBlobURI &blobURI) |
| BlobWriter * | newBlobWriter (const BlobURI &blobURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| ConfigReader * | newConfigReader (const ConfigURI &configURI) |
| DataReader * | newDataReader (const DataURI &dataURI) |
| DataReader * | newDataReaderFromUniversal (const Str &componentName, const UniversalURI &universalURI) |
| DataWriter * | newDataWriter (const DataURI &dataURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalBlobReader * | newUniversalBlobReader (const UniversalBlobURI &universalURI) |
| UniversalBlobWriter * | newUniversalBlobWriter (const UniversalBlobURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalDataReader * | newUniversalReader (const UniversalURI &universalURI) |
| UniversalDataWriter * | newUniversalWriter (const UniversalURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
Private Types | |
| enum | StartState { SS_INIT, SS_CONNECTING_AS_CLIENT, SS_WAITING_FOR_ESP_TO_CONNECT, SS_WAITING_FOR_PORT_NUMBER, SS_CONNECTED } |
| Sub-states while in LRAUV framework's STARTING state. More... | |
Private Member Functions | |
| ESPComponent (const ESPComponent &old) | |
| const char * | startStateName (StartState startState) |
| void | createESPComm () |
| Creates espComm_ in specific mode (LRAUV either as server or client) depending on espServerHost_ (and using socketServerPort_ if LRAUV is to be server). More... | |
| void | createESPClient () |
| Creates espClient_. More... | |
| bool | openServerSocket () |
| opens server socket to listen for ESP connection More... | |
| bool | powerUpESP () |
| powers up ESP and initiates PPP link More... | |
| bool | powerDownESP (bool setFailure=true) |
| powers down ESP and brings down PPP link. More... | |
| Component::RunState | waitForESPConnection () |
| Once the ESP is powered up, we wait for the ESP to connect. More... | |
| bool | scanEspServerPort (Str &line, int *espServerPort) |
| Once the ESP is connected as a client, we expect a first line indicating the port it is listening on as a server. More... | |
| void | espReady () |
| ESP connection ready. More... | |
| Component::RunState | startSamplingPhase () |
| Starts a sampling phase. More... | |
| int | getLine (Str &line) |
| Expects next line from the ESP. More... | |
| bool | isDataRequested () |
| bool | logVoltageAndCurrent () |
| bool | getSimulatedData () |
| void | writeData () |
| void | startPPP (void) |
| void | stopPPP (void) |
| bool | readConfigs () |
| bool | readAdjustableConfigs () |
| void | logDebug (Str msg) |
Additional Inherited Members | |
Public Types inherited from Component | |
| enum | ComponentState { BLOCK_CONTINUOUS, BLOCK_PERIODIC, BLOCK_NORMAL, BLOCK_COMPLETED, BLOCK_UNKNOWN } |
| In this model, the component has basically two states: wanting to run, and completed (no longer needing to run). More... | |
| enum | ComponentType { COMPONENT_ASYNC, COMPONENT_CONFIG, COMPONENT_BEHAVIOR, COMPONENT_SYNC } |
| Components can indicate how they want to be handled by their type. More... | |
| enum | RunState { NO_RUN_STATE = 0, START, STARTING, RUNNABLE, SATISFIED, PAUSE, PAUSING, PAUSED, RESUME, RESUMING, RESETTING, STOP, STOPPING, STOPPED } |
Static Public Attributes inherited from SyncComponent | |
| static const int | CYCLE_INCREMENT |
| static const int | CYCLE_REPEAT_OFFSET |
| static const CycleOrder | CYCLE_STARTER |
| static const CycleOrder | CYCLE_SIMULATOR |
| static const CycleOrder | CYCLE_SENSOR |
| static const CycleOrder | CYCLE_DERIVATION |
| static const CycleOrder | CYCLE_ESTIMATION |
| static const CycleOrder | CYCLE_NAVIGATION |
| static const CycleOrder | CYCLE_MISSION_MANAGER |
| static const CycleOrder | CYCLE_MISSION |
| static const CycleOrder | CYCLE_CONTROL |
| static const CycleOrder | CYCLE_SERVO |
| static const CycleOrder | CYCLE_TEST |
| static const CycleOrder | CYCLE_REPORTER |
| static const CycleOrder | CYCLE_LOGGER |
Protected Types inherited from Component | |
| enum | ConfigOption { CONFIG_SIMULATE_HARDWARE, CONFIG_POWER, CONFIG_FREQUENCY, CONFIG_LATENCY } |
Protected Member Functions inherited from SyncSensorComponent | |
| SyncSensorComponent (const Str &name, const Module *module, int divisor=1, int modulo=0) | |
Protected Member Functions inherited from SyncComponent | |
| void | setRepeater (bool repeater) |
Protected Member Functions inherited from Component | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption, ElementURI forElement) const |
| Should return [myNamespace]::POWER_[forElement], [myNamespace]::LATENCY_[forElement], etc. More... | |
| virtual void | setDurationOfLastRun (const Timespan &span) |
| virtual void | setTimeOfRun (const Timestamp &time) |
| virtual void | setTimeOfLastRun (const Timestamp &time) |
| virtual void | setDt (const Timespan &dt) |
| virtual bool | setEnabled (bool enabled=true) |
| void | setRunState (const RunState runState) |
| const Timespan | getPauseTime () const |
| virtual void | setFailureMissionCritical (bool failureMissionCritical) |
| bool | simulateHardware () |
Protected Attributes inherited from Component | |
| Logger | logger_ |
| Syslog::Severity | debugLevel_ |
| ComponentState | state_ |
| Keep track of whether the component has "completed" or should be run again. More... | |
| Timespan | desiredPeriod_ |
| CodedStr & | name_ |
| Store the component's name (used for logging purposes) More... | |
| Timestamp | timeOfRun_ |
| Timestamp | timeOfLastRun_ |
| Timespan | durationOfLastRun_ |
| Timespan | dt_ |
| Timespan | retryTimeout_ |
| bool | enabled_ |
| bool | failureReported_ |
| Indicates if the failure has been reported – cuts down on syslog. More... | |
| bool | criticalFailureReported_ |
| Indicates if a "Critical" failure has been reported – cuts down on syslog. More... | |
| bool | recoveringFromCritical_ |
| Indicates that a component had a previous critical failure that has been cleared temporarily awaiting final word from the component itself. More... | |
| bool | failureUninitialized_ |
| Indicates if the failure has resulted in an uninitialize call. More... | |
| int | failCount_ |
| Number of failures logged by PCaller. More... | |
| bool | failureMissionCritical_ |
| If true (default), complete failure ends mission. More... | |
| int | allowableFailures_ |
| Number of failures allowed to occur. More... | |
| int | skippedRunsSinceFail_ |
| Number of skipped runs since failureMode_ set by failCount_. More... | |
| FailureMode::FailType | failureType_ |
| Failed status. If failCount_ > 0, then this may be reset. More... | |
| Timestamp | timeOfFailure_ |
| Time of last failure. Relevant only if failed=true. More... | |
| Timestamp | writeTimestamp_ |
| Time of last write. More... | |
| FlexArray< DataReader * > | readers_ |
| FlexArray< DataWriter * > | writers_ |
| const Module * | module_ |
| Timespan | pauseTime_ |
| bool | meteringEnabled_ |
| If true, metering is enabled. More... | |
| DataWriter * | durationOfLastRunWriter_ |
| Writer for durationOfLastRun. More... | |
| DataWriter * | voltageWriter_ |
| DataWriter * | avgVoltageWriter_ |
| DataWriter * | currentWriter_ |
| DataWriter * | avgCurrentWriter_ |
| bool | persistentPause_ |
| True if data is persistent while component is paused. More... | |
Sensor component to interface with the ESP.
Uses ESPComm for the base communication layer with the ESP. Uses ESPClient for the high-level logic for interactions with the ESP.
| ESPComponent::ESPComponent | ( | const Module * | module | ) |
Testing with simulators on bufflehead and tethyssim:
See example of complete session at https://bitbucket.org/snippets/carueda/8KR6B
(Note: the config parameter ESPComponent.simulateHardware is false for these tests: the ESP simulator is still an external process and we interact with it from here as if it were a real ESP.)
On bufflehead, where an image of the ESP software is ready to be exercised (under carueda's home):
Make sure the ESP simulator has enough "dry" cartridges. For this you can simply run Cmd.slot All=>:dry:
Then, in this bufflehead session prepare the following command but do not launch it yet:
This prepares the subsequent execution of the ESP system (see below) once the socket server is running on the (simulated) vehicle.
On tethyssim:
Once the socket server is ready to accept the ESP connection, indicated by a line like so: 2015-10-28T16:12:36.161Z,1446048756.161 [ESPComponent](IMPORTANT): Waiting for ESP to connect (timeout=10.0000)
go to the bufflehead session and run:
which makes the ESP to connect as a TCP client to the vehicle at tethyssim:9998, and also launch a TCP server on port 7777 for subsequent connection of vehicle as TCP client.
Output on both terminals will show communication establishment and complete sampling. All messages received from the ESP are captured in Logs/latest/ESP.log.
References connectExec_, connectTimeoutCfgReader_, debugCfgReader_, espAlwaysServer_, espServerHostCfgReader_, filterCompleteTimeoutCfgReader_, filterResultTimeoutCfgReader_, initialPromptTimeoutCfgReader_, loadCartridgeTimeoutCfgReader_, loadControl_, Component::logger_, Component::newConfigReader(), Component::newDataWriter(), poTimeoutCfgReader_, pppFlow_, processCompleteTimeoutCfgReader_, processResultTimeoutCfgReader_, readConfigs(), Slate::ReadOnce(), sampleNumberWriter_, sampleTimeoutCfgReader_, samplingActiveWriter_, Component::setAllowableFailures(), Component::setFailureMissionCritical(), Component::setRetryTimeout(), Component::setRunState(), Component::simulateHardware(), socketServerPortCfgReader_, Component::STOP, stopResultTimeoutCfgReader_, and uartName_.
|
virtual |
References espClient_, espComm_, and loadControl_.
|
private |
|
private |
Creates espClient_.
References debug_, Syslog::ERROR, espClient_, espComm_, filterCompleteTimeout_, filterResultTimeout_, initialPromptTimeout_, loadCartridgeTimeout_, Component::logger_, processCompleteTimeout_, processResultTimeout_, ESPClient::setDebug(), stopResultTimeout_, and Logger::syslog().
Referenced by espReady().
|
private |
Creates espComm_ in specific mode (LRAUV either as server or client) depending on espServerHost_ (and using socketServerPort_ if LRAUV is to be server).
Also sets espAlwaysServer_ accordingly.
References StrValue::asString(), Str::cStr(), debug_, Syslog::ERROR, espAlwaysServer_, espComm_, espServerHost_, Syslog::FAULT, Str::length(), logDebug(), Component::logger_, ESPComm::setDebug(), socketServerPort_, and Logger::syslog().
Referenced by start(), and starting().
|
private |
ESP connection ready.
References createESPClient(), debug_, espComm_, Syslog::IMPORTANT, Component::logger_, ESPComm::setEspLogFile(), and Logger::syslog().
Referenced by starting().
|
virtual |
Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc.
Reimplemented from Component.
References Component::CONFIG_POWER, Component::CONFIG_SIMULATE_HARDWARE, and ConfigURI::NO_CONFIG_URI.
|
private |
Expects next line from the ESP.
NOTE: This method is actually only called while in SS_WAITING_FOR_PORT_NUMBER. The getLine logic here is similar to that of the getLine method in ESPClient. This could be factored out at some point.
| line | the receive line is reported here. Trailing NOT included. |
References FailureMode::COMMUNICATIONS, Str::cStr(), debug_, Timestamp::elapsed(), ESPComm::escape(), espComm_, Syslog::FAULT, Str::length(), lineTimeout_, logDebug(), Component::logger_, partialLine_, ESPComm::readLine(), Component::setFailure(), startTimeForLine_, and Logger::syslog().
Referenced by starting().
|
private |
References Timestamp::elapsed(), Timestamp::Now(), sampleNumber_, sampleTime_, sampleTimeout_, and samplingActive_.
Referenced by runnable().
|
private |
References DataWriter::isDataRequested(), and samplingActiveWriter_.
Referenced by runnable(), start(), and stopped().
|
private |
References Syslog::DEBUG, Component::logger_, and Logger::syslog().
Referenced by createESPComm(), getLine(), pause(), paused(), powerDownESP(), resume(), resuming(), scanEspServerPort(), start(), starting(), startSamplingPhase(), stop(), stopping(), waitForESPConnection(), and writeData().
|
private |
References LoadControl::errorString(), Syslog::FAULT, Str::find(), LoadControl::hasError(), loadControl_, Component::logger_, LoadControl::requestVoltageAndCurrent(), and Logger::syslog().
Referenced by runnable(), and starting().
|
private |
opens server socket to listen for ESP connection
References ESPComm::errorString(), espComm_, ESPComm::hasError(), Component::logger_, ESPComm::open(), and Logger::syslog().
Referenced by starting().
|
virtual |
Pause for a short period (indicated by pauseTime)
Reimplemented from Component.
References debug_, logDebug(), and Component::STOP.
|
virtual |
Should eventually follow a PAUSE request: should set continueTime.
Reimplemented from Component.
References debug_, logDebug(), and Component::STOP.
|
private |
powers down ESP and brings down PPP link.
| setFailure | true (the default) to report problem with powerDown call to loadControl as a FAULT and set failure to HARDWARE; otherwise, such problem is just reported as a DEBUG message. |
References Syslog::FAULT, FailureMode::HARDWARE, Syslog::INFO, loadControl_, logDebug(), Component::logger_, LoadControl::powerDown(), Component::setFailure(), stopPPP(), and Logger::syslog().
Referenced by starting(), and stop().
|
private |
powers up ESP and initiates PPP link
References CommandLine::DoCommand(), Syslog::FAULT, FailureMode::HARDWARE, Syslog::INFO, loadControl_, Component::logger_, LoadControl::powerUp(), Component::setFailure(), startPPP(), and Logger::syslog().
Referenced by starting().
|
private |
References DataReader::read(), sampleTimeout_, and sampleTimeoutCfgReader_.
Referenced by runnable().
|
private |
References connectTimeout_, connectTimeoutCfgReader_, Units::COUNT, debug_, debugCfgReader_, espServerHost_, espServerHostCfgReader_, filterCompleteTimeout_, filterCompleteTimeoutCfgReader_, filterResultTimeout_, filterResultTimeoutCfgReader_, initialPromptTimeout_, initialPromptTimeoutCfgReader_, loadCartridgeTimeout_, loadCartridgeTimeoutCfgReader_, poTimeout_, poTimeoutCfgReader_, processCompleteTimeout_, processCompleteTimeoutCfgReader_, processResultTimeout_, processResultTimeoutCfgReader_, DataReader::read(), sampleTimeout_, sampleTimeoutCfgReader_, socketServerPort_, socketServerPortCfgReader_, stopResultTimeout_, and stopResultTimeoutCfgReader_.
Referenced by ESPComponent().
|
inlinevirtual |
|
virtual |
Resume from PAUSE.
Reimplemented from Component.
References debug_, logDebug(), and Component::START.
|
virtual |
Might follow a PAUSE...RESUME sequence.
Reimplemented from Component.
References debug_, logDebug(), and Component::START.
|
virtual |
The actual "payload" of the component.
Reimplemented from Component.
|
virtual |
Should eventually follow a START request or RESETTING.
Reimplemented from Component.
References FailureMode::COMMUNICATIONS, Syslog::CRITICAL, ESPClient::currentSamplingState(), espClient_, ESPClient::getSamplingError(), getSimulatedData(), Syslog::IMPORTANT, isDataRequested(), ESPClient::isSampling(), ESPClient::isSuccessfulSampling(), Component::logger_, logVoltageAndCurrent(), Timestamp::Now(), readAdjustableConfigs(), Component::resetFailCount(), Component::RUNNABLE, sampleNumber_, sampleTime_, samplingActive_, samplingState_, ESPClient::samplingStateName(), Component::setFailure(), Component::simulateHardware(), Component::STOP, Logger::syslog(), and writeData().
|
private |
Once the ESP is connected as a client, we expect a first line indicating the port it is listening on as a server.
This port, along with the peer address, is captured in case we need to connect as a client later on (specifically for the submitAbort operation).
References FailureMode::COMMUNICATIONS, Str::cStr(), debug_, Syslog::FAULT, logDebug(), Component::logger_, Component::setFailure(), and Logger::syslog().
Referenced by starting().
|
virtual |
Do what needs to be done to run Similar to initialize, in old init/run/uninit sequence.
Creates espComm_ object, if not already created; and then transitions to STARTING.
Reimplemented from Component.
References ESPComm::close(), createESPComm(), debug_, espComm_, Syslog::FAULT, FailureMode::HARDWARE, isDataRequested(), ESPComm::isReadable(), logDebug(), Component::logger_, Component::setFailure(), Component::simulateHardware(), Component::START, Component::STARTING, Component::STOP, Component::STOPPED, and Logger::syslog().
Referenced by resetting().
|
virtual |
Might follow a STOP...START sequence.
Handles the "establish connection" state machine, that is, the transition through the states indicated by the StartState enum, whose final normal state, SS_CONNECTED, in turn triggers the transition to LRAUV framework's RUNNABLE state.
Reimplemented from Component.
References FailureMode::COMMUNICATIONS, ESPComm::connectAsClient(), connectTimeout_, createESPComm(), Str::cStr(), debug_, Timestamp::elapsed(), Syslog::ERROR, ESPComm::escape(), espComm_, espReady(), Syslog::FAULT, ESPComm::getError(), getLine(), ESPComm::getPeerAddress(), ESPComm::hasError(), ESPComm::hasEspServerAddressAndPort(), Syslog::IMPORTANT, ESPComm::isClientConnected(), Str::length(), logDebug(), Component::logger_, logVoltageAndCurrent(), Timestamp::Now(), openServerSocket(), poTimeout_, powerDownESP(), powerUpESP(), Component::RUNNABLE, scanEspServerPort(), ESPComm::setEspServerAddressAndPort(), Component::setFailure(), ESPComm::showEspServerAddressAndPort(), Component::simulateHardware(), SS_CONNECTED, SS_CONNECTING_AS_CLIENT, SS_INIT, SS_WAITING_FOR_ESP_TO_CONNECT, SS_WAITING_FOR_PORT_NUMBER, Component::START, Component::STARTING, startSamplingPhase(), startState_, startStateName(), startTimeAccept_, startTimeConnecting_, startTimeForLine_, Component::STOP, Logger::syslog(), ESPComm::TIMEOUT_CONNECTING, Timespan::toString(), and waitForESPConnection().
|
private |
References StrValue::asString(), FailureMode::COMMUNICATIONS, connectExec_, Str::cStr(), UartStream::enableUART(), Syslog::FAULT, Syslog::IMPORTANT, Component::logger_, pppCmd_, pppFlow_, Component::setFailure(), Logger::syslog(), uart_, and uartName_.
Referenced by powerUpESP().
|
private |
Starts a sampling phase.
References ESPClient::currentSamplingState(), debug_, Syslog::ERROR, espClient_, ESPClient::getSamplingError(), Syslog::IMPORTANT, logDebug(), Component::logger_, Timestamp::Now(), Component::RUNNABLE, sampleNumber_, sampleTime_, samplingActive_, samplingState_, ESPClient::samplingStateName(), ESPClient::startSampling(), Component::STOP, Logger::syslog(), and writeData().
Referenced by starting().
|
inlineprivate |
References SS_CONNECTED, SS_CONNECTING_AS_CLIENT, SS_INIT, SS_WAITING_FOR_ESP_TO_CONNECT, and SS_WAITING_FOR_PORT_NUMBER.
Referenced by starting().
|
virtual |
Initial state – can be later followed by START.
Reimplemented from Component.
References ESPComm::close(), debug_, espAlwaysServer_, espClient_, espComm_, ESPComm::isReadable(), logDebug(), powerDownESP(), samplingActive_, ESPComm::setEspServerAddressAndPort(), Component::simulateHardware(), SS_INIT, startState_, and Component::STOPPING.
|
virtual |
Initial state – can be later followed by START.
Reimplemented from Component.
References isDataRequested(), Component::START, and Component::STOPPED.
|
virtual |
Might follow a STOP request.
Reimplemented from Component.
References debug_, LoadControl::errorString(), Syslog::FAULT, Str::find(), FailureMode::HARDWARE, LoadControl::hasError(), loadControl_, logDebug(), Component::logger_, LoadControl::readFaults(), Component::setFailure(), Component::simulateHardware(), Component::STOPPED, and Logger::syslog().
|
private |
References FailureMode::COMMUNICATIONS, UartStream::disableUART(), Syslog::FAULT, Component::logger_, Component::setFailure(), Logger::syslog(), and uart_.
Referenced by powerDownESP().
|
virtual |
Provide a space for uninitialization.
Reimplemented from Component.
References ESPComm::close(), espComm_, Syslog::FAULT, FailureMode::HARDWARE, loadControl_, Component::logger_, LoadControl::powerDown(), Component::setFailure(), Component::simulateHardware(), and Logger::syslog().
|
private |
Once the ESP is powered up, we wait for the ESP to connect.
References ESPComm::acceptClient(), FailureMode::COMMUNICATIONS, debug_, Timestamp::elapsed(), espComm_, Syslog::FAULT, ESPComm::getError(), ESPComm::hasError(), logDebug(), Component::logger_, Timestamp::Now(), poTimeout_, Component::setFailure(), Component::STARTING, startTimeAccept_, Component::STOP, Logger::syslog(), ESPComm::TIMEOUT_ACCEPT_CLIENT, and Timespan::toString().
Referenced by starting().
|
private |
References Units::BOOL, Units::COUNT, logDebug(), sampleNumber_, sampleNumberWriter_, sampleTime_, samplingActive_, samplingActiveWriter_, and DataWriter::write().
Referenced by runnable(), and startSamplingPhase().
|
private |
Referenced by ESPComponent(), and startPPP().
|
private |
Referenced by readConfigs(), and starting().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Debugging outputs.
Referenced by createESPClient(), createESPComm(), espReady(), getLine(), pause(), paused(), readConfigs(), resume(), resuming(), scanEspServerPort(), start(), starting(), startSamplingPhase(), stop(), stopping(), and waitForESPConnection().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
true if and only if espServerHost_ is non-empty and has the format "hostname:portNumber"
Referenced by createESPComm(), ESPComponent(), and stop().
|
private |
High-level logic for interactions with the ESP.
Referenced by createESPClient(), runnable(), startSamplingPhase(), stop(), and ~ESPComponent().
|
private |
The base communications interface to the ESP.
Referenced by createESPClient(), createESPComm(), espReady(), getLine(), openServerSocket(), start(), starting(), stop(), uninitialize(), waitForESPConnection(), and ~ESPComponent().
|
private |
Typically this will the empty string from configuration, meaning that the LRAUV will power-up and down the ESP as part of an overall sampling sequence.
If non-empty, must have the format "hostname:portNumber" (with portNumber > 0), indicating the host and port of the ESP server. In this case, the LRAUV will always assume the ESP is already running and accessible at hostname:portNumber. No ESP power cycling at all will be performed.
Referenced by createESPComm(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by ESPComponent(), logVoltageAndCurrent(), powerDownESP(), powerUpESP(), stopping(), uninitialize(), and ~ESPComponent().
|
private |
Timeouts.
Referenced by readConfigs(), starting(), and waitForESPConnection().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by startPPP().
|
private |
Referenced by ESPComponent(), and startPPP().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by getSimulatedData(), runnable(), startSamplingPhase(), and writeData().
|
private |
Referenced by ESPComponent(), and writeData().
|
private |
Time when sampling started.
Referenced by getSimulatedData(), runnable(), startSamplingPhase(), and writeData().
|
private |
Referenced by getSimulatedData(), readAdjustableConfigs(), and readConfigs().
|
private |
Referenced by ESPComponent(), readAdjustableConfigs(), and readConfigs().
|
private |
Referenced by getSimulatedData(), runnable(), startSamplingPhase(), stop(), and writeData().
|
private |
Referenced by ESPComponent(), isDataRequested(), and writeData().
|
private |
Referenced by runnable(), and startSamplingPhase().
|
private |
Referenced by createESPComm(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Referenced by starting(), and stop().
|
private |
Time prior to accept ESP client connection:
Referenced by starting(), and waitForESPConnection().
|
private |
Time prior to connecting as client to the ESP:
Referenced by starting().
|
private |
Time prior to expecting a line from ESP:
Referenced by getLine(), and starting().
|
private |
Referenced by createESPClient(), and readConfigs().
|
private |
Referenced by ESPComponent(), and readConfigs().
|
private |
Power and comms in this case.
Referenced by startPPP(), and stopPPP().
|
private |
Referenced by ESPComponent(), and startPPP().