USB Badge Reader
mjones2620
Posts: 86
Hello All,
I have a USB badge reader, that I'd like to use for authenticating users to access a touch panel. I have a CSV file of all of the users that are allowed access. I'm trying to figure out the best way to program the panel for authentication. Basically, the badge reader just works as a keyboard function, inputting the badge ID number when it's scanned.
Thanks,
Matt
I have a USB badge reader, that I'd like to use for authenticating users to access a touch panel. I have a CSV file of all of the users that are allowed access. I'm trying to figure out the best way to program the panel for authentication. Basically, the badge reader just works as a keyboard function, inputting the badge ID number when it's scanned.
Thanks,
Matt
0
Comments
When text comes in from this it will then fill into this button. From here you a couple of options:
1) Add a button with it's port set to the loopback port (0) and channel of 'Keyboard: Exit'. When pressed this will fire the contents of all of your text inputs on that page back to the master as a string event prefixed with the text input button's name. Depending on your desired interaction pattern you could also have this hidden and use a do_push *shudder* at say a one second interval when your are in this area of your UI.
2) Alternatively, you could query the contents of this button at a set interval. This would keep all controls hidden and enable your users to auth etc just by the physical interaction with the reader.
Hey Kim,
Thanks so much for the help! I am trying to do exactly what you thought, hooking it directly to the panel and using it as the keyboard function. What I think I am going to need the most help with is getting it to authenticate based on the numbers it reads. I have a CSV file with all of the badge numbers available, but how do I get the master to check against these numbers?
If you could provide any netlinx code I'd appreciate any help I can get!
THANKS!
Depending on your environment though (number of users, frequency of updates etc.) you may want to store this sort of data in an external service though and query it as required.
Thanks Kim,
I'm a novice programmer, so I think this is going to be way above my head. For testing of the equipment purposes, is there a simple way to see if the reader is working and make it flip pages?
Thanks,
Matt
Also, don't be afraid I've diving into something that seems over your head. If you keep doing what your comfortable doing you never have any fun
Okay thanks,
So I tried that, and sure enough it did read the badge and numbers appeared in the box. Without getting overly complicated for now, how would I create a string of code in netlinx that would authenticate a page flip based on if only my badge ID was entered? I'll dive into the CSV file and all that once I get a better sense of what I'm doing! Thanks for the words of encouragement! You seem like a very talented programmer.
Matt
Been fooling around with this all day: Can't seem to get it to work just for basic testing. Any ideas where I'm going wrong?
PROGRAM_NAME='Keypad Testing'
DEFINE_DEVICE
dvTP = 10001:1:0 //AMX Modero NXTCV10
dvMaster = 0:1:0 //NI700 Master Controller
DEFINE_START
SEND_COMMAND dvTP, "'?TXT-1,0'"
DEFINE_VARIABLE
NON_VOLATILE char Text[11]
DEFINE_EVENT
DATA_EVENT[dvTP]
{
ONLINE:
{
SEND_COMMAND dvTP, 'PAGE-Swipe'
}
}
BUTTON_EVENT[dvTP,212]
{
PUSH:
IF(Text == '13960017776')
{
SEND_COMMAND dvTP, 'PAGE-Error'
}
ELSE
{
SEND_COMMAND dvTP, 'PAGE-Main'
}
}
I was able to use one badge id to authenticate... now how to get multiple badges using a text file is the next step..
PROGRAM_NAME='Keypad Testing'
DEFINE_DEVICE
dvTP = 10001:1:0 //AMX Modero NXTCV10
dvMaster = 0:1:0 //NI700 Master Controller
DEFINE_VARIABLE
NON_VOLATILE CHAR Text
DEFINE_START
SEND_COMMAND dvTP, "'^TXT-1,3',ITOA(Text)"
DEFINE_EVENT
DATA_EVENT[dvTP]
{
ONLINE:
{
SEND_COMMAND dvTP, 'Page-Swipe'
}
STRING:
{
IF
(FIND_STRING(DATA.TEXT,'139600177',1))
SEND_COMMAND dvTP, 'Page-Main'
ELSE
SEND_COMMAND dvTP, 'Page-Swipe'
}
}
BUTTON_EVENT[dvTP,212]
{
PUSH:
{
SEND_COMMAND dvTP, '@PKP'
}
}
Please note that this code has been edited from a MUCH larger file that tests lots of different things. I know it compiles and I think it will work OK but I don't have any hardware to test it with at the moment so YMMV.
Kim:
My read_file function continually truncates the length of cSUBJECT with objects that I cannot see in Debug. For whatever reason, it thinks there is a comma or space in the CSV file. Can you tell what I'm doing wrong?
One thing I see as a possibility from the code below is your cBUFF variable is only 120 characters. This will result in a max line length of 120. As your subject is the last column of that CSV format it will be the item that is truncated during the read line.
I've attached code for reference. I tried to solve the cBUFF issue by having it ignore commas or blank space, but I'd prefer not to. Any tips would be helpful. I changed the cBUFF length back to 2048, what should it be?
Thanks,
Unless you have trailing comma's you may have more luck replacing: with
Alternatively, the explode(..) function I pointed to earlier in the thread may be able to neaten things up a bit.
Kim,
thank you... that is exactly what is happening. I was able to write my own function to clean up the commas and blank spaces before I saw the explode function!
sorry for the delay: