summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2011-05-09 16:22:56 +0200
committerMarcel Holtmann <marcel@holtmann.org>2011-10-20 23:54:03 -0700
commit77db47d9600ae7adef86fb50c1c4cc417449a1ad (patch)
treec3a9fe2a99d4942663521ad7c659eb9764121732 /include
parent195d467ea9e33eece729e1a8eaa252f833e9bd0e (diff)
downloadneard-77db47d9600ae7adef86fb50c1c4cc417449a1ad.tar.gz
neard-77db47d9600ae7adef86fb50c1c4cc417449a1ad.tar.bz2
neard-77db47d9600ae7adef86fb50c1c4cc417449a1ad.zip
tag: Update NDEF reading API
Diffstat (limited to 'include')
-rw-r--r--include/ndef.h45
-rw-r--r--include/tag.h6
2 files changed, 49 insertions, 2 deletions
diff --git a/include/ndef.h b/include/ndef.h
new file mode 100644
index 0000000..f0565f2
--- /dev/null
+++ b/include/ndef.h
@@ -0,0 +1,45 @@
+/*
+ *
+ * neard - Near Field Communication manager
+ *
+ * Copyright (C) 2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __NEAR_NDEF_H
+#define __NEAR_NDEF_H
+
+struct near_ndef_record {
+ uint8_t tnf;
+ uint8_t type_length;
+ uint8_t payload[];
+};
+
+struct near_ndef {
+ uint32_t n_records;
+ struct near_ndef_record *records;
+};
+
+uint8_t near_ndef_record_tnf(struct near_ndef_record *ndef);
+
+uint8_t *near_ndef_record_type(struct near_ndef_record *ndef,
+ uint8_t *type_length);
+uint8_t *near_ndef_record_id(struct near_ndef *ndef,
+ uint8_t *id_length);
+uint8_t *near_ndef_record_payload(struct near_ndef *ndef,
+ uint8_t *payload_length);
+
+#endif
diff --git a/include/tag.h b/include/tag.h
index b254fcb..47c44f8 100644
--- a/include/tag.h
+++ b/include/tag.h
@@ -26,6 +26,8 @@
#include <glib.h>
+#include <near/ndef.h>
+
#define NEAR_TAG_NFC_TYPE1 0x1
#define NEAR_TAG_NFC_TYPE2 0x2
#define NEAR_TAG_NFC_TYPE3 0x4
@@ -36,8 +38,8 @@
struct near_tag_driver {
uint16_t type;
- int (*read)(uint32_t adapter_idx, uint32_t target_idx,
- void *buf, size_t length);
+ struct near_ndef *
+ (*read_ndef)(uint32_t adapter_idx, uint32_t target_idx);
};
int near_tag_driver_register(struct near_tag_driver *driver);