Add required namespace instead of relying on mbed.h

mbed.h has 'using namespace mbed;', hence some of the files skip
adding required namespace to the code, it is always good to specify the
namespace around the elements in header and `using namespace` in
specific CPP files, instead of all
pull/8550/head
deepikabhavnani 2018-10-25 12:21:30 -05:00
parent 9c59d9acc3
commit 451cf7ccb3
7 changed files with 24 additions and 14 deletions

View File

@ -220,6 +220,8 @@ static inline rf_trx_states_t rf_if_trx_status_from_full(uint8_t full_trx_status
#ifdef MBED_CONF_RTOS_PRESENT #ifdef MBED_CONF_RTOS_PRESENT
#include "mbed.h" #include "mbed.h"
#include "rtos.h" #include "rtos.h"
using namespace mbed;
using namespace rtos;
static void rf_if_irq_task_process_irq(); static void rf_if_irq_task_process_irq();

View File

@ -55,12 +55,12 @@ public:
virtual void set_mac_address(uint8_t *mac); virtual void set_mac_address(uint8_t *mac);
private: private:
SPI _spi; mbed::SPI _spi;
DigitalOut _rf_cs; mbed::DigitalOut _rf_cs;
DigitalOut _rf_rst; mbed::DigitalOut _rf_rst;
InterruptIn _rf_irq; mbed::InterruptIn _rf_irq;
DigitalIn _rf_irq_pin; mbed::DigitalIn _rf_irq_pin;
Thread _irq_thread; rtos::Thread _irq_thread;
void _pins_set(); void _pins_set();
void _pins_clear(); void _pins_clear();

View File

@ -23,6 +23,9 @@
#include <string.h> #include <string.h>
#include "rtos.h" #include "rtos.h"
using namespace mbed;
using namespace rtos;
/* Freescale headers which are for C files */ /* Freescale headers which are for C files */
extern "C" { extern "C" {
#include "MCR20Drv.h" #include "MCR20Drv.h"

View File

@ -20,6 +20,8 @@
#include <cstring> #include <cstring>
using namespace mbed;
#define ESP8266_DEFAULT_BAUD_RATE 115200 #define ESP8266_DEFAULT_BAUD_RATE 115200
#define ESP8266_ALL_SOCKET_IDS -1 #define ESP8266_ALL_SOCKET_IDS -1

View File

@ -227,7 +227,7 @@ public:
* *
* @param func A pointer to a void function, or 0 to set as none * @param func A pointer to a void function, or 0 to set as none
*/ */
void sigio(Callback<void()> func); void sigio(mbed::Callback<void()> func);
/** /**
* Attach a function to call whenever sigio happens in the serial * Attach a function to call whenever sigio happens in the serial
@ -237,7 +237,7 @@ public:
*/ */
template <typename T, typename M> template <typename T, typename M>
void sigio(T *obj, M method) { void sigio(T *obj, M method) {
sigio(Callback<void()>(obj, method)); sigio(mbed::Callback<void()>(obj, method));
} }
/** /**
@ -271,9 +271,9 @@ public:
static const int8_t SOCKET_COUNT = 5; static const int8_t SOCKET_COUNT = 5;
private: private:
UARTSerial _serial; mbed::UARTSerial _serial;
ATCmdParser _parser; mbed::ATCmdParser _parser;
Mutex _smutex; // Protect serial port access rtos::Mutex _smutex; // Protect serial port access
struct packet { struct packet {
struct packet *next; struct packet *next;
@ -303,7 +303,7 @@ private:
bool _closed; bool _closed;
int _socket_open[SOCKET_COUNT]; int _socket_open[SOCKET_COUNT];
nsapi_connection_status_t _connection_status; nsapi_connection_status_t _connection_status;
Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb; mbed::Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
}; };
#endif #endif

View File

@ -51,9 +51,9 @@ protected:
NanostackPhy &get_phy() const { return interface_phy; } NanostackPhy &get_phy() const { return interface_phy; }
int8_t interface_id; int8_t interface_id;
int8_t _device_id; int8_t _device_id;
Semaphore connect_semaphore; rtos::Semaphore connect_semaphore;
Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb; mbed::Callback<void(nsapi_event_t, intptr_t)> _connection_status_cb;
nsapi_connection_status_t _connect_status; nsapi_connection_status_t _connect_status;
nsapi_connection_status_t _previous_connection_status; nsapi_connection_status_t _previous_connection_status;
bool _blocking; bool _blocking;

View File

@ -26,6 +26,9 @@
#define NUMBER_OF_SIMULTANEOUS_TIMEOUTS 2 #define NUMBER_OF_SIMULTANEOUS_TIMEOUTS 2
#endif //NUMBER_OF_SIMULTANEOUS_TIMEOUTS #endif //NUMBER_OF_SIMULTANEOUS_TIMEOUTS
using namespace mbed;
using namespace events;
static Timer timer; static Timer timer;
static bool timer_initialized = false; static bool timer_initialized = false;
static const fhss_api_t *fhss_active_handle = NULL; static const fhss_api_t *fhss_active_handle = NULL;