mbed-mesh-api: Add API set_file_system_root_path

pull/11181/head
Arto Kinnunen 2019-08-09 16:06:19 +03:00
parent 774162dd83
commit f8289ec0ac
5 changed files with 41 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
* Copyright (c) 2016-2019 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@ -132,9 +132,19 @@ public:
*/
virtual nsapi_error_t set_blocking(bool blocking);
/** Set file system root path.
*
* Set file system root path that stack will use to write and read its data.
* Setting root_path to NULL will disable file system usage.
*
* @param root_path Address to NUL-terminated root-path string or NULL to disable file system usage.
* @return MESH_ERROR_NONE on success, MESH_ERROR_MEMORY in case of memory failure, MESH_ERROR_UNKNOWN in case of other error.
*/
virtual nsapi_error_t set_file_system_root_path(const char *root_path);
/** Get the interface ID
/return Interface identifier
*/
* @return Interface identifier
*/
int8_t get_interface_id() const
{
return _interface->get_interface_id();

View File

@ -75,7 +75,7 @@ public:
* Function can be called several times if intermediate certificates are used. Then each call to the function
* adds a certificate reference to own certificate chain. Certificates are in bottom up order i.e. the top certificate is given last.
*
* Function must be called before connecting the device i.e before first call to connect() method.
* Function must be called before connecting the device i.e before call to connect() method.
* Function will not copy certificate or key, therefore addresses must remain valid.
*
* \param cert Certificate address.
@ -91,7 +91,7 @@ public:
/**
* \brief Remove own certificates from the Wi-SUN network.
*
* Function must be called before connecting the device i.e before first call to connect() method.
* Function must be called before connecting the device i.e before call to connect() method.
*
* \return MESH_ERROR_NONE on success.
* \return MESH_ERROR_STATE if method is called after calling connect().
@ -103,7 +103,7 @@ public:
*
* Function can be called several times. Certificates are in bottom up order i.e. the top certificate is given last.
*
* Function must be called before connecting the device i.e before first call to connect() method.
* Function must be called before connecting the device i.e before call to connect() method.
* Function will not copy certificate, therefore addresses must remain valid.
*
* \param cert Certificate address.
@ -117,7 +117,7 @@ public:
/**
* \brief Remove trusted certificates from the Wi-SUN network.
*
* Function must be called before connecting the device i.e before first call to connect() method.
* Function must be called before connecting the device i.e before call to connect() method.
*
* \return MESH_ERROR_NONE on success.
* \return MESH_ERROR_STATE if method is called after calling connect().

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 ARM Limited. All rights reserved.
* Copyright (c) 2016-2019 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@ -217,6 +217,19 @@ nsapi_error_t InterfaceNanostack::set_blocking(bool blocking)
return NSAPI_ERROR_OK;
}
nsapi_error_t InterfaceNanostack::set_file_system_root_path(const char *root_path)
{
int status = mesh_system_set_file_system_root_path(root_path);
if (status == 0) {
return MESH_ERROR_NONE;
} else if (status == -2) {
return MESH_ERROR_MEMORY;
}
return MESH_ERROR_UNKNOWN;
}
#if !DEVICE_802_15_4_PHY
MBED_WEAK MeshInterface *MeshInterface::get_target_default_instance()
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 ARM Limited. All rights reserved.
* Copyright (c) 2015-2019 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@ -38,6 +38,8 @@ enum {
*/
void mesh_system_send_connect_event(uint8_t receiver);
int mesh_system_set_file_system_root_path(const char *root_path);
/*
* \brief Initialize mesh system.
* Memory pool, timers, traces and support are initialized.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 ARM Limited. All rights reserved.
* Copyright (c) 2015-2019 ARM Limited. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@ -25,6 +25,7 @@
#include "include/mesh_system.h"
#include "mbed_assert.h"
#include "mbed_error.h"
#include "ns_file_system.h"
// For tracing we need to define flag, have include and define group
#define HAVE_DEBUG 1
#include "ns_trace.h"
@ -77,3 +78,8 @@ void mesh_system_send_connect_event(uint8_t receiver)
};
eventOS_event_send(&event);
}
int mesh_system_set_file_system_root_path(const char *root_path)
{
return ns_file_system_set_root_path(root_path);
}