I'm in the middle of creating a web application for a client, and he wants me to integrate magnetic card swipers so his office staff can quickly swipe a card, and load up details for specific patients (each patient is assigned a unique number corresponding to a unique card).
In my software, handling the incoming string is fairly trivial, as the card swiper simulates keypresses for each character in the id on the card.
However, I've run into some oddities. We are using two different brands of card swipers, and I discovered that one card swiper generates a string that begins with "+", and the other swiper generates a string that begins with ";". The actual numbers on the card (the id number that comes after the "+" or ";") are the same for each kind of swiper.
I can of course add to my code and detect for both a "+" and a ";". However, I'm concerned that if we introduce yet another brand or model of card swiper, it might generate something entirely different. Or, if they decide to use a different brand of cards, I might get something different still.
I don't want to have to keep patching my code to handle all these differences, if possible. Is there some sort of documentation that sets standards for all card swipers and magnetic cards? I'm looking for something that will tell me something like:
- All cards begin with one of these:
['$', '+', ';'] - Followed by a varied length string of alpha-numeric characters
- Ending with one of these:
['?', '*', '^']
Here are some additional considerations:
- These are simple magnetic cards, that simply contain on string of characters (used as identifiers for quick lookup). We aren't swiping credit cards or anything like that.
- This is a distributed web application, that will be used all over the United States. And I don't have control over what brand of card or swiper each office uses.
- Because of business requirements, I am using pattern recognition based on the
keypressevent. I'm not looking at the generated string inside a text box.