From f0d7e205ffadf0dadcd523ae3f7982911d9ff893 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Fri, 8 Mar 2019 16:17:57 +0200 Subject: [PATCH] Update nanostack-interface error mapping Use status NSAPI_ERROR_PARAMETER instead of NSAPI_ERROR_UNSUPPORTED when error is caused by parameter. --- features/nanostack/nanostack-interface/Nanostack.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/features/nanostack/nanostack-interface/Nanostack.cpp b/features/nanostack/nanostack-interface/Nanostack.cpp index 8c070b660c..bb76f4e1db 100644 --- a/features/nanostack/nanostack-interface/Nanostack.cpp +++ b/features/nanostack/nanostack-interface/Nanostack.cpp @@ -114,7 +114,7 @@ nsapi_error_t map_mesh_error(mesh_error_t err) case MESH_ERROR_MEMORY: return NSAPI_ERROR_NO_MEMORY; case MESH_ERROR_PARAM: - return NSAPI_ERROR_UNSUPPORTED; + return NSAPI_ERROR_PARAMETER; case MESH_ERROR_STATE: return NSAPI_ERROR_DEVICE_ERROR; default: @@ -664,7 +664,7 @@ out: nsapi_size_or_error_t Nanostack::socket_sendto(void *handle, const SocketAddress &address, const void *data, nsapi_size_t size) { if (address.get_ip_version() != NSAPI_IPv6) { - return NSAPI_ERROR_UNSUPPORTED; + return NSAPI_ERROR_PARAMETER; } ns_address_t ns_address; @@ -736,7 +736,7 @@ nsapi_error_t Nanostack::socket_bind(void *handle, const SocketAddress &address) addr_field = &ns_in6addr_any; break; default: - return NSAPI_ERROR_UNSUPPORTED; + return NSAPI_ERROR_PARAMETER; } NanostackLockGuard lock; @@ -874,7 +874,7 @@ nsapi_error_t Nanostack::socket_connect(void *handle, const SocketAddress &addr) NanostackLockGuard lock; if (addr.get_ip_version() != NSAPI_IPv6) { - ret = NSAPI_ERROR_UNSUPPORTED; + ret = NSAPI_ERROR_PARAMETER; goto out; } @@ -1006,3 +1006,4 @@ OnboardNetworkStack &OnboardNetworkStack::get_default_instance() return Nanostack::get_instance(); } #endif +