mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-11-16 03:59:11 +01:00
Added baudrate
This commit is contained in:
parent
d6b092ea9f
commit
201ffe1e44
@ -16,6 +16,7 @@
|
|||||||
#define DEFAULT_BINDDN "cn=%s,ou=Users,dc=binary-kitchen,dc=de"
|
#define DEFAULT_BINDDN "cn=%s,ou=Users,dc=binary-kitchen,dc=de"
|
||||||
#define DEFAULT_LOG_FILE "/var/log/doorlockd.log"
|
#define DEFAULT_LOG_FILE "/var/log/doorlockd.log"
|
||||||
#define DEFAULT_SERIAL_DEVICE "/dev/ttyAMA0"
|
#define DEFAULT_SERIAL_DEVICE "/dev/ttyAMA0"
|
||||||
|
#define DEFAULT_SERIAL_BAUDRATE 9600UL
|
||||||
|
|
||||||
#define TEMPLATE_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/template.png"
|
#define TEMPLATE_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/template.png"
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Door final
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Door(const std::string &serDev,
|
Door(const std::string &serDev,
|
||||||
unsigned int baudrate = 9600);
|
unsigned int baudrate);
|
||||||
~Door();
|
~Door();
|
||||||
|
|
||||||
enum class State {Unlocked, Locked};
|
enum class State {Unlocked, Locked};
|
||||||
|
@ -18,9 +18,10 @@ Logic::Logic(const chrono::seconds tokenTimeout,
|
|||||||
const string &bindDN,
|
const string &bindDN,
|
||||||
const string &webPrefix,
|
const string &webPrefix,
|
||||||
const string &serDev,
|
const string &serDev,
|
||||||
|
const unsigned int baudrate,
|
||||||
condition_variable &onTokenUpdate) :
|
condition_variable &onTokenUpdate) :
|
||||||
_logger(Logger::get()),
|
_logger(Logger::get()),
|
||||||
_door(serDev),
|
_door(serDev, baudrate),
|
||||||
_tokenTimeout(tokenTimeout),
|
_tokenTimeout(tokenTimeout),
|
||||||
_onTokenUpdate(onTokenUpdate),
|
_onTokenUpdate(onTokenUpdate),
|
||||||
_ldapUri(ldapUri),
|
_ldapUri(ldapUri),
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
const std::string &bindDN,
|
const std::string &bindDN,
|
||||||
const std::string &webPrefix,
|
const std::string &webPrefix,
|
||||||
const std::string &serDev,
|
const std::string &serDev,
|
||||||
|
const unsigned int baudrate,
|
||||||
std::condition_variable &onTokenUpdate);
|
std::condition_variable &onTokenUpdate);
|
||||||
~Logic();
|
~Logic();
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ int main(int argc, char** argv)
|
|||||||
std::string lockPagePrefix;
|
std::string lockPagePrefix;
|
||||||
std::string logfile;
|
std::string logfile;
|
||||||
std::string serDev;
|
std::string serDev;
|
||||||
|
unsigned int baudrate;
|
||||||
|
|
||||||
l(LogLevel::notice, "Starting doorlockd");
|
l(LogLevel::notice, "Starting doorlockd");
|
||||||
|
|
||||||
@ -166,7 +167,11 @@ int main(int argc, char** argv)
|
|||||||
"Log file")
|
"Log file")
|
||||||
("serial,i",
|
("serial,i",
|
||||||
po::value<std::string>(&serDev)->default_value(DEFAULT_SERIAL_DEVICE),
|
po::value<std::string>(&serDev)->default_value(DEFAULT_SERIAL_DEVICE),
|
||||||
"Serial port");
|
"Serial port")
|
||||||
|
|
||||||
|
("baud,r",
|
||||||
|
po::value<unsigned int>(&baudrate)->default_value((DEFAULT_SERIAL_BAUDRATE)),
|
||||||
|
"Serial baudrate");
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
|
po::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
|
||||||
@ -204,6 +209,7 @@ int main(int argc, char** argv)
|
|||||||
bindDN,
|
bindDN,
|
||||||
lockPagePrefix,
|
lockPagePrefix,
|
||||||
serDev,
|
serDev,
|
||||||
|
baudrate,
|
||||||
onTokenUpdate));
|
onTokenUpdate));
|
||||||
server(port);
|
server(port);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user