mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'fix_astyle_error' of ssh://github.com/0xc0170/mbed-os into rollup-b.1
commit
5c1c7bf71f
|
@ -16,6 +16,7 @@ hal/storage_abstraction
|
|||
TESTS/mbed_hal/trng/pithy
|
||||
features/nanostack/coap-service
|
||||
features/nanostack/sal-stack-nanostack
|
||||
features/nanostack/targets
|
||||
rtos/TARGET_CORTEX/rtx5
|
||||
TESTS/mbed_hal/trng/pithy
|
||||
targets
|
||||
|
|
|
@ -132,7 +132,9 @@ matrix:
|
|||
- git diff --name-only $TRAVIS_BRANCH | grep '.*\.\(h\|c\|hpp\|cpp\)' | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-files-changed.out;
|
||||
if [ $(cat astyle-files-changed.out | grep Formatted | wc -l) -ne 0 ]; then
|
||||
git --no-pager diff;
|
||||
echo "Please fix style issues as shown above";
|
||||
echo "";
|
||||
echo "AStyle check failed, please fix style issues as shown above";
|
||||
(exit 1);
|
||||
else
|
||||
echo "Coding style check OK";
|
||||
fi
|
||||
|
@ -155,7 +157,6 @@ matrix:
|
|||
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") files)"
|
||||
fi
|
||||
- bash -c "$STATUS" success "$STATUSM"
|
||||
|
||||
- env:
|
||||
- NAME=events
|
||||
- EVENTS=events
|
||||
|
|
|
@ -26,7 +26,8 @@ class stubInternetSocket : public InternetSocket {
|
|||
protected:
|
||||
nsapi_error_t return_value;
|
||||
public:
|
||||
stubInternetSocket() {
|
||||
stubInternetSocket()
|
||||
{
|
||||
return_value = 0;
|
||||
}
|
||||
virtual nsapi_error_t connect(const SocketAddress &address)
|
||||
|
|
|
@ -26,7 +26,8 @@ public:
|
|||
std::list<nsapi_error_t> return_values;
|
||||
nsapi_error_t return_value;
|
||||
|
||||
NetworkStackstub() {
|
||||
NetworkStackstub()
|
||||
{
|
||||
return_value = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,10 @@ public:
|
|||
|
||||
/** Desctruct QSPIFBlockDevie
|
||||
*/
|
||||
~QSPIFBlockDevice() {deinit();}
|
||||
~QSPIFBlockDevice()
|
||||
{
|
||||
deinit();
|
||||
}
|
||||
|
||||
/** Read blocks from a block device
|
||||
*
|
||||
|
|
|
@ -266,8 +266,11 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
template <typename T, typename R, typename ...Args>
|
||||
int call(T *obj, R (T::*method)(Args ...args), Args ...args);
|
||||
// *INDENT-ON*
|
||||
|
||||
/** Calls an event on the queue after a specified delay
|
||||
*
|
||||
|
@ -346,8 +349,11 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
template <typename T, typename R, typename ...Args>
|
||||
int call_in(int ms, T *obj, R (T::*method)(Args ...args), Args ...args);
|
||||
// *INDENT-ON*
|
||||
|
||||
/** Calls an event on the queue periodically
|
||||
*
|
||||
|
@ -440,8 +446,11 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
template <typename T, typename R, typename ...Args>
|
||||
int call_every(int ms, T *obj, R (T::*method)(Args ...args), Args ...args);
|
||||
// *INDENT-ON*
|
||||
|
||||
/** Creates an event bound to the event queue
|
||||
*
|
||||
|
@ -483,8 +492,11 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
template <typename R, typename ...BoundArgs, typename ...Args>
|
||||
Event<void(Args...)> event(R (*func)(BoundArgs...), Args ...args);
|
||||
// *INDENT-ON*
|
||||
|
||||
/** Creates an event bound to the event queue
|
||||
*
|
||||
|
@ -528,8 +540,11 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
template <typename T, typename R, typename ...BoundArgs, typename ...ContextArgs, typename ...Args>
|
||||
Event<void(Args...)> event(T *obj, R (T::*method)(BoundArgs..., Args...), ContextArgs ...context_args);
|
||||
// *INDENT-ON*
|
||||
|
||||
/** Creates an event bound to the event queue
|
||||
*
|
||||
|
|
|
@ -32,7 +32,10 @@ public:
|
|||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
||||
virtual nsapi_connection_status_t get_connection_status() const;
|
||||
|
||||
void get_mac_address(uint8_t *buf) const { interface_phy.get_mac_address(buf); }
|
||||
void get_mac_address(uint8_t *buf) const
|
||||
{
|
||||
interface_phy.get_mac_address(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Callback from C-layer
|
||||
|
@ -40,15 +43,24 @@ public:
|
|||
* */
|
||||
void network_handler(mesh_connection_status_t status);
|
||||
|
||||
int8_t get_interface_id() const { return interface_id; }
|
||||
int8_t get_driver_id() const { return _device_id; }
|
||||
int8_t get_interface_id() const
|
||||
{
|
||||
return interface_id;
|
||||
}
|
||||
int8_t get_driver_id() const
|
||||
{
|
||||
return _device_id;
|
||||
}
|
||||
|
||||
private:
|
||||
NanostackPhy &interface_phy;
|
||||
protected:
|
||||
Interface(NanostackPhy &phy);
|
||||
virtual nsapi_error_t register_phy();
|
||||
NanostackPhy &get_phy() const { return interface_phy; }
|
||||
NanostackPhy &get_phy() const
|
||||
{
|
||||
return interface_phy;
|
||||
}
|
||||
int8_t interface_id;
|
||||
int8_t _device_id;
|
||||
rtos::Semaphore connect_semaphore;
|
||||
|
@ -62,7 +74,10 @@ protected:
|
|||
class Nanostack::MeshInterface : public Nanostack::Interface {
|
||||
protected:
|
||||
MeshInterface(NanostackRfPhy &phy) : Interface(phy) { }
|
||||
NanostackRfPhy &get_phy() const { return static_cast<NanostackRfPhy &>(Interface::get_phy()); }
|
||||
NanostackRfPhy &get_phy() const
|
||||
{
|
||||
return static_cast<NanostackRfPhy &>(Interface::get_phy());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -116,12 +131,18 @@ public:
|
|||
/** Get the interface ID
|
||||
/return Interface identifier
|
||||
*/
|
||||
int8_t get_interface_id() const { return _interface->get_interface_id(); }
|
||||
int8_t get_interface_id() const
|
||||
{
|
||||
return _interface->get_interface_id();
|
||||
}
|
||||
|
||||
protected:
|
||||
InterfaceNanostack();
|
||||
virtual Nanostack *get_stack(void);
|
||||
Nanostack::Interface *get_interface() const { return _interface; }
|
||||
Nanostack::Interface *get_interface() const
|
||||
{
|
||||
return _interface;
|
||||
}
|
||||
virtual nsapi_error_t do_initialize() = 0;
|
||||
|
||||
Nanostack::Interface *_interface;
|
||||
|
@ -147,7 +168,10 @@ public:
|
|||
protected:
|
||||
MeshInterfaceNanostack() : _phy(NULL) { }
|
||||
MeshInterfaceNanostack(NanostackRfPhy *phy) : _phy(phy) { }
|
||||
Nanostack::MeshInterface *get_interface() const { return static_cast<Nanostack::MeshInterface *>(_interface); }
|
||||
Nanostack::MeshInterface *get_interface() const
|
||||
{
|
||||
return static_cast<Nanostack::MeshInterface *>(_interface);
|
||||
}
|
||||
NanostackRfPhy *_phy;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,10 @@ private:
|
|||
EthernetInterface(NanostackEthernetPhy &phy) : Interface(phy) {}
|
||||
nsapi_error_t initialize();
|
||||
protected:
|
||||
NanostackEthernetPhy &get_phy() const { return static_cast<NanostackEthernetPhy &>(Interface::get_phy()); }
|
||||
NanostackEthernetPhy &get_phy() const
|
||||
{
|
||||
return static_cast<NanostackEthernetPhy &>(Interface::get_phy());
|
||||
}
|
||||
};
|
||||
|
||||
/** Ethernet interface for Nanostack.
|
||||
|
@ -50,7 +53,10 @@ public:
|
|||
nsapi_error_t initialize(NanostackEthernetPhy *phy);
|
||||
|
||||
protected:
|
||||
Nanostack::EthernetInterface *get_interface() const { return static_cast<Nanostack::EthernetInterface *>(_interface); }
|
||||
Nanostack::EthernetInterface *get_interface() const
|
||||
{
|
||||
return static_cast<Nanostack::EthernetInterface *>(_interface);
|
||||
}
|
||||
virtual nsapi_error_t do_initialize();
|
||||
|
||||
};
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#include "ns_trace.h"
|
||||
#define TRACE_GROUP "nslp"
|
||||
|
||||
class Nanostack::LoWPANNDInterface : public Nanostack::MeshInterface
|
||||
{
|
||||
class Nanostack::LoWPANNDInterface : public Nanostack::MeshInterface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#include "arm_hal_phy.h"
|
||||
#include "EMAC.h"
|
||||
|
||||
class EMACPhy : public NanostackEthernetPhy
|
||||
{
|
||||
class EMACPhy : public NanostackEthernetPhy {
|
||||
public:
|
||||
EMACPhy(NanostackMemoryManager &mem, EMAC &m);
|
||||
virtual int8_t phy_register();
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include "mbed_assert.h"
|
||||
#include "NanostackMemoryManager.h"
|
||||
|
||||
struct ns_stack_mem_t
|
||||
{
|
||||
struct ns_stack_mem_t {
|
||||
ns_stack_mem_t *next;
|
||||
void *payload;
|
||||
uint32_t len;
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#include "ns_trace.h"
|
||||
#define TRACE_GROUP "nsth"
|
||||
|
||||
class Nanostack::ThreadInterface : public Nanostack::MeshInterface
|
||||
{
|
||||
class Nanostack::ThreadInterface : public Nanostack::MeshInterface {
|
||||
public:
|
||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||
const char *netmask, const char *gw,
|
||||
|
|
|
@ -197,10 +197,11 @@ static void enet_tasklet_poll_network_status(void *param)
|
|||
}
|
||||
} else {
|
||||
if (tasklet_data_ptr->connection_status != MESH_DISCONNECTED &&
|
||||
tasklet_data_ptr->connection_status != MESH_BOOTSTRAP_STARTED)
|
||||
tasklet_data_ptr->connection_status != MESH_BOOTSTRAP_STARTED) {
|
||||
enet_tasklet_network_state_changed(MESH_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Configure and establish network connection
|
||||
|
|
|
@ -246,12 +246,14 @@ void thread_tasklet_poll_network_status(void *param)
|
|||
}
|
||||
} else {
|
||||
if (thread_tasklet_data_ptr->connection_status != MESH_DISCONNECTED &&
|
||||
thread_tasklet_data_ptr->connection_status != MESH_BOOTSTRAP_STARTED)
|
||||
thread_tasklet_data_ptr->connection_status != MESH_BOOTSTRAP_STARTED) {
|
||||
thread_tasklet_network_state_changed(MESH_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void read_link_configuration() {
|
||||
void read_link_configuration()
|
||||
{
|
||||
|
||||
thread_tasklet_data_ptr->link_config.panId = MBED_CONF_MBED_MESH_API_THREAD_CONFIG_PANID;
|
||||
TRACE_DETAIL("PANID %x", thread_tasklet_data_ptr->link_config.panId);
|
||||
|
@ -305,8 +307,7 @@ void thread_tasklet_configure_and_connect_to_network(void)
|
|||
|
||||
if (MBED_CONF_MBED_MESH_API_THREAD_DEVICE_TYPE == MESH_DEVICE_TYPE_THREAD_MINIMAL_END_DEVICE) {
|
||||
thread_tasklet_data_ptr->operating_mode = NET_6LOWPAN_HOST;
|
||||
}
|
||||
else if (MBED_CONF_MBED_MESH_API_THREAD_DEVICE_TYPE == MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE) {
|
||||
} else if (MBED_CONF_MBED_MESH_API_THREAD_DEVICE_TYPE == MESH_DEVICE_TYPE_THREAD_SLEEPY_END_DEVICE) {
|
||||
thread_tasklet_data_ptr->operating_mode = NET_6LOWPAN_SLEEPY_HOST;
|
||||
} else {
|
||||
thread_tasklet_data_ptr->operating_mode = NET_6LOWPAN_ROUTER;
|
||||
|
|
|
@ -36,8 +36,7 @@ static const fhss_api_t *fhss_active_handle = NULL;
|
|||
static EventQueue *equeue;
|
||||
#endif
|
||||
|
||||
struct fhss_timeout_s
|
||||
{
|
||||
struct fhss_timeout_s {
|
||||
void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t);
|
||||
uint32_t start_time;
|
||||
uint32_t stop_time;
|
||||
|
|
|
@ -229,8 +229,7 @@ static int nvm_fsm_update(cs_context_t *cs_context)
|
|||
int ret_val = 0;
|
||||
|
||||
tr_debug("nvm_fsm_update() state=%d", (int)cs_context->state);
|
||||
switch (cs_context->state)
|
||||
{
|
||||
switch (cs_context->state) {
|
||||
case NVM_STATE_UNINIT_DONE:
|
||||
cs_context->client_cb(cs_context->client_status, cs_context->client_context);
|
||||
cs_context->state = NVM_STATE_NONE;
|
||||
|
|
|
@ -22,8 +22,7 @@ uint8_t buf[100];
|
|||
uint16_t buf_len;
|
||||
uint16_t data_len;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
platform_nvm_status status;
|
||||
void *ctx;
|
||||
} test_platform_nvm_api_callback_t;
|
||||
|
|
|
@ -101,8 +101,7 @@ static int32_t test_cfstore_write(ARM_CFSTORE_HANDLE hkey, const char* data, ARM
|
|||
return cfstore_stub.write_ret_val;
|
||||
}
|
||||
|
||||
ARM_CFSTORE_DRIVER cfstore_driver =
|
||||
{
|
||||
ARM_CFSTORE_DRIVER cfstore_driver = {
|
||||
.Close = test_cfstore_close,
|
||||
.Create = test_cfstore_create,
|
||||
.Delete = test_cfstore_delete,
|
||||
|
|
|
@ -17,26 +17,20 @@ void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fa
|
|||
|
||||
void *ns_dyn_mem_alloc(int16_t alloc_size)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0) {
|
||||
nsdynmemlib_stub.returnCounter--;
|
||||
return malloc(alloc_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return (nsdynmemlib_stub.expectedPointer);
|
||||
}
|
||||
}
|
||||
|
||||
void *ns_dyn_mem_temporary_alloc(int16_t alloc_size)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0)
|
||||
{
|
||||
if (nsdynmemlib_stub.returnCounter > 0) {
|
||||
nsdynmemlib_stub.returnCounter--;
|
||||
return malloc(alloc_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return (nsdynmemlib_stub.expectedPointer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ void eventOS_timeout_cancel(timeout_t *t)
|
|||
|
||||
}
|
||||
|
||||
void test_eventOS_timeout_trigger() {
|
||||
void test_eventOS_timeout_trigger()
|
||||
{
|
||||
test_callback(test_args);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,10 @@ public:
|
|||
bool open(void);
|
||||
int accept(NanostackSocket *accepted_socket, ns_address_t *addr);
|
||||
void close(void);
|
||||
bool closed(void) {return SOCKET_MODE_CLOSED == mode;}
|
||||
bool closed(void)
|
||||
{
|
||||
return SOCKET_MODE_CLOSED == mode;
|
||||
}
|
||||
bool is_connecting(void);
|
||||
void set_connecting(ns_address_t *addr);
|
||||
bool is_connected(void);
|
||||
|
@ -106,11 +109,16 @@ static NanostackSocket * socket_tbl[NS_INTERFACE_SOCKETS_MAX];
|
|||
nsapi_error_t map_mesh_error(mesh_error_t err)
|
||||
{
|
||||
switch (err) {
|
||||
case MESH_ERROR_NONE: return 0;
|
||||
case MESH_ERROR_MEMORY: return NSAPI_ERROR_NO_MEMORY;
|
||||
case MESH_ERROR_PARAM: return NSAPI_ERROR_UNSUPPORTED;
|
||||
case MESH_ERROR_STATE: return NSAPI_ERROR_DEVICE_ERROR;
|
||||
default: return NSAPI_ERROR_DEVICE_ERROR;
|
||||
case MESH_ERROR_NONE:
|
||||
return 0;
|
||||
case MESH_ERROR_MEMORY:
|
||||
return NSAPI_ERROR_NO_MEMORY;
|
||||
case MESH_ERROR_PARAM:
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
case MESH_ERROR_STATE:
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
default:
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,10 +150,12 @@ static int8_t find_interface_by_address(const uint8_t target_addr[16])
|
|||
return -1;
|
||||
}
|
||||
|
||||
void* NanostackSocket::operator new(std::size_t sz) {
|
||||
void *NanostackSocket::operator new (std::size_t sz)
|
||||
{
|
||||
return MALLOC(sz);
|
||||
}
|
||||
void NanostackSocket::operator delete(void* ptr) {
|
||||
void NanostackSocket::operator delete (void *ptr)
|
||||
{
|
||||
FREE(ptr);
|
||||
}
|
||||
|
||||
|
@ -296,7 +306,8 @@ void NanostackSocket::signal_event()
|
|||
}
|
||||
}
|
||||
|
||||
void NanostackSocket::socket_callback(void *cb) {
|
||||
void NanostackSocket::socket_callback(void *cb)
|
||||
{
|
||||
nanostack_assert_locked();
|
||||
|
||||
socket_callback_t *sock_cb = (socket_callback_t *) cb;
|
||||
|
@ -979,7 +990,8 @@ void Nanostack::socket_attach(void *handle, void (*callback)(void *), void *id)
|
|||
tr_debug("socket_attach(socket=%p) sock_id=%d", socket, socket->socket_id);
|
||||
}
|
||||
|
||||
Nanostack &Nanostack::get_instance() {
|
||||
Nanostack &Nanostack::get_instance()
|
||||
{
|
||||
static Nanostack nanostack;
|
||||
return nanostack;
|
||||
}
|
||||
|
@ -989,7 +1001,8 @@ Nanostack &Nanostack::get_instance() {
|
|||
#define NANOSTACK 0x99119911
|
||||
#if MBED_CONF_NSAPI_DEFAULT_STACK == NANOSTACK
|
||||
#undef NANOSTACK
|
||||
OnboardNetworkStack &OnboardNetworkStack::get_default_instance() {
|
||||
OnboardNetworkStack &OnboardNetworkStack::get_default_instance()
|
||||
{
|
||||
return Nanostack::get_instance();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
|
||||
class NanostackLockGuard {
|
||||
public:
|
||||
NanostackLockGuard() {
|
||||
NanostackLockGuard()
|
||||
{
|
||||
eventOS_scheduler_mutex_wait();
|
||||
}
|
||||
|
||||
~NanostackLockGuard() {
|
||||
~NanostackLockGuard()
|
||||
{
|
||||
eventOS_scheduler_mutex_release();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,12 +48,18 @@ public:
|
|||
* @return Device driver ID or a negative error
|
||||
* code on failure
|
||||
*/
|
||||
virtual int8_t phy_register() { return rf_register();}
|
||||
virtual int8_t phy_register()
|
||||
{
|
||||
return rf_register();
|
||||
}
|
||||
|
||||
/** Unregister this physical interface
|
||||
*
|
||||
*/
|
||||
virtual void unregister() { rf_unregister(); }
|
||||
virtual void unregister()
|
||||
{
|
||||
rf_unregister();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* NANOSTACK_RF_PHY_H_ */
|
||||
|
|
|
@ -78,14 +78,16 @@ static timeout_t *eventOS_timeout_at_(void (*callback)(void *), void *arg, uint3
|
|||
.data_ptr = timeout
|
||||
};
|
||||
|
||||
if (period)
|
||||
if (period) {
|
||||
storage = eventOS_event_timer_request_every(&event, period);
|
||||
else
|
||||
} else {
|
||||
storage = eventOS_event_timer_request_at(&event, at);
|
||||
}
|
||||
|
||||
timeout->event = storage;
|
||||
if (storage)
|
||||
if (storage) {
|
||||
return timeout;
|
||||
}
|
||||
FAIL:
|
||||
ns_dyn_mem_free(timeout);
|
||||
return NULL;
|
||||
|
@ -103,8 +105,9 @@ timeout_t *eventOS_timeout_every_ms(void (*callback)(void *), uint32_t every, vo
|
|||
|
||||
void eventOS_timeout_cancel(timeout_t *t)
|
||||
{
|
||||
if (!t)
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventOS_cancel(t->event);
|
||||
|
||||
|
|
|
@ -20,32 +20,69 @@
|
|||
#ifdef CELLULAR_DEVICE
|
||||
using namespace mbed;
|
||||
MBED_DEPRECATED_SINCE("mbed-os-5.9", "This API will be deprecated, use CellularBase::get_default_instance() instead.")
|
||||
class OnboardCellularInterface : public CellularBase
|
||||
{
|
||||
class OnboardCellularInterface : public CellularBase {
|
||||
public:
|
||||
OnboardCellularInterface() {
|
||||
OnboardCellularInterface()
|
||||
{
|
||||
context = CellularContext::get_default_instance();
|
||||
MBED_ASSERT(context != NULL);
|
||||
}
|
||||
public: // from NetworkInterface
|
||||
virtual nsapi_error_t set_blocking(bool blocking) {return context->set_blocking(blocking);}
|
||||
virtual NetworkStack *get_stack() {return context->get_stack();}
|
||||
virtual const char *get_ip_address() {return context->get_ip_address();}
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) {context->attach(status_cb);}
|
||||
virtual nsapi_error_t connect() {return context->connect();}
|
||||
virtual nsapi_error_t disconnect() {return context->disconnect();}
|
||||
virtual nsapi_error_t set_blocking(bool blocking)
|
||||
{
|
||||
return context->set_blocking(blocking);
|
||||
}
|
||||
virtual NetworkStack *get_stack()
|
||||
{
|
||||
return context->get_stack();
|
||||
}
|
||||
virtual const char *get_ip_address()
|
||||
{
|
||||
return context->get_ip_address();
|
||||
}
|
||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
|
||||
{
|
||||
context->attach(status_cb);
|
||||
}
|
||||
virtual nsapi_error_t connect()
|
||||
{
|
||||
return context->connect();
|
||||
}
|
||||
virtual nsapi_error_t disconnect()
|
||||
{
|
||||
return context->disconnect();
|
||||
}
|
||||
|
||||
// from CellularBase
|
||||
virtual void set_plmn(const char *plmn) {context->set_plmn(plmn);}
|
||||
virtual void set_sim_pin(const char *sim_pin) {context->set_sim_pin(sim_pin);}
|
||||
virtual void set_plmn(const char *plmn)
|
||||
{
|
||||
context->set_plmn(plmn);
|
||||
}
|
||||
virtual void set_sim_pin(const char *sim_pin)
|
||||
{
|
||||
context->set_sim_pin(sim_pin);
|
||||
}
|
||||
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0, const char *uname = 0,
|
||||
const char *pwd = 0)
|
||||
{return context->connect(sim_pin, apn, uname, pwd);}
|
||||
{
|
||||
return context->connect(sim_pin, apn, uname, pwd);
|
||||
}
|
||||
virtual void set_credentials(const char *apn, const char *uname = 0, const char *pwd = 0)
|
||||
{context->set_credentials(apn, uname, pwd);}
|
||||
virtual const char *get_netmask() {return context->get_netmask();}
|
||||
virtual const char *get_gateway() {return context->get_gateway();}
|
||||
virtual bool is_connected() {return context->is_connected();}
|
||||
{
|
||||
context->set_credentials(apn, uname, pwd);
|
||||
}
|
||||
virtual const char *get_netmask()
|
||||
{
|
||||
return context->get_netmask();
|
||||
}
|
||||
virtual const char *get_gateway()
|
||||
{
|
||||
return context->get_gateway();
|
||||
}
|
||||
virtual bool is_connected()
|
||||
{
|
||||
return context->is_connected();
|
||||
}
|
||||
|
||||
private:
|
||||
CellularContext *context;
|
||||
|
|
|
@ -39,9 +39,10 @@ namespace span_detail {
|
|||
// If From type is convertible to To type, then the compilation constant value is
|
||||
// true; otherwise, it is false.
|
||||
template<typename From, typename To>
|
||||
class is_convertible
|
||||
{
|
||||
struct true_type { char x[512]; };
|
||||
class is_convertible {
|
||||
struct true_type {
|
||||
char x[512];
|
||||
};
|
||||
struct false_type { };
|
||||
|
||||
static const From &generator();
|
||||
|
@ -293,6 +294,8 @@ struct Span {
|
|||
MBED_ASSERT(Extent == 0 || first != NULL);
|
||||
}
|
||||
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
/**
|
||||
* Construct a Span from the reference to an array.
|
||||
*
|
||||
|
@ -322,6 +325,7 @@ struct Span {
|
|||
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
|
||||
);
|
||||
}
|
||||
// *INDENT-ON*
|
||||
|
||||
/**
|
||||
* Return the size of the sequence viewed.
|
||||
|
@ -409,6 +413,8 @@ struct Span {
|
|||
return Span<element_type, Count>(_data + (Extent - Count), Count);
|
||||
}
|
||||
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
/**
|
||||
* Create a subspan that is a view of other Count elements; the view starts at
|
||||
* element Offset.
|
||||
|
@ -439,6 +445,7 @@ struct Span {
|
|||
Count == SPAN_DYNAMIC_EXTENT ? Extent - Offset : Count
|
||||
);
|
||||
}
|
||||
// *INDENT-ON*
|
||||
|
||||
/**
|
||||
* Create a new Span over the first @p count elements of the existing view.
|
||||
|
@ -579,6 +586,8 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
|
|||
MBED_ASSERT(first != NULL || (last - first) == 0);
|
||||
}
|
||||
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
/**
|
||||
* Construct a Span from the reference to an array.
|
||||
*
|
||||
|
@ -611,6 +620,7 @@ struct Span<ElementType, SPAN_DYNAMIC_EXTENT> {
|
|||
"OtherElementType(*)[] should be convertible to ElementType (*)[]"
|
||||
);
|
||||
}
|
||||
// *INDENT-ON*
|
||||
|
||||
/**
|
||||
* Return the size of the array viewed.
|
||||
|
@ -804,6 +814,8 @@ bool operator==(const Span<T, LhsExtent> &lhs, const Span<U, RhsExtent> &rhs)
|
|||
return std::equal(lhs.data(), lhs.data() + lhs.size(), rhs.data());
|
||||
}
|
||||
|
||||
// AStyle ignore, not handling correctly below
|
||||
// *INDENT-OFF*
|
||||
/**
|
||||
* Equality operation between a Span and a reference to a C++ array.
|
||||
*
|
||||
|
@ -959,7 +971,7 @@ Span<const T, Extent> make_const_Span(const T (&elements)[Extent])
|
|||
{
|
||||
return Span<const T, Extent>(elements);
|
||||
}
|
||||
|
||||
// *INDENT-ON*
|
||||
/**
|
||||
* Generate a Span to a const content from a pointer to a C/C++ array.
|
||||
*
|
||||
|
|
15
rtos/Mail.h
15
rtos/Mail.h
|
@ -96,7 +96,8 @@ public:
|
|||
*
|
||||
* @note You may call this function from ISR context.
|
||||
*/
|
||||
T* alloc(uint32_t millisec=0) {
|
||||
T *alloc(uint32_t millisec = 0)
|
||||
{
|
||||
return _pool.alloc();
|
||||
}
|
||||
|
||||
|
@ -108,7 +109,8 @@ public:
|
|||
*
|
||||
* @note You may call this function from ISR context.
|
||||
*/
|
||||
T* calloc(uint32_t millisec=0) {
|
||||
T *calloc(uint32_t millisec = 0)
|
||||
{
|
||||
return _pool.calloc();
|
||||
}
|
||||
|
||||
|
@ -120,7 +122,8 @@ public:
|
|||
*
|
||||
* @note You may call this function from ISR context.
|
||||
*/
|
||||
osStatus put(T *mptr) {
|
||||
osStatus put(T *mptr)
|
||||
{
|
||||
return _queue.put(mptr);
|
||||
}
|
||||
|
||||
|
@ -136,7 +139,8 @@ public:
|
|||
*
|
||||
* @note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
*/
|
||||
osEvent get(uint32_t millisec=osWaitForever) {
|
||||
osEvent get(uint32_t millisec = osWaitForever)
|
||||
{
|
||||
osEvent evt = _queue.get(millisec);
|
||||
if (evt.status == osEventMessage) {
|
||||
evt.status = osEventMail;
|
||||
|
@ -152,7 +156,8 @@ public:
|
|||
*
|
||||
* @note You may call this function from ISR context.
|
||||
*/
|
||||
osStatus free(T *mptr) {
|
||||
osStatus free(T *mptr)
|
||||
{
|
||||
return _pool.free(mptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,8 @@ public:
|
|||
* parameter is set to 0.
|
||||
*
|
||||
*/
|
||||
osStatus put(T* data, uint32_t millisec=0, uint8_t prio=0) {
|
||||
osStatus put(T *data, uint32_t millisec = 0, uint8_t prio = 0)
|
||||
{
|
||||
return osMessageQueuePut(_id, &data, prio, millisec);
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,8 @@ public:
|
|||
* @note You may call this function from ISR context if the millisec
|
||||
* parameter is set to 0.
|
||||
*/
|
||||
osEvent get(uint32_t millisec=osWaitForever) {
|
||||
osEvent get(uint32_t millisec = osWaitForever)
|
||||
{
|
||||
osEvent event;
|
||||
T *data = NULL;
|
||||
osStatus_t res = osMessageQueueGet(_id, &data, NULL, millisec);
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace mbed;
|
|||
static rtos::internal::SysTimer *os_timer;
|
||||
static uint64_t os_timer_data[sizeof(rtos::internal::SysTimer) / 8];
|
||||
|
||||
/// Enable System Timer.
|
||||
// Enable System Timer.
|
||||
void OS_Tick_Enable(void)
|
||||
{
|
||||
// Do not use SingletonPtr since this relies on the RTOS
|
||||
|
@ -55,19 +55,19 @@ void OS_Tick_Enable(void)
|
|||
os_timer->schedule_tick();
|
||||
}
|
||||
|
||||
/// Disable System Timer.
|
||||
// Disable System Timer.
|
||||
void OS_Tick_Disable(void)
|
||||
{
|
||||
os_timer->cancel_tick();
|
||||
}
|
||||
|
||||
/// Acknowledge System Timer IRQ.
|
||||
// Acknowledge System Timer IRQ.
|
||||
void OS_Tick_AcknowledgeIRQ(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Get System Timer count.
|
||||
// Get System Timer count.
|
||||
uint32_t OS_Tick_GetCount(void)
|
||||
{
|
||||
return os_timer->get_time() & 0xFFFFFFFF;
|
||||
|
|
Loading…
Reference in New Issue