mirror of https://github.com/ARMmbed/mbed-os.git
[Wio 3G] Changed suggested points
Changed accessibility cellular features member functions, fixed minor target issuespull/7098/head
parent
e5b8591818
commit
16e706ecd4
|
@ -243,7 +243,16 @@ nsapi_error_t AT_CellularNetwork::activate_context()
|
||||||
{
|
{
|
||||||
_at.lock();
|
_at.lock();
|
||||||
|
|
||||||
nsapi_error_t err = set_context_to_be_activated();
|
nsapi_error_t err = NSAPI_ERROR_OK;
|
||||||
|
|
||||||
|
// try to find or create context with suitable stack
|
||||||
|
if(get_context()) {
|
||||||
|
// try to authenticate user before activating or modifying context
|
||||||
|
err = do_user_authentication();
|
||||||
|
} else {
|
||||||
|
err = NSAPI_ERROR_NO_CONNECTION;
|
||||||
|
}
|
||||||
|
|
||||||
if (err != NSAPI_ERROR_OK) {
|
if (err != NSAPI_ERROR_OK) {
|
||||||
_at.unlock();
|
_at.unlock();
|
||||||
tr_error("Failed to activate network context! (%d)", err);
|
tr_error("Failed to activate network context! (%d)", err);
|
||||||
|
@ -420,7 +429,7 @@ void AT_CellularNetwork::ppp_status_cb(nsapi_event_t event, intptr_t parameter)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsapi_error_t AT_CellularNetwork::set_context_to_be_activated()
|
nsapi_error_t AT_CellularNetwork::do_user_authentication()
|
||||||
{
|
{
|
||||||
// try to find or create context with suitable stack
|
// try to find or create context with suitable stack
|
||||||
if (!get_context()) {
|
if (!get_context()) {
|
||||||
|
@ -429,21 +438,11 @@ nsapi_error_t AT_CellularNetwork::set_context_to_be_activated()
|
||||||
|
|
||||||
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
|
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
|
||||||
if (_pwd && _uname) {
|
if (_pwd && _uname) {
|
||||||
#if defined(TARGET_WIO_3G)
|
|
||||||
_at.cmd_start("AT+QICSGP=");
|
|
||||||
_at.write_int(_cid);
|
|
||||||
_at.write_int(1); // context type 1=IPv4
|
|
||||||
_at.write_string(_apn);
|
|
||||||
_at.write_string(_uname);
|
|
||||||
_at.write_string(_pwd);
|
|
||||||
_at.write_int(_authentication_type);
|
|
||||||
#else
|
|
||||||
_at.cmd_start("AT+CGAUTH=");
|
_at.cmd_start("AT+CGAUTH=");
|
||||||
_at.write_int(_cid);
|
_at.write_int(_cid);
|
||||||
_at.write_int(_authentication_type);
|
_at.write_int(_authentication_type);
|
||||||
_at.write_string(_uname);
|
_at.write_string(_uname);
|
||||||
_at.write_string(_pwd);
|
_at.write_string(_pwd);
|
||||||
#endif
|
|
||||||
_at.cmd_stop();
|
_at.cmd_stop();
|
||||||
_at.resp_start();
|
_at.resp_start();
|
||||||
_at.resp_stop();
|
_at.resp_stop();
|
||||||
|
@ -452,7 +451,7 @@ nsapi_error_t AT_CellularNetwork::set_context_to_be_activated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _at.get_last_error();
|
return NSAPI_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AT_CellularNetwork::set_new_context(int cid)
|
bool AT_CellularNetwork::set_new_context(int cid)
|
||||||
|
|
|
@ -149,13 +149,11 @@ private:
|
||||||
void urc_cereg();
|
void urc_cereg();
|
||||||
void urc_cgreg();
|
void urc_cgreg();
|
||||||
|
|
||||||
nsapi_error_t set_context_to_be_activated();
|
|
||||||
nsapi_ip_stack_t string_to_stack_type(const char* pdp_type);
|
nsapi_ip_stack_t string_to_stack_type(const char* pdp_type);
|
||||||
|
|
||||||
void free_credentials();
|
void free_credentials();
|
||||||
|
|
||||||
nsapi_error_t open_data_channel();
|
nsapi_error_t open_data_channel();
|
||||||
bool get_context();
|
|
||||||
bool set_new_context(int cid);
|
bool set_new_context(int cid);
|
||||||
|
|
||||||
nsapi_error_t delete_current_context();
|
nsapi_error_t delete_current_context();
|
||||||
|
@ -180,6 +178,8 @@ protected:
|
||||||
AuthenticationType _authentication_type;
|
AuthenticationType _authentication_type;
|
||||||
int _cell_id;
|
int _cell_id;
|
||||||
nsapi_connection_status_t _connect_status;
|
nsapi_connection_status_t _connect_status;
|
||||||
|
virtual nsapi_error_t do_user_authentication();
|
||||||
|
bool get_context();
|
||||||
bool _new_context_set;
|
bool _new_context_set;
|
||||||
bool _is_context_active;
|
bool _is_context_active;
|
||||||
RegistrationStatus _reg_status;
|
RegistrationStatus _reg_status;
|
||||||
|
|
|
@ -42,3 +42,29 @@ nsapi_error_t QUECTEL_UG96_CellularNetwork::set_access_technology_impl(RadioAcce
|
||||||
_op_act = RAT_UNKNOWN;
|
_op_act = RAT_UNKNOWN;
|
||||||
return NSAPI_ERROR_UNSUPPORTED;
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsapi_error_t QUECTEL_UG96_CellularNetwork::do_user_authentication()
|
||||||
|
{
|
||||||
|
// try to find or create context with suitable stack
|
||||||
|
if (!get_context()) {
|
||||||
|
return NSAPI_ERROR_NO_CONNECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_pwd && _uname) {
|
||||||
|
_at.cmd_start("AT+QICSGP=");
|
||||||
|
_at.write_int(_cid);
|
||||||
|
_at.write_int(1); // context type 1=IPv4
|
||||||
|
_at.write_string(_apn);
|
||||||
|
_at.write_string(_uname);
|
||||||
|
_at.write_string(_pwd);
|
||||||
|
_at.write_int(_authentication_type);
|
||||||
|
_at.cmd_stop();
|
||||||
|
_at.resp_start();
|
||||||
|
_at.resp_stop();
|
||||||
|
if (_at.get_last_error() != NSAPI_ERROR_OK) {
|
||||||
|
return NSAPI_ERROR_AUTH_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NSAPI_ERROR_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ protected:
|
||||||
virtual bool has_registration(RegistrationType rat);
|
virtual bool has_registration(RegistrationType rat);
|
||||||
|
|
||||||
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
|
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
|
||||||
|
|
||||||
|
virtual nsapi_error_t do_user_authentication();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -220,7 +220,7 @@ typedef enum {
|
||||||
LED_RED = LED2,
|
LED_RED = LED2,
|
||||||
USER_BUTTON = PC_13,
|
USER_BUTTON = PC_13,
|
||||||
// Standardized button names
|
// Standardized button names
|
||||||
// BUTTON1 = USER_BUTTON,
|
BUTTON1 = PC_13,
|
||||||
SERIAL_TX = STDIO_UART_TX, // Virtual Com Port
|
SERIAL_TX = STDIO_UART_TX, // Virtual Com Port
|
||||||
SERIAL_RX = STDIO_UART_RX, // Virtual Com Port
|
SERIAL_RX = STDIO_UART_RX, // Virtual Com Port
|
||||||
USBTX = STDIO_UART_TX, // Virtual Com Port
|
USBTX = STDIO_UART_TX, // Virtual Com Port
|
||||||
|
@ -229,33 +229,8 @@ typedef enum {
|
||||||
SPI_MISO = PC_11,
|
SPI_MISO = PC_11,
|
||||||
SPI_SCK = PC_10,
|
SPI_SCK = PC_10,
|
||||||
SPI_CS = PD_0,
|
SPI_CS = PD_0,
|
||||||
// PWM_OUT = D9,
|
PWM_OUT = D39,
|
||||||
|
|
||||||
/*
|
|
||||||
//USB pins
|
|
||||||
USB_OTG_HS_ULPI_D0 = PA_3,
|
|
||||||
USB_OTG_HS_SOF = PA_4,
|
|
||||||
USB_OTG_HS_ULPI_CK = PA_5,
|
|
||||||
USB_OTG_FS_SOF = PA_8,
|
|
||||||
USB_OTG_FS_VBUS = PA_9,
|
|
||||||
USB_OTG_FS_ID = PA_10,
|
|
||||||
USB_OTG_FS_DM = PA_11,
|
|
||||||
USB_OTG_FS_DP = PA_12,
|
|
||||||
USB_OTG_HS_ULPI_D1 = PB_0,
|
|
||||||
USB_OTG_HS_ULPI_D2 = PB_1,
|
|
||||||
USB_OTG_HS_ULPI_D7 = PB_5,
|
|
||||||
USB_OTG_HS_ULPI_D3 = PB_10,
|
|
||||||
USB_OTG_HS_ULPI_D4 = PB_11,
|
|
||||||
USB_OTG_HS_ID = PB_12,
|
|
||||||
USB_OTG_HS_ULPI_D5 = PB_12,
|
|
||||||
USB_OTG_HS_ULPI_D6 = PB_13,
|
|
||||||
USB_OTG_HS_VBUS = PB_13,
|
|
||||||
USB_OTG_HS_DM = PB_14,
|
|
||||||
USB_OTG_HS_DP = PB_15,
|
|
||||||
USB_OTG_HS_ULPI_STP = PC_0,
|
|
||||||
USB_OTG_HS_ULPI_DIR = PC_2,
|
|
||||||
USB_OTG_HS_ULPI_NXT = PC_3,
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Not connected
|
// Not connected
|
||||||
NC = (int)0xFFFFFFFF
|
NC = (int)0xFFFFFFFF
|
||||||
|
|
|
@ -1729,7 +1729,7 @@
|
||||||
"core": "Cortex-M4F",
|
"core": "Cortex-M4F",
|
||||||
"config": {
|
"config": {
|
||||||
"clock_source": {
|
"clock_source": {
|
||||||
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
|
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL | USE_PLL_HSI",
|
||||||
"value": "USE_PLL_HSE_XTAL|USE_PLL_HSI",
|
"value": "USE_PLL_HSE_XTAL|USE_PLL_HSI",
|
||||||
"macro_name": "CLOCK_SOURCE"
|
"macro_name": "CLOCK_SOURCE"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue