samples: mgmt: mcumgr: smp_svr: Removed un-needed UDP file
UDP configuration has now moved to the transport, thus this file is no longer needed or used. Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
parent
3210541c86
commit
445117bb72
2 changed files with 0 additions and 50 deletions
|
@ -14,4 +14,3 @@ project(smp_svr)
|
||||||
|
|
||||||
target_sources(app PRIVATE src/main.c)
|
target_sources(app PRIVATE src/main.c)
|
||||||
target_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_BT app PRIVATE src/bluetooth.c)
|
target_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_BT app PRIVATE src/bluetooth.c)
|
||||||
target_sources_ifdef(CONFIG_MCUMGR_TRANSPORT_UDP app PRIVATE src/udp.c)
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Prevas A/S
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/net/net_mgmt.h>
|
|
||||||
#include <zephyr/net/net_event.h>
|
|
||||||
#include <zephyr/net/net_conn_mgr.h>
|
|
||||||
#include <zephyr/mgmt/mcumgr/transport/smp_udp.h>
|
|
||||||
|
|
||||||
#define LOG_LEVEL LOG_LEVEL_DBG
|
|
||||||
#include <zephyr/logging/log.h>
|
|
||||||
LOG_MODULE_REGISTER(smp_udp_sample);
|
|
||||||
|
|
||||||
#define EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)
|
|
||||||
|
|
||||||
static struct net_mgmt_event_callback mgmt_cb;
|
|
||||||
|
|
||||||
static void event_handler(struct net_mgmt_event_callback *cb,
|
|
||||||
uint32_t mgmt_event, struct net_if *iface)
|
|
||||||
{
|
|
||||||
if ((mgmt_event & EVENT_MASK) != mgmt_event) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mgmt_event == NET_EVENT_L4_CONNECTED) {
|
|
||||||
LOG_INF("Network connected");
|
|
||||||
|
|
||||||
if (smp_udp_open() < 0) {
|
|
||||||
LOG_ERR("could not open smp udp");
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mgmt_event == NET_EVENT_L4_DISCONNECTED) {
|
|
||||||
LOG_INF("Network disconnected");
|
|
||||||
smp_udp_close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void start_smp_udp(void)
|
|
||||||
{
|
|
||||||
net_mgmt_init_event_callback(&mgmt_cb, event_handler, EVENT_MASK);
|
|
||||||
net_mgmt_add_event_callback(&mgmt_cb);
|
|
||||||
net_conn_mgr_resend_status();
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue