mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Merge pull request #12339 from jeromecoutant/PR_MODEMVERSION
Cellular : add modem version in mbed tracepull/12431/head
						commit
						d7f3341974
					
				| 
						 | 
				
			
			@ -367,11 +367,13 @@ bool AT_CellularContext::get_context()
 | 
			
		|||
            apn_len = _at.read_string(apn, sizeof(apn));
 | 
			
		||||
            if (apn_len >= 0) {
 | 
			
		||||
                if (_apn && (strcmp(apn, _apn) != 0)) {
 | 
			
		||||
                    tr_debug("CID %d APN \"%s\"", cid, apn);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                // APN matched -> Check PDP type
 | 
			
		||||
                pdp_type_t pdp_type = string_to_pdp_type(pdp_type_from_context);
 | 
			
		||||
                tr_debug("CID %d APN \"%s\" pdp_type %u", cid, apn, pdp_type);
 | 
			
		||||
 | 
			
		||||
                // Accept exact matching PDP context type or dual PDP context for modems that support both IPv4 and IPv6 stacks
 | 
			
		||||
                if (get_device()->get_property(pdp_type_t_to_cellular_property(pdp_type)) ||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@
 | 
			
		|||
#include "CellularStateMachine.h"
 | 
			
		||||
#include "CellularDevice.h"
 | 
			
		||||
#include "CellularLog.h"
 | 
			
		||||
#include "CellularInformation.h"
 | 
			
		||||
 | 
			
		||||
#ifndef MBED_TRACE_MAX_LEVEL
 | 
			
		||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_INFO
 | 
			
		||||
| 
						 | 
				
			
			@ -243,8 +244,8 @@ bool CellularStateMachine::get_network_registration(CellularNetwork::Registratio
 | 
			
		|||
            break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (is_roaming) {
 | 
			
		||||
        tr_info("Roaming network.");
 | 
			
		||||
    if (is_registered || is_roaming) {
 | 
			
		||||
        tr_info("Roaming %u Registered %u", is_roaming, is_registered);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
| 
						 | 
				
			
			@ -360,6 +361,26 @@ void CellularStateMachine::state_device_ready()
 | 
			
		|||
    if (_cb_data.error == NSAPI_ERROR_OK) {
 | 
			
		||||
        _cb_data.error = _cellularDevice.init();
 | 
			
		||||
        if (_cb_data.error == NSAPI_ERROR_OK) {
 | 
			
		||||
 | 
			
		||||
#if MBED_CONF_MBED_TRACE_ENABLE
 | 
			
		||||
            CellularInformation *info = _cellularDevice.open_information();
 | 
			
		||||
 | 
			
		||||
            char *buf = new (std::nothrow) char[2048]; // size from 3GPP TS 27.007
 | 
			
		||||
            if (buf) {
 | 
			
		||||
                if (info->get_manufacturer(buf, 2048) == NSAPI_ERROR_OK) {
 | 
			
		||||
                    tr_info("Modem manufacturer: %s", buf);
 | 
			
		||||
                }
 | 
			
		||||
                if (info->get_model(buf, 2048) == NSAPI_ERROR_OK) {
 | 
			
		||||
                    tr_info("Modem model: %s", buf);
 | 
			
		||||
                }
 | 
			
		||||
                if (info->get_revision(buf, 2048) == NSAPI_ERROR_OK) {
 | 
			
		||||
                    tr_info("Modem revision: %s", buf);
 | 
			
		||||
                }
 | 
			
		||||
                delete[] buf;
 | 
			
		||||
            }
 | 
			
		||||
            _cellularDevice.close_information();
 | 
			
		||||
#endif // MBED_CONF_MBED_TRACE_ENABLE
 | 
			
		||||
 | 
			
		||||
            if (device_ready()) {
 | 
			
		||||
                _status = 0;
 | 
			
		||||
                enter_to_state(STATE_SIM_PIN);
 | 
			
		||||
| 
						 | 
				
			
			@ -373,6 +394,7 @@ void CellularStateMachine::state_device_ready()
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (_cb_data.error != NSAPI_ERROR_OK) {
 | 
			
		||||
        if (_retry_count == 0) {
 | 
			
		||||
            _cellularDevice.set_ready_cb(callback(this, &CellularStateMachine::device_ready_cb));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,4 +32,9 @@ nsapi_error_t QUECTEL_BG96_CellularInformation::get_iccid(char *buf, size_t buf_
 | 
			
		|||
    return _at.at_cmd_str("+QCCID", "", buf, buf_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nsapi_error_t QUECTEL_BG96_CellularInformation::get_revision(char *buf, size_t buf_size)
 | 
			
		||||
{
 | 
			
		||||
    return get_info("AT+QGMR", buf, buf_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} /* namespace mbed */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ public:
 | 
			
		|||
 | 
			
		||||
public: // AT_CellularInformation
 | 
			
		||||
    virtual nsapi_error_t get_iccid(char *buf, size_t buf_size);
 | 
			
		||||
    virtual nsapi_error_t get_revision(char *buf, size_t buf_size);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} /* namespace mbed */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue