AuthenticationLegacy.cpp
Go to the documentation of this file.
1 // -- BEGIN LICENSE BLOCK ----------------------------------------------
20 // -- END LICENSE BLOCK ------------------------------------------------
21 
25 
26 namespace visionary {
27 
29  : m_VisionaryControl(vctrl)
30 {
31 }
32 
34 
35 bool AuthenticationLegacy::login(UserLevel userLevel, const std::string& password)
36 {
37  CoLaCommand loginCommand =
39  .parameterSInt(static_cast<int8_t>(userLevel))
40  .parameterPasswordMD5(password)
41  .build();
42  CoLaCommand loginResponse = m_VisionaryControl.sendCommand(loginCommand);
43 
44 
45  if (loginResponse.getError() == CoLaError::OK)
46  {
47  return CoLaParameterReader(loginResponse).readBool();
48  }
49  return false;
50 }
51 
53 {
55  CoLaCommand runResponse = m_VisionaryControl.sendCommand(runCommand);
56 
57  if (runResponse.getError() == CoLaError::OK)
58  {
59  return CoLaParameterReader(runResponse).readBool();
60  }
61  return false;
62 }
63 
64 } // namespace visionary
visionary::IAuthentication::UserLevel
UserLevel
Available CoLa user levels.
Definition: IAuthentication.h:31
visionary::CoLaParameterReader
Class for reading data from a CoLaCommand.
Definition: CoLaParameterReader.h:33
visionary::AuthenticationLegacy::logout
virtual bool logout()
Definition: AuthenticationLegacy.cpp:52
visionary
Definition: AuthenticationLegacy.h:25
visionary::CoLaParameterWriter
Builder for constructing CoLaCommands.
Definition: CoLaParameterWriter.h:35
visionary::CoLaCommand
Definition: CoLaCommand.h:32
visionary::CoLaError::OK
@ OK
No error.
Definition: CoLaError.h:35
visionary::CoLaCommand::getError
CoLaError::Enum getError()
Get error.
Definition: CoLaCommand.cpp:113
visionary::AuthenticationLegacy::AuthenticationLegacy
AuthenticationLegacy(VisionaryControl &vctrl)
Definition: AuthenticationLegacy.cpp:28
CoLaParameterWriter.h
visionary::CoLaCommandType::METHOD_INVOCATION
@ METHOD_INVOCATION
Definition: CoLaCommandType.h:36
visionary::CoLaParameterWriter::parameterSInt
CoLaParameterWriter & parameterSInt(const int8_t sInt)
Add a signed short (8-bit, range [-128, 127]).
Definition: CoLaParameterWriter.cpp:38
visionary::VisionaryControl::sendCommand
CoLaCommand sendCommand(CoLaCommand &command)
Send a CoLaBCommand to the device and waits for the result.
Definition: VisionaryControl.cpp:171
visionary::CoLaParameterReader::readBool
bool readBool()
Read a boolean and advance the position by 1 byte.
Definition: CoLaParameterReader.cpp:100
visionary::AuthenticationLegacy::login
virtual bool login(UserLevel userLevel, const std::string &password)
Definition: AuthenticationLegacy.cpp:35
visionary::AuthenticationLegacy::m_VisionaryControl
VisionaryControl & m_VisionaryControl
Definition: AuthenticationLegacy.h:37
CoLaParameterReader.h
visionary::CoLaParameterWriter::parameterPasswordMD5
CoLaParameterWriter & parameterPasswordMD5(const std::string &str)
Add the given password as a UDInt, using MD5 hashing.
Definition: CoLaParameterWriter.cpp:110
visionary::AuthenticationLegacy::~AuthenticationLegacy
virtual ~AuthenticationLegacy()
Definition: AuthenticationLegacy.cpp:33
AuthenticationLegacy.h
visionary::VisionaryControl
Definition: VisionaryControl.h:35
visionary::CoLaParameterWriter::build
const CoLaCommand build()
Definition: CoLaParameterWriter.cpp:198


sick_safevisionary_base
Author(s):
autogenerated on Sat Oct 21 2023 02:24:26