mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
Removed BG95SSL test functions
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -308,349 +308,6 @@ class TinyGsmBG95 : public TinyGsmModem<TinyGsmBG95>,
|
||||
// commands. As this is a separate paid service which I do not have access
|
||||
// to, I am not implementing it here.
|
||||
|
||||
|
||||
/*
|
||||
* Testing functions
|
||||
*/
|
||||
|
||||
public:
|
||||
String getModemManufacturer() {
|
||||
sendAT(GF("+GMI"));
|
||||
String res;
|
||||
if (waitResponse(1000L, res) != 1) { return ""; }
|
||||
res.replace(AT_NL "OK" AT_NL, "");
|
||||
res.replace(AT_NL, " ");
|
||||
res.trim();
|
||||
return res;
|
||||
}
|
||||
String getModemFirmwareFullVersion() {
|
||||
sendAT(GF("+QGMR"));
|
||||
String res;
|
||||
if (waitResponse(1000L, res) != 1) { return ""; }
|
||||
res.replace(AT_NL "OK" AT_NL, "");
|
||||
res.replace(AT_NL, " ");
|
||||
res.trim();
|
||||
return res;
|
||||
}
|
||||
String getModemFirmwareApplicationVersionn() {
|
||||
sendAT(GF("+QAPPVER"));
|
||||
String res;
|
||||
if (waitResponse(1000L, res) != 1) { return ""; }
|
||||
res.replace(AT_NL "OK" AT_NL, "");
|
||||
res.replace(AT_NL, " ");
|
||||
res.replace("+QAPPVER: ", "");
|
||||
res.trim();
|
||||
return res;
|
||||
}
|
||||
bool configureGPS(void) {
|
||||
sendAT(GF("+QGPSCFG=\"gnssconfig\",5")); // Based on Mobile Country Code
|
||||
// (europe : galileo)
|
||||
if (waitResponse() != 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
bool configureGPSPriority(void) {
|
||||
sendAT(GF("+QGPSCFG=\"priority\"")); // Priority GNSS instead of WWAN
|
||||
if (waitResponse() != 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
bool test(void) {
|
||||
sendAT(GF("+QGPSCFG=\"gnssconfig\",5")); // Based on Mobile Country Code
|
||||
// (europe : galileo)
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPSCFG=\"priority\",0,0")); // Priority GNSS, not saved
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPS=1,1,0,1")); // Low Accuracy, Continuous positionning, Rate
|
||||
// : 1 sec
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPSCFG=\"gnssconfig\",5")); // Based on Mobile Country Code
|
||||
// (europe : galileo)
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPSCFG=\"priority\",0,0")); // Priority GNSS, not saved
|
||||
waitResponse();
|
||||
return true;
|
||||
}
|
||||
bool test_ask(void) {
|
||||
sendAT(GF("+QGPSCFG=\"gnssconfig\"")); // Based on Mobile Country Code
|
||||
// (europe : galileo)
|
||||
waitResponse();
|
||||
// if (waitResponse() != 1) { return false; }
|
||||
sendAT(GF("+QGPSCFG=?"));
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPSEND=?"));
|
||||
waitResponse();
|
||||
sendAT(GF("+QGPSEND"));
|
||||
waitResponse();
|
||||
return true;
|
||||
}
|
||||
#define MODEM_RAT_SEARCHED_AUTOMATIC (0)
|
||||
#define MODEM_RAT_SEARCHED_GSM_ONLY (1)
|
||||
#define MODEM_RAT_SEARCHED_LTE_ONLY (3)
|
||||
#define MODEM_RAT_SEARCHED_ERROR (255)
|
||||
uint8_t query_modem_rat_searched(void) {
|
||||
uint8_t returned;
|
||||
sendAT(GF("+QCFG=\"nwscanmode\""));
|
||||
if (waitResponse(GF("+QCFG:")) != 1) { return MODEM_RAT_SEARCHED_ERROR; }
|
||||
streamSkipUntil('"');
|
||||
streamSkipUntil('"');
|
||||
streamSkipUntil(',');
|
||||
returned = stream.parseInt();
|
||||
waitResponse();
|
||||
return returned;
|
||||
/* Max Response Time : 300ms
|
||||
0 : Automatic (GSM + LTE)
|
||||
1 : GSM only
|
||||
3 : LTE only
|
||||
*/
|
||||
}
|
||||
#define MODEM_NETWORK_CATEGORY_SEARCHED_EMTC (0)
|
||||
#define MODEM_NETWORK_CATEGORY_SEARCHED_NBIOT (1)
|
||||
#define MODEM_NETWORK_CATEGORY_SEARCHED_ALL (2)
|
||||
#define MODEM_NETWORK_CATEGORY_SEARCHED_ERROR (255)
|
||||
uint8_t query_modem_network_category_searched(void) {
|
||||
uint8_t returned;
|
||||
sendAT(GF("+QCFG=\"iotopmode\""));
|
||||
if (waitResponse(GF("+QCFG:")) != 1) {
|
||||
return MODEM_NETWORK_CATEGORY_SEARCHED_ERROR;
|
||||
}
|
||||
streamSkipUntil('"');
|
||||
streamSkipUntil('"');
|
||||
streamSkipUntil(',');
|
||||
returned = stream.parseInt();
|
||||
waitResponse();
|
||||
return returned;
|
||||
/* Max Response Time : 300ms
|
||||
0 : eMTC
|
||||
1 : NB-IoT
|
||||
2 : eMTC and NB-IoT
|
||||
*/
|
||||
}
|
||||
void query_modem_register_settings(void) {
|
||||
sendAT(GF("+QCFG=\"band\""));
|
||||
waitResponse(500);
|
||||
sendAT(GF("+QCFG=\"nwscanmode\""));
|
||||
waitResponse(500);
|
||||
sendAT(GF("+QCFG=\"nwscanseq\""));
|
||||
waitResponse(500);
|
||||
sendAT(GF("+QCFG=\"iotopmode\""));
|
||||
waitResponse(500);
|
||||
/* Without any modification it gives :
|
||||
+QCFG: "band",0x3,0x80084,0x80084
|
||||
+QCFG: "nwscanmode",3
|
||||
+QCFG: "nwscanseq",020301
|
||||
+QCFG: "iotopmode",0
|
||||
When previously set automatic_register
|
||||
+QCFG: "band",0x3,0x80084,0x80084
|
||||
+QCFG: "nwscanmode",0
|
||||
+QCFG: "nwscanseq",020301
|
||||
+QCFG: "iotopmode",2
|
||||
|
||||
*/
|
||||
}
|
||||
void configure_europe_band(void) {
|
||||
/*
|
||||
* =>Speed-up auto detection
|
||||
* Based on Quectel Series Network Searching Scheme Introduction 2.0-1.pdf
|
||||
* existing GSM band : GSM850, EGSM900, DCS1800, PCS1900
|
||||
* Europe GSM : EGSM900/DCS1800
|
||||
* EGSM900 : 0x1
|
||||
* DCS1800 : 0x2
|
||||
* =>3
|
||||
* F for all bands
|
||||
* Europe eMTC & NB-IOT bands : B3/B8/B20
|
||||
* B3 : 0x4
|
||||
* B8 : 0x80
|
||||
* B20 : 0x80000
|
||||
* =>80084
|
||||
*/
|
||||
// sendAT(GF("+QCFG=\"band\",F,80084,80084,1"));
|
||||
sendAT(GF("+QCFG=\"band\",3,80084,80084,1"));
|
||||
waitResponse(500);
|
||||
}
|
||||
bool automatic_register(bool restart_modem = false) {
|
||||
//// NB-IOT Band Configuration
|
||||
//// 1NCE: 80 for Band 8
|
||||
// sendAT(GF("+QCFG=\"band\",0,0,80,1"));
|
||||
// waitResponse(500);
|
||||
|
||||
// Configure RAT(s) to be Searched
|
||||
// 0 Automatic(GSM and LTE), 1 Take effect immediately(default)
|
||||
// 1 GSM only
|
||||
// 3 LTE only
|
||||
sendAT(GF("+QCFG=\"nwscanmode\",0,1"));
|
||||
waitResponse(500);
|
||||
|
||||
// Configure RAT Searching Sequence
|
||||
//// (LTE Cat NB1 -> LTE Cat M1 -> GSM)
|
||||
// sendAT(GF("+QCFG=\"nwscanseq\",030201,1"));
|
||||
// 00 : (LTE Cat M1 -> LTE Cat NB1 -> GSM)(default)
|
||||
sendAT(GF("+QCFG=\"nwscanseq\",00,1"));
|
||||
waitResponse(500);
|
||||
|
||||
// Configure Network Category to be Searched under
|
||||
// 0 : LTE Cat M1
|
||||
// 1 : LTE Cat NB1
|
||||
// 2 : LTE Cat M1 and Cat NB1(default)
|
||||
// sendAT(GF("+QCFG=\"iotopmode\",1,1"));
|
||||
sendAT(GF("+QCFG=\"iotopmode\",2,1"));
|
||||
waitResponse(500);
|
||||
|
||||
//// Configure Service Domain
|
||||
//// 1 : use PS domain service for data-service
|
||||
//// 2 : CS & PS (default)
|
||||
// sendAT(GF("+QCFG=\"servicedomain\",2,1"));
|
||||
// waitResponse(500);
|
||||
|
||||
//// Configure Get the EMM cause value
|
||||
//// 0 : Numeric value (default)
|
||||
//// 1 : Verbose value
|
||||
// sendAT(GF("+QCFG=\"emmcause\",0"));
|
||||
// waitResponse(500);
|
||||
if (restart_modem) {
|
||||
setPhoneFunctionalityImpl(0);
|
||||
setPhoneFunctionalityImpl(1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool force_ltem_register(bool restart_modem = false) {
|
||||
/* Purpose speed up searching time since much longer searching time for
|
||||
* NB-IoT than eMTC Based on Quectel Series Network Searching Scheme
|
||||
* Introduction 2.0-1.pdf 6.2. Solutions to Speed up Network Searching :
|
||||
* 6.2.1 Disable NB-IoT and Enable Required RAT(s)
|
||||
*/
|
||||
// Configure Network Category to be Searched under
|
||||
// 0 : LTE Cat M1
|
||||
// 1 : LTE Cat NB1
|
||||
// 2 : LTE Cat M1 and Cat NB1(default)
|
||||
sendAT(GF("+QCFG=\"iotopmode\",0,1"));
|
||||
waitResponse(500);
|
||||
// Configure RAT(s) to be Searched
|
||||
// 0 Automatic(GSM and LTE), 1 Take effect immediately(default)
|
||||
// 1 GSM only
|
||||
// 3 LTE only
|
||||
sendAT(GF("+QCFG=\"nwscanmode\",3,1"));
|
||||
waitResponse(500);
|
||||
if (restart_modem) {
|
||||
setPhoneFunctionalityImpl(0);
|
||||
setPhoneFunctionalityImpl(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool force_nbiot_register(bool restart_modem = false) {
|
||||
/* Purpose speed up searching time since much longer searching time for
|
||||
* NB-IoT than eMTC Based on Quectel Series Network Searching Scheme
|
||||
* Introduction 2.0-1.pdf 6.2. Solutions to Speed up Network Searching :
|
||||
* 6.2.2. Enable NB-IoT Bands Supported by Current Operator Only
|
||||
*/
|
||||
// Configure Network Category to be Searched under
|
||||
// 0 : LTE Cat M1
|
||||
// 1 : LTE Cat NB1
|
||||
// 2 : LTE Cat M1 and Cat NB1(default)
|
||||
sendAT(GF("+QCFG=\"iotopmode\",2,1"));
|
||||
waitResponse(500);
|
||||
// Configure RAT Searching Sequence
|
||||
//// (LTE Cat NB1 -> LTE Cat M1 -> GSM)
|
||||
// sendAT(GF("+QCFG=\"nwscanseq\",030201,1"));
|
||||
// 00 : (LTE Cat M1 -> LTE Cat NB1 -> GSM)(default)
|
||||
sendAT(GF("+QCFG=\"nwscanseq\",020301,1"));
|
||||
waitResponse(500);
|
||||
// Configure RAT(s) to be Searched
|
||||
// 0 Automatic(GSM and LTE), 1 Take effect immediately(default)
|
||||
// 1 GSM only
|
||||
// 3 LTE only
|
||||
sendAT(GF("+QCFG=\"nwscanmode\",3,1"));
|
||||
waitResponse(500);
|
||||
if (restart_modem) {
|
||||
setPhoneFunctionalityImpl(0);
|
||||
setPhoneFunctionalityImpl(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool force_gsm_register(bool restart_modem = false) {
|
||||
/* Purpose speed up searching time since much longer searching time for
|
||||
* NB-IoT than eMTC Based on Quectel Series Network Searching Scheme
|
||||
* Introduction 2.0-1.pdf 6.2. Solutions to Speed up Network Searching :
|
||||
* 6.2.1 Disable NB-IoT and Enable Required RAT(s)
|
||||
*/
|
||||
// Configure RAT(s) to be Searched
|
||||
// 0 Automatic(GSM and LTE), 1 Take effect immediately(default)
|
||||
// 1 GSM only
|
||||
// 3 LTE only
|
||||
sendAT(GF("+QCFG=\"nwscanmode\",1,1"));
|
||||
waitResponse(500);
|
||||
if (restart_modem) {
|
||||
setPhoneFunctionalityImpl(0);
|
||||
setPhoneFunctionalityImpl(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool lte_and_falling_gsm_register(bool restore_band = false,
|
||||
bool restart_modem = false) {
|
||||
if (restore_band) {
|
||||
// Restore default Banc Configuration
|
||||
sendAT(GF("+QCFG=\"bandrestore\""));
|
||||
waitResponse(500);
|
||||
}
|
||||
// Configure Network Category to be Searched under
|
||||
// 0 : LTE Cat M1
|
||||
// 1 : LTE Cat NB1
|
||||
// 2 : LTE Cat M1 and Cat NB1(default)
|
||||
sendAT(GF("+QCFG=\"iotopmode\",2,1"));
|
||||
waitResponse(500);
|
||||
// Configure RAT(s) to be Searched
|
||||
// 0 Automatic(GSM and LTE), 1 Take effect immediately(default)
|
||||
// 1 GSM only
|
||||
// 3 LTE only
|
||||
sendAT(GF("+QCFG=\"nwscanmode\",0,1"));
|
||||
waitResponse(500);
|
||||
// Configure RAT Searching Sequence
|
||||
//// (LTE Cat NB1 -> LTE Cat M1 -> GSM)
|
||||
// sendAT(GF("+QCFG=\"nwscanseq\",030201,1"));
|
||||
// 00 : (LTE Cat M1 -> LTE Cat NB1 -> GSM)(default)
|
||||
// 01 : GSM
|
||||
// 02 : LTE-M(eMTC)
|
||||
// 03 : NB-IOT
|
||||
sendAT(GF("+QCFG=\"nwscanseq\",020301,1"));
|
||||
waitResponse(500);
|
||||
if (restart_modem) {
|
||||
setPhoneFunctionalityImpl(0);
|
||||
setPhoneFunctionalityImpl(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* parse AT+COPS :
|
||||
* +COPS: <mode>[,<format>[,<oper>][,<Act>]]
|
||||
* where <Act>:
|
||||
* 0 : GSM
|
||||
* 8 : eMTC/LTE-M
|
||||
* 9 : NB-IoT
|
||||
*/
|
||||
#define MODEM_COP_GSM (0)
|
||||
#define MODEM_COP_EMTC (8)
|
||||
#define MODEM_COP_NBIOT (9)
|
||||
uint8_t get_access_technology(void) {
|
||||
uint8_t act_value;
|
||||
sendAT(GF("+COPS?"));
|
||||
if (waitResponse(GF("+COPS:")) != 1) { return 10; }
|
||||
streamSkipUntil('"'); /* Skip mode and format */
|
||||
streamSkipUntil('"'); /* Skip mode and format */
|
||||
streamSkipUntil(','); /* Skip mode and format */
|
||||
act_value = stream.parseInt();
|
||||
waitResponse();
|
||||
return act_value;
|
||||
}
|
||||
void get_emmcause(void) {
|
||||
uint8_t act_value;
|
||||
sendAT(GF("+QCFG=\"emmcause\",1"));
|
||||
waitResponse();
|
||||
}
|
||||
bool ask_to_automatically_register(void) {
|
||||
sendAT(GF("+COPS=0")); // Auto-register to the network
|
||||
if (waitResponse() != 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* GPS/GNSS/GLONASS location functions
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user