tag: Initial implementation
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 29 Apr 2011 16:42:29 +0000 (18:42 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 21 Oct 2011 06:54:02 +0000 (23:54 -0700)
Makefile.am
include/tag.h [new file with mode: 0644]
src/tag.c [new file with mode: 0644]

index a5c8ea2..06c136b 100644 (file)
@@ -3,7 +3,7 @@ AM_MAKEFLAGS = --no-print-directory
 
 includedir = @includedir@/near
 
-noinst_HEADERS = include/dbus.h include/types.h
+noinst_HEADERS = include/dbus.h include/types.h include/tag.h
 
 local_headers = $(foreach file,$(include_HEADERS) $(nodist_include_HEADERS) \
                        $(noinst_HEADERS), include/near/$(notdir $(file)))
@@ -21,7 +21,7 @@ libexec_PROGRAMS = src/neard
 src_neard_SOURCES = $(gdbus_sources) $(gweb_sources) $(builtin_sources) \
                        src/main.c src/error.c src/near.h src/log.h src/log.c \
                        src/dbus.c src/manager.c src/adapter.c src/target.c \
-                       src/netlink.c
+                       src/tag.c src/netlink.c
 
 src_neard_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @NETLINK_LIBS@ -lresolv -ldl
 
diff --git a/include/tag.h b/include/tag.h
new file mode 100644 (file)
index 0000000..98eb466
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ *
+ *  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_TAG_H
+#define __NEAR_TAG_H
+
+#define        NEAR_TAG_NFC_TYPE1   0x1
+#define        NEAR_TAG_NFC_TYPE2   0x2
+#define        NEAR_TAG_NFC_TYPE3   0x4
+#define        NEAR_TAG_NFC_TYPE4   0x8
+#define        NEAR_TAG_NFC_DEP     0x10
+#define        NEAR_TAG_NFC_UNKNOWN 0xff
+
+struct near_tag_driver {
+       near_uint16_t type;
+
+       int (*read)(guint32 adapter_idx, void *buf, size_t length);
+};
+
+int near_tag_driver_register(struct near_tag_driver *driver);
+int near_tag_driver_unregister(struct near_tag_driver *driver);
+
+#endif
diff --git a/src/tag.c b/src/tag.c
new file mode 100644 (file)
index 0000000..c230b2e
--- /dev/null
+++ b/src/tag.c
@@ -0,0 +1,62 @@
+/*
+ *
+ *  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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <glib.h>
+
+#include <gdbus.h>
+
+#include "near.h"
+
+static GList *driver_list = NULL;
+
+int near_tag_driver_register(struct near_tag_driver *driver)
+{
+       DBG("");
+
+       driver_list = g_list_append(driver_list, driver);
+
+       return 0;
+}
+
+int near_tag_driver_unregister(struct near_tag_driver *driver)
+{
+       DBG("");
+
+       driver_list = g_list_remove(driver_list, driver);
+
+       return 0;
+}
+
+#if 0
+int near_tag_read(guint32 adapter_idx, void *buf, size_t length)
+{
+       return 0;
+}
+
+#endif