DUNE: Uniform Navigational Environment
2017.01.0
|
Public Member Functions | |
Protocol (void) | |
~Protocol (void) | |
void | setUART (const std::string &uart_dev) |
void | setI2C (const std::string &i2c_dev, uint8_t addr) |
void | setName (const std::string &name) |
void | open (int baud=0) |
bool | isOpen (void) |
void | close (void) |
unsigned | read (uint8_t *bfr, unsigned bfr_len) |
unsigned | write (const uint8_t *bfr, unsigned bfr_len) |
CommandType | consumeData (Command &cmd) |
template<typename H > | |
void | read (H &handler) |
void | sendCommand (uint8_t cmd, const uint8_t *data=0, int data_size=0) |
void | requestVersion (void) |
void | requestName (void) |
void | requestReset (void) |
void | requestBootJump (void) |
int | requestBaud (const std::string &device) |
std::string | searchNewFirmware (const FileSystem::Path &path, unsigned ver=0, unsigned rev=0, unsigned pat=0, bool ver_fixed=false) |
Static Public Member Functions | |
static const char * | getErrorString (uint8_t error) |
DUNE::Hardware::LUCL::Protocol::Protocol | ( | void | ) |
DUNE::Hardware::LUCL::Protocol::~Protocol | ( | void | ) |
References close().
void DUNE::Hardware::LUCL::Protocol::close | ( | void | ) |
Referenced by ~Protocol().
CommandType DUNE::Hardware::LUCL::Protocol::consumeData | ( | Command & | cmd | ) |
References DUNE::Hardware::LUCL::Command::ErrorPayload::code, DUNE::Hardware::LUCL::Command::CommandPayload::code, DUNE::Hardware::LUCL::Command::command, DUNE::Hardware::LUCL::CommandTypeBootJump, DUNE::Hardware::LUCL::CommandTypeError, DUNE::Hardware::LUCL::CommandTypeInvalidChecksum, DUNE::Hardware::LUCL::CommandTypeInvalidVersion, DUNE::Hardware::LUCL::CommandTypeName, DUNE::Hardware::LUCL::CommandTypeNone, DUNE::Hardware::LUCL::CommandTypeNormal, DUNE::Hardware::LUCL::CommandTypeReset, DUNE::Hardware::LUCL::CommandTypeVersion, DUNE::Hardware::LUCL::Command::CommandPayload::data, DUNE::Hardware::LUCL::Command::NamePayload::data, DUNE::Hardware::LUCL::Command::error, DUNE::Hardware::LUCL::Command::VersionPayload::major, DUNE::Hardware::LUCL::Command::VersionPayload::minor, DUNE::Hardware::LUCL::Command::name, DUNE::Hardware::LUCL::Command::VersionPayload::patch, read(), DUNE::Hardware::LUCL::Command::CommandPayload::size, DUNE::Hardware::LUCL::Command::type, and DUNE::Hardware::LUCL::Command::version.
|
static |
bool DUNE::Hardware::LUCL::Protocol::isOpen | ( | void | ) |
void DUNE::Hardware::LUCL::Protocol::open | ( | int | baud = 0 | ) |
Open device.
baud | target baud rate for uart devices. 0 means auto-detect. |
References DUNE::Hardware::I2C::connect(), DUNE::Hardware::I2C, and DUNE::Hardware::SerialPort.
unsigned DUNE::Hardware::LUCL::Protocol::read | ( | uint8_t * | bfr, |
unsigned | bfr_len | ||
) |
References DUNE::Hardware::I2C::read(), and DUNE::IO::Handle::read().
Referenced by consumeData(), and read().
|
inline |
References read().
int DUNE::Hardware::LUCL::Protocol::requestBaud | ( | const std::string & | device | ) |
void DUNE::Hardware::LUCL::Protocol::requestBootJump | ( | void | ) |
References sendCommand().
void DUNE::Hardware::LUCL::Protocol::requestName | ( | void | ) |
References sendCommand().
void DUNE::Hardware::LUCL::Protocol::requestReset | ( | void | ) |
References sendCommand().
void DUNE::Hardware::LUCL::Protocol::requestVersion | ( | void | ) |
References sendCommand().
std::string DUNE::Hardware::LUCL::Protocol::searchNewFirmware | ( | const FileSystem::Path & | path, |
unsigned | ver = 0 , |
||
unsigned | rev = 0 , |
||
unsigned | pat = 0 , |
||
bool | ver_fixed = false |
||
) |
References DUNE::FileSystem::Path::contents().
void DUNE::Hardware::LUCL::Protocol::sendCommand | ( | uint8_t | cmd, |
const uint8_t * | data = 0 , |
||
int | data_size = 0 |
||
) |
References write().
Referenced by requestBootJump(), requestName(), requestReset(), and requestVersion().
void DUNE::Hardware::LUCL::Protocol::setI2C | ( | const std::string & | i2c_dev, |
uint8_t | addr | ||
) |
void DUNE::Hardware::LUCL::Protocol::setName | ( | const std::string & | name | ) |
References DUNE::Utils::String::toLowerCase(), and DUNE::Utils::String::toUpperCase().
void DUNE::Hardware::LUCL::Protocol::setUART | ( | const std::string & | uart_dev | ) |
unsigned DUNE::Hardware::LUCL::Protocol::write | ( | const uint8_t * | bfr, |
unsigned | bfr_len | ||
) |
References DUNE::IO::Handle::write(), and DUNE::Hardware::I2C::write().
Referenced by sendCommand().