[-]
[+]
|
Changed |
_service:tar_git:libnciplugin.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/libnciplugin.git</param>
<param name="branch">master</param>
- <param name="revision">1.0.2</param>
+ <param name="revision">1.0.7</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:libnciplugin-1.0.2.tar.bz2/debian/libnciplugin-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libnciplugin.so usr/lib
-include/*.h usr/include/nciplugin
-build/libnciplugin.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:libnciplugin-1.0.2.tar.bz2/debian/libnciplugin.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libnciplugin.so.* usr/lib
|
[-]
[+]
|
Deleted |
_service:tar_git:libnciplugin-1.0.2.tar.bz2/include/nci_adapter.h
^
|
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
- *
- * You may use this file under the terms of the BSD license as follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation
- * are those of the authors and should not be interpreted as representing
- * any official policies, either expressed or implied.
- */
-
-#ifndef NCI_ADAPTER_H
-#define NCI_ADAPTER_H
-
-#include <nci_plugin_types.h>
-
-G_BEGIN_DECLS
-
-NfcAdapter*
-nci_adapter_new(
- NciCore* nci);
-
-G_END_DECLS
-
-#endif /* NCI_ADAPTER_H */
-
-/*
- * Local Variables:
- * mode: C
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/.gitignore
^
|
@@ -4,6 +4,7 @@
debian/libnciplugin-dev
debian/*.debhelper.log
debian/*.debhelper
+debian/*.install
debian/*.substvars
debian/tmp
documentation.list
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/LICENSE
^
|
@@ -1,7 +1,7 @@
-Copyright (C) 2018-2019 Jolla Ltd.
-Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2019-2020 Jolla Ltd.
+Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
-You may use this file under the terms of BSD license as follows:
+You may use this file under the terms of the BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -10,20 +10,25 @@
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
3. Neither the names of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation
+are those of the authors and should not be interpreted as representing
+any official policies, either expressed or implied.
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/Makefile
^
|
@@ -34,7 +34,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 2
+VERSION_RELEASE = 7
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -75,10 +75,7 @@
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -154,6 +151,7 @@
rm -fr debian/tmp debian/lib$(NAME) debian/lib$(NAME)-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -f debian/*.install
$(BUILD_DIR):
mkdir -p $@
@@ -206,8 +204,19 @@
$(RELEASE_BUILD_DIR)/$(LIB_SYMLINK2): $(RELEASE_LIB)
ln -sf $(LIB) $@
-$(PKGCONFIG): $(LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+#
+# LIBDIR usually gets substituted with arch specific dir.
+# It's relative in deb build and can be whatever in rpm build.
+#
+
+LIBDIR ?= usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
+$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
+
+debian/%.install: debian/%.install.in
+ sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@
#
# Install
@@ -217,9 +226,9 @@
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m 644
-INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
+INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
-INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
+INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
install: $(INSTALL_LIB_DIR)
$(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR)
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/changelog
^
|
@@ -1,3 +1,34 @@
+libnciplugin (1.0.7) unstable; urgency=low
+
+ * Respect arch specific lib dir
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 02 Jul 2020 17:15:12 +0300
+
+libnciplugin (1.0.6) unstable; urgency=low
+
+ * Allow ISO-DEP response to be empty
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 29 Apr 2020 20:50:00 +0300
+
+libnciplugin (1.0.5) unstable; urgency=low
+
+ * Removed unused header nci_adapter.h
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 08 Apr 2020 13:47:46 +0300
+
+libnciplugin (1.0.4) unstable; urgency=low
+
+ * Implement reactivation API
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 25 Feb 2020 18:16:49 +0200
+
+libnciplugin (1.0.3) unstable; urgency=low
+
+ * Correctly cancel presence check
+ * Ignore known Glib deprecation warnings
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 23 Feb 2020 04:15:39 +0200
+
libnciplugin (1.0.2) unstable; urgency=low
* Virtualize completion of transmission
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil-dev, libncicore-dev
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil-dev, libncicore-dev
Standards-Version: 3.8.4
Package: libnciplugin
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/copyright
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2019 Jolla Ltd.
-Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2019-2020 Jolla Ltd.
+Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Added |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/libnciplugin-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libnciplugin.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libnciplugin.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include
|
[-]
[+]
|
Added |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/libnciplugin.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libnciplugin.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/debian/rules
^
|
@@ -4,8 +4,13 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_auto_build:
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libnciplugin.install debian/libnciplugin-dev.install
+
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
%:
dh $@
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/include/nci_adapter_impl.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -38,7 +38,7 @@
#define NCI_PLUGIN_H
#include <nfc_adapter_impl.h>
-#include <nci_types.h>
+#include <nci_plugin_types.h>
G_BEGIN_DECLS
@@ -50,12 +50,12 @@
typedef struct nci_adapter_priv NciAdapterPriv;
-typedef struct nci_adapter {
+struct nci_adapter {
NfcAdapter parent;
NfcTarget* target;
NciAdapterPriv* priv;
NciCore* nci;
-} NciAdapter;
+};
typedef struct nci_adapter_class {
NfcAdapterClass parent;
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/include/nci_plugin_types.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -41,6 +41,8 @@
G_BEGIN_DECLS
+typedef struct nci_adapter NciAdapter;
+
/* Logging */
#define NCI_PLUGIN_LOG_MODULE nci_plugin_log
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/libnciplugin.pc.in
^
|
@@ -1,10 +1,10 @@
name=nciplugin
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libnciplugin
Description: Support library for NCI-based nfcd plugins
-Version: [version]
+Version: @version@
Requires.private: glib-2.0 gio-2.0 libglibutil libncicore
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/${name}
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/src/nci_adapter.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -35,6 +35,8 @@
* any official policies, either expressed or implied.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "nci_adapter_impl.h"
#include "nci_plugin_p.h"
#include "nci_plugin_log.h"
@@ -46,6 +48,8 @@
#include <nci_core.h>
+#include <gutil_macros.h>
+
GLOG_MODULE_DEFINE("nciplugin");
/* NCI core events */
@@ -56,6 +60,14 @@
CORE_EVENT_COUNT
};
+typedef struct nci_adapter_intf_info {
+ NCI_RF_INTERFACE rf_intf;
+ NCI_PROTOCOL protocol;
+ NCI_MODE mode;
+ GUtilData mode_param;
+ GUtilData activation_param;
+} NciAdapterIntfInfo;
+
struct nci_adapter_priv {
gulong nci_event_id[CORE_EVENT_COUNT];
NFC_MODE desired_mode;
@@ -64,6 +76,8 @@
guint mode_check_id;
guint presence_check_id;
guint presence_check_timer;
+ NciAdapterIntfInfo* active_intf;
+ gboolean reactivating;
};
G_DEFINE_ABSTRACT_TYPE(NciAdapter, nci_adapter, NFC_TYPE_ADAPTER)
@@ -77,6 +91,64 @@
* Implementation
*==========================================================================*/
+#define nci_adapter_intf_info_free(x) g_free(x)
+
+static
+NciAdapterIntfInfo*
+nci_adapter_intf_info_new(
+ const NciIntfActivationNtf* ntf)
+{
+ if (ntf) {
+ /* Allocate the whole thing from a single memory block */
+ const gsize total = G_ALIGN8(sizeof(NciAdapterIntfInfo)) +
+ G_ALIGN8(ntf->mode_param_len) + ntf->activation_param_len;
+ NciAdapterIntfInfo* info = g_malloc(total);
+ guint8* ptr = (guint8*)info;
+
+ info->rf_intf = ntf->rf_intf;
+ info->protocol = ntf->protocol;
+ info->mode = ntf->mode;
+ ptr += G_ALIGN8(sizeof(NciAdapterIntfInfo));
+
+ info->mode_param.size = ntf->mode_param_len;
+ if (ntf->mode_param_len) {
+ info->mode_param.bytes = ptr;
+ memcpy(ptr, ntf->mode_param_bytes, ntf->mode_param_len);
+ ptr += G_ALIGN8(ntf->mode_param_len);
+ } else {
+ info->mode_param.bytes = NULL;
+ }
+
+ info->activation_param.size = ntf->activation_param_len;
+ if (ntf->activation_param_len) {
+ info->activation_param.bytes = ptr;
+ memcpy(ptr, ntf->activation_param_bytes, ntf->activation_param_len);
+ } else {
+ info->activation_param.bytes = NULL;
+ }
+ return info;
+ }
+ return NULL;
+}
+
+static
+gboolean
+nci_adapter_intf_info_matches(
+ const NciAdapterIntfInfo* info,
+ const NciIntfActivationNtf* ntf)
+{
+ return info &&
+ info->rf_intf == ntf->rf_intf &&
+ info->protocol == ntf->protocol &&
+ info->mode == ntf->mode &&
+ info->mode_param.size == ntf->mode_param_len &&
+ (!ntf->mode_param_len || !memcmp(info->mode_param.bytes,
+ ntf->mode_param_bytes, ntf->mode_param_len)) &&
+ info->activation_param.size == ntf->activation_param_len &&
+ (!ntf->activation_param_len || !memcmp(info->activation_param.bytes,
+ ntf->activation_param_bytes, ntf->activation_param_len));
+}
+
static
void
nci_adapter_drop_target(
@@ -88,14 +160,19 @@
NciAdapterPriv* priv = self->priv;
self->target = NULL;
+ priv->reactivating = FALSE;
if (priv->presence_check_timer) {
g_source_remove(priv->presence_check_timer);
priv->presence_check_timer = 0;
}
if (priv->presence_check_id) {
- nci_core_cancel(self->nci, priv->presence_check_id);
+ nfc_target_cancel_transmit(target, priv->presence_check_id);
priv->presence_check_id = 0;
}
+ if (priv->active_intf) {
+ nci_adapter_intf_info_free(priv->active_intf);
+ priv->active_intf = NULL;
+ }
GINFO("Target is gone");
nfc_target_gone(target);
nfc_target_unref(target);
@@ -115,7 +192,7 @@
GDEBUG("Presence check %s", ok ? "ok" : "failed");
priv->presence_check_id = 0;
if (!ok) {
- nci_core_set_state(self->nci, NCI_RFST_DISCOVERY);
+ nci_adapter_deactivate(self, target);
}
}
@@ -228,6 +305,71 @@
}
static
+NfcTag*
+nci_adapter_create_known_tag(
+ NciAdapter* self,
+ const NciIntfActivationNtf* ntf)
+{
+ const NciModeParam* mp = ntf->mode_param; /* Caller checked it for NULL */
+ NfcParamPollA poll_a;
+ NfcParamPollB poll_b;
+
+ /* Figure out what kind of target we are dealing with */
+ switch (ntf->mode) {
+ case NCI_MODE_PASSIVE_POLL_A:
+ switch (ntf->rf_intf) {
+ case NCI_RF_INTERFACE_FRAME:
+ /* Type 2 Tag */
+ return nfc_adapter_add_tag_t2(NFC_ADAPTER(self), self->target,
+ nci_adapter_convert_poll_a(&poll_a, &mp->poll_a));
+ case NCI_RF_INTERFACE_ISO_DEP:
+ /* ISO-DEP Type 4A */
+ if (ntf->activation_param) {
+ const NciActivationParam* ap = ntf->activation_param;
+ NfcParamIsoDepPollA iso_dep_poll_a;
+
+ return nfc_adapter_add_tag_t4a(NFC_ADAPTER(self),
+ self->target, nci_adapter_convert_poll_a
+ (&poll_a, &mp->poll_a),
+ nci_adapter_convert_iso_dep_poll_a
+ (&iso_dep_poll_a, &ap->iso_dep_poll_a));
+ }
+ break;
+ case NCI_RF_INTERFACE_NFCEE_DIRECT:
+ case NCI_RF_INTERFACE_NFC_DEP:
+ case NCI_RF_INTERFACE_PROPRIETARY:
+ break;
+ }
+ break;
+ case NCI_MODE_PASSIVE_POLL_B:
+ switch (ntf->rf_intf) {
+ case NCI_RF_INTERFACE_ISO_DEP:
+ /* ISO-DEP Type 4B */
+ return nfc_adapter_add_tag_t4b(NFC_ADAPTER(self), self->target,
+ nci_adapter_convert_poll_b(&poll_b, &mp->poll_b), NULL);
+ case NCI_RF_INTERFACE_FRAME:
+ case NCI_RF_INTERFACE_NFCEE_DIRECT:
+ case NCI_RF_INTERFACE_NFC_DEP:
+ case NCI_RF_INTERFACE_PROPRIETARY:
+ break;
+ }
+ break;
+ case NCI_MODE_ACTIVE_POLL_A:
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/src/nci_plugin_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -47,18 +47,30 @@
gboolean ok,
void* user_data);
-G_GNUC_INTERNAL
NfcTarget*
nci_target_new(
- NciCore* nci,
- const NciIntfActivationNtf* ntf);
+ NciAdapter* adapter,
+ const NciIntfActivationNtf* ntf)
+ G_GNUC_INTERNAL;
-G_GNUC_INTERNAL
guint
nci_target_presence_check(
NfcTarget* target,
NciTargetPresenseCheckFunc fn,
- void* user_data);
+ void* user_data)
+ G_GNUC_INTERNAL;
+
+gboolean
+nci_adapter_reactivate(
+ NciAdapter* adapter,
+ NfcTarget* target)
+ G_GNUC_INTERNAL;
+
+void
+nci_adapter_deactivate(
+ NciAdapter* adapter,
+ NfcTarget* target)
+ G_GNUC_INTERNAL;
#endif /* NCI_PLUGIN_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libnciplugin-1.0.7.tar.bz2/src/nci_target.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -37,6 +37,7 @@
#include "nci_plugin_p.h"
#include "nci_plugin_log.h"
+#include "nci_adapter_impl.h"
#include <nci_core.h>
@@ -73,7 +74,7 @@
struct nci_target {
NfcTarget target;
- NciCore* nci;
+ NciAdapter* adapter;
gulong event_id[EVENT_COUNT];
guint send_in_progress;
gboolean transmit_in_progress;
@@ -124,7 +125,9 @@
NciTarget* self)
{
if (self->send_in_progress) {
- nci_core_cancel(self->nci, self->send_in_progress);
+ if (self->adapter) {
+ nci_core_cancel(self->adapter->nci, self->send_in_progress);
+ }
self->send_in_progress = 0;
if (self->pending_reply) {
g_bytes_unref(self->pending_reply);
@@ -135,12 +138,18 @@
static
void
-nci_target_drop_nci(
+nci_target_drop_adapter(
NciTarget* self)
{
- nci_target_cancel_send(self);
- nci_core_remove_all_handlers(self->nci, self->event_id);
- self->nci = NULL;
+ if (self->adapter) {
+ NciAdapter* adapter = self->adapter;
+
+ nci_target_cancel_send(self);
+ nci_core_remove_all_handlers(adapter->nci, self->event_id);
+ g_object_remove_weak_pointer(G_OBJECT(adapter), (gpointer*)
+ &self->adapter);
+ self->adapter = NULL;
+ }
}
static
@@ -283,15 +292,12 @@
const guint8* payload,
guint len)
{
- if (len > 0) {
- /*
- * 8.3 ISO-DEP RF Interface
- * 8.3.1.2 Data from RF to the DH
- */
- nfc_target_transmit_done(target, NFC_TRANSMIT_STATUS_OK, payload, len);
- return TRUE;
- }
- return FALSE;
+ /*
+ * 8.3 ISO-DEP RF Interface
+ * 8.3.1.2 Data from RF to the DH
+ */
+ nfc_target_transmit_done(target, NFC_TRANSMIT_STATUS_OK, payload, len);
+ return TRUE;
}
/*==========================================================================*
@@ -300,7 +306,7 @@
NfcTarget*
nci_target_new(
- NciCore* nci,
+ NciAdapter* adapter,
const NciIntfActivationNtf* ntf)
{
NciTarget* self = g_object_new(PN547_NFC_TYPE_TARGET, NULL);
@@ -371,9 +377,11 @@
break;
}
- self->nci = nci;
- self->event_id[EVENT_DATA_PACKET] = nci_core_add_data_packet_handler(nci,
- nci_target_data_packet_handler, self);
+ self->adapter = adapter;
+ g_object_add_weak_pointer(G_OBJECT(adapter), (gpointer*)&self->adapter);
+ self->event_id[EVENT_DATA_PACKET] =
+ nci_core_add_data_packet_handler(adapter->nci,
+ nci_target_data_packet_handler, self);
return target;
}
@@ -412,13 +420,14 @@
guint len)
{
NciTarget* self = NCI_TARGET(target);
+ NciAdapter* adapter = self->adapter;
GASSERT(!self->send_in_progress);
GASSERT(!self->transmit_in_progress);
- if (self->nci) {
+ if (adapter) {
GBytes* bytes = g_bytes_new(data, len);
- self->send_in_progress = nci_core_send_data_msg(self->nci,
+ self->send_in_progress = nci_core_send_data_msg(adapter->nci,
NCI_STATIC_RF_CONN_ID, bytes, nci_target_data_sent,
NULL, self);
g_bytes_unref(bytes);
@@ -446,9 +455,7 @@
nci_target_deactivate(
NfcTarget* target)
{
- NciTarget* self = NCI_TARGET(target);
-
- nci_core_set_state(self->nci, NCI_RFST_IDLE);
+ nci_adapter_deactivate(NCI_TARGET(target)->adapter, target);
}
static
@@ -456,10 +463,20 @@
nci_target_gone(
NfcTarget* target)
{
- nci_target_drop_nci(NCI_TARGET(target));
+ nci_target_drop_adapter(NCI_TARGET(target));
NFC_TARGET_CLASS(nci_target_parent_class)->gone(target);
}
+static
+gboolean
+nci_target_reactivate(
+ NfcTarget* target)
+{
+ NciTarget* self = NCI_TARGET(target);
+
+ return self->adapter && nci_adapter_reactivate(self->adapter, target);
+}
+
/*==========================================================================*
* Internals
*==========================================================================*/
@@ -476,9 +493,7 @@
nci_target_finalize(
GObject* object)
{
- NciTarget* self = NCI_TARGET(object);
-
- nci_target_drop_nci(self);
+ nci_target_drop_adapter(NCI_TARGET(object));
G_OBJECT_CLASS(nci_target_parent_class)->finalize(object);
}
@@ -492,6 +507,7 @@
klass->transmit = nci_target_transmit;
klass->cancel_transmit = nci_target_cancel_transmit;
klass->gone = nci_target_gone;
+ klass->reactivate = nci_target_reactivate;
}
/*
|