ESPComponent¶
The code on the LRAUV side contains comments explaining the design and implementation strategy. Here is a quick overview.
The ESPComponent relies on two key supporting classes:
ESPClient and ESPComm.
ESPClient¶
This class provides the core logic for interactions with the ESP.
ESPClient basically takes care of a complete sampling phase.
The main methods are:
startSampling()to start a sampling phaseisSampling()to advance the interactions with the ESP until it returns falseisSuccessfulSampling()to verify the sampling has completed successfully.
ESPClientTest.cpp is a very handy standalone program that uses this client class
to exercise interaction with a remote ESP outside the regular LRAUV execution framework.
It has been very useful for development and testing.
$ bin/ESPClientTest --help
USAGE: ESPClientTest [options]
-h/--host <name> indicate ESP server hostname (default: bufflehead)
-p/--port <port> indicate ESP server port (default: 7777)
-l/--log <file> indicate log filename (default: none)
-o/--onlyLog include only <log> lines in log file (default: false)
-c/--cartridge <c> set loadCartridge argument for automated mode (default: none)
-i/--interactive run in interactive mode (default: false)
--help show this message
ESPComm¶
This class provides support for interfacing with the ESP at the socket level.
It is used by ESPClient and by ESPComponent, not only to create the ESPClient
instance, but also for direct calls mainly related with the ESP log messages.
Along with communication establishment (with two constructors available
depending on which side will play the initial server role), it provides the basic
operations (readLine, sendLine) that support the higher-level protocol.