mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 02:14:26 +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_LOG_FILE "/var/log/doorlockd.log"
|
||||
#define DEFAULT_SERIAL_DEVICE "/dev/ttyAMA0"
|
||||
#define DEFAULT_SERIAL_BAUDRATE 9600UL
|
||||
|
||||
#define TEMPLATE_LOCATION "@CMAKE_INSTALL_PREFIX@/share/doorlockd/template.png"
|
||||
|
||||
|
@ -17,7 +17,7 @@ class Door final
|
||||
public:
|
||||
|
||||
Door(const std::string &serDev,
|
||||
unsigned int baudrate = 9600);
|
||||
unsigned int baudrate);
|
||||
~Door();
|
||||
|
||||
enum class State {Unlocked, Locked};
|
||||
|
@ -18,9 +18,10 @@ Logic::Logic(const chrono::seconds tokenTimeout,
|
||||
const string &bindDN,
|
||||
const string &webPrefix,
|
||||
const string &serDev,
|
||||
const unsigned int baudrate,
|
||||
condition_variable &onTokenUpdate) :
|
||||
_logger(Logger::get()),
|
||||
_door(serDev),
|
||||
_door(serDev, baudrate),
|
||||
_tokenTimeout(tokenTimeout),
|
||||
_onTokenUpdate(onTokenUpdate),
|
||||
_ldapUri(ldapUri),
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
const std::string &bindDN,
|
||||
const std::string &webPrefix,
|
||||
const std::string &serDev,
|
||||
const unsigned int baudrate,
|
||||
std::condition_variable &onTokenUpdate);
|
||||
~Logic();
|
||||
|
||||
|
@ -137,6 +137,7 @@ int main(int argc, char** argv)
|
||||
std::string lockPagePrefix;
|
||||
std::string logfile;
|
||||
std::string serDev;
|
||||
unsigned int baudrate;
|
||||
|
||||
l(LogLevel::notice, "Starting doorlockd");
|
||||
|
||||
@ -166,7 +167,11 @@ int main(int argc, char** argv)
|
||||
"Log file")
|
||||
("serial,i",
|
||||
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::store(po::command_line_parser(argc, argv).options(desc).run(), vm);
|
||||
@ -204,6 +209,7 @@ int main(int argc, char** argv)
|
||||
bindDN,
|
||||
lockPagePrefix,
|
||||
serDev,
|
||||
baudrate,
|
||||
onTokenUpdate));
|
||||
server(port);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user