From 7e7af773ea286618bdce0d55f109508f3e065493 Mon Sep 17 00:00:00 2001 From: Kari Haapalehto Date: Mon, 10 Dec 2018 15:29:33 +0200 Subject: [PATCH 1/2] 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 From 8de7a36061902cd379c22cb9e18ca1cb39e73594 Mon Sep 17 00:00:00 2001 From: Mel W Date: Wed, 12 Dec 2018 11:38:10 +0200 Subject: [PATCH 2/2] Capitalization and punctuation --- .../source/include/enet_tasklet.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 d1db4d175f..88c42f9dc8 100644 --- a/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h +++ b/features/nanostack/mbed-mesh-api/source/include/enet_tasklet.h @@ -30,16 +30,16 @@ void enet_tasklet_init(void); /* * \brief Create network interface. * - * \param device_id registered physical device - * \return interface ID that can be used to communication with this interface + * \param device_id Registered physical device. + * \return interface ID used to communication with this interface. */ int8_t enet_tasklet_network_init(int8_t device_id); /* - * \brief Connect to ethernet network + * \brief Connect to Ethernet network. * - * \param callback to be called when network state changes - * \param nwk_interface_id to use for networking + * \param callback Call 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); @@ -47,16 +47,16 @@ int8_t enet_tasklet_connect(void (*)(mesh_connection_status_t mesh_status), int8 /* * \brief Disconnect network interface. * - * \param send_cb send possible network status change event if set to true. + * \param send_cb Send possible network status change event if set to `true`. * \return >= 0 if disconnected successfully. - * \return < 0 in case of errors + * \return < 0 if error. */ int8_t enet_tasklet_disconnect(bool send_cb); /* - * \brief callback to be called when the link state changes. + * \brief Callback to call when the link state changes. * - * \param up tells if the link is up or down + * \param up Tells if link is up or down. */ void enet_tasklet_link_state_changed(bool up);