Code clean, move definition for internal data struct and cleanup headers.
Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
#include <stdbool.h>
#include <aitt_c.h>
+#include "nnstreamer-edge-aitt.h"
#include "nnstreamer-edge-data.h"
#include "nnstreamer-edge-event.h"
-#include "nnstreamer-edge-internal.h"
#include "nnstreamer-edge-util.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
+/**
+ * @brief Internal data structure for the header of the serialzied edge data.
+ */
+typedef struct
+{
+ uint32_t num_mem;
+ nns_size_t data_len[NNS_EDGE_DATA_LIMIT];
+ nns_size_t meta_len;
+} nns_edge_data_header_s;
+
+/**
+ * @brief Internal data structure for edge data.
+ */
+typedef struct
+{
+ uint32_t magic;
+ pthread_mutex_t lock;
+ uint32_t num;
+ nns_edge_raw_data_s data[NNS_EDGE_DATA_LIMIT];
+ nns_edge_metadata_h metadata;
+} nns_edge_data_s;
+
/**
* @brief Create nnstreamer edge data.
*/
#define __NNSTREAMER_EDGE_DATA_H__
#include "nnstreamer-edge.h"
-#include "nnstreamer-edge-internal.h"
#include "nnstreamer-edge-metadata.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-/**
- * @brief Internal data structure for edge data.
- */
-typedef struct {
- uint32_t magic;
- pthread_mutex_t lock;
- uint32_t num;
- nns_edge_raw_data_s data[NNS_EDGE_DATA_LIMIT];
- nns_edge_metadata_h metadata;
-} nns_edge_data_s;
-
-/**
- * @brief Internal data structure for the header of the serialzied edge data.
- */
-typedef struct {
- uint32_t num_mem;
- nns_size_t data_len[NNS_EDGE_DATA_LIMIT];
- nns_size_t meta_len;
-} nns_edge_data_header_s;
-
/**
* @brief Internal wrapper function of the nns_edge_data_destory() to avoid build warning of the incompatibe type casting. (See nns_edge_data_destroy_cb())
*/
#include "nnstreamer-edge-data.h"
#include "nnstreamer-edge-event.h"
-#include "nnstreamer-edge-internal.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
+/**
+ * @brief Internal data structure for edge event.
+ */
+typedef struct
+{
+ uint32_t magic;
+ nns_edge_event_e event;
+ nns_edge_raw_data_s data;
+} nns_edge_event_s;
+
/**
* @brief Internal util function to invoke event callback.
*/
#include "nnstreamer-edge-event.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
-#include "nnstreamer-edge-internal.h"
+#include "nnstreamer-edge-queue.h"
+#include "nnstreamer-edge-aitt.h"
+#include "nnstreamer-edge-mqtt.h"
#ifndef PTHREAD_CREATE_JOINABLE
#define PTHREAD_CREATE_JOINABLE 0
#define N_BACKLOG 10
#define DEFAULT_TIMEOUT_SEC 10
+/**
+ * @brief Data structure for edge handle.
+ */
+typedef struct
+{
+ uint32_t magic;
+ pthread_mutex_t lock;
+ char *id;
+ char *topic;
+ nns_edge_connect_type_e connect_type;
+ char *host; /**< host name or IP address */
+ int port; /**< port number (0~65535, default 0 to get available port.) */
+ char *dest_host; /**< destination IP address (broker or target device) */
+ int dest_port; /**< destination port number (broker or target device) */
+ nns_edge_node_type_e node_type;
+ nns_edge_metadata_h metadata;
+
+ /* Edge event callback and user data */
+ nns_edge_event_cb event_cb;
+ void *user_data;
+
+ int64_t client_id;
+ char *caps_str;
+
+ /* list of connection data */
+ void *connections;
+
+ /* socket listener */
+ bool listening;
+ int listener_fd;
+ pthread_t listener_thread;
+
+ /* thread and queue to send data */
+ nns_edge_queue_h send_queue;
+ pthread_t send_thread;
+
+ /* MQTT or AITT handle */
+ void *broker_h;
+} nns_edge_handle_s;
+
/**
* @brief enum for nnstreamer edge query commands.
*/
+++ /dev/null
-/* SPDX-License-Identifier: Apache-2.0 */
-/**
- * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
- *
- * @file nnstreamer-edge-internal.h
- * @date 11 May 2022
- * @brief Internal functions and definition to support communication among devices.
- * @see https://github.com/nnstreamer/nnstreamer
- * @author Gichan Jang <gichan2.jang@samsung.com>
- * @bug No known bugs except for NYI items
- * @note This file is internal header for nnstreamer edge. DO NOT export this file.
- */
-
-#ifndef __NNSTREAMER_EDGE_INTERNAL_H__
-#define __NNSTREAMER_EDGE_INTERNAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include "nnstreamer-edge.h"
-#include "nnstreamer-edge-metadata.h"
-#include "nnstreamer-edge-aitt.h"
-#include "nnstreamer-edge-mqtt.h"
-#include "nnstreamer-edge-queue.h"
-
-/**
- * @brief Internal data structure for raw data.
- */
-typedef struct {
- void *data;
- nns_size_t data_len;
- nns_edge_data_destroy_cb destroy_cb;
-} nns_edge_raw_data_s;
-
-/**
- * @brief Internal data structure for edge event.
- */
-typedef struct {
- uint32_t magic;
- nns_edge_event_e event;
- nns_edge_raw_data_s data;
-} nns_edge_event_s;
-
-/**
- * @brief Data structure for edge handle.
- */
-typedef struct {
- uint32_t magic;
- pthread_mutex_t lock;
- char *id;
- char *topic;
- nns_edge_connect_type_e connect_type;
- char *host; /**< host name or IP address */
- int port; /**< port number (0~65535, default 0 to get available port.) */
- char *dest_host; /**< destination IP address (broker or target device) */
- int dest_port; /**< destination port number (broker or target device) */
- nns_edge_node_type_e node_type;
- nns_edge_metadata_h metadata;
-
- /* Edge event callback and user data */
- nns_edge_event_cb event_cb;
- void *user_data;
-
- int64_t client_id;
- char *caps_str;
-
- /* list of connection data */
- void *connections;
-
- /* socket listener */
- bool listening;
- int listener_fd;
- pthread_t listener_thread;
-
- /* thread and queue to send data */
- nns_edge_queue_h send_queue;
- pthread_t send_thread;
-
- /* MQTT or AITT handle */
- void *broker_h;
-} nns_edge_handle_s;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __NNSTREAMER_EDGE_INTERNAL_H__ */
#endif
#include <mosquitto.h>
-#include "nnstreamer-edge-internal.h"
+#include "nnstreamer-edge-mqtt.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
#include "nnstreamer-edge-queue.h"
#endif
#include <MQTTAsync.h>
-#include "nnstreamer-edge-internal.h"
+#include "nnstreamer-edge-mqtt.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
#include "nnstreamer-edge-queue.h"
* @bug No known bugs except for NYI items.
*/
-#include "nnstreamer-edge-internal.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-queue.h"
#include "nnstreamer-edge-util.h"
#define nns_edge_cond_timedwait(h,t) do { pthread_cond_timedwait (&(h)->cond, &(h)->lock, (t)); } while (0)
#define nns_edge_cond_signal(h) do { pthread_cond_signal (&(h)->cond); } while (0)
+/**
+ * @brief Internal data structure for raw data.
+ */
+typedef struct {
+ void *data;
+ nns_size_t data_len;
+ nns_edge_data_destroy_cb destroy_cb;
+} nns_edge_raw_data_s;
+
/**
* @brief Generate client ID.
*/
#include <gtest/gtest.h>
#include "nnstreamer-edge.h"
-#include "nnstreamer-edge-internal.h"
+#include "nnstreamer-edge-aitt.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
#include "nnstreamer-edge-data.h"
#include "nnstreamer-edge-event.h"
#include "nnstreamer-edge-metadata.h"
-#include "nnstreamer-edge-internal.h"
+#include "nnstreamer-edge-mqtt.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"
#include "nnstreamer-edge-queue.h"