Bank Account Security System

Dependencies:   FatFileSystemSD mbed

Committer:
Dhruv_Varun
Date:
Thu Oct 11 20:49:25 2012 +0000
Revision:
0:7e4786a3584b
Code For Bank Account Security System

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Dhruv_Varun 0:7e4786a3584b 1 /* mbed ID12 RFID Library
Dhruv_Varun 0:7e4786a3584b 2 * Copyright (c) 2007-2010, sford, http://mbed.org
Dhruv_Varun 0:7e4786a3584b 3 *
Dhruv_Varun 0:7e4786a3584b 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
Dhruv_Varun 0:7e4786a3584b 5 * of this software and associated documentation files (the "Software"), to deal
Dhruv_Varun 0:7e4786a3584b 6 * in the Software without restriction, including without limitation the rights
Dhruv_Varun 0:7e4786a3584b 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Dhruv_Varun 0:7e4786a3584b 8 * copies of the Software, and to permit persons to whom the Software is
Dhruv_Varun 0:7e4786a3584b 9 * furnished to do so, subject to the following conditions:
Dhruv_Varun 0:7e4786a3584b 10 *
Dhruv_Varun 0:7e4786a3584b 11 * The above copyright notice and this permission notice shall be included in
Dhruv_Varun 0:7e4786a3584b 12 * all copies or substantial portions of the Software.
Dhruv_Varun 0:7e4786a3584b 13 *
Dhruv_Varun 0:7e4786a3584b 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Dhruv_Varun 0:7e4786a3584b 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Dhruv_Varun 0:7e4786a3584b 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Dhruv_Varun 0:7e4786a3584b 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Dhruv_Varun 0:7e4786a3584b 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Dhruv_Varun 0:7e4786a3584b 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Dhruv_Varun 0:7e4786a3584b 20 * THE SOFTWARE.
Dhruv_Varun 0:7e4786a3584b 21 */
Dhruv_Varun 0:7e4786a3584b 22
Dhruv_Varun 0:7e4786a3584b 23 #ifndef MBED_ID12RFID_H
Dhruv_Varun 0:7e4786a3584b 24 #define MBED_ID12RFID_H
Dhruv_Varun 0:7e4786a3584b 25
Dhruv_Varun 0:7e4786a3584b 26 #include "mbed.h"
Dhruv_Varun 0:7e4786a3584b 27
Dhruv_Varun 0:7e4786a3584b 28 /** An interface for the ID-12 RFID reader device
Dhruv_Varun 0:7e4786a3584b 29 *
Dhruv_Varun 0:7e4786a3584b 30 * @code
Dhruv_Varun 0:7e4786a3584b 31 * // Print RFID tag numbers
Dhruv_Varun 0:7e4786a3584b 32 *
Dhruv_Varun 0:7e4786a3584b 33 * #include "mbed.h"
Dhruv_Varun 0:7e4786a3584b 34 * #include "ID12RFID.h"
Dhruv_Varun 0:7e4786a3584b 35 *
Dhruv_Varun 0:7e4786a3584b 36 * ID12RFID rfid(p10); // serial rx
Dhruv_Varun 0:7e4786a3584b 37 *
Dhruv_Varun 0:7e4786a3584b 38 * int main() {
Dhruv_Varun 0:7e4786a3584b 39 * while(1) {
Dhruv_Varun 0:7e4786a3584b 40 * if(rfid.readable()) {
Dhruv_Varun 0:7e4786a3584b 41 * printf("RFID Tag number : %d\n", rfid.read());
Dhruv_Varun 0:7e4786a3584b 42 * }
Dhruv_Varun 0:7e4786a3584b 43 * }
Dhruv_Varun 0:7e4786a3584b 44 * }
Dhruv_Varun 0:7e4786a3584b 45 * @endcode
Dhruv_Varun 0:7e4786a3584b 46 */
Dhruv_Varun 0:7e4786a3584b 47 class ID12RFID {
Dhruv_Varun 0:7e4786a3584b 48
Dhruv_Varun 0:7e4786a3584b 49 public:
Dhruv_Varun 0:7e4786a3584b 50 /** Create an ID12 RFID interface, connected to the specified Serial rx port
Dhruv_Varun 0:7e4786a3584b 51 *
Dhruv_Varun 0:7e4786a3584b 52 * @param rx Recieve pin
Dhruv_Varun 0:7e4786a3584b 53 */
Dhruv_Varun 0:7e4786a3584b 54 ID12RFID(PinName rx);
Dhruv_Varun 0:7e4786a3584b 55
Dhruv_Varun 0:7e4786a3584b 56 /** Non blocking function to determine if an ID has been received
Dhruv_Varun 0:7e4786a3584b 57 *
Dhruv_Varun 0:7e4786a3584b 58 * @return Non zero value when the device is readable
Dhruv_Varun 0:7e4786a3584b 59 */
Dhruv_Varun 0:7e4786a3584b 60 int readable();
Dhruv_Varun 0:7e4786a3584b 61
Dhruv_Varun 0:7e4786a3584b 62 /** A blocking function that will return a tag ID when available
Dhruv_Varun 0:7e4786a3584b 63 *
Dhruv_Varun 0:7e4786a3584b 64 * @return The ID tag value
Dhruv_Varun 0:7e4786a3584b 65 */
Dhruv_Varun 0:7e4786a3584b 66 int read();
Dhruv_Varun 0:7e4786a3584b 67
Dhruv_Varun 0:7e4786a3584b 68 private:
Dhruv_Varun 0:7e4786a3584b 69 Serial _rfid;
Dhruv_Varun 0:7e4786a3584b 70
Dhruv_Varun 0:7e4786a3584b 71 };
Dhruv_Varun 0:7e4786a3584b 72
Dhruv_Varun 0:7e4786a3584b 73 #endif