From 35ce1e5ff3f6c3877c503847f39981ca508e6980 Mon Sep 17 00:00:00 2001 From: Kari Haapalehto Date: Mon, 10 Dec 2018 15:29:33 +0200 Subject: [PATCH] Modify enet_tasklet.h Change enet_tasklet_network_init() and enet_tasklet_disconnect() declarations to match code. Also add document enet_tasklet.h functions --- .../source/NanostackEthernetInterface.cpp | 3 +- .../mbed-mesh-api/source/ethernet_tasklet.c | 1 + .../source/include/enet_tasklet.h | 36 +++++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/source/NanostackEthernetInterface.cpp b/features/nanostack/mbed-mesh-api/source/NanostackEthernetInterface.cpp index a502b86886..15757ff8af 100644 --- a/features/nanostack/mbed-mesh-api/source/NanostackEthernetInterface.cpp +++ b/features/nanostack/mbed-mesh-api/source/NanostackEthernetInterface.cpp @@ -97,6 +97,5 @@ nsapi_error_t NanostackEthernetInterface::do_initialize() nsapi_error_t Nanostack::EthernetInterface::bringdown() { - enet_tasklet_disconnect(); - return 0; + return enet_tasklet_disconnect(true); } diff --git a/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c b/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c index 7f9dfc68ae..39ba1068ed 100644 --- a/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/ethernet_tasklet.c @@ -24,6 +24,7 @@ #include "ns_event_loop.h" #include "mesh_interface_types.h" #include "eventOS_event.h" +#include "enet_tasklet.h" // For tracing we need to define flag, have include and define group #include "ns_trace.h" diff --git a/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h b/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h index e04752856e..d1db4d175f 100644 --- a/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h +++ b/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h @@ -22,10 +22,42 @@ extern "C" { #endif +/* + * \brief Initialize system. + */ void enet_tasklet_init(void); -uint8_t enet_tasklet_network_init(int8_t); + +/* + * \brief Create network interface. + * + * \param device_id registered physical device + * \return interface ID that can be used to communication with this interface + */ +int8_t enet_tasklet_network_init(int8_t device_id); + +/* + * \brief Connect to ethernet network + * + * \param callback to be called when network state changes + * \param nwk_interface_id to use for networking + * + */ int8_t enet_tasklet_connect(void (*)(mesh_connection_status_t mesh_status), int8_t nwk_interface_id); -void enet_tasklet_disconnect(); + +/* + * \brief Disconnect network interface. + * + * \param send_cb send possible network status change event if set to true. + * \return >= 0 if disconnected successfully. + * \return < 0 in case of errors + */ +int8_t enet_tasklet_disconnect(bool send_cb); + +/* + * \brief callback to be called when the link state changes. + * + * \param up tells if the link is up or down + */ void enet_tasklet_link_state_changed(bool up); #ifdef __cplusplus