Integrated barcode code into main project.
parent
3cb0ca2784
commit
3e90efe0c5
|
@ -8,3 +8,4 @@ install_manifest.txt
|
|||
|
||||
*.o
|
||||
hf-terminal
|
||||
test-barcode
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
project(hf-terminal)
|
||||
|
||||
add_executable(hf-terminal main.c tts.c base64.c ldap.c nfc.c)
|
||||
add_executable(hf-terminal main.c tts.c base64.c ldap.c nfc.c barcode.c)
|
||||
add_executable(hash-one hash-one.c ldap.c)
|
||||
add_executable(test-barcode test-barcode.c barcode.c)
|
||||
set(CMAKE_C_FLAGS "-std=c99 -g")
|
||||
|
||||
target_link_libraries(hf-terminal nfc m ldap crypto)
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
int g_BarcodeFD;
|
||||
|
||||
int barcode_initialize(char *Device)
|
||||
|
@ -51,6 +53,8 @@ int barcode_initialize(char *Device)
|
|||
return 1;
|
||||
}
|
||||
|
||||
tcflush(g_BarcodeFD, TCIOFLUSH);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -81,7 +85,7 @@ int barcode_read(char *BarcodeOut)
|
|||
int BytesRead = 0;
|
||||
|
||||
// read the first byte with a long timeout
|
||||
BytesRead += _async_read_timeout(g_BarcodeFD, BarcodeOut + BytesRead, 14, 20);
|
||||
BytesRead += _async_read_timeout(g_BarcodeFD, BarcodeOut + BytesRead, 14, BARCODE_TIMEOUT);
|
||||
if (BytesRead == -1)
|
||||
{
|
||||
printf("Timeout on reading first barcode bytes.\n");
|
||||
|
|
|
@ -7,4 +7,7 @@
|
|||
#define LDAP_BASE "ou=Peole,dc=somecorp,dc=com"
|
||||
#define LDAP_FILTER_HASHES "objectClass=hsMember"
|
||||
|
||||
#define BARCODE_PORT "/dev/ttyUSB0"
|
||||
#define BARCODE_TIMEOUT 20
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "nfc.h"
|
||||
#include "barcode.h"
|
||||
#include "tts.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
Reference in New Issue