1 /* librfid - core reader handling
2 * (C) 2005-2006 by Harald Welte <laforge@gnumonks.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <librfid/rfid.h>
24 #include <librfid/rfid_reader.h>
25 #include <librfid/rfid_reader_cm5121.h>
26 #include <librfid/rfid_reader_openpcd.h>
28 static const struct rfid_reader *rfid_readers[] = {
30 [RFID_READER_CM5121] = &rfid_reader_cm5121,
32 [RFID_READER_OPENPCD] = &rfid_reader_openpcd,
35 struct rfid_reader_handle *
36 rfid_reader_open(void *data, unsigned int id)
38 const struct rfid_reader *p;
40 if (id >= ARRAY_SIZE(rfid_readers)) {
41 DEBUGP("unable to find matching reader\n");
53 rfid_reader_transceive(struct rfid_reader_handle *rh,
54 enum rfid_frametype frametype,
55 const unsigned char *tx_buf, unsigned int len,
56 unsigned char *rx_buf, unsigned int *rx_len,
57 u_int64_t timeout, unsigned int flags)
59 return rh->reader->transceive(rh, frametype, tx_buf, len, rx_buf,
60 rx_len, timeout, flags);
64 rfid_reader_close(struct rfid_reader_handle *rh)
66 rh->reader->close(rh);