Skip to content

Commit

Permalink
[core] Cleaned up dependencies between headers. JB#48413
Browse files Browse the repository at this point in the history
impl headers only need to be included by derived classes and unit tests.
  • Loading branch information
monich committed May 11, 2020
1 parent a30772a commit 601e807
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 45 deletions.
29 changes: 29 additions & 0 deletions core/include/nfc_target.h
Expand Up @@ -71,6 +71,15 @@ void
NfcTarget* target,
void* user_data);

typedef
void
(*NfcTargetTransmitFunc)(
NfcTarget* target,
NFC_TRANSMIT_STATUS status,
const void* data,
guint len,
void* user_data);

NfcTarget*
nfc_target_ref(
NfcTarget* target);
Expand Down Expand Up @@ -115,6 +124,26 @@ void
nfc_target_sequence_free(
NfcTargetSequence* seq); /* Since 1.0.17 */

/*
* These functions can be used for sending internal requests (e.g. presence
* check) to take advantage of queueing provided by NfcTarget:
*/

guint
nfc_target_transmit(
NfcTarget* target,
const void* data,
guint len,
NfcTargetSequence* seq,
NfcTargetTransmitFunc complete,
GDestroyNotify destroy,
void* user_data);

gboolean
nfc_target_cancel_transmit(
NfcTarget* target,
guint id);

G_END_DECLS

#endif /* NFC_TARGET_H */
Expand Down
29 changes: 0 additions & 29 deletions core/include/nfc_target_impl.h
Expand Up @@ -78,15 +78,6 @@ typedef struct nfc_target_class {
#define NFC_TARGET_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), \
NFC_TYPE_TARGET, NfcTargetClass)

typedef
void
(*NfcTargetTransmitFunc)(
NfcTarget* target,
NFC_TRANSMIT_STATUS status,
const void* data,
guint len,
void* user_data);

void
nfc_target_transmit_done(
NfcTarget* target,
Expand All @@ -102,26 +93,6 @@ void
nfc_target_gone(
NfcTarget* target);

/*
* These functions can be used for sending internal requests (e.g. presence
* check) to take advantage of queueing provided by NfcTarget:
*/

guint
nfc_target_transmit(
NfcTarget* target,
const void* data,
guint len,
NfcTargetSequence* seq,
NfcTargetTransmitFunc complete,
GDestroyNotify destroy,
void* user_data);

gboolean
nfc_target_cancel_transmit(
NfcTarget* target,
guint id);

G_END_DECLS

#endif /* NFC_TARGET_IMPL_H */
Expand Down
1 change: 1 addition & 0 deletions core/src/nfc_adapter.c
Expand Up @@ -32,6 +32,7 @@

#define GLIB_DISABLE_DEPRECATION_WARNINGS

#include "nfc_adapter_impl.h"
#include "nfc_adapter_p.h"
#include "nfc_tag_p.h"
#include "nfc_tag_t4_p.h"
Expand Down
2 changes: 1 addition & 1 deletion core/src/nfc_adapter_p.h
Expand Up @@ -35,7 +35,7 @@

#include "nfc_types_p.h"

#include <nfc_adapter_impl.h>
#include <nfc_adapter.h>

void
nfc_adapter_set_name(
Expand Down
1 change: 1 addition & 0 deletions core/src/nfc_plugin.c
Expand Up @@ -32,6 +32,7 @@

#define GLIB_DISABLE_DEPRECATION_WARNINGS

#include "nfc_plugin_impl.h"
#include "nfc_plugin_p.h"

struct nfc_plugin_priv {
Expand Down
2 changes: 1 addition & 1 deletion core/src/nfc_plugin_p.h
Expand Up @@ -35,7 +35,7 @@

#include "nfc_types_p.h"

#include <nfc_plugin_impl.h>
#include <nfc_plugin.h>

gboolean
nfc_plugin_start(
Expand Down
1 change: 1 addition & 0 deletions core/src/nfc_plugins.c
Expand Up @@ -32,6 +32,7 @@

#include "nfc_plugin_p.h"
#include "nfc_plugins.h"
#include "nfc_version.h"
#include "nfc_log.h"

#include <gutil_strv.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/nfc_target.c
Expand Up @@ -32,8 +32,8 @@

#define GLIB_DISABLE_DEPRECATION_WARNINGS

#include "nfc_target_impl.h"
#include "nfc_target_p.h"
#include "nfc_tag.h"
#include "nfc_log.h"

#include <gutil_misc.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/nfc_target_p.h
Expand Up @@ -35,7 +35,7 @@

#include "nfc_types_p.h"

#include <nfc_target_impl.h>
#include <nfc_target.h>

void
nfc_target_deactivate(
Expand Down
5 changes: 3 additions & 2 deletions unit/core_adapter/test_core_adapter.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "test_target.h"

#include "nfc_adapter_p.h"
#include "nfc_adapter_impl.h"
#include "nfc_target_impl.h"
#include "nfc_tag_t2.h"

Expand Down
5 changes: 3 additions & 2 deletions unit/core_plugin/test_core_plugin.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -32,6 +32,7 @@

#include "test_common.h"

#include "nfc_plugin_impl.h"
#include "nfc_plugin_p.h"

#include <gutil_log.h>
Expand Down
5 changes: 3 additions & 2 deletions unit/core_tag/test_core_tag.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -35,6 +35,7 @@

#include "nfc_tag_p.h"
#include "nfc_target_p.h"
#include "nfc_target_impl.h"

#include <gutil_log.h>

Expand Down
6 changes: 3 additions & 3 deletions unit/core_tag_t2/test_core_tag_t2.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -35,7 +35,7 @@
#include "nfc_ndef.h"
#include "nfc_tag_p.h"
#include "nfc_tag_t2.h"
#include "nfc_target_p.h"
#include "nfc_target_impl.h"

#include <gutil_log.h>
#include <gutil_misc.h>
Expand Down
2 changes: 1 addition & 1 deletion unit/core_tag_t4/test_core_tag_t4.c
Expand Up @@ -35,7 +35,7 @@
#include "nfc_ndef.h"
#include "nfc_tag_p.h"
#include "nfc_tag_t4_p.h"
#include "nfc_target_p.h"
#include "nfc_target_impl.h"

#include <gutil_log.h>

Expand Down
1 change: 1 addition & 0 deletions unit/core_target/test_core_target.c
Expand Up @@ -34,6 +34,7 @@

#include "nfc_tag_p.h"
#include "nfc_target_p.h"
#include "nfc_target_impl.h"

#include <gutil_log.h>

Expand Down
@@ -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 BSD license as follows:
*
Expand Down Expand Up @@ -40,6 +40,7 @@
#include "internal/nfc_manager_i.h"
#include "nfc_plugins.h"
#include "nfc_adapter_p.h"
#include "nfc_adapter_impl.h"
#include "nfc_target_impl.h"
#include "nfc_tag.h"

Expand Down

0 comments on commit 601e807

Please sign in to comment.