Commit 12f2b0bf authored by Slava Monich's avatar Slava Monich

[nfcd] NFC-DEP support. JB#49576

parent 1d4726ec
......@@ -8,7 +8,7 @@
# Required packages
#
PKGS = libglibutil glib-2.0 gobject-2.0
PKGS = libglibutil glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0
#
# Default target
......@@ -32,14 +32,28 @@ SRC = \
nfc_adapter.c \
nfc_crc.c \
nfc_core.c \
nfc_initiator.c \
nfc_llc.c \
nfc_llc_io.c \
nfc_llc_io_initiator.c \
nfc_llc_io_target.c \
nfc_llc_param.c \
nfc_locale.c \
nfc_manager.c \
nfc_ndef_rec.c \
nfc_ndef_rec_sp.c \
nfc_ndef_rec_u.c \
nfc_ndef_rec_t.c \
nfc_peer.c \
nfc_peer_connection.c \
nfc_peer_initiator.c \
nfc_peer_service.c \
nfc_peer_services.c \
nfc_peer_socket.c \
nfc_peer_target.c \
nfc_plugins.c \
nfc_plugin.c \
nfc_snep_server.c \
nfc_tag.c \
nfc_tag_t2.c \
nfc_tag_t4.c \
......
......@@ -54,7 +54,7 @@ struct nfc_adapter {
NFC_MODE supported_modes;
NFC_MODE mode_requested;
NFC_MODE mode;
gboolean target_present;
gboolean target_present; /* Presence of anything, actually */
};
GType nfc_adapter_get_type(void) NFCD_EXPORT;
......@@ -75,6 +75,13 @@ void
NfcTag* tag,
void* user_data);
typedef
void
(*NfcAdapterPeerFunc)(
NfcAdapter* adapter,
NfcPeer* peer,
void* user_data); /* Since 1.1.0 */
NfcAdapter*
nfc_adapter_ref(
NfcAdapter* adapter)
......@@ -97,6 +104,11 @@ nfc_adapter_request_mode(
NFC_MODE mode)
NFCD_EXPORT;
NfcPeer**
nfc_adapter_peers(
NfcAdapter* adapter) /* Since 1.1.0 */
NFCD_EXPORT;
NfcTag*
nfc_adapter_add_tag_t2(
NfcAdapter* adapter,
......@@ -140,6 +152,44 @@ nfc_adapter_remove_tag(
const char* name)
NFCD_EXPORT;
NfcPeer*
nfc_adapter_add_peer_initiator_a(
NfcAdapter* adapter,
NfcTarget* target,
const NfcParamPollA* tech_param,
const NfcParamNfcDepInitiator* nfc_dep_param) /* Since 1.1.0 */
NFCD_EXPORT;
NfcPeer*
nfc_adapter_add_peer_initiator_f(
NfcAdapter* adapter,
NfcTarget* target,
const NfcParamPollF* tech_param,
const NfcParamNfcDepInitiator* nfc_dep_param) /* Since 1.1.0 */
NFCD_EXPORT;
NfcPeer*
nfc_adapter_add_peer_target_a(
NfcAdapter* adapter,
NfcInitiator* initiator,
const NfcParamListenA* tech_param,
const NfcParamNfcDepTarget* nfc_dep_param) /* Since 1.1.0 */
NFCD_EXPORT;
NfcPeer*
nfc_adapter_add_peer_target_f(
NfcAdapter* adapter,
NfcInitiator* initiator,
const NfcParamListenF* tech_param,
const NfcParamNfcDepTarget* nfc_dep_param) /* Since 1.1.0 */
NFCD_EXPORT;
void
nfc_adapter_remove_peer(
NfcAdapter* adapter,
const char* name) /* Since 1.1.0 */
NFCD_EXPORT;
gulong
nfc_adapter_add_target_presence_handler(
NfcAdapter* adapter,
......@@ -161,6 +211,20 @@ nfc_adapter_add_tag_removed_handler(
void* user_data)
NFCD_EXPORT;
gulong
nfc_adapter_add_peer_added_handler(
NfcAdapter* adapter,
NfcAdapterPeerFunc func,
void* user_data) /* Since 1.1.0 */
NFCD_EXPORT;
gulong
nfc_adapter_add_peer_removed_handler(
NfcAdapter* adapter,
NfcAdapterPeerFunc func,
void* user_data) /* Since 1.1.0 */
NFCD_EXPORT;
gulong
nfc_adapter_add_powered_changed_handler(
NfcAdapter* adapter,
......
/*
* Copyright (C) 2020-2021 Jolla Ltd.
* Copyright (C) 2020-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of 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.
*/
#ifndef NFC_INITIATOR_H
#define NFC_INITIATOR_H
#include "nfc_types.h"
#include <glib-object.h>
G_BEGIN_DECLS
/* Since 1.1.0 */
typedef struct nfc_initiator_priv NfcInitiatorPriv;
struct nfc_initiator {
GObject object;
NfcInitiatorPriv* priv;
NFC_TECHNOLOGY technology;
NFC_PROTOCOL protocol;
/* This one-way flag is set to FALSE when peer goes away. */
gboolean present;
};
GType nfc_initiator_get_type(void) NFCD_EXPORT;
#define NFC_TYPE_INITIATOR (nfc_initiator_get_type())
#define NFC_INITIATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
NFC_TYPE_INITIATOR, NfcInitiator))
NfcInitiator*
nfc_initiator_ref(
NfcInitiator* initiator)
NFCD_EXPORT;
void
nfc_initiator_unref(
NfcInitiator* initiator)
NFCD_EXPORT;
G_END_DECLS
#endif /* NFC_INITIATOR_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
/*
* Copyright (C) 2020-2021 Jolla Ltd.
* Copyright (C) 2020-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of 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.
*/
#ifndef NFC_INITIATOR_IMPL_H
#define NFC_INITIATOR_IMPL_H
#include "nfc_initiator.h"
/* Internal API for use by NfcInitiator implemenations */
G_BEGIN_DECLS
/* Since 1.1.0 */
typedef struct nfc_initiator_class {
GObjectClass parent;
/* Base class makes sure that there are no overlapping responses.
* When transmission completes, nfc_initiator_response_sent() is called
* by the derived class. */
gboolean (*respond)(NfcInitiator* initiator, const void* data, guint len);
/* This should deactivate the initiator. When the initiator gets
* deactivated, subclass calls nfc_initiator_gone() to update the
* 'present' flag. */
void (*deactivate)(NfcInitiator* initiator);
/* These base implementation emits signal, must always be called. */
void (*gone)(NfcInitiator* initiator);
/* Padding for future expansion */
void (*_reserved1)(void);
void (*_reserved2)(void);
void (*_reserved3)(void);
void (*_reserved4)(void);
void (*_reserved5)(void);
void (*_reserved6)(void);
void (*_reserved7)(void);
void (*_reserved8)(void);
void (*_reserved9)(void);
void (*_reserved10)(void);
} NfcInitiatorClass;
#define NFC_INITIATOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), \
NFC_TYPE_INITIATOR, NfcInitiatorClass)
/*
* Normally it goes like this:
*
* 1. Data is coming in. Derived class calls nfc_initiator_transmit()
* 2. Base class issues a signal passing in NfcTransmission object
* 3. Transmission handler does whatever and calls nfc_transmission_respond()
* That translates into respond() call to the derived class.
* 4. Derived class calls nfc_initiator_response_sent() when response is sent.
* 5. At this point initiator is ready to receive a new portion of data.
*
* Now, if anything goes wrong... Basically, if anything goes wrong,
* RF interface is deactivated by invoking deactivate() callback of the
* derived class. Here is what can go wrong:
* a. No one responds to the signal at step 2.
* b. nfc_transmission_unref() is called before nfc_transmission_respond()
* in other words, transmission is received but dropped with no reply
* provided.
* c. nfc_initiator_response_sent() receives an error status at step 4.
*
* It's not quite clear what to do when the next portion of data arrives
* before we have sent a response to the previous one. Even though it
* shouldn't happen in real life, lower level APIs (e.g. NCI) often
* allow it. Currently it's being treated as an error (or was treated
* at the time of this writing). Let's see how it goes.
*/
void
nfc_initiator_transmit(
NfcInitiator* initiator,
const void* data,
guint len)
NFCD_EXPORT;
void
nfc_initiator_response_sent(
NfcInitiator* initiator,
NFC_TRANSMIT_STATUS status)
NFCD_EXPORT;
void
nfc_initiator_gone(
NfcInitiator* initiator)
NFCD_EXPORT;
G_END_DECLS
#endif /* NFC_INITIATOR_IMPL_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
......@@ -14,8 +14,8 @@
* 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.
* 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
......@@ -48,6 +48,8 @@ struct nfc_manager {
gboolean enabled;
gboolean stopped;
int error;
/* Since 1.1.0 */
NFC_MODE mode;
};
GType nfc_manager_get_type() NFCD_EXPORT;
......@@ -122,6 +124,18 @@ nfc_manager_request_power(
gboolean on)
NFCD_EXPORT;
gboolean
nfc_manager_register_service(
NfcManager* manager,
NfcPeerService* service) /* Since 1.1.0 */
NFCD_EXPORT;
void
nfc_manager_unregister_service(
NfcManager* manager,
NfcPeerService* service) /* Since 1.1.0 */
NFCD_EXPORT;
gulong
nfc_manager_add_adapter_added_handler(
NfcManager* manager,
......@@ -143,6 +157,13 @@ nfc_manager_add_enabled_changed_handler(
void* user_data)
NFCD_EXPORT;
gulong
nfc_manager_add_mode_changed_handler(
NfcManager* manager,
NfcManagerFunc func,
void* user_data) /* Since 1.1.0 */
NFCD_EXPORT;
gulong
nfc_manager_add_stopped_handler(
NfcManager* manager,
......@@ -166,6 +187,35 @@ nfc_manager_remove_handlers(
#define nfc_manager_remove_all_handlers(manager,ids) \
nfc_manager_remove_handlers(manager, ids, G_N_ELEMENTS(ids))
/*
* Plugins can ask NfcManager to enable and/or disable certain NFC modes.
* The last submitted request takes precedence, i.e. if first a request
* is submitted to enable certain mode and then another another request
* to disable the same mode, the mode remains enabled until the first
* request is dropped.
*
* If the same bits are set in both enable and disable masks, the enabling
* bits take precedence. If both are zero, nfc_manager_mode_request_new()
* returns NULL which is tolerated by nfc_manager_mode_request_free()
*
* Note that each NfcModeRequest carries an implicit reference to NfcManager.
*/
typedef struct nfc_mode_request NfcModeRequest; /* Since 1.1.0 */
NfcModeRequest*
nfc_manager_mode_request_new(
NfcManager* manager,
NFC_MODE enable,
NFC_MODE disable) /* Since 1.1.0 */
G_GNUC_WARN_UNUSED_RESULT
NFCD_EXPORT;
void
nfc_manager_mode_request_free(
NfcModeRequest* req) /* Since 1.1.0 */
NFCD_EXPORT;
G_END_DECLS
#endif /* NFC_MANAGER_H */
......
/*
* Copyright (C) 2020-2021 Jolla Ltd.
* Copyright (C) 2020-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of 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.
*/
#ifndef NFC_PEER_H
#define NFC_PEER_H
#include "nfc_types.h"
#include <glib-object.h>
G_BEGIN_DECLS
/* Since 1.1.0 */
typedef struct nfc_peer_priv NfcPeerPriv;
typedef enum nfc_peer_flags {
NFC_PEER_FLAGS_NONE = 0x00,
NFC_PEER_FLAG_INITIALIZED = 0x01,
NFC_PEER_FLAG_INITIATOR = 0x02
} NFC_PEER_FLAGS;
struct nfc_peer {
GObject object;
NfcPeerPriv* priv;
const char* name;
gboolean present;
NFC_TECHNOLOGY technology;
NFC_PEER_FLAGS flags;
guint wks; /* Remote Well-Known Services (mask) */
NfcNdefRec* ndef; /* Received via SNEP */
};
GType nfc_peer_get_type(void) NFCD_EXPORT;
#define NFC_TYPE_PEER (nfc_peer_get_type())
#define NFC_IS_PEER(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, NFC_TYPE_PEER)
#define NFC_PEER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), NFC_TYPE_PEER, \
NfcPeer))
/*
* NFC-DEP Initiator and Target parameters.
* Contain relevant parts of ATR_RES/ATR_REQ (General bytes, what else?).
*
* NFCForum-TS-LLCP_1.1
* 6.2.3.1 Link Activation procedure for the Initiator
* 6.2.3.2 Link Activation procedure for the Target
*/
struct nfc_param_nfc_dep_initator {
GUtilData atr_res_g; /* ATR_RES General Bytes */
};
struct nfc_param_nfc_dep_target {
GUtilData atr_req_g; /* ATR_REQ General Bytes */
};
typedef
void
(*NfcPeerFunc)(
NfcPeer* peer,
void* user_data);
gulong
nfc_peer_add_initialized_handler(
NfcPeer* peer,
NfcPeerFunc func,
void* user_data)
NFCD_EXPORT;
NfcPeer*
nfc_peer_ref(
NfcPeer* peer)
NFCD_EXPORT;
void
nfc_peer_unref(
NfcPeer* peer)
NFCD_EXPORT;
void
nfc_peer_deactivate(
NfcPeer* peer)
NFCD_EXPORT;
gulong
nfc_peer_add_wks_changed_handler(
NfcPeer* peer,
NfcPeerFunc func,
void* user_data)
NFCD_EXPORT;
gulong
nfc_peer_add_ndef_changed_handler(
NfcPeer* peer,
NfcPeerFunc func,
void* user_data)
NFCD_EXPORT;
gulong
nfc_peer_add_initialized_handler(
NfcPeer* peer,
NfcPeerFunc func,
void* user_data)
NFCD_EXPORT;
gulong
nfc_peer_add_gone_handler(
NfcPeer* peer,
NfcPeerFunc func,
void* user_data)
NFCD_EXPORT;
void
nfc_peer_remove_handler(
NfcPeer* peer,
gulong id)
NFCD_EXPORT;
void
nfc_peer_remove_handlers(
NfcPeer* peer,
gulong* ids,
guint count)
NFCD_EXPORT;
#define nfc_peer_remove_all_handlers(peer,ids) \
nfc_peer_remove_handlers(peer, ids, G_N_ELEMENTS(ids))
gboolean
nfc_peer_register_service(
NfcPeer* peer,
NfcPeerService* service)
NFCD_EXPORT;
void
nfc_peer_unregister_service(
NfcPeer* peer,
NfcPeerService* service)
NFCD_EXPORT;
/*
* Functions below return a NfcPeerConnection pointer, not a reference.
* In other words, if the caller needs to keep this pointer, it needs
* to add its own reference. If is only guaranteed that this pointer
* stays alive until return to the event loop, or until the next call
* to NFC core, whichever happens first.
*/
typedef
void
(*NfcPeerConnectFunc)(
NfcPeer* peer,
NfcPeerConnection* connection,
NFC_PEER_CONNECT_RESULT result,
void* user_data);
NfcPeerConnection*
nfc_peer_connect(
NfcPeer* peer,
NfcPeerService* service,
guint rsap,
NfcPeerConnectFunc complete,
GDestroyNotify destroy,
void* user_data)
NFCD_EXPORT;
NfcPeerConnection*
nfc_peer_connect_sn(
NfcPeer* peer,
NfcPeerService* service,
const char* sn,
NfcPeerConnectFunc complete,
GDestroyNotify destroy,
void* user_data)
NFCD_EXPORT;
G_END_DECLS
#endif /* NFC_PEER_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
/*
* Copyright (C) 2020-2021 Jolla Ltd.
* Copyright (C) 2020-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of 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.
*/
#ifndef NFC_PEER_CONNECTION_H
#define NFC_PEER_CONNECTION_H
#include "nfc_types.h"
#include <glib-object.h>
G_BEGIN_DECLS
/* Since 1.1.0 */
typedef enum nfc_llc_co_state {
NFC_LLC_CO_CONNECTING, /* CONNECT sent, waiting for CC */
NFC_LLC_CO_ACCEPTING, /* CONNECT received, CC not sent */
NFC_LLC_CO_ABANDONED, /* CONNECT sent, will disconnect */
NFC_LLC_CO_ACTIVE, /* Connection established */
NFC_LLC_CO_DISCONNECTING, /* DISC sent, waiting for DM */
NFC_LLC_CO_DEAD /* Final state */
} NFC_LLC_CO_STATE;
typedef struct nfc_peer_connection_priv NfcPeerConnectionPriv;
struct nfc_peer_connection {
GObject object;
NfcPeerConnectionPriv* priv;
NfcPeerService* service; /* Local service */
NFC_LLC_CO_STATE state; /* Connection state */
const char* name; /* Remote service name, if known */
gsize bytes_queued; /* Bytes currently queued */
guint64 bytes_sent; /* Bytes sent (passed to LLCP level) */
guint64 bytes_received; /* Bytes received */
guint8 rsap; /* Remote SAP */
};
GType nfc_peer_connection_get_type(void) NFCD_EXPORT;