|
LRAUV
revA
|
Provides software interface for sending sbds over the https when an https connection is available. More...
#include <DataOverHttps.h>


Public Member Functions | |
| DataOverHttps (const Module *module) | |
| virtual | ~DataOverHttps () |
| virtual void | run () |
| The actual "payload" of the component. More... | |
| virtual void | initialize () |
| Provide a space for initialization before being run. More... | |
| virtual 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 | 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 | 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 Subseqent. More... | |
| virtual RunState | runnable () |
| Should eventually follow a START request or RESETTING. More... | |
| virtual RunState | satisfied () |
| Possible return value of a Behavior. More... | |
| virtual RunState | pause () |
| Pause for a short period (indicated by pauseTime) More... | |
| virtual RunState | pausing () |
| Might follow a PAUSE request. 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 | 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 () |
| Should eventually follow a STOP 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 | DataState { TCP_CONNECT, TCP_CONNECTING, SSL_CONNECT, SSL_CONNECTING, DATA_WRITE, DATA_WRITING, DATA_READ, DISCONNECT, DISCONNECTED } |
| enum | KeyType { KEY_UNKNOWN = -1, KEY_BUSY, KEY_FILE, KEY_FILENAME, KEY_FILESIZE, KEY_MOMSN, KEY_MTMSN, KEY_VEHICLE, KEY_COUNT } |
Private Member Functions | |
| DataOverHttps (const DataOverHttps &old) | |
| bool | loadParams (void) |
| bool | readConfig () |
| DataState | tcpConnect () |
| DataState | tcpConnecting () |
| DataState | sslConnect () |
| DataState | sslConnecting () |
| DataState | dataWrite () |
| DataState | dataWriting () |
| DataState | dataRead () |
| DataState | disconnect () |
Static Private Member Functions | |
| static KeyType | Str2KeyType (const char *const keyTypeStr) |
| static bool | ParseDataRead (char **data, KeyType &key, char **value) |
Static Private Attributes | |
| static const char *const | KEY_TYPE_STRS [KEY_COUNT] |
| static const int | BUFFER_SIZE = 2048 |
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... | |
Provides software interface for sending sbds over the https when an https connection is available.
DataOverHttps.h should only be included by DataOverHttps.cpp Other classes should include DataOverHttpsIF.h
| DataOverHttps::DataOverHttps | ( | const Module * | module | ) |
References Units::BOOL, communicationsWriter_, connectionTimeoutCfgReader_, Syslog::DEBUG, Component::debugLevel_, Syslog::IMPORTANT, Syslog::INFO, loadParams(), Component::newConfigReader(), Component::newUniversalWriter(), Syslog::NONE, periodCfgReader_, Component::persistentPause_, UniversalURI::PLATFORM_COMMUNICATIONS, sendDataToShoreCfgReader_, Component::setFailureMissionCritical(), DataWriter::setUnavailable(), timeoutCfgReader_, verbosity_, and verbosityLevelCfgReader_.
|
virtual |
References addrinfo_.
|
private |
|
private |
References Timespan::asFloat(), buffer_, BUFFER_SIZE, bufferPos_, busy_, connectionTimeout_, connectStart_, Str::cStr(), dashSSL_, DATA_READ, dataSize_, dataStart_, Syslog::DEBUG, debug_, DEBUG_LOG, decoded_, decodedSize_, DISCONNECT, disconnect(), Timestamp::elapsed(), Str::EMPTY_STR, Syslog::FAULT, filename_, Syslog::IMPORTANT, Syslog::INFO, KEY_BUSY, KEY_FILE, KEY_FILENAME, KEY_FILESIZE, KEY_MOMSN, KEY_MTMSN, KEY_UNKNOWN, KEY_VEHICLE, lastComms_, lastMtmsn_, Component::logger_, Timestamp::Now(), ParseDataRead(), Component::resetFailCount(), sendFilename_, socket_, sslErrBuf_, sslHandle_, Logger::syslog(), Encoder::UrlDecode(), and verbosity_.
Referenced by run().
|
private |
References busy_, contentStart_, Syslog::CRITICAL, Str::cStr(), dataWriting(), DEBUG_LOG, Str::EMPTY_STR, headerStart_, Syslog::IMPORTANT, Syslog::INFO, lastMtmsn_, Str::length(), Component::logger_, outgoing_, outgoingSize_, sendFilename_, Logger::syslog(), Encoder::UrlEncode(), and verbosity_.
Referenced by run(), sslConnect(), and sslConnecting().
|
private |
References StrValue::asString(), bufferPos_, cmdReceived_, Syslog::CRITICAL, Str::cStr(), dashSSL_, DATA_READ, DATA_WRITING, dataSize_, dataStart_, decoded_, decodedSize_, disconnect(), Syslog::IMPORTANT, Syslog::INFO, keyText_, Component::logger_, outgoing_, outgoingSize_, DataReceiver::ReceiveSbd(), socket_, sslErrBuf_, sslHandle_, Logger::syslog(), verbosity_, and OutStream::writeHex().
Referenced by dataWrite(), and run().
|
private |
References DEBUG_LOG, DISCONNECTED, outgoing_, outgoingSize_, socket_, sslContext_, and sslHandle_.
Referenced by dataRead(), dataWriting(), run(), sslConnecting(), tcpConnecting(), and uninitialize().
|
virtual |
Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc.
Reimplemented from Component.
References Component::CONFIG_POWER, and ConfigURI::NO_CONFIG_URI.
|
virtual |
Provide a space for initialization before being run.
Reimplemented from Component.
References dataState_, and TCP_CONNECT.
|
private |
References StrValue::asString(), Units::BOOL, contentStart_, Str::cStr(), dashIP_, dashPath_, dashPort_, dashSSL_, headerStart_, imei_, imeiPassword_, keyText_, Str::length(), Component::logger_, readConfig(), Slate::ReadOnce(), and Encoder::UrlEncode().
Referenced by DataOverHttps().
|
staticprivate |
Referenced by dataRead().
|
private |
References Units::BOOL, connectionTimeout_, connectionTimeoutCfgReader_, Units::COUNT, period_, periodCfgReader_, DataReader::read(), Units::SECOND, sendDataToShore_, sendDataToShoreCfgReader_, timeout_, timeoutCfgReader_, verbosity_, and verbosityLevelCfgReader_.
Referenced by loadParams(), and run().
|
virtual |
The actual "payload" of the component.
Reimplemented from Component.
References Timespan::asFloat(), Units::BOOL, cmdReceived_, communicationsWriter_, Str::cStr(), DATA_READ, DATA_WRITE, DATA_WRITING, dataRead(), dataState_, dataWrite(), dataWriting(), DEBUG_LOG, decodedSize_, DISCONNECT, disconnect(), DISCONNECTED, Timestamp::elapsed(), Str::EMPTY_STR, Supervisor::GetToShoreFilename(), Supervisor::IncrementShoreFile(), Syslog::INFO, DataWriter::isDataRequested(), DataWriter::isUnavailable(), lastComms_, lastPoll_, Component::logger_, Timestamp::NOT_SET_TIME, Timestamp::Now(), period_, readConfig(), sendDataToShore_, sendFilename_, LogWriter::SERVICE_COURIER, LogWriter::SERVICE_EXPRESS, DataWriter::setUnavailable(), SSL_CONNECT, SSL_CONNECTING, sslConnect(), sslConnecting(), Logger::syslog(), TCP_CONNECT, TCP_CONNECTING, tcpConnect(), tcpConnecting(), timeout_, verbosity_, and DataWriter::write().
|
private |
References dashSSL_, dataWrite(), DEBUG_LOG, DISCONNECT, Component::logger_, socket_, sslConnecting(), sslContext_, sslErrBuf_, sslHandle_, and Logger::syslog().
Referenced by run(), tcpConnect(), and tcpConnecting().
|
private |
References Timespan::asFloat(), connectionTimeout_, connectStart_, dataWrite(), DEBUG_LOG, DISCONNECT, disconnect(), Timestamp::elapsed(), Component::logger_, SSL_CONNECTING, sslErrBuf_, sslHandle_, Logger::syslog(), and wasConnected_.
Referenced by run(), and sslConnect().
|
staticprivate |
|
private |
References addrinfo_, StrValue::asString(), connectStart_, Str::cStr(), dashIP_, dashPort_, DEBUG_LOG, Syslog::FAULT, FailureMode::HARDWARE, Component::logger_, Timestamp::Now(), Component::setFailure(), socket_, sslConnect(), Logger::syslog(), TCP_CONNECT, and TCP_CONNECTING.
Referenced by run().
|
private |
References Timespan::asFloat(), connectionTimeout_, connectStart_, DEBUG_LOG, disconnect(), Timestamp::elapsed(), Syslog::INFO, Component::logger_, socket_, sslConnect(), Logger::syslog(), TCP_CONNECTING, and wasConnected_.
Referenced by run().
|
virtual |
Provide a space for uninitialization.
Reimplemented from Component.
References dataState_, disconnect(), and wasConnected_.
|
private |
Referenced by tcpConnect(), and ~DataOverHttps().
|
private |
Referenced by dataRead().
|
staticprivate |
Referenced by dataRead().
|
private |
Referenced by dataRead(), and dataWriting().
|
private |
Referenced by dataRead(), and dataWrite().
|
private |
Referenced by dataWriting(), and run().
|
private |
Referenced by DataOverHttps(), and run().
|
private |
Referenced by dataRead(), readConfig(), sslConnecting(), and tcpConnecting().
|
private |
Referenced by DataOverHttps(), and readConfig().
|
private |
Referenced by dataRead(), sslConnecting(), tcpConnect(), and tcpConnecting().
|
private |
Referenced by dataWrite(), and loadParams().
|
private |
Referenced by loadParams(), and tcpConnect().
|
private |
Referenced by loadParams().
|
private |
Referenced by loadParams(), and tcpConnect().
|
private |
Referenced by dataRead(), dataWriting(), loadParams(), and sslConnect().
|
private |
Referenced by dataRead(), and dataWriting().
|
private |
Referenced by dataRead(), and dataWriting().
|
private |
Referenced by initialize(), run(), and uninitialize().
|
private |
Referenced by dataRead().
|
private |
Referenced by dataRead(), and dataWriting().
|
private |
Referenced by dataRead(), dataWriting(), and run().
|
private |
Referenced by dataRead().
|
private |
Referenced by dataWrite(), and loadParams().
|
private |
Referenced by loadParams().
|
private |
Referenced by loadParams().
|
staticprivate |
|
private |
Referenced by dataWriting(), and loadParams().
|
private |
Referenced by dataRead(), and run().
|
private |
Identity of last packet received from shore.
Referenced by dataRead(), and dataWrite().
|
private |
Referenced by dataWrite(), dataWriting(), and disconnect().
|
private |
Referenced by dataWrite(), dataWriting(), and disconnect().
|
private |
Referenced by readConfig(), and run().
|
private |
Referenced by DataOverHttps(), and readConfig().
|
private |
Referenced by readConfig(), and run().
|
private |
Configuration readers.
Referenced by DataOverHttps(), and readConfig().
|
private |
Name of file currently being sent to shore.
Referenced by dataRead(), dataWrite(), and run().
|
private |
Referenced by dataRead(), dataWriting(), disconnect(), sslConnect(), tcpConnect(), and tcpConnecting().
|
private |
Referenced by disconnect(), and sslConnect().
|
private |
Referenced by dataRead(), dataWriting(), sslConnect(), and sslConnecting().
|
private |
Referenced by dataRead(), dataWriting(), disconnect(), sslConnect(), and sslConnecting().
|
private |
Referenced by readConfig(), and run().
|
private |
Referenced by DataOverHttps(), and readConfig().
|
private |
Referenced by DataOverHttps(), dataRead(), dataWrite(), dataWriting(), readConfig(), and run().
|
private |
Referenced by DataOverHttps(), and readConfig().
|
private |
Referenced by sslConnecting(), tcpConnecting(), and uninitialize().