From: Samuel Ortiz Date: Fri, 29 Apr 2011 16:42:29 +0000 (+0200) Subject: tag: Initial implementation X-Git-Tag: 0.1~183 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b404ed1bea04c050023cf770e3fe126e422ad9c4;p=platform%2Fupstream%2Fneard.git tag: Initial implementation --- diff --git a/Makefile.am b/Makefile.am index a5c8ea2..06c136b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 index 0000000..98eb466 --- /dev/null +++ b/include/tag.h @@ -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 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 +#endif + +#include +#include +#include + +#include + +#include + +#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