From ad29cb26b0bb1140fe657cace999beb99e441a23 Mon Sep 17 00:00:00 2001 From: Mattia Rebato Date: Mon, 18 Jul 2022 14:18:29 +0200 Subject: [PATCH] Adjusted scripts indentation (#37) --- .../cell_all_hexCmd_networkReg_basic.atl | 18 +- .../cell_modem/cell_all_hfc_ctsrts_basic.atl | 60 +- .../cell_modem/cell_all_hfc_dsrdtr_basic.atl | 70 +- ...cell_all_network_genericCommands_basic.atl | 14 +- ...l_network_registrationCommands_advance.atl | 14 +- .../cell_all_network_urc_advance.atl | 20 +- ...ll_all_phoneBook_functionality_advance.atl | 114 +-- .../cell_all_readNameAndFirmware_basic.atl | 38 +- .../cell_all_registrationTime_basic.atl | 12 +- ...ell_all_settings_genericCommands_basic.atl | 20 +- .../cell_all_sms_functionality_advance.atl | 74 +- ...cell_all_startup_genericCommands_basic.atl | 22 +- .../cell_all_urc_configuration_basic.atl | 24 +- .../common_lib/lib_bitwise_operation.atl | 126 +-- at_scripts/common_lib/library.atl | 20 +- .../debug_laraR2_tobyR2_basic.atl | 22 +- .../debug-ability/debug_laraR6_basic.atl | 16 +- .../debug-ability/debug_saraN2_basic.atl | 22 +- .../debug-ability/debug_saraN3_basic.atl | 22 +- .../debug-ability/debug_saraR41_basic.atl | 22 +- ...ebug_saraR41_preProductionScript_basic.atl | 396 ++++---- .../debug-ability/debug_saraR42_basic.atl | 22 +- .../debug-ability/debug_saraR5_basic.atl | 26 +- .../debug-ability/debug_tobyL2_basic.atl | 18 +- .../debug-ability/debug_tobyL4_basic.atl | 22 +- at_scripts/evk/evk_exampleEvkR2_basic.atl | 20 +- at_scripts/evk/evk_exampleEvkR4_basic.atl | 20 +- at_scripts/evk/evk_exampleEvkR5_basic.atl | 20 +- at_scripts/evk/evk_exampleEvkR6_basic.atl | 20 +- .../ipApp_all_activatePsdProfile_basic.atl | 172 ++-- .../ipApp_all_socketEchoTest_advance.atl | 26 +- .../ipApp_laraR6_httpDemo_basic.atl | 16 +- ...pp_laraR6_thingstreamDualApnDemo_basic.atl | 22 +- ...pApp_saraR5_saraR42_FTP_retrieve_basic.atl | 24 +- ..._saraR5_saraR42_mqttAnywhereDemo_basic.atl | 26 +- .../con_all_fileManagement_basic.atl | 23 +- ...ion_saraR5_saraR42_gnssAiding_advanced.atl | 372 +++---- ...5_saraR42_laraR6_gnssCellInfo_advanced.atl | 944 +++++++++--------- ..._lpwa_first_configuration_psm_advanced.atl | 44 +- ...a_first_configuration_pwr_off_advanced.atl | 42 +- ...wake_up_and_publish_QoS-1_psm_advanced.atl | 40 +- ..._up_and_publish_QoS-1_pwr_off_advanced.atl | 42 +- ..._wake_up_and_publish_QoS1_psm_advanced.atl | 38 +- ...e_up_and_publish_QoS1_pwr_off_advanced.atl | 42 +- .../sim/SIM_all_readSimFiles_advanced.atl | 350 +++---- .../sys_all_baudRateFinder_basic.atl | 48 +- .../sys_all_ffsStoreReceiveDelete_advance.atl | 92 +- .../sys_all_fileManagement_advance.atl | 178 ++-- .../sys_all_filesystemManagement_advance.atl | 262 ++--- .../sys_all_macroTesting_advance.atl | 740 +++++++------- .../sys_all_multipleBaudTesting_basic.atl | 62 +- .../sys_all_traceExample_basic.atl | 68 +- license/LICENSE_SCRIPTING | 2 +- 53 files changed, 2492 insertions(+), 2497 deletions(-) diff --git a/at_scripts/cell_modem/cell_all_hexCmd_networkReg_basic.atl b/at_scripts/cell_modem/cell_all_hexCmd_networkReg_basic.atl index fbed199..eb506df 100644 --- a/at_scripts/cell_modem/cell_all_hexCmd_networkReg_basic.atl +++ b/at_scripts/cell_modem/cell_all_hexCmd_networkReg_basic.atl @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_hexCmd_networkReg_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: hmeh, bkha -* Description: -* This script has the purpose to test the network registration -* using SENDHEX() macro. +* Synopsis: cell_all_hexCmd_networkReg_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: hmeh, bkha +* Description: +* This script has the purpose to test the network registration +* using SENDHEX() macro. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ // sending AT command in HEX diff --git a/at_scripts/cell_modem/cell_all_hfc_ctsrts_basic.atl b/at_scripts/cell_modem/cell_all_hfc_ctsrts_basic.atl index dfdefd9..6e8be43 100644 --- a/at_scripts/cell_modem/cell_all_hfc_ctsrts_basic.atl +++ b/at_scripts/cell_modem/cell_all_hfc_ctsrts_basic.atl @@ -13,52 +13,52 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_hfc_ctsrts_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: hmeh, bkha -* Description: -* This script has the purpose to test the flow control line status using -* CTS and RTS lines. -* bool GETCOMCTS(void): return the status of CTS line -* void SETCOMRTS(bool &in): sets the RTS with value = 'in' +* Synopsis: cell_all_hfc_ctsrts_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: hmeh, bkha +* Description: +* This script has the purpose to test the flow control line status using +* CTS and RTS lines. +* bool GETCOMCTS(void): return the status of CTS line +* void SETCOMRTS(bool &in): sets the RTS with value = 'in' ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ void send_AT_command(string cmd, int ms_timeout, string exp_resp){ - PAUSE(50); - string resp = SENDAT(cmd, ms_timeout, exp_resp); - ECHO("response = " + resp); + PAUSE(50); + string resp = SENDAT(cmd, ms_timeout, exp_resp); + ECHO("response = " + resp); } void update_status(){ - ECHO("GET updated status"); - ECHO("{DSR:" + GETCOMDSR()+"},{RI:" + GETCOMRI()+"},{DCD:" + GETCOMDCD()+"}"); + ECHO("GET updated status"); + ECHO("{DSR:" + GETCOMDSR()+"},{RI:" + GETCOMRI()+"},{DCD:" + GETCOMDCD()+"}"); } void RTS_testing(){ - ECHO("RTS TESTING START"); + ECHO("RTS TESTING START"); - ECHO("SET RTS TO FALSE"); - SETCOMRTS(false); + ECHO("SET RTS TO FALSE"); + SETCOMRTS(false); - PAUSE(3000); - send_AT_command("ATI9", 3000, "OK"); + PAUSE(3000); + send_AT_command("ATI9", 3000, "OK"); - update_status(); - - PAUSE(3000); - ECHO("SET RTS TO TRUE"); - SETCOMRTS(true); + update_status(); + + PAUSE(3000); + ECHO("SET RTS TO TRUE"); + SETCOMRTS(true); - update_status(); + update_status(); - ECHO("RTS TESTING END"); + ECHO("RTS TESTING END"); } void main(){ - update_status(); - RTS_testing(); + update_status(); + RTS_testing(); } diff --git a/at_scripts/cell_modem/cell_all_hfc_dsrdtr_basic.atl b/at_scripts/cell_modem/cell_all_hfc_dsrdtr_basic.atl index 9ec4d97..400c404 100644 --- a/at_scripts/cell_modem/cell_all_hfc_dsrdtr_basic.atl +++ b/at_scripts/cell_modem/cell_all_hfc_dsrdtr_basic.atl @@ -13,62 +13,62 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_hfc_dsrdtr_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: hmeh, bkha +* Synopsis: cell_all_hfc_dsrdtr_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: hmeh, bkha * Description: -* This script has the purpose to test the flow control line status -* using DSR and DTR lines. -* bool GETCOMDSR(void): return the status of DSR line -* bool GETCOMRI(void): return the status of RI line -* bool GETCOMDCD(void): return the status of DCD line -* void SETCOMDTR(bool &in): sets the DTR with value = 'in' +* This script has the purpose to test the flow control line status +* using DSR and DTR lines. +* bool GETCOMDSR(void): return the status of DSR line +* bool GETCOMRI(void): return the status of RI line +* bool GETCOMDCD(void): return the status of DCD line +* void SETCOMDTR(bool &in): sets the DTR with value = 'in' ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ void send_AT_command(string cmd, int ms_timeout, string exp_resp){ - PAUSE(50); - string resp = SENDAT(cmd, ms_timeout, exp_resp); - ECHO("response = " + resp); + PAUSE(50); + string resp = SENDAT(cmd, ms_timeout, exp_resp); + ECHO("response = " + resp); } void update_status(){ - ECHO("GET updated status"); - ECHO("{DSR:" + GETCOMDSR()+"},{RI:" + GETCOMRI()+"},{DCD:" + GETCOMDCD()+"}"); + ECHO("GET updated status"); + ECHO("{DSR:" + GETCOMDSR()+"},{RI:" + GETCOMRI()+"},{DCD:" + GETCOMDCD()+"}"); } void DTR_testing(){ - ECHO("DTR TESTING START"); + ECHO("DTR TESTING START"); - send_AT_command("AT+UPSV=3", 1000, "OK"); + send_AT_command("AT+UPSV=3", 1000, "OK"); - send_AT_command("AT+UPSV?", 1000, "OK"); + send_AT_command("AT+UPSV?", 1000, "OK"); - ECHO("SET DTR TO FALSE"); - SETCOMDTR(false); - PAUSE(100); - update_status(); + ECHO("SET DTR TO FALSE"); + SETCOMDTR(false); + PAUSE(100); + update_status(); - send_AT_command("AT", 100, "OK"); + send_AT_command("AT", 100, "OK"); - update_status(); - PAUSE(2000); + update_status(); + PAUSE(2000); - ECHO("SET DTR TO TRUE"); - SETCOMDTR(true); + ECHO("SET DTR TO TRUE"); + SETCOMDTR(true); - update_status(); - PAUSE(2000); - send_AT_command("AT+UPSV=0", 1000, "OK"); + update_status(); + PAUSE(2000); + send_AT_command("AT+UPSV=0", 1000, "OK"); - ECHO("DTR TESTING END"); + ECHO("DTR TESTING END"); } void main(){ - update_status(); - DTR_testing(); + update_status(); + DTR_testing(); } diff --git a/at_scripts/cell_modem/cell_all_network_genericCommands_basic.atl b/at_scripts/cell_modem/cell_all_network_genericCommands_basic.atl index 0af6e3a..5cd1558 100644 --- a/at_scripts/cell_modem/cell_all_network_genericCommands_basic.atl +++ b/at_scripts/cell_modem/cell_all_network_genericCommands_basic.atl @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_network_genericCommands_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha +* Synopsis: cell_all_network_genericCommands_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha * Description: -* This script has the purpose to test network related generic commands. +* This script has the purpose to test network related generic commands. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ AT+COPS? diff --git a/at_scripts/cell_modem/cell_all_network_registrationCommands_advance.atl b/at_scripts/cell_modem/cell_all_network_registrationCommands_advance.atl index d7e2c78..f3833ed 100644 --- a/at_scripts/cell_modem/cell_all_network_registrationCommands_advance.atl +++ b/at_scripts/cell_modem/cell_all_network_registrationCommands_advance.atl @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_network_registrationCommands_advance.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha +* Synopsis: cell_all_network_registrationCommands_advance.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha * Description: -* This script has the purpose to test network related advance commands. +* This script has the purpose to test network related advance commands. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ ECHO("Comment lines from the script which are not applicable to the target module"); diff --git a/at_scripts/cell_modem/cell_all_network_urc_advance.atl b/at_scripts/cell_modem/cell_all_network_urc_advance.atl index 06d7623..d0e5069 100644 --- a/at_scripts/cell_modem/cell_all_network_urc_advance.atl +++ b/at_scripts/cell_modem/cell_all_network_urc_advance.atl @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_network_urc_advance.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha +* Synopsis: cell_all_network_urc_advance.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha * Description: -* This script has the purpose to test the network registration with URC -* using AT scripting macros. +* This script has the purpose to test the network registration with URC +* using AT scripting macros. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ @@ -49,10 +49,10 @@ string resp1 = WAIT(command, 30000); if(FIND(resp1, "+CREG: 1") != -1) { - ECHO("Registered on network (HPLMN)"); + ECHO("Registered on network (HPLMN)"); } else { - ECHO("Registration status to be checked (not HPLMN)"); + ECHO("Registration status to be checked (not HPLMN)"); } diff --git a/at_scripts/cell_modem/cell_all_phoneBook_functionality_advance.atl b/at_scripts/cell_modem/cell_all_phoneBook_functionality_advance.atl index e558fe2..1cff8f3 100644 --- a/at_scripts/cell_modem/cell_all_phoneBook_functionality_advance.atl +++ b/at_scripts/cell_modem/cell_all_phoneBook_functionality_advance.atl @@ -4,24 +4,24 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_phoneBook_functionality_advance.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha, hmeh -* Description: -* This Script has a purpose to read, write, edit, delete phone book +* Synopsis: cell_all_phoneBook_functionality_advance.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha, hmeh +* Description: +* This Script has a purpose to read, write, edit, delete phone book ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ string number = "123456789"; @@ -35,70 +35,70 @@ string index = "14"; int resp_timeout = 35000; void send_AT_command(string cmd, int ms_timeout, string exp_resp){ - PAUSE(50); - string resp = SENDAT(cmd, ms_timeout, exp_resp); - ECHO("response = " + resp); + PAUSE(50); + string resp = SENDAT(cmd, ms_timeout, exp_resp); + ECHO("response = " + resp); } void get_phonebook(){ - // get list - send_AT_command("AT+CPBS=\"SM\"",resp_timeout ,"OK"); - send_AT_command("AT+CPBR=1,500",resp_timeout ,"OK"); + // get list + send_AT_command("AT+CPBS=\"SM\"",resp_timeout ,"OK"); + send_AT_command("AT+CPBR=1,500",resp_timeout ,"OK"); } void add_new_contact(string number, string name){ - // add in phone book - string command = "AT+CPBW=,\""; - command = command + number; - command = command + "\",,\""; - command = command + name; - command = command + "\""; - send_AT_command(command,resp_timeout ,"OK"); + // add in phone book + string command = "AT+CPBW=,\""; + command = command + number; + command = command + "\",,\""; + command = command + name; + command = command + "\""; + send_AT_command(command,resp_timeout ,"OK"); } void edit_contact(string index, string number, string name){ - // edit selected index - string command = "AT+CPBW="; - command = command + index; - command = command +",\""; - command = command + number; - command = command + "\",,\""; - command = command + name; - command = command + "\""; - send_AT_command(command,resp_timeout ,"OK"); + // edit selected index + string command = "AT+CPBW="; + command = command + index; + command = command +",\""; + command = command + number; + command = command + "\",,\""; + command = command + name; + command = command + "\""; + send_AT_command(command,resp_timeout ,"OK"); } void delete_contact(string index){ - // delete selected index - string command = "AT+CPBW="; - command = command + index; - send_AT_command(command,resp_timeout ,"OK"); + // delete selected index + string command = "AT+CPBW="; + command = command + index; + send_AT_command(command,resp_timeout ,"OK"); } void get_last_dialed_calls(){ - // get last dialed calls - send_AT_command("AT+CPBS=\"LD\"",resp_timeout ,"OK"); - send_AT_command("AT+CPBR=1,10",resp_timeout ,"OK"); + // get last dialed calls + send_AT_command("AT+CPBS=\"LD\"",resp_timeout ,"OK"); + send_AT_command("AT+CPBR=1,10",resp_timeout ,"OK"); } void main(){ - ECHO("*************************************************************************************************************"); - ECHO("Please configure all the script parameters before using it"); - ECHO("*************************************************************************************************************"); - ECHO(""); - ECHO(""); - ECHO("Read phone book"); - get_phonebook(); - ECHO("Add new contact in phone book"); - add_new_contact(number, name); - get_phonebook(); - ECHO("Edit contact in phone book"); - edit_contact(index, new_number , new_name); - get_phonebook(); - ECHO("Delete contact from phone book"); - delete_contact(index); - get_phonebook(); - ECHO("Get last dialed calls from sim."); - get_last_dialed_calls(); + ECHO("*************************************************************************************************************"); + ECHO("Please configure all the script parameters before using it"); + ECHO("*************************************************************************************************************"); + ECHO(""); + ECHO(""); + ECHO("Read phone book"); + get_phonebook(); + ECHO("Add new contact in phone book"); + add_new_contact(number, name); + get_phonebook(); + ECHO("Edit contact in phone book"); + edit_contact(index, new_number , new_name); + get_phonebook(); + ECHO("Delete contact from phone book"); + delete_contact(index); + get_phonebook(); + ECHO("Get last dialed calls from sim."); + get_last_dialed_calls(); } diff --git a/at_scripts/cell_modem/cell_all_readNameAndFirmware_basic.atl b/at_scripts/cell_modem/cell_all_readNameAndFirmware_basic.atl index 618d5c7..f808cff 100644 --- a/at_scripts/cell_modem/cell_all_readNameAndFirmware_basic.atl +++ b/at_scripts/cell_modem/cell_all_readNameAndFirmware_basic.atl @@ -4,39 +4,39 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_readNameAndFirmware_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: hmeh, bkha -* Description: -* This Script has a purpose to read modem name, firmware version -* and submodule series. +* Synopsis: cell_all_readNameAndFirmware_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: hmeh, bkha +* Description: +* This Script has a purpose to read modem name, firmware version +* and submodule series. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ void send_AT_command(string cmd, int ms_timeout, string exp_resp){ - PAUSE(50); - string resp = SENDAT(cmd, ms_timeout, exp_resp); - ECHO("response = " + resp); + PAUSE(50); + string resp = SENDAT(cmd, ms_timeout, exp_resp); + ECHO("response = " + resp); } void main(){ - send_AT_command("ATI0", 100, "OK"); - send_AT_command("ATI9", 100, "OK"); - send_AT_command("AT+CGMM", 100, "OK"); - send_AT_command("AT+CGMR", 100, "OK"); - send_AT_command("AT+CGSN", 100, "OK"); + send_AT_command("ATI0", 100, "OK"); + send_AT_command("ATI9", 100, "OK"); + send_AT_command("AT+CGMM", 100, "OK"); + send_AT_command("AT+CGMR", 100, "OK"); + send_AT_command("AT+CGSN", 100, "OK"); } diff --git a/at_scripts/cell_modem/cell_all_registrationTime_basic.atl b/at_scripts/cell_modem/cell_all_registrationTime_basic.atl index 27b41bd..8fb300f 100644 --- a/at_scripts/cell_modem/cell_all_registrationTime_basic.atl +++ b/at_scripts/cell_modem/cell_all_registrationTime_basic.atl @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,13 +17,13 @@ * Topic: cell_modem * Version: 1.0 * Author: dtro -* Description: -* This script has the purpose to measure the time elapsed for the network +* Description: +* This script has the purpose to measure the time elapsed for the network * registation. Some initial configurations are necessary in order to run * the script. ****************************************************************************** -* Modules: All products -* Tested on: SARA-R5 +* Modules: All products +* Tested on: SARA-R5 ******************************************************************************/ // insert apn name here diff --git a/at_scripts/cell_modem/cell_all_settings_genericCommands_basic.atl b/at_scripts/cell_modem/cell_all_settings_genericCommands_basic.atl index e6fd021..685ed4c 100644 --- a/at_scripts/cell_modem/cell_all_settings_genericCommands_basic.atl +++ b/at_scripts/cell_modem/cell_all_settings_genericCommands_basic.atl @@ -4,24 +4,24 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_settings_genericCommands_basic.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to check few settings of the modem. +* Synopsis: cell_all_settings_genericCommands_basic.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to check few settings of the modem. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ diff --git a/at_scripts/cell_modem/cell_all_sms_functionality_advance.atl b/at_scripts/cell_modem/cell_all_sms_functionality_advance.atl index 7dfcdf5..eb53157 100644 --- a/at_scripts/cell_modem/cell_all_sms_functionality_advance.atl +++ b/at_scripts/cell_modem/cell_all_sms_functionality_advance.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: cell_all_sms_functionality_advance.atl -* Topic: cell_modem -* Version: 1.0 -* Author: bkha -* Description: -* This script has the purpose to test the SMS behavior with proper connected -* SIM and antenna. +* Synopsis: cell_all_sms_functionality_advance.atl +* Topic: cell_modem +* Version: 1.0 +* Author: bkha +* Description: +* This script has the purpose to test the SMS behavior with proper connected +* SIM and antenna. ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ @@ -35,47 +35,47 @@ int loop_count = 50; //--------------------------------// void send_AT_command(string cmd, int ms_timeout, string exp_resp){ - PAUSE(50); - string resp = SENDAT(cmd, ms_timeout, exp_resp); - ECHO("response = " + resp); + PAUSE(50); + string resp = SENDAT(cmd, ms_timeout, exp_resp); + ECHO("response = " + resp); } // sms sending void SMS_sending(int i){ - // setting text mode - send_AT_command("AT+CMGF=1", 100, "OK"); - // set the number to which sms should be sent - string phone_number_cmd ="AT+CMGS=\"" + phone_number + "\""; - send_AT_command(phone_number_cmd ,1000, ">"); - // reset the string - string body = sms_body; - body = body + i; - body = body + 1; - body[body.length()-1] = 26; - // set the body of text message. - send_AT_command(body, 180000, "OK"); + // setting text mode + send_AT_command("AT+CMGF=1", 100, "OK"); + // set the number to which sms should be sent + string phone_number_cmd ="AT+CMGS=\"" + phone_number + "\""; + send_AT_command(phone_number_cmd ,1000, ">"); + // reset the string + string body = sms_body; + body = body + i; + body = body + 1; + body[body.length()-1] = 26; + // set the body of text message. + send_AT_command(body, 180000, "OK"); } // sms deleting void SMS_deleting(){ - send_AT_command("AT+CMGR=1", 1000, "OK"); - send_AT_command("AT+CMGD=1", 1000, "OK"); + send_AT_command("AT+CMGR=1", 1000, "OK"); + send_AT_command("AT+CMGD=1", 1000, "OK"); } // display all messages void SMS_display_all_messages(){ - send_AT_command("AT+CMGL=ALL", 1000, "OK"); + send_AT_command("AT+CMGL=ALL", 1000, "OK"); } void main(){ - ECHO("*************************************************************************************************************"); - ECHO("Add valid number in string phone_number"); - ECHO("*************************************************************************************************************"); - for(int i =0; i> 1; - } - int l = s.length(); - if (l < size){ - s = formatInt(0, '0', size - l) + s; - } - if (negVal == true) - { - string r = ""; - for (int i = 0; i < s.length(); i++){ - if (s[i] == 0x30) - r +="1"; - else - r += "0"; - } - s = r; - } - return s; + bool negVal = false; + string s = ""; + if (n < 0){ + n *= -1; + n -= 1; + negVal = true; + } + while(n != 0){ + s = formatInt(n % 2) + s; + n = n >> 1; + } + int l = s.length(); + if (l < size){ + s = formatInt(0, '0', size - l) + s; + } + if (negVal == true) + { + string r = ""; + for (int i = 0; i < s.length(); i++){ + if (s[i] == 0x30) + r +="1"; + else + r += "0"; + } + s = r; + } + return s; } // Converts bitstream in string format to int type. // returns -1 if the input is not in bitstream format. int bitstream_to_int_converter(string bitstream){ - int ret_val = 0; - int len = bitstream.length(); - int mul_factor = 1; - for(int j = 0; j < len - 1; j++){ - mul_factor *= 2; - } - for(int i = 0; i < len; i++){ - if(bitstream[i] == 0x30 || bitstream[i] == 0x31){ - ret_val += (mul_factor * (bitstream[i] - 0x30)); - mul_factor /= 2; - } - else{ - return -1; - } - } - return ret_val; + int ret_val = 0; + int len = bitstream.length(); + int mul_factor = 1; + for(int j = 0; j < len - 1; j++){ + mul_factor *= 2; + } + for(int i = 0; i < len; i++){ + if(bitstream[i] == 0x30 || bitstream[i] == 0x31){ + ret_val += (mul_factor * (bitstream[i] - 0x30)); + mul_factor /= 2; + } + else{ + return -1; + } + } + return ret_val; } // compute xor of two numbers and returns it int compute_XOR(int x, int y) { - return x^y; + return x^y; } // compute and of two numbers and returns it int compute_AND(int x, int y) { - return x & y; + return x & y; } // compute and of two numbers and returns it int compute_OR(int x, int y) { - return x | y; + return x | y; } // return left bit shift (<< , 010 -> 100) of a number int compute_left_bit_shift(int num, int shift){ - for(int i = 0; i < shift; i++){ - num *= 2; - } - return num; + for(int i = 0; i < shift; i++){ + num *= 2; + } + return num; } // return right bit shift (>> , 010 -> 001) of a number int compute_right_bit_shift(int num, int shift){ - for(int i = 0; i < shift; i++){ - num /= 2; - } - return num; + for(int i = 0; i < shift; i++){ + num /= 2; + } + return num; } diff --git a/at_scripts/common_lib/library.atl b/at_scripts/common_lib/library.atl index 96ef07a..a8a43f7 100644 --- a/at_scripts/common_lib/library.atl +++ b/at_scripts/common_lib/library.atl @@ -4,23 +4,23 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: library.atl -* Topic: common_lib -* Version: 1.0 -* Author: hmeh, bkha -* Description: -* This script has the purpose to maintain common functions to be use in -* all the scripts. All lib functions should be defined in the -* library.atl file. +* Synopsis: library.atl +* Topic: common_lib +* Version: 1.0 +* Author: hmeh, bkha +* Description: +* This script has the purpose to maintain common functions to be use in +* all the scripts. All lib functions should be defined in the +* library.atl file. ******************************************************************************/ // Properly sending AT command. Pausing for 50 seconds. Sending AT command and ECHOing the response. diff --git a/at_scripts/debug-ability/debug_laraR2_tobyR2_basic.atl b/at_scripts/debug-ability/debug_laraR2_tobyR2_basic.atl index 2c41113..627211c 100644 --- a/at_scripts/debug-ability/debug_laraR2_tobyR2_basic.atl +++ b/at_scripts/debug-ability/debug_laraR2_tobyR2_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_laraR2_tobyR2_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_laraR2_tobyR2_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: LARA-R2, TOBY-R2 -* Tested on: LARA-R2, TOBY-R2 +* Modules: LARA-R2, TOBY-R2 +* Tested on: LARA-R2, TOBY-R2 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_laraR6_basic.atl b/at_scripts/debug-ability/debug_laraR6_basic.atl index f53eafb..b351bcb 100644 --- a/at_scripts/debug-ability/debug_laraR6_basic.atl +++ b/at_scripts/debug-ability/debug_laraR6_basic.atl @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_laraR6_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: mdem +* Synopsis: debug_laraR6_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: mdem * Description: -* This script has the general purpose to collect debug info from -* the target module. +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: LARA-R6 -* Tested on: LARA-R6 +* Modules: LARA-R6 +* Tested on: LARA-R6 *******************************************************************************/ ######################### diff --git a/at_scripts/debug-ability/debug_saraN2_basic.atl b/at_scripts/debug-ability/debug_saraN2_basic.atl index 98ec2c7..8f61033 100644 --- a/at_scripts/debug-ability/debug_saraN2_basic.atl +++ b/at_scripts/debug-ability/debug_saraN2_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_saraN2_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_saraN2_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: SARA-N2 -* Tested on: SARA-N2 +* Modules: SARA-N2 +* Tested on: SARA-N2 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_saraN3_basic.atl b/at_scripts/debug-ability/debug_saraN3_basic.atl index 271b0ea..73e88c9 100644 --- a/at_scripts/debug-ability/debug_saraN3_basic.atl +++ b/at_scripts/debug-ability/debug_saraN3_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_saraN3_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_saraN3_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: SARA-N3 -* Tested on: SARA-N3 +* Modules: SARA-N3 +* Tested on: SARA-N3 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_saraR41_basic.atl b/at_scripts/debug-ability/debug_saraR41_basic.atl index 32eafd2..9007e84 100644 --- a/at_scripts/debug-ability/debug_saraR41_basic.atl +++ b/at_scripts/debug-ability/debug_saraR41_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_saraR41_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_saraR41_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: SARA-R41 -* Tested on: SARA-R41 +* Modules: SARA-R41 +* Tested on: SARA-R41 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_saraR41_preProductionScript_basic.atl b/at_scripts/debug-ability/debug_saraR41_preProductionScript_basic.atl index e641bcc..7b6f9fc 100644 --- a/at_scripts/debug-ability/debug_saraR41_preProductionScript_basic.atl +++ b/at_scripts/debug-ability/debug_saraR41_preProductionScript_basic.atl @@ -4,46 +4,46 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *************************************************************************************** -* Synopsis: debug_saraR41_preProductionScript_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: clee, aayy +* Synopsis: debug_saraR41_preProductionScript_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: clee, aayy * Description: -* This script has the general purpose to help configuring the target module which -* was received directly from the factory. +* This script has the general purpose to help configuring the target module which +* was received directly from the factory. * -* PLEASE SET THE FOLLOWING PARAMETERS BEFORE RUNNING -* THE SCRIPT: -* , in +CGDCONT (LINE 154) -* in +CSGT (LINE 101) -* in +UMNOPROF (LINE 110) -* in +UBANDMASK (LINE 131) -* in +URAT (LINE 134) -* in +USVCDOMAIN (LINE 137) +* PLEASE SET THE FOLLOWING PARAMETERS BEFORE RUNNING +* THE SCRIPT: +* , in +CGDCONT (LINE 154) +* in +CSGT (LINE 101) +* in +UMNOPROF (LINE 110) +* in +UBANDMASK (LINE 131) +* in +URAT (LINE 134) +* in +USVCDOMAIN (LINE 137) * -* Example: (for AT&T Network) +* Example: (for AT&T Network) * -* = broadband, = IP in +CGDCONT (LINE 154) -* = Modem Ready in +CSGT (LINE 101) -* = 100 in +UMNOPROF (LINE 110) -* = 2074 in +UBANDMASK (B2,B4,B5,B12)(LINE 131) -* = 7 in +URAT for CAT M1(LINE 134) -* = 2 in +USVCDOMAIN for CS/PS (LINE 137) +* = broadband, = IP in +CGDCONT (LINE 154) +* = Modem Ready in +CSGT (LINE 101) +* = 100 in +UMNOPROF (LINE 110) +* = 2074 in +UBANDMASK (B2,B4,B5,B12)(LINE 131) +* = 7 in +URAT for CAT M1(LINE 134) +* = 2 in +USVCDOMAIN for CS/PS (LINE 137) * -* This script assumes sim was inserted before starting -* PLEASE REFER AT COMMAND MANUAL FOR REFERENCE +* This script assumes sim was inserted before starting +* PLEASE REFER AT COMMAND MANUAL FOR REFERENCE **************************************************************************************** -* Modules: SARA-R41x-04 -* Tested on: SARA-R41x-04 +* Modules: SARA-R41x-04 +* Tested on: SARA-R41x-04 ***************************************************************************************/ @@ -51,19 +51,19 @@ void repeated_at_command(string cmd, int msTimeOut, string expResp) { // adding For Loop to make sure AT commands returns the correct output in case ERROR is returned due to timing issues - for(int i=0;i<=15;i++){ - PAUSE(40); // 40ms delay was introduced; as it is advised to maintain 20ms delay in between AT commands - string resp = SENDAT(cmd, msTimeOut, expResp); // this command sends the "cmd" - At command, and waits for msTimeOut or for "expResp" - ECHO("execution count of above command" + i); // displays the index of Command sent - if( resp != expResp) // if command gives back error, the same command will be sent again until it resends correct output - { - PAUSE 1000; - } - else{ - break; // terminate Loop incase of successful response - } - } - + for(int i=0;i<=15;i++){ + PAUSE(40); // 40ms delay was introduced; as it is advised to maintain 20ms delay in between AT commands + string resp = SENDAT(cmd, msTimeOut, expResp); // this command sends the "cmd" - At command, and waits for msTimeOut or for "expResp" + ECHO("execution count of above command" + i); // displays the index of Command sent + if( resp != expResp) // if command gives back error, the same command will be sent again until it resends correct output + { + PAUSE 1000; + } + else{ + break; // terminate Loop incase of successful response + } + } + } @@ -71,170 +71,170 @@ void repeated_at_command(string cmd, int msTimeOut, string expResp) void run_bootup_commands(void) { - PAUSE(5000); // first time bootup delay - - send_at_command("AT", 10000, "OK"); - - // this command enables Verbose Error values - send_at_command("AT+CMEE=2", 10000, "OK"); - - // this command provides with the FW version of Module - send_at_command("AT+CGMR", 10000, "OK"); - - // this command provides with the IMEI of Module - send_at_command("AT+CGSN", 10000, "OK"); - - // this command provides with the Module Type - send_at_command("ATI0", 10000, "OK"); - - // this command provides with the Module Type and other parameters - send_at_command("ATI9", 10000, "OK"); - - // checks for previous backup operation details - send_at_command("AT+UBKUPDATA?", 10000, "OK"); - - // checks for the previous set Greeting message - send_at_command("AT+CSGT?", 10000, "OK"); - - // setting the desired Greeting Text - send_at_command('AT+CSGT=1,""', 10000, "OK"); - - // reading the device functionality mode - send_at_command("AT+CFUN?", 10000, "OK"); - - // set the module to minimum functionality mode - send_at_command("AT+CFUN=0", 10000, "OK"); - - // setting the module to desired profile - send_at_command("AT+UMNOPROF=", 10000, "OK"); - - // rebooting the module - send_at_command("AT+CFUN=15", 10000, "OK"); - - // wait for Greeting Text - WAIT("Modem Ready", 15000); - - // reading the MNO profile value - send_at_command("AT+UMNOPROF?", 10000, "OK"); + PAUSE(5000); // first time bootup delay + + send_at_command("AT", 10000, "OK"); + + // this command enables Verbose Error values + send_at_command("AT+CMEE=2", 10000, "OK"); + + // this command provides with the FW version of Module + send_at_command("AT+CGMR", 10000, "OK"); + + // this command provides with the IMEI of Module + send_at_command("AT+CGSN", 10000, "OK"); + + // this command provides with the Module Type + send_at_command("ATI0", 10000, "OK"); + + // this command provides with the Module Type and other parameters + send_at_command("ATI9", 10000, "OK"); + + // checks for previous backup operation details + send_at_command("AT+UBKUPDATA?", 10000, "OK"); + + // checks for the previous set Greeting message + send_at_command("AT+CSGT?", 10000, "OK"); + + // setting the desired Greeting Text + send_at_command('AT+CSGT=1,""', 10000, "OK"); + + // reading the device functionality mode + send_at_command("AT+CFUN?", 10000, "OK"); + + // set the module to minimum functionality mode + send_at_command("AT+CFUN=0", 10000, "OK"); + + // setting the module to desired profile + send_at_command("AT+UMNOPROF=", 10000, "OK"); + + // rebooting the module + send_at_command("AT+CFUN=15", 10000, "OK"); + + // wait for Greeting Text + WAIT("Modem Ready", 15000); + + // reading the MNO profile value + send_at_command("AT+UMNOPROF?", 10000, "OK"); - // disabling LWM2M. This setting is persistant and please do not turn off/ reboot the module before 4 sec, thus adding 4Sec delay below before CFUN=15 - send_at_command("AT+ULWM2M=1,1", 10000, "OK"); - - // reading Power saving control value - send_at_command("AT+UPSV?", 10000, "OK"); - - // setting the module to minimum functionality mode - send_at_command("AT+CFUN=0", 10000, "OK"); - - // setting the desired Bandmask - send_at_command("AT+UBANDMASK=0,", 10000, "OK"); - - // setting the preferred RAT type - send_at_command("AT+URAT=", 10000, "OK"); - - // setting the preferred service domain - send_at_command("AT+USVCDOMAIN=", 10000, "OK"); - - // enabling CSCON URC's - send_at_command("AT+CSCON=1", 10000, "OK"); + // disabling LWM2M. This setting is persistant and please do not turn off/ reboot the module before 4 sec, thus adding 4Sec delay below before CFUN=15 + send_at_command("AT+ULWM2M=1,1", 10000, "OK"); + + // reading Power saving control value + send_at_command("AT+UPSV?", 10000, "OK"); + + // setting the module to minimum functionality mode + send_at_command("AT+CFUN=0", 10000, "OK"); + + // setting the desired Bandmask + send_at_command("AT+UBANDMASK=0,", 10000, "OK"); + + // setting the preferred RAT type + send_at_command("AT+URAT=", 10000, "OK"); + + // setting the preferred service domain + send_at_command("AT+USVCDOMAIN=", 10000, "OK"); + + // enabling CSCON URC's + send_at_command("AT+CSCON=1", 10000, "OK"); - // enabling PSM URC's - send_at_command("AT+UPSMR=1", 10000, "OK"); - - // reading the UTEST command - send_at_command("AT+UTEST?", 10000, "OK"); - - // setting The UTEST mode - send_at_command("AT+UTEST=1", 10000, "OK"); - - ECHO("Setting the desired APN"); - - // setting APN - repeated_at_command('AT+CGDCONT=1,"IP",""', 10000, "OK"); - - // reading the APN - send_at_command("AT+CGDCONT?", 10000, "OK"); - - // disabling the eDRX feature - send_at_command("AT+CEDRXS=0,2", 10000, "OK"); - send_at_command("AT+CEDRXS=0,4", 10000, "OK"); - send_at_command("AT+CEDRXS=0,5", 10000, "OK"); - - // disabling the PSM feature - send_at_command("AT+CPSMS=0", 10000, "OK"); - - // reading the time zone update setting - send_at_command("AT+CTZU?", 10000, "OK"); - - // setting the storage type for SMS - send_at_command('AT+CPMS="ME","ME","ME"', 10000, "OK"); - - // pause needed after disabling LwM2M to ensure 4sec gap if a power down or reboot sent - PAUSE(4000); - - // rebooting the module - send_at_command("AT+CFUN=15 ", 10000, "OK"); - - // waiting for the Greeting Text - WAIT("Modem Ready", 15000); - - // reading the UTEST settings - send_at_command("AT+UTEST?", 10000, "OK"); - - // setting the module to non signalling mode - send_at_command("AT+UTEST=1", 10000, "OK"); - - // reading the Device mode - send_at_command("AT+CFUN?", 10000, "OK"); - - // TX test executed on B12 TX - send_at_command("AT+UTEST=3,123130,17,,,5000", 10000, "OK"); - - // setting the device to signalling mode - send_at_command("AT+UTEST=0", 10000, "OK"); - - // checking device mode - send_at_command("AT+CFUN?", 10000, "OK"); - - ECHO("please check the following parameters +CFUN:1 and +UTEST:0 for signalling mode"); - - // reading the LWM2M settings - send_at_command("AT+ULWM2M?", 10000, "OK"); - - ECHO(" Turn off LWM2M manually at bootup if not turned off"); - - // reading the bandmask - send_at_command("AT+UBANDMASK?", 10000, "OK"); - - // reading the RAT type - send_at_command("AT+URAT?", 10000, "OK"); - - // reading the eDRX Settings - send_at_command("AT+CEDRXS?", 10000, "OK"); - - // reading then PSM settings - send_at_command("AT+CPSMS?", 10000, "OK"); - - // reading the service domain values - send_at_command("AT+USVCDOMAIN?", 10000, "OK"); - - // reading the URC enabling status - send_at_command("AT+CSCON?", 10000, "OK"); - - // reading the URC enabling status - send_at_command("AT+UPSMR?", 10000, "OK"); - - ECHO("Module ready to use; device will power off now"); - - // gracefully shutdown the module - send_at_command("AT+CPWROFF", 40000, "OK"); + // enabling PSM URC's + send_at_command("AT+UPSMR=1", 10000, "OK"); + + // reading the UTEST command + send_at_command("AT+UTEST?", 10000, "OK"); + + // setting The UTEST mode + send_at_command("AT+UTEST=1", 10000, "OK"); + + ECHO("Setting the desired APN"); + + // setting APN + repeated_at_command('AT+CGDCONT=1,"IP",""', 10000, "OK"); + + // reading the APN + send_at_command("AT+CGDCONT?", 10000, "OK"); + + // disabling the eDRX feature + send_at_command("AT+CEDRXS=0,2", 10000, "OK"); + send_at_command("AT+CEDRXS=0,4", 10000, "OK"); + send_at_command("AT+CEDRXS=0,5", 10000, "OK"); + + // disabling the PSM feature + send_at_command("AT+CPSMS=0", 10000, "OK"); + + // reading the time zone update setting + send_at_command("AT+CTZU?", 10000, "OK"); + + // setting the storage type for SMS + send_at_command('AT+CPMS="ME","ME","ME"', 10000, "OK"); + + // pause needed after disabling LwM2M to ensure 4sec gap if a power down or reboot sent + PAUSE(4000); + + // rebooting the module + send_at_command("AT+CFUN=15 ", 10000, "OK"); + + // waiting for the Greeting Text + WAIT("Modem Ready", 15000); + + // reading the UTEST settings + send_at_command("AT+UTEST?", 10000, "OK"); + + // setting the module to non signalling mode + send_at_command("AT+UTEST=1", 10000, "OK"); + + // reading the Device mode + send_at_command("AT+CFUN?", 10000, "OK"); + + // TX test executed on B12 TX + send_at_command("AT+UTEST=3,123130,17,,,5000", 10000, "OK"); + + // setting the device to signalling mode + send_at_command("AT+UTEST=0", 10000, "OK"); + + // checking device mode + send_at_command("AT+CFUN?", 10000, "OK"); + + ECHO("please check the following parameters +CFUN:1 and +UTEST:0 for signalling mode"); + + // reading the LWM2M settings + send_at_command("AT+ULWM2M?", 10000, "OK"); + + ECHO(" Turn off LWM2M manually at bootup if not turned off"); + + // reading the bandmask + send_at_command("AT+UBANDMASK?", 10000, "OK"); + + // reading the RAT type + send_at_command("AT+URAT?", 10000, "OK"); + + // reading the eDRX Settings + send_at_command("AT+CEDRXS?", 10000, "OK"); + + // reading then PSM settings + send_at_command("AT+CPSMS?", 10000, "OK"); + + // reading the service domain values + send_at_command("AT+USVCDOMAIN?", 10000, "OK"); + + // reading the URC enabling status + send_at_command("AT+CSCON?", 10000, "OK"); + + // reading the URC enabling status + send_at_command("AT+UPSMR?", 10000, "OK"); + + ECHO("Module ready to use; device will power off now"); + + // gracefully shutdown the module + send_at_command("AT+CPWROFF", 40000, "OK"); } // below is the main function, its where the execution of script starts void main(){ - ECHO("If you haven't set the parameters in script before please stop the script, set the values ,then Save and restart the script"); - - run_bootup_commands(); + ECHO("If you haven't set the parameters in script before please stop the script, set the values ,then Save and restart the script"); + + run_bootup_commands(); } diff --git a/at_scripts/debug-ability/debug_saraR42_basic.atl b/at_scripts/debug-ability/debug_saraR42_basic.atl index 3367498..3dcc1bc 100644 --- a/at_scripts/debug-ability/debug_saraR42_basic.atl +++ b/at_scripts/debug-ability/debug_saraR42_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_saraR42_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: mreb -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_saraR42_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: mreb +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: SARA-R42 -* Tested on: SARA-R42 +* Modules: SARA-R42 +* Tested on: SARA-R42 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_saraR5_basic.atl b/at_scripts/debug-ability/debug_saraR5_basic.atl index bcd5174..bd793a4 100644 --- a/at_scripts/debug-ability/debug_saraR5_basic.atl +++ b/at_scripts/debug-ability/debug_saraR5_basic.atl @@ -4,27 +4,27 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http:// www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_saraR5_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module without changing any settings. -* After the execution of this script, some Unsolicited Result Code (URC) -* will be actived. +* Synopsis: debug_saraR5_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module without changing any settings. +* After the execution of this script, some Unsolicited Result Code (URC) +* will be actived. ******************************************************************************* -* Modules: SARA-R5 -* Tested on: SARA-R5 +* Modules: SARA-R5 +* Tested on: SARA-R5 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_tobyL2_basic.atl b/at_scripts/debug-ability/debug_tobyL2_basic.atl index 5faa5e1..ee06fb4 100644 --- a/at_scripts/debug-ability/debug_tobyL2_basic.atl +++ b/at_scripts/debug-ability/debug_tobyL2_basic.atl @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_tobyL2_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_tobyL2_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: TOBY-L2 -* Tested on: TOBY-L2 +* Modules: TOBY-L2 +* Tested on: TOBY-L2 *******************************************************************************/ diff --git a/at_scripts/debug-ability/debug_tobyL4_basic.atl b/at_scripts/debug-ability/debug_tobyL4_basic.atl index 01354e3..357893d 100644 --- a/at_scripts/debug-ability/debug_tobyL4_basic.atl +++ b/at_scripts/debug-ability/debug_tobyL4_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: debug_tobyL4_basic.atl -* Topic: debug-ability -* Version: 1.0 -* Author: bkha -* Description: -* This script has the general purpose to collect debug info from -* the target module. +* Synopsis: debug_tobyL4_basic.atl +* Topic: debug-ability +* Version: 1.0 +* Author: bkha +* Description: +* This script has the general purpose to collect debug info from +* the target module. ******************************************************************************* -* Modules: TOBY-L4 -* Tested on: TOBY-L4 +* Modules: TOBY-L4 +* Tested on: TOBY-L4 *******************************************************************************/ diff --git a/at_scripts/evk/evk_exampleEvkR2_basic.atl b/at_scripts/evk/evk_exampleEvkR2_basic.atl index dcc5301..fa8c636 100644 --- a/at_scripts/evk/evk_exampleEvkR2_basic.atl +++ b/at_scripts/evk/evk_exampleEvkR2_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http:// www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: evk_exampleEvkR2_basic.atl -* Topic: evk -* Version: 1.0 -* Author: mreb +* Synopsis: evk_exampleEvkR2_basic.atl +* Topic: evk +* Version: 1.0 +* Author: mreb * Description: -* Example script associated to EVK-R2_UserGuide_UBX-16016088.pdf -* application note document. +* Example script associated to EVK-R2_UserGuide_UBX-16016088.pdf +* application note document. ******************************************************************************* -* Modules: EVK-R2 -* Tested on: LARA-R2 +* Modules: EVK-R2 +* Tested on: LARA-R2 *******************************************************************************/ diff --git a/at_scripts/evk/evk_exampleEvkR4_basic.atl b/at_scripts/evk/evk_exampleEvkR4_basic.atl index e47479a..2b09693 100644 --- a/at_scripts/evk/evk_exampleEvkR4_basic.atl +++ b/at_scripts/evk/evk_exampleEvkR4_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http:// www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: evk_exampleEvkR4_basic.atl -* Topic: evk -* Version: 1.0 -* Author: mreb +* Synopsis: evk_exampleEvkR4_basic.atl +* Topic: evk +* Version: 1.0 +* Author: mreb * Description: -* Example script associated to EVK-R4_UserGuide_UBX-16029216.pdf -* application note document. +* Example script associated to EVK-R4_UserGuide_UBX-16029216.pdf +* application note document. ******************************************************************************* -* Modules: EVK-R4 -* Tested on: SARA-R412 +* Modules: EVK-R4 +* Tested on: SARA-R412 *******************************************************************************/ diff --git a/at_scripts/evk/evk_exampleEvkR5_basic.atl b/at_scripts/evk/evk_exampleEvkR5_basic.atl index 369a329..cd9d7db 100644 --- a/at_scripts/evk/evk_exampleEvkR5_basic.atl +++ b/at_scripts/evk/evk_exampleEvkR5_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http:// www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: evk_exampleEvkR5_basic.atl -* Topic: evk -* Version: 1.0 -* Author: mreb +* Synopsis: evk_exampleEvkR5_basic.atl +* Topic: evk +* Version: 1.0 +* Author: mreb * Description: -* Example script associated to EVK-R5_UserGuide_UBX-19042592.pdf -* application note document. +* Example script associated to EVK-R5_UserGuide_UBX-19042592.pdf +* application note document. ******************************************************************************* -* Modules: EVK-R5 -* Tested on: SARA-R5 +* Modules: EVK-R5 +* Tested on: SARA-R5 *******************************************************************************/ diff --git a/at_scripts/evk/evk_exampleEvkR6_basic.atl b/at_scripts/evk/evk_exampleEvkR6_basic.atl index b6e0f68..295bd6e 100644 --- a/at_scripts/evk/evk_exampleEvkR6_basic.atl +++ b/at_scripts/evk/evk_exampleEvkR6_basic.atl @@ -4,25 +4,25 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http:// www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************* -* Synopsis: evk_exampleEvkR6_basic.atl -* Topic: evk -* Version: 1.0 -* Author: mreb +* Synopsis: evk_exampleEvkR6_basic.atl +* Topic: evk +* Version: 1.0 +* Author: mreb * Description: -* Example script associated to EVK-R6_UserGuide_UBX-21035387.pdf -* application note document. +* Example script associated to EVK-R6_UserGuide_UBX-21035387.pdf +* application note document. ******************************************************************************* -* Modules: EVK-R6 -* Tested on: LARA-R6 +* Modules: EVK-R6 +* Tested on: LARA-R6 *******************************************************************************/ diff --git a/at_scripts/internet_applications/ipApp_all_activatePsdProfile_basic.atl b/at_scripts/internet_applications/ipApp_all_activatePsdProfile_basic.atl index b598998..47ff530 100644 --- a/at_scripts/internet_applications/ipApp_all_activatePsdProfile_basic.atl +++ b/at_scripts/internet_applications/ipApp_all_activatePsdProfile_basic.atl @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_all_activatePsdProfile_basic.atl -* Topic: internet_application -* Version: 1.0 -* Author: muaw -* Description: This script has the purpose to activate PSD profile +* Synopsis: ipApp_all_activatePsdProfile_basic.atl +* Topic: internet_application +* Version: 1.0 +* Author: muaw +* Description: This script has the purpose to activate PSD profile * ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2, SARA-R5, SARA-R42, LARA-R6 +* Modules: All Products +* Tested on: LARA-R2, SARA-R5, SARA-R42, LARA-R6 ******************************************************************************/ // Configurable parameters @@ -36,84 +36,84 @@ string IPV = 0; //0: IPV4, 1: IPV6 void main() { - ECHO("*************************************************************************************************************"); - ECHO("This script requires to set some configurable parameters."); - ECHO("Be sure those are correctly configured before the initialization of this."); - ECHO("*************************************************************************************************************"); - ECHO(""); - - string resp = ""; - bool registered; - string rat = ""; - - SENDAT("AT+CFUN=0",180000,"OK"); - - if (SENDAT("AT+CGDCONT=" + CID + ",\"" + PDPtype + "\",\"" + APN + "\"" , 2000, "OK") != "OK") - { - STOP("ERROR: unable to set APN"); - } - - SENDAT("AT+CFUN=1",180000,"OK"); - PAUSE 10000; - - // Check registration - resp = SENDAT("AT+CEREG?", 2000, "OK"); - if (resp.split(',')[1].findFirst("1") >= 0 || resp.split(',')[1].findFirst("5") >= 0) - { - registered = true; - } + ECHO("*************************************************************************************************************"); + ECHO("This script requires to set some configurable parameters."); + ECHO("Be sure those are correctly configured before the initialization of this."); + ECHO("*************************************************************************************************************"); + ECHO(""); + + string resp = ""; + bool registered; + string rat = ""; + + SENDAT("AT+CFUN=0",180000,"OK"); + + if (SENDAT("AT+CGDCONT=" + CID + ",\"" + PDPtype + "\",\"" + APN + "\"" , 2000, "OK") != "OK") + { + STOP("ERROR: unable to set APN"); + } + + SENDAT("AT+CFUN=1",180000,"OK"); + PAUSE 10000; + + // Check registration + resp = SENDAT("AT+CEREG?", 2000, "OK"); + if (resp.split(',')[1].findFirst("1") >= 0 || resp.split(',')[1].findFirst("5") >= 0) + { + registered = true; + } - resp = SENDAT("AT+CGREG?", 2000, "OK"); - if (resp.split(',')[1].findFirst("1") >= 0 || resp.split(',')[1].findFirst("5") >= 0) - { - registered = true; - } - - if(!registered) - { - STOP("ERROR: unable to register modem on the network"); - } - - SENDAT("AT+CGDCONT?",10000,""); - - if(productInUse == "laraR2" || productInUse == "saraR5" || productInUse == "saraR42") - { - if (SENDAT("AT+UPSD=0,0," + IPV,1000,"OK") != "OK") - { - STOP("ERROR: unable to set IP version"); - } - - if (SENDAT("AT+UPSD=0,100," + CID , 2000, "OK") != "OK") - { - STOP("ERROR: unable to map PSD profile"); - } - } - - if(productInUse == "laraR2" || productInUse == "saraR5") - { - if(SENDAT("AT+UPSDA=0,3",150000,"OK") != "OK") - { - STOP("ERROR: unable to map PSD profile"); - } - - SENDAT("AT+UPSND=0,8", 2000, "OK"); - ECHO("SUCCESS!"); - } - - if(productInUse == "laraR6" || productInUse == "saraR42") - { - if(productInUse == "laraR6") - { - resp = SENDAT("AT+COPS?", 2000, 'OK'); - rat = resp.split(',')[3].split('\r')[0]; - } - - if(!(productInUse == "laraR6" && rat == "7")) - { - if (SENDAT("AT+CGACT=1," + CID ,5000,"OK") != "OK") - { - STOP("ERROR: unable to activate context"); - } - } - } + resp = SENDAT("AT+CGREG?", 2000, "OK"); + if (resp.split(',')[1].findFirst("1") >= 0 || resp.split(',')[1].findFirst("5") >= 0) + { + registered = true; + } + + if(!registered) + { + STOP("ERROR: unable to register modem on the network"); + } + + SENDAT("AT+CGDCONT?",10000,""); + + if(productInUse == "laraR2" || productInUse == "saraR5" || productInUse == "saraR42") + { + if (SENDAT("AT+UPSD=0,0," + IPV,1000,"OK") != "OK") + { + STOP("ERROR: unable to set IP version"); + } + + if (SENDAT("AT+UPSD=0,100," + CID , 2000, "OK") != "OK") + { + STOP("ERROR: unable to map PSD profile"); + } + } + + if(productInUse == "laraR2" || productInUse == "saraR5") + { + if(SENDAT("AT+UPSDA=0,3",150000,"OK") != "OK") + { + STOP("ERROR: unable to map PSD profile"); + } + + SENDAT("AT+UPSND=0,8", 2000, "OK"); + ECHO("SUCCESS!"); + } + + if(productInUse == "laraR6" || productInUse == "saraR42") + { + if(productInUse == "laraR6") + { + resp = SENDAT("AT+COPS?", 2000, 'OK'); + rat = resp.split(',')[3].split('\r')[0]; + } + + if(!(productInUse == "laraR6" && rat == "7")) + { + if (SENDAT("AT+CGACT=1," + CID ,5000,"OK") != "OK") + { + STOP("ERROR: unable to activate context"); + } + } + } } diff --git a/at_scripts/internet_applications/ipApp_all_socketEchoTest_advance.atl b/at_scripts/internet_applications/ipApp_all_socketEchoTest_advance.atl index ecc0896..c07f9a1 100644 --- a/at_scripts/internet_applications/ipApp_all_socketEchoTest_advance.atl +++ b/at_scripts/internet_applications/ipApp_all_socketEchoTest_advance.atl @@ -4,31 +4,31 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_all_socketEchoTest_advance.atl -* Topic: internet_application -* Version: 1.0 -* Author: dtro +* Synopsis: ipApp_all_socketEchoTest_advance.atl +* Topic: internet_application +* Version: 1.0 +* Author: dtro * Description: -* This script has the purpose to demonstrate a TCP/UDP socket connection -* with an ECHO server test. -* The module must be connected to internet and the internal context -* must be activated. +* This script has the purpose to demonstrate a TCP/UDP socket connection +* with an ECHO server test. +* The module must be connected to internet and the internal context +* must be activated. ****************************************************************************** -* Modules: All products -* Tested on: LARA-R2 +* Modules: All products +* Tested on: LARA-R2 ******************************************************************************/ // Configurable parameters -string protocol = "TCP"; +string protocol = "TCP"; // protocol can be TCP or UDP string server_ip = "185.215.195.137"; int server_port = 7; string echo_text = "Hello world!"; diff --git a/at_scripts/internet_applications/ipApp_laraR6_httpDemo_basic.atl b/at_scripts/internet_applications/ipApp_laraR6_httpDemo_basic.atl index 514ffe0..d07fab2 100644 --- a/at_scripts/internet_applications/ipApp_laraR6_httpDemo_basic.atl +++ b/at_scripts/internet_applications/ipApp_laraR6_httpDemo_basic.atl @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_laraR6_httpDemo_basic.atl -* Topic: internet_application -* Version: 1.0 -* Author: mreb +* Synopsis: ipApp_laraR6_httpDemo_basic.atl +* Topic: internet_application +* Version: 1.0 +* Author: mreb * Description: -* This script has the purpose to demonstrate the use of internal HTTP -* application avaible in u-blox LARA-R6. +* This script has the purpose to demonstrate the use of internal HTTP +* application avaible in u-blox LARA-R6. ****************************************************************************** -* Modules: LARA-R6 -* Tested on: LARA-R6 +* Modules: LARA-R6 +* Tested on: LARA-R6 ******************************************************************************/ // Variables diff --git a/at_scripts/internet_applications/ipApp_laraR6_thingstreamDualApnDemo_basic.atl b/at_scripts/internet_applications/ipApp_laraR6_thingstreamDualApnDemo_basic.atl index e312419..a7e1779 100644 --- a/at_scripts/internet_applications/ipApp_laraR6_thingstreamDualApnDemo_basic.atl +++ b/at_scripts/internet_applications/ipApp_laraR6_thingstreamDualApnDemo_basic.atl @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_laraR6_thingstreamDualApnDemo_basic.atl -* Topic: internet_application -* Version: 1.0 -* Author: mreb +* Synopsis: ipApp_laraR6_thingstreamDualApnDemo_basic.atl +* Topic: internet_application +* Version: 1.0 +* Author: mreb * Description: -* This script has the purpose to demonstrate the activation of two -* differnt APNs at the same time. Thingstream IoT SIM card is required -* for the correct execution of this script. APN "TSUDP" is used for -* the MQTT Anywhere service provided by u-blox Thingstream. While, -* APN "TSIOT" is used to perfom generic data traffic. +* This script has the purpose to demonstrate the activation of two +* differnt APNs at the same time. Thingstream IoT SIM card is required +* for the correct execution of this script. APN "TSUDP" is used for +* the MQTT Anywhere service provided by u-blox Thingstream. While, +* APN "TSIOT" is used to perfom generic data traffic. * Product page: -* https://www.u-blox.com/en/product/iot-sim-card +* https://www.u-blox.com/en/product/iot-sim-card ****************************************************************************** -* Modules: LARA-R6 +* Modules: LARA-R6 * Tested on: LARA-R6 ******************************************************************************/ diff --git a/at_scripts/internet_applications/ipApp_saraR5_saraR42_FTP_retrieve_basic.atl b/at_scripts/internet_applications/ipApp_saraR5_saraR42_FTP_retrieve_basic.atl index 1c0b773..a44f0e8 100644 --- a/at_scripts/internet_applications/ipApp_saraR5_saraR42_FTP_retrieve_basic.atl +++ b/at_scripts/internet_applications/ipApp_saraR5_saraR42_FTP_retrieve_basic.atl @@ -4,26 +4,26 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_saraR5_saraR42_FTP_retrieve_basic.atl -* Topic: internet_application -* Version: 1.0 -* Author: dtro -* Description: -* This script has the purpose to present a simple FTP retrieve. -* Some configurations, such as FTP server address, username and password -* must be set. +* Synopsis: ipApp_saraR5_saraR42_FTP_retrieve_basic.atl +* Topic: internet_application +* Version: 1.0 +* Author: dtro +* Description: +* This script has the purpose to present a simple FTP retrieve. +* Some configurations, such as FTP server address, username and password +* must be set. ****************************************************************************** -* Modules: SARA-R5, SARA-R42 -* Tested on: SARA-R5, SARA-R42 +* Modules: SARA-R5, SARA-R42 +* Tested on: SARA-R5, SARA-R42 ******************************************************************************/ ECHO("******************************************************************************"); diff --git a/at_scripts/internet_applications/ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl b/at_scripts/internet_applications/ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl index 33d37d6..ab6bec5 100644 --- a/at_scripts/internet_applications/ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl +++ b/at_scripts/internet_applications/ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl @@ -4,29 +4,29 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl -* Topic: internet_application -* Version: 1.0 -* Author: mreb +* Synopsis: ipApp_saraR5_saraR42_mqttAnywhereDemo_basic.atl +* Topic: internet_application +* Version: 1.0 +* Author: mreb * Description: -* This script has the purpose to demonstrate the MQTT Anywhere service -* provided by u-blox Thingstream. Thingstream IoT SIM card is required -* for the correct execution of this script. +* This script has the purpose to demonstrate the MQTT Anywhere service +* provided by u-blox Thingstream. Thingstream IoT SIM card is required +* for the correct execution of this script. * Product page: -* https://www.u-blox.com/en/product/mqtt-anywhere -* https://www.u-blox.com/en/product/iot-sim-card +* https://www.u-blox.com/en/product/mqtt-anywhere +* https://www.u-blox.com/en/product/iot-sim-card ****************************************************************************** -* Modules: SARA-R5, SARA-R42 -* Tested on: SARA-R5, SARA-R42 +* Modules: SARA-R5, SARA-R42 +* Tested on: SARA-R5, SARA-R42 ******************************************************************************/ // Variables diff --git a/at_scripts/local_connectivity/con_all_fileManagement_basic.atl b/at_scripts/local_connectivity/con_all_fileManagement_basic.atl index d8b8fbb..6c840b2 100644 --- a/at_scripts/local_connectivity/con_all_fileManagement_basic.atl +++ b/at_scripts/local_connectivity/con_all_fileManagement_basic.atl @@ -4,28 +4,27 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: con_all_fileManagement_basic.atl -* Topic: local_connectivity -* Version: 1.0 -* Author: dtro +* Synopsis: con_all_fileManagement_basic.atl +* Topic: local_connectivity +* Version: 1.0 +* Author: dtro * Description: -* This script has the purpose to demonstrate a basic file system read/write. +* This script has the purpose to demonstrate a basic file system read/write. ****************************************************************************** -* Modules: All products -* Tested on: LARA-R2 +* Modules: All products +* Tested on: LARA-R2 ******************************************************************************/ - string name_file = "example.txt"; string string_to_write = "Hello world!!!"; @@ -43,7 +42,6 @@ ECHO("************************************************************************** - // write a new file in the memory command = "AT+UDWNFILE=\"" + name_file + "\"," + string_to_write.length(); resp = SENDAT(command, 200, ""); @@ -64,7 +62,6 @@ ECHO("************************************************************************** - // read the new created file command = "AT+URDFILE=\"" + name_file + "\""; resp = SENDAT(command, 200, "OK"); @@ -75,7 +72,6 @@ ECHO("************************************************************************** - // read the size of the new created file command = "AT+ULSTFILE=2,\"" + name_file + "\""; resp = SENDAT(command, 200, "OK"); @@ -86,7 +82,6 @@ ECHO("************************************************************************** - // delete the created file command = "AT+UDELFILE=\"" + name_file + "\""; resp = SENDAT(command, 200, "OK"); diff --git a/at_scripts/location_features/location_saraR5_saraR42_gnssAiding_advanced.atl b/at_scripts/location_features/location_saraR5_saraR42_gnssAiding_advanced.atl index ba2eda8..e0f0dc0 100644 --- a/at_scripts/location_features/location_saraR5_saraR42_gnssAiding_advanced.atl +++ b/at_scripts/location_features/location_saraR5_saraR42_gnssAiding_advanced.atl @@ -4,28 +4,28 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: location_saraR5_saraR42_aiding_advanced.atl -* Topic: location_features -* Version: 1.0 -* Author: mace -* Description: -* This script has the purpose to demonstrate the use of the GNSS chip -* Integrated into the modules. -* This script needs a "Start!" greeting message active on boot. The -* greeting text can be activated using the command AT+CSGT=1,"Start!" -* and using a fixed baud rate. +* Synopsis: location_saraR5_saraR42_aiding_advanced.atl +* Topic: location_features +* Version: 1.0 +* Author: mace +* Description: +* This script has the purpose to demonstrate the use of the GNSS chip +* Integrated into the modules. +* This script needs a "Start!" greeting message active on boot. The +* greeting text can be activated using the command AT+CSGT=1,"Start!" +* and using a fixed baud rate. ****************************************************************************** -* Modules: SARA-R510M8S, SARA-R422M8S -* Tested on: SARA-R510M8S, SARA-R422M8S +* Modules: SARA-R510M8S, SARA-R422M8S +* Tested on: SARA-R510M8S, SARA-R422M8S ******************************************************************************/ // to check if it is the first round @@ -72,191 +72,191 @@ string apn_initial_def_bearer = ""; // it looks for the string 'Start!' void wait_for_at_ready(void) { - string command = "Start!"; - string resp = WAIT(command, 60000); + string command = "Start!"; + string resp = WAIT(command, 60000); - if(FIND(resp, "Start!") != -1) - { - ECHO("Module ready"); - } - else - { - ECHO("Module not ready"); - STOP("************ SCRIPT STOPPED **************"); - } + if(FIND(resp, "Start!") != -1) + { + ECHO("Module ready"); + } + else + { + ECHO("Module not ready"); + STOP("************ SCRIPT STOPPED **************"); + } } void modem_initialization (void) { - string command, resp; - - ECHO("Waiting for registration"); - command = "AT+CFUN=4"; - resp = SENDAT(command, 200, "OK"); - PAUSE 20 - command = "AT+CMEE=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE 20 - command = "AT+CREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE 20 - command = "AT+CGREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE 20 - command = "AT+CEREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE 200 - command = "AT+CGDCONT=1,\"IP\",\"" + apn_initial_def_bearer + "\""; - resp = SENDAT(command, 200, "OK"); - PAUSE 20 - command = "AT+CFUN=1"; - resp = SENDAT(command, 200, "OK"); + string command, resp; + + ECHO("Waiting for registration"); + command = "AT+CFUN=4"; + resp = SENDAT(command, 200, "OK"); + PAUSE 20 + command = "AT+CMEE=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE 20 + command = "AT+CREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE 20 + command = "AT+CGREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE 20 + command = "AT+CEREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE 200 + command = "AT+CGDCONT=1,\"IP\",\"" + apn_initial_def_bearer + "\""; + resp = SENDAT(command, 200, "OK"); + PAUSE 20 + command = "AT+CFUN=1"; + resp = SENDAT(command, 200, "OK"); } void wait_for_registration(void) { - string command, resp; - int registration = 0; - - - while (registration < 1) - { - ECHO("Waiting for registration"); - // wait for URC - string command1 = "+C"; - string resp1 = WAIT(command1, 300000); - if(FIND(resp1, "+CREG: 1") != -1) - { - ECHO("Registered on network (HPLMN)"); - registration=1; - } - else if(FIND(resp1, "+CREG: 5") != -1) - { - ECHO("Registered on roaming (VPLMN)"); - registration=1; - } - else if(FIND(resp1, "+CEREG: 1") != -1) - { - ECHO("Registered on network (HPLMN)"); - registration=1; - } - else if(FIND(resp1, "+CEREG: 5") != -1) - { - ECHO("Registered on roaming (VPLMN)"); - registration=1; - } - else - { - ECHO("Registration status to be checked (not HPLMN)"); - } - } - - if (modem_type == 0) - { - command = "AT+CGACT=1,1"; - resp = SENDAT(command, 10000, "OK"); - command = "AT+UPSD=0,0,0"; - resp = SENDAT(command, 10000, "OK"); - command = "AT+UPSD=0,100,1"; - resp = SENDAT(command, 10000, "OK"); - command = "AT+UPSDA=0,3"; - resp = SENDAT(command, 10000, "OK"); - } + string command, resp; + int registration = 0; + + + while (registration < 1) + { + ECHO("Waiting for registration"); + // wait for URC + string command1 = "+C"; + string resp1 = WAIT(command1, 300000); + if(FIND(resp1, "+CREG: 1") != -1) + { + ECHO("Registered on network (HPLMN)"); + registration=1; + } + else if(FIND(resp1, "+CREG: 5") != -1) + { + ECHO("Registered on roaming (VPLMN)"); + registration=1; + } + else if(FIND(resp1, "+CEREG: 1") != -1) + { + ECHO("Registered on network (HPLMN)"); + registration=1; + } + else if(FIND(resp1, "+CEREG: 5") != -1) + { + ECHO("Registered on roaming (VPLMN)"); + registration=1; + } + else + { + ECHO("Registration status to be checked (not HPLMN)"); + } + } + + if (modem_type == 0) + { + command = "AT+CGACT=1,1"; + resp = SENDAT(command, 10000, "OK"); + command = "AT+UPSD=0,0,0"; + resp = SENDAT(command, 10000, "OK"); + command = "AT+UPSD=0,100,1"; + resp = SENDAT(command, 10000, "OK"); + command = "AT+UPSDA=0,3"; + resp = SENDAT(command, 10000, "OK"); + } } void main() -{ - string command, resp; - int aiding_online; - int max_iteration = 200; - int aiding = aiding_type; - - ECHO("*************************************************************************************************************"); - ECHO("This script needs 'Start!' greeting message active on boot"); - ECHO("The greeting text can be actived using the command +CSGT=1,\"Start!\" and using a fixed baud rate (+IPR)"); - ECHO(""); - ECHO(""); - ECHO("*************************************************************************************************************"); - ECHO("REMEMBER TO HAVE ALREADY SET A VALID TOKEN on the module with +UGSRV for accessing online aiding"); - ECHO("*************************************************************************************************************"); - ECHO(""); - ECHO(""); - ECHO("*************************************************************************************************************"); - ECHO("REMEMBER TO CONFIGURE THE GNSS SYSTEM AND THE AIDING MODE"); - ECHO("*************************************************************************************************************"); - - wait_for_at_ready(); - modem_initialization(); - - command ="AT+UGIND=1"; - resp = SENDAT(command, 1000, "OK"); - command ="AT+UGRMC=1"; - resp = SENDAT(command, 1000, "OK"); - command ="AT+ULOCIND=1"; - resp = SENDAT(command, 1000, "OK"); - - /* - if (first_round) - { - aiding = 15; - first_round = false; - } - */ - - if ((aiding & 4) == 4 || (aiding & 2) == 2) - { - ECHO("AIDING CONFIGURED REQUIRES DATA CONNECTION"); - wait_for_registration(); - } - else - { - ECHO("AIDING CONFIGURED DOES NOT REQUIRE DATA CONNECTION"); - } - - ECHO("*************************************************************************************************************"); - ECHO("STARTING GNSS"); - ECHO("*************************************************************************************************************"); - gnss_command ="AT+UGPS=1," + aiding + "," + gnss_system; - resp = SENDAT(gnss_command, 6000, "OK"); - PAUSE 2000; - - for (int i = 0; i < max_iteration; i++) - { - command ="AT+UGRMC?"; - resp = SENDAT(command, 1000, "OK"); - PAUSE 200 - } - - // read twice TTFF value from UBX-NAV-STATUS - command = "AT+UGUBX=\"B56201030000040D\""; - resp = SENDAT(command, 1000, "OK"); - PAUSE 200 - resp = resp.substr(37,8); - // ECHO("TTFF in UBX-NAV-STATUS is " + resp); - resp = SWAPENDIAN(resp); - ECHO("TTFF in UBX-NAV-STATUS is " + resp); - float ttff = parseUInt(resp, 16); - ttff = ttff / 1000; - ECHO("TTFF in UBX-NAV-STATUS is " + ttff +" s"); - PAUSE 1000 - command = "AT+UGUBX=\"B56201030000040D\""; - resp = SENDAT(command, 1000, "OK"); - PAUSE 200 - resp = resp.substr(37,8); - //ECHO("TTFF in UBX-NAV-STATUS is " + resp); - resp = SWAPENDIAN(resp); - ECHO("TTFF in UBX-NAV-STATUS is " + resp); - ttff = parseUInt(resp, 16); - ttff = ttff / 1000; - ECHO("TTFF in UBX-NAV-STATUS is " + ttff +" s"); - PAUSE 1000 +{ + string command, resp; + int aiding_online; + int max_iteration = 200; + int aiding = aiding_type; + + ECHO("*************************************************************************************************************"); + ECHO("This script needs 'Start!' greeting message active on boot"); + ECHO("The greeting text can be actived using the command +CSGT=1,\"Start!\" and using a fixed baud rate (+IPR)"); + ECHO(""); + ECHO(""); + ECHO("*************************************************************************************************************"); + ECHO("REMEMBER TO HAVE ALREADY SET A VALID TOKEN on the module with +UGSRV for accessing online aiding"); + ECHO("*************************************************************************************************************"); + ECHO(""); + ECHO(""); + ECHO("*************************************************************************************************************"); + ECHO("REMEMBER TO CONFIGURE THE GNSS SYSTEM AND THE AIDING MODE"); + ECHO("*************************************************************************************************************"); + + wait_for_at_ready(); + modem_initialization(); + + command ="AT+UGIND=1"; + resp = SENDAT(command, 1000, "OK"); + command ="AT+UGRMC=1"; + resp = SENDAT(command, 1000, "OK"); + command ="AT+ULOCIND=1"; + resp = SENDAT(command, 1000, "OK"); + + /* + if (first_round) + { + aiding = 15; + first_round = false; + } + */ + + if ((aiding & 4) == 4 || (aiding & 2) == 2) + { + ECHO("AIDING CONFIGURED REQUIRES DATA CONNECTION"); + wait_for_registration(); + } + else + { + ECHO("AIDING CONFIGURED DOES NOT REQUIRE DATA CONNECTION"); + } + + ECHO("*************************************************************************************************************"); + ECHO("STARTING GNSS"); + ECHO("*************************************************************************************************************"); + gnss_command ="AT+UGPS=1," + aiding + "," + gnss_system; + resp = SENDAT(gnss_command, 6000, "OK"); + PAUSE 2000; + + for (int i = 0; i < max_iteration; i++) + { + command ="AT+UGRMC?"; + resp = SENDAT(command, 1000, "OK"); + PAUSE 200 + } + + // read twice TTFF value from UBX-NAV-STATUS + command = "AT+UGUBX=\"B56201030000040D\""; + resp = SENDAT(command, 1000, "OK"); + PAUSE 200 + resp = resp.substr(37,8); + // ECHO("TTFF in UBX-NAV-STATUS is " + resp); + resp = SWAPENDIAN(resp); + ECHO("TTFF in UBX-NAV-STATUS is " + resp); + float ttff = parseUInt(resp, 16); + ttff = ttff / 1000; + ECHO("TTFF in UBX-NAV-STATUS is " + ttff +" s"); + PAUSE 1000 + command = "AT+UGUBX=\"B56201030000040D\""; + resp = SENDAT(command, 1000, "OK"); + PAUSE 200 + resp = resp.substr(37,8); + //ECHO("TTFF in UBX-NAV-STATUS is " + resp); + resp = SWAPENDIAN(resp); + ECHO("TTFF in UBX-NAV-STATUS is " + resp); + ttff = parseUInt(resp, 16); + ttff = ttff / 1000; + ECHO("TTFF in UBX-NAV-STATUS is " + ttff +" s"); + PAUSE 1000 - - command ="AT+UGPS=0"; - resp = SENDAT(command, 5000, "OK"); - PAUSE 1000 - command ="AT+CPWROFF"; - resp = SENDAT(command, 10000, "OK"); + + command ="AT+UGPS=0"; + resp = SENDAT(command, 5000, "OK"); + PAUSE 1000 + command ="AT+CPWROFF"; + resp = SENDAT(command, 10000, "OK"); } \ No newline at end of file diff --git a/at_scripts/location_features/location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl b/at_scripts/location_features/location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl index 76ac804..148b451 100644 --- a/at_scripts/location_features/location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl +++ b/at_scripts/location_features/location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl -* Topic: location_features -* Version: 1.0 -* Author: dtro +* Synopsis: location_saraR5_saraR42_laraR6_gnssCellInfo_advanced.atl +* Topic: location_features +* Version: 1.0 +* Author: dtro * Description: The script retrives info about the mobile network status together with -* the GNSS position in which the info are collected. -* The script encapsuletes the info with two set strings in order to make -* the results easy to parse. +* the GNSS position in which the info are collected. +* The script encapsuletes the info with two set strings in order to make +* the results easy to parse. * ****************************************************************************** -* Modules: SARA-R5, SARA-R42, LARA-R6 -* Tested on: SARA-R5, SARA-R42, LARA-R6 +* Modules: SARA-R5, SARA-R42, LARA-R6 +* Tested on: SARA-R5, SARA-R42, LARA-R6 ******************************************************************************/ @@ -33,11 +33,11 @@ int iteration_number = 1000; // modem type // 0 - SARA-R5 -// if chosen, the script encapsuletes and returns the +CESQ and the +UCELLINFO AT command reply +// if chosen, the script encapsuletes and returns the +CESQ and the +UCELLINFO AT command reply // 1 - SARA-R42 -// if chosen, the script encapsuletes and returns the +CESQ AT command reply +// if chosen, the script encapsuletes and returns the +CESQ AT command reply // 2 - LARA-R6 -// if chosen, the script encapsuletes and returns the +CESQ AT command reply +// if chosen, the script encapsuletes and returns the +CESQ AT command reply int modem_type = 2; // flag for the multirat module @@ -108,528 +108,528 @@ string gnss_commnad ="AT+UGPS=1," + aiding_type + "," + gnss_system; // it looks for the string 'Start!' void wait_for_at_ready(void) { - string command = "Start!"; - string resp = WAIT(command, 60000); - - if(FIND(resp, "Start!") != -1) { - ECHO("Module ready"); - } else { - ECHO("Module not ready"); - } + string command = "Start!"; + string resp = WAIT(command, 60000); + + if(FIND(resp, "Start!") != -1) { + ECHO("Module ready"); + } else { + ECHO("Module not ready"); + } } void modem_initialization (void) { - string command, resp; - ECHO("Waiting for registration"); - - command = "AT+UMNOPROF?"; - resp = SENDAT(command, 1000, "OK"); - PAUSE(200); - - if (FIND(resp, "+UMNOPROF: " + umnoprof_set) == -1){ - command = "AT+CFUN=4"; - resp = SENDAT(command, 200,"OK"); - PAUSE(1000); - command = "AT+UMNOPROF=" + umnoprof_set; - resp = SENDAT(command, 200, "OK"); - - command = "AT+CFUN=16"; - resp = SENDAT(command, 5000, "OK"); - - PAUSE(8000); - } - - command = "AT+URAT?"; - resp = SENDAT(command, 1000, "OK"); - PAUSE(200); - handle_rat(resp); - - command = "AT+CMEE=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE(20); - command = "AT+CREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE(20); - command = "AT+CGREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE(20); - command = "AT+CEREG=2"; - resp = SENDAT(command, 200, "OK"); - PAUSE(20); - command = "AT+CSCON=1"; - resp = SENDAT(command, 200, "OK"); - PAUSE(20); - command = "AT+CFUN=4"; - resp = SENDAT(command, 200,"OK"); - PAUSE(1000); - command = "AT+CGDCONT?"; - resp = SENDAT(command, 1000, "OK"); - PAUSE(200); - - if (FIND(resp, apn_initial_def_bearer) == -1){ - command = "AT+CFUN=4"; - resp = SENDAT(command, 200,"OK"); - PAUSE(1000); - command = "AT+CGDCONT=1,\"IP\",\"" + apn_initial_def_bearer + "\""; - resp = SENDAT(command, 200, "OK"); - PAUSE(1000); - } - - command = "AT+CFUN=1"; - resp = SENDAT(command, 200,"OK"); - PAUSE(20); - + string command, resp; + ECHO("Waiting for registration"); + + command = "AT+UMNOPROF?"; + resp = SENDAT(command, 1000, "OK"); + PAUSE(200); + + if (FIND(resp, "+UMNOPROF: " + umnoprof_set) == -1){ + command = "AT+CFUN=4"; + resp = SENDAT(command, 200,"OK"); + PAUSE(1000); + command = "AT+UMNOPROF=" + umnoprof_set; + resp = SENDAT(command, 200, "OK"); + + command = "AT+CFUN=16"; + resp = SENDAT(command, 5000, "OK"); + + PAUSE(8000); + } + + command = "AT+URAT?"; + resp = SENDAT(command, 1000, "OK"); + PAUSE(200); + handle_rat(resp); + + command = "AT+CMEE=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE(20); + command = "AT+CREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE(20); + command = "AT+CGREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE(20); + command = "AT+CEREG=2"; + resp = SENDAT(command, 200, "OK"); + PAUSE(20); + command = "AT+CSCON=1"; + resp = SENDAT(command, 200, "OK"); + PAUSE(20); + command = "AT+CFUN=4"; + resp = SENDAT(command, 200,"OK"); + PAUSE(1000); + command = "AT+CGDCONT?"; + resp = SENDAT(command, 1000, "OK"); + PAUSE(200); + + if (FIND(resp, apn_initial_def_bearer) == -1){ + command = "AT+CFUN=4"; + resp = SENDAT(command, 200,"OK"); + PAUSE(1000); + command = "AT+CGDCONT=1,\"IP\",\"" + apn_initial_def_bearer + "\""; + resp = SENDAT(command, 200, "OK"); + PAUSE(1000); + } + + command = "AT+CFUN=1"; + resp = SENDAT(command, 200,"OK"); + PAUSE(20); + } void wait_for_registration_urc(void) { - string command, resp; - ECHO("Waiting for registration"); - - int counter_cycle = 0; - bool registered = false; - command = "+C"; - resp = WAIT(command, 300000); - - while (!registered) { - - if (FIND(resp, "+CREG: 1") != -1 || FIND(resp, "+CEREG: 1") != -1 || FIND(resp, "+CGREG: 1") != -1) { - ECHO("Registered on network (HPLMN)"); - registered = true; - } else if(FIND(resp, "+CREG: 6") != -1 || FIND(resp, "+CREG: 7") != -1) { - ECHO("Registered for SMS only"); - registered = true; - } else if(FIND(resp, "+CREG: 5") != -1 || FIND(resp, "+CEREG: 5") != -1 || FIND(resp, "+CGREG: 5") != -1) { - ECHO("Registered on roaming (VPLMN)"); - registered = true; - } else { - resp = WAIT(command, 30000); - } - - if (counter_cycle < max_number_retry_registration) { - counter_cycle++; - } else { - ECHO("*************************************************************************************************************"); - ECHO("Registration status to be checked (not HPLMN), stopping the script..."); - STOP("*************************************************************************************************************"); - } - } - - command = "AT+CGACT=1,1"; - resp = SENDAT(command, 10000, "OK"); - - if (modem_type == 0 || modem_type == 1) { - command = "AT+UPSD=0,0,0"; - resp = SENDAT(command, 10000, "OK"); - command = "AT+UPSD=0,100,1"; - resp = SENDAT(command, 10000, "OK"); - } - if (modem_type == 0) { - command = "AT+UPSDA=0,3"; - resp = SENDAT(command, 10000, "OK"); - } + string command, resp; + ECHO("Waiting for registration"); + + int counter_cycle = 0; + bool registered = false; + command = "+C"; + resp = WAIT(command, 300000); + + while (!registered) { + + if (FIND(resp, "+CREG: 1") != -1 || FIND(resp, "+CEREG: 1") != -1 || FIND(resp, "+CGREG: 1") != -1) { + ECHO("Registered on network (HPLMN)"); + registered = true; + } else if(FIND(resp, "+CREG: 6") != -1 || FIND(resp, "+CREG: 7") != -1) { + ECHO("Registered for SMS only"); + registered = true; + } else if(FIND(resp, "+CREG: 5") != -1 || FIND(resp, "+CEREG: 5") != -1 || FIND(resp, "+CGREG: 5") != -1) { + ECHO("Registered on roaming (VPLMN)"); + registered = true; + } else { + resp = WAIT(command, 30000); + } + + if (counter_cycle < max_number_retry_registration) { + counter_cycle++; + } else { + ECHO("*************************************************************************************************************"); + ECHO("Registration status to be checked (not HPLMN), stopping the script..."); + STOP("*************************************************************************************************************"); + } + } + + command = "AT+CGACT=1,1"; + resp = SENDAT(command, 10000, "OK"); + + if (modem_type == 0 || modem_type == 1) { + command = "AT+UPSD=0,0,0"; + resp = SENDAT(command, 10000, "OK"); + command = "AT+UPSD=0,100,1"; + resp = SENDAT(command, 10000, "OK"); + } + if (modem_type == 0) { + command = "AT+UPSDA=0,3"; + resp = SENDAT(command, 10000, "OK"); + } } void wait_for_registration_polling(void) { - string command, command_creg, command_cereg, command_cgreg, resp; - ECHO("Waiting for registration"); - - int counter_cycle = 0; - bool registered = false; - command_creg = "AT+CREG?"; - command_cereg = "AT+CEREG?"; - command_cgreg = "AT+CGREG?"; - bool registered_sms = false; - - while (!registered) { - resp = SENDAT(command_creg, 1000, "OK"); - string status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - int stat = parseInt(status.split(",")[1]); - - if (!registered_sms) { - if (stat == 1 || stat == 5) { - registered = true; - ECHO("*************************************************************************************************************"); - ECHO("Registered in CS domain"); - ECHO("*************************************************************************************************************"); - break; - } else if (stat == 6 || stat == 7 || stat == 8 || stat == 9 || stat == 10) { - registered_sms = true; - ECHO("*************************************************************************************************************"); - ECHO("Registered only for SMS"); - ECHO("*************************************************************************************************************"); - } - } - - resp = SENDAT(command_cereg, 1000, "OK"); - status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - stat = parseInt(status.split(",")[1]); - - if (stat == 1 || stat == 5) { - registered = true; - ECHO("*************************************************************************************************************"); - ECHO("Registered in PS domain"); - ECHO("*************************************************************************************************************"); - break; - } - - resp = SENDAT(command_cgreg, 1000, "OK"); - status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - stat = parseInt(status.split(",")[1]); - - if (stat == 1 || stat == 5) { - registered = true; - ECHO("*************************************************************************************************************"); - ECHO("Registered in PS domain"); - ECHO("*************************************************************************************************************"); - break; - } - - if (counter_cycle < max_number_retry_registration) { - counter_cycle++; - } else { - ECHO("*************************************************************************************************************"); - ECHO("Registration status to be checked, stopping the script..."); - STOP("*************************************************************************************************************"); - } - - PAUSE(5000); - } - - command = "AT+CGACT=1,1"; - resp = SENDAT(command, 10000, "OK"); - - if (modem_type == 0 || modem_type == 1) { - command = "AT+UPSD=0,0,0"; - resp = SENDAT(command, 10000, "OK"); - command = "AT+UPSD=0,100,1"; - resp = SENDAT(command, 10000, "OK"); - } - if (modem_type == 0) { - command = "AT+UPSDA=0,3"; - resp = SENDAT(command, 10000, "OK"); - } + string command, command_creg, command_cereg, command_cgreg, resp; + ECHO("Waiting for registration"); + + int counter_cycle = 0; + bool registered = false; + command_creg = "AT+CREG?"; + command_cereg = "AT+CEREG?"; + command_cgreg = "AT+CGREG?"; + bool registered_sms = false; + + while (!registered) { + resp = SENDAT(command_creg, 1000, "OK"); + string status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + int stat = parseInt(status.split(",")[1]); + + if (!registered_sms) { + if (stat == 1 || stat == 5) { + registered = true; + ECHO("*************************************************************************************************************"); + ECHO("Registered in CS domain"); + ECHO("*************************************************************************************************************"); + break; + } else if (stat == 6 || stat == 7 || stat == 8 || stat == 9 || stat == 10) { + registered_sms = true; + ECHO("*************************************************************************************************************"); + ECHO("Registered only for SMS"); + ECHO("*************************************************************************************************************"); + } + } + + resp = SENDAT(command_cereg, 1000, "OK"); + status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + stat = parseInt(status.split(",")[1]); + + if (stat == 1 || stat == 5) { + registered = true; + ECHO("*************************************************************************************************************"); + ECHO("Registered in PS domain"); + ECHO("*************************************************************************************************************"); + break; + } + + resp = SENDAT(command_cgreg, 1000, "OK"); + status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + stat = parseInt(status.split(",")[1]); + + if (stat == 1 || stat == 5) { + registered = true; + ECHO("*************************************************************************************************************"); + ECHO("Registered in PS domain"); + ECHO("*************************************************************************************************************"); + break; + } + + if (counter_cycle < max_number_retry_registration) { + counter_cycle++; + } else { + ECHO("*************************************************************************************************************"); + ECHO("Registration status to be checked, stopping the script..."); + STOP("*************************************************************************************************************"); + } + + PAUSE(5000); + } + + command = "AT+CGACT=1,1"; + resp = SENDAT(command, 10000, "OK"); + + if (modem_type == 0 || modem_type == 1) { + command = "AT+UPSD=0,0,0"; + resp = SENDAT(command, 10000, "OK"); + command = "AT+UPSD=0,100,1"; + resp = SENDAT(command, 10000, "OK"); + } + if (modem_type == 0) { + command = "AT+UPSDA=0,3"; + resp = SENDAT(command, 10000, "OK"); + } } void handle_rat(string resp_rat) { - string resp, command; - if (FIND(resp_rat, "+URAT: " + urat_set) == -1 && !multi_rat_module){ - command = "AT+CFUN=4"; - resp = SENDAT(command, 200,"OK"); - PAUSE(1000); - command = "AT+URAT=" + urat_set; - resp = SENDAT(command, 200, "OK"); - - command = "AT+CFUN=16"; - resp = SENDAT(command, 5000, "OK"); - - ECHO("*************************************************************************************************************"); - ECHO("RAT SETTING:" + urat_set); - ECHO("*************************************************************************************************************"); - PAUSE(8000); - - } else if (multi_rat_module) { - resp = resp_rat.split("\r\nOK")[0]; - string rat = resp.split(": ")[1]; - array rat_mode = rat.split(","); - string actual_first_rat_mode = rat_mode[0]; - string rat_to_write = ""; - - if (parseInt(actual_first_rat_mode) != urat_set) { - rat_to_write = rat_to_write + urat_set; - for (int i = 0; i < rat_mode.length(); i++) { - if (parseInt(rat_mode[i]) != urat_set) { - rat_to_write = rat_to_write + "," + rat_mode[i]; - } - } - - command = "AT+CFUN=4"; - resp = SENDAT(command, 200,"OK"); - PAUSE(1000); - command = "AT+URAT=" + rat_to_write; - resp = SENDAT(command, 200, "OK"); - - command = "AT+CFUN=16"; - resp = SENDAT(command, 5000, "OK"); - - ECHO("*************************************************************************************************************"); - ECHO("RAT SETTING:" + rat_to_write); - ECHO("*************************************************************************************************************"); - PAUSE(8000); - } - } + string resp, command; + if (FIND(resp_rat, "+URAT: " + urat_set) == -1 && !multi_rat_module){ + command = "AT+CFUN=4"; + resp = SENDAT(command, 200,"OK"); + PAUSE(1000); + command = "AT+URAT=" + urat_set; + resp = SENDAT(command, 200, "OK"); + + command = "AT+CFUN=16"; + resp = SENDAT(command, 5000, "OK"); + + ECHO("*************************************************************************************************************"); + ECHO("RAT SETTING:" + urat_set); + ECHO("*************************************************************************************************************"); + PAUSE(8000); + + } else if (multi_rat_module) { + resp = resp_rat.split("\r\nOK")[0]; + string rat = resp.split(": ")[1]; + array rat_mode = rat.split(","); + string actual_first_rat_mode = rat_mode[0]; + string rat_to_write = ""; + + if (parseInt(actual_first_rat_mode) != urat_set) { + rat_to_write = rat_to_write + urat_set; + for (int i = 0; i < rat_mode.length(); i++) { + if (parseInt(rat_mode[i]) != urat_set) { + rat_to_write = rat_to_write + "," + rat_mode[i]; + } + } + + command = "AT+CFUN=4"; + resp = SENDAT(command, 200,"OK"); + PAUSE(1000); + command = "AT+URAT=" + rat_to_write; + resp = SENDAT(command, 200, "OK"); + + command = "AT+CFUN=16"; + resp = SENDAT(command, 5000, "OK"); + + ECHO("*************************************************************************************************************"); + ECHO("RAT SETTING:" + rat_to_write); + ECHO("*************************************************************************************************************"); + PAUSE(8000); + } + } } void activate_external_gnss() { - string command, resp; - command = "AT+UGPIOC?"; - resp = SENDAT(command, 1000, "OK"); - if (FIND(resp, "23,3") == -1 || FIND(resp, "24,4") == -1) { - command = "AT+UGPIOC=23,3"; - resp = SENDAT(command, 100, "OK"); - command = "AT+UGPIOC=24,4"; - resp = SENDAT(command, 100, "OK"); - } + string command, resp; + command = "AT+UGPIOC?"; + resp = SENDAT(command, 1000, "OK"); + if (FIND(resp, "23,3") == -1 || FIND(resp, "24,4") == -1) { + command = "AT+UGPIOC=23,3"; + resp = SENDAT(command, 100, "OK"); + command = "AT+UGPIOC=24,4"; + resp = SENDAT(command, 100, "OK"); + } } string return_clear_nmea(string nmea) { - string coord; - double nmea_a = parseFloat(nmea.split(',')[4]); - double nmea_n = parseFloat(nmea.split(',')[6]); - coord = nmea_a + "," + nmea_n; + string coord; + double nmea_a = parseFloat(nmea.split(',')[4]); + double nmea_n = parseFloat(nmea.split(',')[6]); + coord = nmea_a + "," + nmea_n; - return(coord); + return(coord); } string return_latitude_longitude_from_nmea(string nmea) { - string coord; - double nmea_a = parseFloat(nmea.split(',')[4]); - double nmea_n = parseFloat(nmea.split(',')[6]); - int index = FIND(nmea, "A"); + string coord; + double nmea_a = parseFloat(nmea.split(',')[4]); + double nmea_n = parseFloat(nmea.split(',')[6]); + int index = FIND(nmea, "A"); - int first_term_N = nmea_a / 100; - double second_term_N = ((nmea_a/100 - first_term_N) * 10 )/ 6; - double coord_N = first_term_N + second_term_N; + int first_term_N = nmea_a / 100; + double second_term_N = ((nmea_a/100 - first_term_N) * 10 )/ 6; + double coord_N = first_term_N + second_term_N; - int first_term_E = nmea_n / 100; - double second_term_E = ((nmea_n/100 - first_term_E) * 10 )/ 6; - double coord_E = first_term_E + second_term_E; - coord = coord_N + "," + coord_E; + int first_term_E = nmea_n / 100; + double second_term_E = ((nmea_n/100 - first_term_E) * 10 )/ 6; + double coord_E = first_term_E + second_term_E; + coord = coord_N + "," + coord_E; - return(coord); + return(coord); } array get_ucellinfo() { - string command, resp; - command = "AT+UCELLINFO?"; - resp = SENDAT(command, 3000, "OK"); - - resp = resp.split("\r\nOK")[0]; - array cell_info = resp.split("\r\n+UCELLINFO: "); - string temp = cell_info[0].split("+UCELLINFO: ")[1]; - cell_info.removeAt(0); - cell_info.insertAt(0,temp); - - return cell_info; + string command, resp; + command = "AT+UCELLINFO?"; + resp = SENDAT(command, 3000, "OK"); + + resp = resp.split("\r\nOK")[0]; + array cell_info = resp.split("\r\n+UCELLINFO: "); + string temp = cell_info[0].split("+UCELLINFO: ")[1]; + cell_info.removeAt(0); + cell_info.insertAt(0,temp); + + return cell_info; } array get_ucfscan(int option) { - string command, resp; - command = "AT+UCFSCAN=" + option; - resp = SENDAT(command, 300000, "OK"); - - resp = resp.split("\r\nOK")[0]; - array cell_info = resp.split("\r\n+UCFSCAN: "); - string temp = cell_info[0].split("+UCFSCAN: ")[1]; - cell_info.removeAt(0); - cell_info.insertAt(0,temp); - - return cell_info; + string command, resp; + command = "AT+UCFSCAN=" + option; + resp = SENDAT(command, 300000, "OK"); + + resp = resp.split("\r\nOK")[0]; + array cell_info = resp.split("\r\n+UCFSCAN: "); + string temp = cell_info[0].split("+UCFSCAN: ")[1]; + cell_info.removeAt(0); + cell_info.insertAt(0,temp); + + return cell_info; } string get_creg() { - string command, resp; - command = "AT+CREG?"; - resp = SENDAT(command, 3000, "OK"); - - string status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - - return status; + string command, resp; + command = "AT+CREG?"; + resp = SENDAT(command, 3000, "OK"); + + string status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + + return status; } string get_cgreg() { - string command, resp; - command = "AT+CGREG?"; - resp = SENDAT(command, 3000, "OK"); - - string status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - - return status; + string command, resp; + command = "AT+CGREG?"; + resp = SENDAT(command, 3000, "OK"); + + string status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + + return status; } string get_cereg() { - string command, resp; - command = "AT+CEREG?"; - resp = SENDAT(command, 3000, "OK"); - - string status = resp.split(": ")[1]; - status = status.split("\r\nOK")[0]; - - return status; + string command, resp; + command = "AT+CEREG?"; + resp = SENDAT(command, 3000, "OK"); + + string status = resp.split(": ")[1]; + status = status.split("\r\nOK")[0]; + + return status; } string get_cesq() { - string command, resp; - command = "AT+CESQ"; - resp = SENDAT(command, 3000, "OK"); - - string cesq = resp.split(": ")[1]; - cesq = cesq.split("\r\nOK")[0]; - - return cesq; + string command, resp; + command = "AT+CESQ"; + resp = SENDAT(command, 3000, "OK"); + + string cesq = resp.split(": ")[1]; + cesq = cesq.split("\r\nOK")[0]; + + return cesq; } void get_info() { - string command, resp; - for (int i = 0; i < iteration_number; i++) { - command ="AT+UGRMC?"; - resp = SENDAT(command, 500, "OK"); - - string pos; - if (return_latitude_longitude) { - pos = return_latitude_longitude_from_nmea(resp); - } else { - pos = return_clear_nmea(resp); - } - - array cell_info; - if (modem_type == 0) { - cell_info = get_ucellinfo(); - } - if (modem_type == 1) { - if (urat_set == 8) { - cell_info = get_ucfscan(9); - } - if (urat_set == 7) { - cell_info = get_ucfscan(7); - } - } - - string info = pos + ","+ get_cesq(); - - string creg_info, cereg_info, cgreg_info; - if (urat_set == 8) { - creg_info = get_creg(); - cereg_info = get_cereg(); - } - if (urat_set == 3) { - creg_info = get_creg(); - cereg_info = get_cereg(); - cgreg_info = get_cgreg(); - } - - // start to plot info - ECHO(parse_start); - ECHO(parsing_string + info); - - if (urat_set == 8) { - ECHO(parsing_string + creg_info); - ECHO(parsing_string + cereg_info); - } - if (urat_set == 3) { - ECHO(parsing_string + creg_info); - ECHO(parsing_string + cereg_info); - ECHO(parsing_string + cgreg_info); - } - - - if (modem_type == 1) { - for (int i = 0; i < cell_info.length(); i++) { - ECHO(parsing_string + cell_info[i]); - } - } - - ECHO(parse_end); - // end plot info - - PAUSE(time_update_gnss); - } - PAUSE(1000); + string command, resp; + for (int i = 0; i < iteration_number; i++) { + command ="AT+UGRMC?"; + resp = SENDAT(command, 500, "OK"); + + string pos; + if (return_latitude_longitude) { + pos = return_latitude_longitude_from_nmea(resp); + } else { + pos = return_clear_nmea(resp); + } + + array cell_info; + if (modem_type == 0) { + cell_info = get_ucellinfo(); + } + if (modem_type == 1) { + if (urat_set == 8) { + cell_info = get_ucfscan(9); + } + if (urat_set == 7) { + cell_info = get_ucfscan(7); + } + } + + string info = pos + ","+ get_cesq(); + + string creg_info, cereg_info, cgreg_info; + if (urat_set == 8) { + creg_info = get_creg(); + cereg_info = get_cereg(); + } + if (urat_set == 3) { + creg_info = get_creg(); + cereg_info = get_cereg(); + cgreg_info = get_cgreg(); + } + + // start to plot info + ECHO(parse_start); + ECHO(parsing_string + info); + + if (urat_set == 8) { + ECHO(parsing_string + creg_info); + ECHO(parsing_string + cereg_info); + } + if (urat_set == 3) { + ECHO(parsing_string + creg_info); + ECHO(parsing_string + cereg_info); + ECHO(parsing_string + cgreg_info); + } + + + if (modem_type == 1) { + for (int i = 0; i < cell_info.length(); i++) { + ECHO(parsing_string + cell_info[i]); + } + } + + ECHO(parse_end); + // end plot info + + PAUSE(time_update_gnss); + } + PAUSE(1000); } void main() { - string command, resp; - int aiding_online; - - ECHO("*************************************************************************************************************"); - ECHO("This script needs 'Start!' greeting message active on boot"); - ECHO("The greeting text can be actived using the command AT+CSGT=1,\"Start!\" and using a fixed baud rate (+IPR)"); - ECHO(""); - ECHO(""); - ECHO("*************************************************************************************************************"); - ECHO("REMEMBER TO CONFIGURE A VALID TOKEN on the module with +UGSRV for accessing online aiding"); - ECHO("*************************************************************************************************************"); - ECHO(""); - ECHO(""); - ECHO("*************************************************************************************************************"); - ECHO("REMEMBER TO CONFIGURE THE GNSS SYSTEM AND THE AIDING MODE"); - ECHO("*************************************************************************************************************"); - - wait_for_at_ready(); - modem_initialization(); - - if (registration_check_mechanism) { - wait_for_registration_polling(); - } else { - wait_for_registration_urc(); - } - - if (!combo_module) { - activate_external_gnss(); - } - - command ="AT+UGIND=1"; - resp = SENDAT(command, 1000, "OK"); - command ="AT+UGRMC=1"; - resp = SENDAT(command, 1000, "OK"); - command ="AT+ULOCIND=1"; - resp = SENDAT(command, 1000, "OK"); - - ECHO("*************************************************************************************************************"); - ECHO("STARTING GNSS"); - ECHO("*************************************************************************************************************"); - - resp = SENDAT(gnss_commnad, 6000, "OK"); - PAUSE(2000); - - bool do_loop = true; - int counter = 0; - string parse_a; - while (do_loop) { - command ="AT+UGRMC?"; - resp = SENDAT(command, 1000, "OK"); - PAUSE(pause_find_fix); - counter = counter + pause_find_fix; - parse_a = resp.split(',')[3]; - if (FIND(parse_a, "A") != -1) { - ECHO("*************************************************************************************************************"); - ECHO("FOUND FIX, taken time: " + counter); - ECHO("*************************************************************************************************************"); - do_loop = false; - } - } - get_info(); - - ECHO("*************************************************************************************************************"); - ECHO("TURNING OFF THE GPS"); - ECHO("*************************************************************************************************************"); - - command ="AT+UGPS=0"; - resp = SENDAT(command, 5000, "OK"); - PAUSE(1000); - - ECHO("*************************************************************************************************************"); - ECHO("POWERING OFF"); - ECHO("*************************************************************************************************************"); - command ="AT+CPWROFF"; - resp = SENDAT(command, 10000, "OK"); + string command, resp; + int aiding_online; + + ECHO("*************************************************************************************************************"); + ECHO("This script needs 'Start!' greeting message active on boot"); + ECHO("The greeting text can be actived using the command AT+CSGT=1,\"Start!\" and using a fixed baud rate (+IPR)"); + ECHO(""); + ECHO(""); + ECHO("*************************************************************************************************************"); + ECHO("REMEMBER TO CONFIGURE A VALID TOKEN on the module with +UGSRV for accessing online aiding"); + ECHO("*************************************************************************************************************"); + ECHO(""); + ECHO(""); + ECHO("*************************************************************************************************************"); + ECHO("REMEMBER TO CONFIGURE THE GNSS SYSTEM AND THE AIDING MODE"); + ECHO("*************************************************************************************************************"); + + wait_for_at_ready(); + modem_initialization(); + + if (registration_check_mechanism) { + wait_for_registration_polling(); + } else { + wait_for_registration_urc(); + } + + if (!combo_module) { + activate_external_gnss(); + } + + command ="AT+UGIND=1"; + resp = SENDAT(command, 1000, "OK"); + command ="AT+UGRMC=1"; + resp = SENDAT(command, 1000, "OK"); + command ="AT+ULOCIND=1"; + resp = SENDAT(command, 1000, "OK"); + + ECHO("*************************************************************************************************************"); + ECHO("STARTING GNSS"); + ECHO("*************************************************************************************************************"); + + resp = SENDAT(gnss_commnad, 6000, "OK"); + PAUSE(2000); + + bool do_loop = true; + int counter = 0; + string parse_a; + while (do_loop) { + command ="AT+UGRMC?"; + resp = SENDAT(command, 1000, "OK"); + PAUSE(pause_find_fix); + counter = counter + pause_find_fix; + parse_a = resp.split(',')[3]; + if (FIND(parse_a, "A") != -1) { + ECHO("*************************************************************************************************************"); + ECHO("FOUND FIX, taken time: " + counter); + ECHO("*************************************************************************************************************"); + do_loop = false; + } + } + get_info(); + + ECHO("*************************************************************************************************************"); + ECHO("TURNING OFF THE GPS"); + ECHO("*************************************************************************************************************"); + + command ="AT+UGPS=0"; + resp = SENDAT(command, 5000, "OK"); + PAUSE(1000); + + ECHO("*************************************************************************************************************"); + ECHO("POWERING OFF"); + ECHO("*************************************************************************************************************"); + command ="AT+CPWROFF"; + resp = SENDAT(command, 10000, "OK"); } diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl index 8cf19e2..de95658 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl @@ -4,37 +4,37 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script has the purpose to configure the cellular device after -* cold booting. This script waits for registration and then configures -* PSM, +UPSV. It turns off Auto-Bauding and sets the greeting message. -* The greeting message is used for the publish script to know when the -* module has been turned on. -* This script uses the DTR line to control the deep sleep of the module. -* -* The wake-up and publish script choices are: -* Steps: Wake up, Connect, Publish message, wait for ACK, enter PSM -* powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl -* or -* Steps: Wake up, Publish message, enter PSM -* powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl +* Synopsis: powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script has the purpose to configure the cellular device after +* cold booting. This script waits for registration and then configures +* PSM, +UPSV. It turns off Auto-Bauding and sets the greeting message. +* The greeting message is used for the publish script to know when the +* module has been turned on. +* This script uses the DTR line to control the deep sleep of the module. +* +* The wake-up and publish script choices are: +* Steps: Wake up, Connect, Publish message, wait for ACK, enter PSM +* powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl +* or +* Steps: Wake up, Publish message, enter PSM +* powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ AT+CGMI diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl index 52ff443..1c0e4cd 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl @@ -4,37 +4,37 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script has the purpose to configure the cellular device after -* cold booting. This script waits for registration and then configures -* +UPSV. It turns off Auto-Bauding and sets the greeting message. -* The greeting message is used for the publish script to know when the -* module has been turned on. -* This script uses the DTR line to control the deep sleep of the module. +* Synopsis: powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script has the purpose to configure the cellular device after +* cold booting. This script waits for registration and then configures +* +UPSV. It turns off Auto-Bauding and sets the greeting message. +* The greeting message is used for the publish script to know when the +* module has been turned on. +* This script uses the DTR line to control the deep sleep of the module. * -* The wake-up and publish script choices are: -* Steps: Turn On, Connect, Publish message, wait for ACK, Pwr_off -* powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl -* or -* Steps: Turn on, Publish message, Pwr_off -* powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl +* The wake-up and publish script choices are: +* Steps: Turn On, Connect, Publish message, wait for ACK, Pwr_off +* powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl +* or +* Steps: Turn on, Publish message, Pwr_off +* powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ AT+CGMI diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl index da982a3..6e1fc39 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_psm_advanced.atl @@ -4,36 +4,36 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pms_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script is used to publish a message to the Thingstream -* MQTT-Anywhere IoT Platform using QoS: -1 -* QoS: -1 does not require to connect to the broker, so the -* message is sent very soon after waking up. The module then uses -* RAI to go back into PSM. -* The powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl -* script needs to be run first to configure the device. -* This script assumes the module is in the PSM state and waits -* for the "Ready" greeting message after waking up from PSM. +* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pms_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script is used to publish a message to the Thingstream +* MQTT-Anywhere IoT Platform using QoS: -1 +* QoS: -1 does not require to connect to the broker, so the +* message is sent very soon after waking up. The module then uses +* RAI to go back into PSM. +* The powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl +* script needs to be run first to configure the device. +* This script assumes the module is in the PSM state and waits +* for the "Ready" greeting message after waking up from PSM. * -* You MUST configure the IdentityID parameter below from your Thingstream -* thing device. +* You MUST configure the IdentityID parameter below from your Thingstream +* thing device. * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ /*****************************************************************************/ diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl index 7f729ac..4ca0724 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl @@ -4,36 +4,36 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script is used to publish a message to the Thingstream -* MQTT-Anywhere IoT Platform using QoS: -1 -* QoS: -1 does not require to connect to the broker, so the -* message is sent very soon after power on. The module then uses -* +CPWROFF to turn off. -* The powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl -* script needs to be run first to configure the device. -* This script assumes the module is in the power-off state and waits -* for the "Ready" greeting message after power on. -* -* You MUST configure the IdentityID parameter below from your Thingstream -* thing device. +* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS-1_pwr_off_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script is used to publish a message to the Thingstream +* MQTT-Anywhere IoT Platform using QoS: -1 +* QoS: -1 does not require to connect to the broker, so the +* message is sent very soon after power on. The module then uses +* +CPWROFF to turn off. +* The powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl +* script needs to be run first to configure the device. +* This script assumes the module is in the power-off state and waits +* for the "Ready" greeting message after power on. +* +* You MUST configure the IdentityID parameter below from your Thingstream +* thing device. * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ /*****************************************************************************/ diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl index b61cd10..c4e5d22 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl @@ -13,27 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script is used to publish a message to the Thingstream -* MQTT-Anywhere IoT Platform using QoS: 1 -* QoS: 1 requires to connect to the broker before publishing a message -* The module then uses RAI to go back into PSM. -* -* The powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl -* script needs to be run first to configure the device. -* This script assumes the module is in the PSM state and waits -* for the "Ready" greeting message after waking up from PSM. -* -* You MUST configure the IdentityID parameter below from your Thingstream -* thing device. +* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_psm_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script is used to publish a message to the Thingstream +* MQTT-Anywhere IoT Platform using QoS: 1 +* QoS: 1 requires to connect to the broker before publishing a message +* The module then uses RAI to go back into PSM. +* +* The powerMng_saraR5_lpwa_first_configuration_psm_advanced.atl +* script needs to be run first to configure the device. +* This script assumes the module is in the PSM state and waits +* for the "Ready" greeting message after waking up from PSM. +* +* You MUST configure the IdentityID parameter below from your Thingstream +* thing device. * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ /*****************************************************************************/ diff --git a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl index cc7c23b..3a166b5 100644 --- a/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl +++ b/at_scripts/power_management/powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl @@ -4,36 +4,36 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl -* Topic: power_management -* Version: 1.0 -* Author: pwar -* Description: -* This script is used to publish a message to the Thingstream -* MQTT-Anywhere IoT Platform using QoS: 1 -* QoS: 1 requires to connect to the broker before publishing a message -* The module then uses +CPWROFF to turn off. -* -* The powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl -* script needs to be run first to configure the device. -* This script assumes the module is in the power-off state and waits -* for the "Ready" greeting message after power on. -* -* You MUST configure the IdentityID parameter below from your Thingstream -* thing device. +* Synopsis: powerMng_saraR5_lpwa_wake_up_and_publish_QoS1_pwr_off_advanced.atl +* Topic: power_management +* Version: 1.0 +* Author: pwar +* Description: +* This script is used to publish a message to the Thingstream +* MQTT-Anywhere IoT Platform using QoS: 1 +* QoS: 1 requires to connect to the broker before publishing a message +* The module then uses +CPWROFF to turn off. +* +* The powerMng_saraR5_lpwa_first_configuration_pwr_off_advanced.atl +* script needs to be run first to configure the device. +* This script assumes the module is in the power-off state and waits +* for the "Ready" greeting message after power on. +* +* You MUST configure the IdentityID parameter below from your Thingstream +* thing device. * ****************************************************************************** -* Modules: SARA-R510-01B -* Tested on: SARA-R510-01B +* Modules: SARA-R510-01B +* Tested on: SARA-R510-01B ******************************************************************************/ /*****************************************************************************/ diff --git a/at_scripts/sim/SIM_all_readSimFiles_advanced.atl b/at_scripts/sim/SIM_all_readSimFiles_advanced.atl index 3bd356d..ff60fca 100644 --- a/at_scripts/sim/SIM_all_readSimFiles_advanced.atl +++ b/at_scripts/sim/SIM_all_readSimFiles_advanced.atl @@ -13,35 +13,35 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sim_all_readSimFiles_advanced.atl -* Topic: sim -* Version: 3.2 -* Author: mrod +* Synopsis: sim_all_readSimFiles_advanced.atl +* Topic: sim +* Version: 3.2 +* Author: mrod * Description: -* This scripts search for all the possible SIM Elementary Files and reads their content -* using +CRSM command. -* At the end, prints on AT terminal window a report having the following syntax: -* |||||||| -* e.g., -* |MF|EF ICCID|3F00|2FE2|12258|0|"989388435801009549F4"| -* The files to be read are listed in the code: see ## EF list ## section. +* This scripts search for all the possible SIM Elementary Files and reads their content +* using +CRSM command. +* At the end, prints on AT terminal window a report having the following syntax: +* |||||||| +* e.g., +* |MF|EF ICCID|3F00|2FE2|12258|0|"989388435801009549F4"| +* The files to be read are listed in the code: see ## EF list ## section. * Requirements: -* m-center 02.04.01 or newer -* Modem supporting +CRSM +* m-center 02.04.01 or newer +* Modem supporting +CRSM ****************************************************************************** -* Modules: TOBY-L210-03, LARA-R211-02, SARA-R422M8S-00, SARA-R510M8S-01 -* SARA-U201-04, SARA-G350-02 -* Tested on: all the supported modules. +* Modules: TOBY-L210-03, LARA-R211-02, SARA-R422M8S-00, SARA-R510M8S-01 +* SARA-U201-04, SARA-G350-02 +* Tested on: all the supported modules. ******************************************************************************* * Revision History: -* 3.1 - first public release -* 3.2 - splitted concatenated AT commands (not supported by all modules) -* - added registration status preliminary check +* 3.1 - first public release +* 3.2 - splitted concatenated AT commands (not supported by all modules) +* - added registration status preliminary check * Known issue and limitations: -* - SARA-R412M-02 does not properly address a lot of EFs -* - SARA-G450-01 responses to +CRSM commands have unexpected content -* - m-center 2.03.00 truncates ECHO strings to 70 chars -* - ADF(ISIM) files cannot be read +* - SARA-R412M-02 does not properly address a lot of EFs +* - SARA-G450-01 responses to +CRSM commands have unexpected content +* - m-center 2.03.00 truncates ECHO strings to 70 chars +* - ADF(ISIM) files cannot be read ******************************************************************************/ @@ -432,166 +432,166 @@ AT+COPS? // main for( uint n = 0; n < ef.length(); n++ ) { - // read each field of the array item - // [0] [1] [2] [3] [4] [5] [6] - // ,,,,,, - // 3F00 , 7F20 , 6F07 , 0 , MF / DF GSM , EF(IMSI), IMSI - ef_prm = ef[n].split(','); - ef_root_id = ef_prm[0]; // Root Path (MF/ADF) id [hex or string] - ef_sub_id = ef_prm[1]; // Sub Path [hex] - ef_id_h = ef_prm[2]; // EF ID [hex] - ef_id_d = parseInt(ef_id_h,16); // EF ID [dec] - ef_struct_id = parseInt(ef_prm[3]); // EF Structure Id - ef_full_path = ef_prm[4]; // EF Full Path Name - ef_name = ef_prm[5]; // EF name - ef_desc = ef_prm[6]; // EF description + // read each field of the array item + // [0] [1] [2] [3] [4] [5] [6] + // ,,,,,, + // 3F00 , 7F20 , 6F07 , 0 , MF / DF GSM , EF(IMSI), IMSI + ef_prm = ef[n].split(','); + ef_root_id = ef_prm[0]; // Root Path (MF/ADF) id [hex or string] + ef_sub_id = ef_prm[1]; // Sub Path [hex] + ef_id_h = ef_prm[2]; // EF ID [hex] + ef_id_d = parseInt(ef_id_h,16); // EF ID [dec] + ef_struct_id = parseInt(ef_prm[3]); // EF Structure Id + ef_full_path = ef_prm[4]; // EF Full Path Name + ef_name = ef_prm[5]; // EF name + ef_desc = ef_prm[6]; // EF description - reading_2_log = true; - - // ef_full_id = ef_root_id + ef_sub_id; // EF full path id [hex] = MF/ADF_id[hex] & Sub_path_id_[hex] - if ( ef_root_id == "3F00") { // MF - ef_full_id = ef_root_id + ef_sub_id; - } - else if ( ef_root_id == "7FFF") { // ADF_USIM - ef_full_id = ef_root_id + ef_sub_id; - } - else if ( ef_root_id == "ADF_ISIM") { // ADF_ISIM - ef_full_id = adf_isim_id + ef_sub_id; //// TO DO: implement the reading of adf_isim_id from +CUAD + reading_2_log = true; + + // ef_full_id = ef_root_id + ef_sub_id; // EF full path id [hex] = MF/ADF_id[hex] & Sub_path_id_[hex] + if ( ef_root_id == "3F00") { // MF + ef_full_id = ef_root_id + ef_sub_id; + } + else if ( ef_root_id == "7FFF") { // ADF_USIM + ef_full_id = ef_root_id + ef_sub_id; + } + else if ( ef_root_id == "ADF_ISIM") { // ADF_ISIM + ef_full_id = adf_isim_id + ef_sub_id; //// TO DO: implement the reading of adf_isim_id from +CUAD - } - - switch (ef_struct_id) - { - case 0: - // structure = transparent --> BINARY access mode - another_rec_2_read = false; // no Records are expected in this type - crsm_cmd = 176; - crsm_p1 = 0; - crsm_p2 = 0; - crsm_p3 = 0; - break; - case 1: - case 3: - // structure = linear fixed or cyclic --> RECORD access mode - another_rec_2_read = true; // possible multiple records to read - crsm_cmd = 178; - crsm_p1 = 1; // record nr - crsm_p2 = 4; - crsm_p3 = 0; - break; - default: - // structure value not expected - another_rec_2_read = false; - ECHO("ERROR: EF structure value not expected"); - break; - } - PAUSE 10; + } + + switch (ef_struct_id) + { + case 0: + // structure = transparent --> BINARY access mode + another_rec_2_read = false; // no Records are expected in this type + crsm_cmd = 176; + crsm_p1 = 0; + crsm_p2 = 0; + crsm_p3 = 0; + break; + case 1: + case 3: + // structure = linear fixed or cyclic --> RECORD access mode + another_rec_2_read = true; // possible multiple records to read + crsm_cmd = 178; + crsm_p1 = 1; // record nr + crsm_p2 = 4; + crsm_p3 = 0; + break; + default: + // structure value not expected + another_rec_2_read = false; + ECHO("ERROR: EF structure value not expected"); + break; + } + PAUSE 10; - do { - report_row = ""; - aat_cmd = "AT+CRSM=" + crsm_cmd + "," + ef_id_d + "," + crsm_p1 + "," + crsm_p2 + "," ; - if (ef_full_id == "") { - aat_cmd0 = aat_cmd + crsm_p3; - } - else { - aat_cmd0 = aat_cmd + crsm_p3 + "," + crsm_data + ",\"" + ef_full_id + "\"" ; - } - PAUSE 40; - // needed to avoid overlapping in the m-center terminal window - aat_resp = SENDAT(aat_cmd0, timeoutM, "+"); + do { + report_row = ""; + aat_cmd = "AT+CRSM=" + crsm_cmd + "," + ef_id_d + "," + crsm_p1 + "," + crsm_p2 + "," ; + if (ef_full_id == "") { + aat_cmd0 = aat_cmd + crsm_p3; + } + else { + aat_cmd0 = aat_cmd + crsm_p3 + "," + crsm_data + ",\"" + ef_full_id + "\"" ; + } + PAUSE 40; + // needed to avoid overlapping in the m-center terminal window + aat_resp = SENDAT(aat_cmd0, timeoutM, "+"); - array Params; - - if(!aat_resp.isEmpty()) { - // it could be: +CRSM: ,[,] - // +CME ERROR: - // ERROR - aat_resp_prefix = aat_resp.split(': ')[0]; - if (aat_resp_prefix.length() < aat_resp.length() ) { - aat_resp_payload = aat_resp.split(': ')[1]; - } + array Params; + + if(!aat_resp.isEmpty()) { + // it could be: +CRSM: ,[,] + // +CME ERROR: + // ERROR + aat_resp_prefix = aat_resp.split(': ')[0]; + if (aat_resp_prefix.length() < aat_resp.length() ) { + aat_resp_payload = aat_resp.split(': ')[1]; + } - if (aat_resp_prefix == "+CRSM") { - Params = aat_resp_payload.split(','); - crsm_sw1 = parseInt(Params[0]); - crsm_sw2 = parseInt(Params[1]); + if (aat_resp_prefix == "+CRSM") { + Params = aat_resp_payload.split(','); + crsm_sw1 = parseInt(Params[0]); + crsm_sw2 = parseInt(Params[1]); - switch (crsm_sw1) { - case 144: - case 145: - crsm_response = Params[2]; - break; - case 103: - aat_cmd1 = aat_cmd + Params[1]; - PAUSE 10; - aat_resp = SENDAT(aat_cmd1, timeoutM, "+CRSM:"); - aat_resp_payload = aat_resp.split(': ')[1]; - Params = aat_resp_payload.split(','); - crsm_response = Params[2]; - break; - case 106: // file/record not found; incorrect parameters P1 to P2 - if (crsm_p1 <= 1) { - crsm_response = "+CRSM: not found / wrong params"; - } - else { - reading_2_log = false; - } - another_rec_2_read = false; - break; - default: - crsm_response = "+CRSM: " + crsm_sw1 + "," + crsm_sw2; - // another_rec_2_read = false; - break; - } - } - else { - // if crsm_response does not start with "+CRSM" ... - crsm_response = aat_resp; // ... the whole response is reported (for debugging) ... - another_rec_2_read = false; // ... and next EF is read. - } - // message for ANALYSYS RECAP: - // |||||||| - // e.g. - // |MF|EF ICCID|3F00|2FE2|12258|0|"989388435801009549F4"| + switch (crsm_sw1) { + case 144: + case 145: + crsm_response = Params[2]; + break; + case 103: + aat_cmd1 = aat_cmd + Params[1]; + PAUSE 10; + aat_resp = SENDAT(aat_cmd1, timeoutM, "+CRSM:"); + aat_resp_payload = aat_resp.split(': ')[1]; + Params = aat_resp_payload.split(','); + crsm_response = Params[2]; + break; + case 106: // file/record not found; incorrect parameters P1 to P2 + if (crsm_p1 <= 1) { + crsm_response = "+CRSM: not found / wrong params"; + } + else { + reading_2_log = false; + } + another_rec_2_read = false; + break; + default: + crsm_response = "+CRSM: " + crsm_sw1 + "," + crsm_sw2; + // another_rec_2_read = false; + break; + } + } + else { + // if crsm_response does not start with "+CRSM" ... + crsm_response = aat_resp; // ... the whole response is reported (for debugging) ... + another_rec_2_read = false; // ... and next EF is read. + } + // message for ANALYSYS RECAP: + // |||||||| + // e.g. + // |MF|EF ICCID|3F00|2FE2|12258|0|"989388435801009549F4"| - if (reading_2_log) { - report_row = " | " + ef_full_path + " | " + ef_name + " | " + ef_full_id + " | " + ef_id_h + " | " + ef_id_d + " | " + crsm_p1 + " | " + crsm_response + " | "; - ECHO(report_row); - report_all.insertLast(report_row); - } + if (reading_2_log) { + report_row = " | " + ef_full_path + " | " + ef_name + " | " + ef_full_id + " | " + ef_id_h + " | " + ef_id_d + " | " + crsm_p1 + " | " + crsm_response + " | "; + ECHO(report_row); + report_all.insertLast(report_row); + } - if (ef_id_h == "2F00") { // if EF_DIR [12032(dec)] read out the ADF(*SIM) adresses - aid_len_h = crsm_response.substr(7,2); - aid_len_d = parseInt(aid_len_h,16)*2; - aid_app_code = crsm_response.substr(19,4); - aid_whole = crsm_response.substr(9,aid_len_d); - - // ECHO("----aid_len_d----->>> " + aid_len_d); - // ECHO("----aid_app_code-->>> " + aid_app_code); - // ECHO("----aid_whole----->>> " + aid_whole); - - if (aid_app_code=="1002") { - ECHO("--record " + crsm_p1 + " is ADF(USIM)"); - } - else if(aid_app_code=="1004") { - ECHO("--record " + crsm_p1 + " is ADF(ISIM)"); - } - else { - ECHO("--record " + crsm_p1 + " is something else"); - } - PAUSE 100; - } - - crsm_p1++; // next record - } - else { - ECHO("ERROR: No Response or unexpected response"); - } - aat_resp_prefix = ""; // clean work variable - aat_resp_payload = ""; // clean work variable - } while (another_rec_2_read and crsm_p1>> " + aid_len_d); + // ECHO("----aid_app_code-->>> " + aid_app_code); + // ECHO("----aid_whole----->>> " + aid_whole); + + if (aid_app_code=="1002") { + ECHO("--record " + crsm_p1 + " is ADF(USIM)"); + } + else if(aid_app_code=="1004") { + ECHO("--record " + crsm_p1 + " is ADF(ISIM)"); + } + else { + ECHO("--record " + crsm_p1 + " is something else"); + } + PAUSE 100; + } + + crsm_p1++; // next record + } + else { + ECHO("ERROR: No Response or unexpected response"); + } + aat_resp_prefix = ""; // clean work variable + aat_resp_payload = ""; // clean work variable + } while (another_rec_2_read and crsm_p1 baud_rates = {57600, 115200, 230400, 460800, 921600, 3000000}; - ECHO("Trying to identify the baud rate!"); - int i; - for(i = 0 ; i < 6; i++) - { - connect_port_with_baud(baud_rates[i]); - if(SENDAT("AT",2000, "OK") == "OK") - { - ECHO("BAUD_FINDER : SUCCESS: Modem is replying at baud = " + baud_rates[i]); - return; - } - } - ECHO("BAUD_FINDER : FAILED : Unable to identify the supported baud rate"); - return; + array baud_rates = {57600, 115200, 230400, 460800, 921600, 3000000}; + ECHO("Trying to identify the baud rate!"); + int i; + for(i = 0 ; i < 6; i++) + { + connect_port_with_baud(baud_rates[i]); + if(SENDAT("AT",2000, "OK") == "OK") + { + ECHO("BAUD_FINDER : SUCCESS: Modem is replying at baud = " + baud_rates[i]); + return; + } + } + ECHO("BAUD_FINDER : FAILED : Unable to identify the supported baud rate"); + return; } void connect_port_with_baud(int baud) { - MC_PORT_DISCONNECT(); - SET_PORT_BAUD(baud); - MC_PORT_CONNECT(); + MC_PORT_DISCONNECT(); + SET_PORT_BAUD(baud); + MC_PORT_CONNECT(); } diff --git a/at_scripts/system_functionalities/sys_all_ffsStoreReceiveDelete_advance.atl b/at_scripts/system_functionalities/sys_all_ffsStoreReceiveDelete_advance.atl index 7d093f5..8f14a45 100644 --- a/at_scripts/system_functionalities/sys_all_ffsStoreReceiveDelete_advance.atl +++ b/at_scripts/system_functionalities/sys_all_ffsStoreReceiveDelete_advance.atl @@ -4,24 +4,24 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sys_all_ffsStoreReceiveDelete_advance.atl -* Topic: system_functionalities -* Version: 1.0 -* Author: muaw +* Synopsis: sys_all_ffsStoreReceiveDelete_advance.atl +* Topic: system_functionalities +* Version: 1.0 +* Author: muaw * Description: -* This script has the purpose to test the basic File-system macros. +* This script has the purpose to test the basic File-system macros. ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ //----configuration settings------// @@ -42,45 +42,45 @@ string receive_file_name = "FFStestfile_received.txt"; file f; void main() { - if(create_test_file()) - { - ECHO("Deleting the test file from modem."); - MC_FFS_DELETE(send_file_name); - if(MC_FFS_STORE(file_path+send_file_name)) - { - ECHO("SUCCESS: File stored to the modem!"); - if(MC_FFS_RETRIEVE(send_file_name,file_path+receive_file_name)) - { - ECHO("SUCCESS: File received from the modem!"); - } - else - { - ECHO("ERROR: Failed to receive the File!"); - } - } - else - { - ECHO("ERROR: Cannot store File!"); - } - } + if(create_test_file()) + { + ECHO("Deleting the test file from modem."); + MC_FFS_DELETE(send_file_name); + if(MC_FFS_STORE(file_path+send_file_name)) + { + ECHO("SUCCESS: File stored to the modem!"); + if(MC_FFS_RETRIEVE(send_file_name,file_path+receive_file_name)) + { + ECHO("SUCCESS: File received from the modem!"); + } + else + { + ECHO("ERROR: Failed to receive the File!"); + } + } + else + { + ECHO("ERROR: Cannot store File!"); + } + } } bool create_test_file() { - if( f.open(file_path+send_file_name, "w") >= 0 ) - { - for(int i = 0 ; i < 250000; ++i) - { - f.writeString("Test"); - } - - f.close(); - ECHO("SUCCESS: Test file Created!"); - return true; - } - else - { - ECHO("ERROR: Cannot create test file!"); - } - return false; + if( f.open(file_path+send_file_name, "w") >= 0 ) + { + for(int i = 0 ; i < 250000; ++i) + { + f.writeString("Test"); + } + + f.close(); + ECHO("SUCCESS: Test file Created!"); + return true; + } + else + { + ECHO("ERROR: Cannot create test file!"); + } + return false; } diff --git a/at_scripts/system_functionalities/sys_all_fileManagement_advance.atl b/at_scripts/system_functionalities/sys_all_fileManagement_advance.atl index 76fec12..a11c989 100644 --- a/at_scripts/system_functionalities/sys_all_fileManagement_advance.atl +++ b/at_scripts/system_functionalities/sys_all_fileManagement_advance.atl @@ -4,24 +4,24 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sys_all_fileManagement_advance.atl -* Topic: system_functionalities -* Version: 1.0 -* Author: bkha +* Synopsis: sys_all_fileManagement_advance.atl +* Topic: system_functionalities +* Version: 1.0 +* Author: bkha * Description: -* This script has the purpose to test the file integration and its functions. +* This script has the purpose to test the file integration and its functions. ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ //----configuration settings------// @@ -37,90 +37,90 @@ file f; void write_file_test(){ - ECHO("File Write Test Start"); - if( f.open(file_name, "a") >= 0 ) - { - f.writeString("line1 \n"); - f.writeString("\n"); - f.writeString("line3 \n"); - f.writeString("line4 \n"); - f.writeInt(5,2); - f.writeString("\n"); - f.writeFloat(2.9); - f.writeString("\n"); - f.writeUInt(5,4); - f.writeString("\n"); - f.writeDouble(4.5); - - f.close(); - } - else - { - ECHO("File not open"); - } + ECHO("File Write Test Start"); + if( f.open(file_name, "a") >= 0 ) + { + f.writeString("line1 \n"); + f.writeString("\n"); + f.writeString("line3 \n"); + f.writeString("line4 \n"); + f.writeInt(5,2); + f.writeString("\n"); + f.writeFloat(2.9); + f.writeString("\n"); + f.writeUInt(5,4); + f.writeString("\n"); + f.writeDouble(4.5); + + f.close(); + } + else + { + ECHO("File not open"); + } } void read_file_test(){ - ECHO("File Read Test Start"); - // Open the file in 'read' mode - if( f.open(file_name, "r") >= 0 ) - { - ECHO("File opened in read mode \r\nreadLine() = " + f.readLine()); - - // set get positions - ECHO("Position - getPos(), setPos(int i), movPos(int delta) test\r\n getPos() = "+ f.getPos()); - - // Read the whole file into the string buffer without setting the position - string str = f.readString(f.getSize()); - ECHO("Words inside file without setting position - readString(size) = " +str); - - // set position to 0 - f.setPos(0); - str = f.readString(f.getSize()); - ECHO("Words inside file after setting position to 0 - readString(size) = " +str); - - - // move to position 0 - f.movePos(-1 * f.getPos()); - str = f.readString(f.getSize()); - ECHO("Words inside file after moving position to 0 - readString(size) = " +str); - - // echo most Significant Byte First - ECHO("mostSignificantByteFirst = " + f.mostSignificantByteFirst); - - // set position again to 0 - f.setPos(0); - // skip 4 lines - f.readLine(); - f.readLine(); - f.readLine(); - f.readLine(); - // read float - ECHO("readInt : " +f.readInt(2)); - f.readLine(); - ECHO("readFloat : " +f.readFloat()); - f.readLine(); - ECHO("readUInt : " +f.readUInt(4)); - f.readLine(); - ECHO("readDouble : " +f.readDouble()); - f.readLine(); - - // check if it is the end of file - ECHO("File index position: " +f.getPos()); - ECHO("End of file = "+ f.isEndOfFile()); - - f.close(); - } - else - { - ECHO("File not open"); - } + ECHO("File Read Test Start"); + // Open the file in 'read' mode + if( f.open(file_name, "r") >= 0 ) + { + ECHO("File opened in read mode \r\nreadLine() = " + f.readLine()); + + // set get positions + ECHO("Position - getPos(), setPos(int i), movPos(int delta) test\r\n getPos() = "+ f.getPos()); + + // Read the whole file into the string buffer without setting the position + string str = f.readString(f.getSize()); + ECHO("Words inside file without setting position - readString(size) = " +str); + + // set position to 0 + f.setPos(0); + str = f.readString(f.getSize()); + ECHO("Words inside file after setting position to 0 - readString(size) = " +str); + + + // move to position 0 + f.movePos(-1 * f.getPos()); + str = f.readString(f.getSize()); + ECHO("Words inside file after moving position to 0 - readString(size) = " +str); + + // echo most Significant Byte First + ECHO("mostSignificantByteFirst = " + f.mostSignificantByteFirst); + + // set position again to 0 + f.setPos(0); + // skip 4 lines + f.readLine(); + f.readLine(); + f.readLine(); + f.readLine(); + // read float + ECHO("readInt : " +f.readInt(2)); + f.readLine(); + ECHO("readFloat : " +f.readFloat()); + f.readLine(); + ECHO("readUInt : " +f.readUInt(4)); + f.readLine(); + ECHO("readDouble : " +f.readDouble()); + f.readLine(); + + // check if it is the end of file + ECHO("File index position: " +f.getPos()); + ECHO("End of file = "+ f.isEndOfFile()); + + f.close(); + } + else + { + ECHO("File not open"); + } } void main(){ - if(write_enable){ - write_file_test(); - } - - read_file_test(); + if(write_enable){ + write_file_test(); + } + + read_file_test(); } diff --git a/at_scripts/system_functionalities/sys_all_filesystemManagement_advance.atl b/at_scripts/system_functionalities/sys_all_filesystemManagement_advance.atl index 17da8b1..7094cae 100644 --- a/at_scripts/system_functionalities/sys_all_filesystemManagement_advance.atl +++ b/at_scripts/system_functionalities/sys_all_filesystemManagement_advance.atl @@ -4,29 +4,29 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -* +* * http://www.apache.org/licenses/LICENSE-2.0 -* +* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sys_all_filesystemManagement_advance.atl -* Topic: system_functionalities -* Version: 1.0 -* Author: bkha +* Synopsis: sys_all_filesystemManagement_advance.atl +* Topic: system_functionalities +* Version: 1.0 +* Author: bkha * Description: -* This script has the purpose to test the filesystem integration and -* its functions. +* This script has the purpose to test the filesystem integration and +* its functions. ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ // used object for filesystem -filesystem fs; +filesystem fs; string new_directory = "newDirectory"; string to_copy_directory = "copyDir"; @@ -34,137 +34,137 @@ string new_file = "newFile.txt"; void datetime_print(string str, datetime d) { - ECHO(str + d.get_year()+":"+d.get_month()+":"+d.get_day()+"-"+d.get_hour()+":"+d.get_minute()+":"+d.get_second()); + ECHO(str + d.get_year()+":"+d.get_month()+":"+d.get_day()+"-"+d.get_hour()+":"+d.get_minute()+":"+d.get_second()); } void create_file(string file_name){ - file f_new; - if( f_new.open(file_name, "r") >= 0 ) - { - ECHO("File already exists: "+ file_name); - f_new.close(); - } - else - { - // create new file - if( f_new.open(file_name, "w") >= 0 ) - { - ECHO("New file Created: " + file_name); - f_new.close(); - } - } + file f_new; + if( f_new.open(file_name, "r") >= 0 ) + { + ECHO("File already exists: "+ file_name); + f_new.close(); + } + else + { + // create new file + if( f_new.open(file_name, "w") >= 0 ) + { + ECHO("New file Created: " + file_name); + f_new.close(); + } + } } void file_system_test(){ - ECHO("File System Test Start"); - string current_path = fs.getCurrentPath(); - ECHO("Current Path: " + current_path); - - ECHO("Change Path: " + fs.changeCurrentPath("C:")); - ECHO("Current Path: " +fs.getCurrentPath()); - ECHO("Change Path: " + fs.changeCurrentPath(current_path)); - ECHO("Current Path: " +fs.getCurrentPath()); - - //****************** - // Get Directories - //****************** - - array dirs = fs.getDirs(); - for( uint n = 0; n < dirs.length(); n++ ) - ECHO("Directory name: " + dirs[n]); - - //****************** - // Get Files - //****************** - - array files = fs.getFiles(); - for(uint n = 0; n dirs = fs.getDirs(); + for( uint n = 0; n < dirs.length(); n++ ) + ECHO("Directory name: " + dirs[n]); + + //****************** + // Get Files + //****************** + + array files = fs.getFiles(); + for(uint n = 0; n = 0 ) - { - for(int i = 0 ; i < 250; ++i) - { - f.writeString("Test"); - } - - f.close(); - return true; - } - else - { - ECHO("Error: Cannot create File!"); - } - return false; + ECHO("File Create Start:"); + if( f.open(file_path+send_file_name, "w") >= 0 ) + { + for(int i = 0 ; i < 250; ++i) + { + f.writeString("Test"); + } + + f.close(); + return true; + } + else + { + ECHO("Error: Cannot create File!"); + } + return false; } // File system related tests void test_fs_macros() { - ECHO("Starting File system related tests..."); - // create file - print_result("Create file", create_test_file(), true); - print_result("Create duplicate file", create_test_file(), true); - - // delete - print_result("Connect port before file system test",MC_PORT_CONNECT(), true); - PAUSE(500); - print_result("Delete file when not present",MC_FFS_DELETE(send_file_name), false); - - // store - print_result("Store file",MC_FFS_STORE(file_path+send_file_name), true); - print_result("Store invalid file",MC_FFS_STORE("invalid_file.txt"), false); - - // retrieve - print_result("Retrieve file",MC_FFS_RETRIEVE(send_file_name,file_path+receive_file_name), true); -//TODO //print_result("Retrieve file",MC_FFS_RETRIEVE("invalidFile.txt",file_path+receive_file_name), true); - - // delete - // TODO after retreive, ffs is stuck 50% of the time if disconnect/reconnect is not called. - MC_PORT_DISCONNECT(); - MC_PORT_CONNECT(); - PAUSE(500); - print_result("Delete invalid file",MC_FFS_DELETE("invalid_file.txt"), false); - print_result("Delete file",MC_FFS_DELETE(send_file_name), true); - - // delete all - print_result("Store file for checking delete all option",MC_FFS_STORE(file_path+send_file_name), true); - print_result("Delete all file",MC_FFS_DELETE_ALL(),true); - - // disconnect port after file system test - print_result("Disconnect port after file system test",MC_PORT_DISCONNECT(), true); + ECHO("Starting File system related tests..."); + // create file + print_result("Create file", create_test_file(), true); + print_result("Create duplicate file", create_test_file(), true); + + // delete + print_result("Connect port before file system test",MC_PORT_CONNECT(), true); + PAUSE(500); + print_result("Delete file when not present",MC_FFS_DELETE(send_file_name), false); + + // store + print_result("Store file",MC_FFS_STORE(file_path+send_file_name), true); + print_result("Store invalid file",MC_FFS_STORE("invalid_file.txt"), false); + + // retrieve + print_result("Retrieve file",MC_FFS_RETRIEVE(send_file_name,file_path+receive_file_name), true); +//TODO //print_result("Retrieve file",MC_FFS_RETRIEVE("invalidFile.txt",file_path+receive_file_name), true); + + // delete + // TODO after retreive, ffs is stuck 50% of the time if disconnect/reconnect is not called. + MC_PORT_DISCONNECT(); + MC_PORT_CONNECT(); + PAUSE(500); + print_result("Delete invalid file",MC_FFS_DELETE("invalid_file.txt"), false); + print_result("Delete file",MC_FFS_DELETE(send_file_name), true); + + // delete all + print_result("Store file for checking delete all option",MC_FFS_STORE(file_path+send_file_name), true); + print_result("Delete all file",MC_FFS_DELETE_ALL(),true); + + // disconnect port after file system test + print_result("Disconnect port after file system test",MC_PORT_DISCONNECT(), true); } // COM Port related tests void test_com_port_macro(){ - ECHO("Starting COM Port related tests..."); - // com port name tests - print_result("Invalid port connect 1", SET_PORT_NAME(""), false); - print_result("Invalid port connect 2",SET_PORT_NAME("123456789012345678901234567890"), false); - print_result("Valid port connect",SET_PORT_NAME(valid_com_port), true); - - // baudrate tests - print_result("Invalid baud rate",SET_PORT_BAUD(1000), false); - print_result("Valid baud rate 1",SET_PORT_BAUD(1200), true); - print_result("Valid baud rate 2",SET_PORT_BAUD(2400), true); - print_result("Valid baud rate 3",SET_PORT_BAUD(4800), true); - print_result("Valid baud rate 4",SET_PORT_BAUD(9600), true); - print_result("Valid baud rate 5",SET_PORT_BAUD(14400), true); - print_result("Valid baud rate 6",SET_PORT_BAUD(19200), true); - print_result("Valid baud rate 7",SET_PORT_BAUD(38400), true); - print_result("Valid baud rate 8",SET_PORT_BAUD(57600), true); - print_result("Valid baud rate 9",SET_PORT_BAUD(115200), true); - print_result("Valid baud rate 10",SET_PORT_BAUD(230400), true); - print_result("Valid baud rate 11",SET_PORT_BAUD(460800), true); - print_result("Valid baud rate 12",SET_PORT_BAUD(921600), true); - print_result("Valid baud rate 13",SET_PORT_BAUD(3000000), true); - print_result("Valid baud rate 14",SET_PORT_BAUD(3250000), true); - print_result("Valid baud rate 15",SET_PORT_BAUD(6000000), true); - print_result("Valid baud rate 16",SET_PORT_BAUD(6500000), true); - print_result("Valid baud rate 17",SET_PORT_BAUD(com_port_baud), true); - - // stop bit tests - print_result("Invalid stop bit 1",SET_PORT_STOP_BITS(-1), false); - print_result("Invalid stop bit 2",SET_PORT_STOP_BITS(0), false); - print_result("Invalid stop bit 3",SET_PORT_STOP_BITS(3), false); - print_result("Valid stop bit 1",SET_PORT_STOP_BITS(2), true); - print_result("Valid stop bit 2",SET_PORT_STOP_BITS(1), true); - print_result("Valid stop bit 3",SET_PORT_STOP_BITS(com_port_stop_bit), true); - - // data bit tests (5-8) - print_result("Invalid data bit 1",SET_PORT_DATA_BITS(-5), false); - print_result("Invalid data bit 2",SET_PORT_DATA_BITS(0), false); - print_result("Invalid data bit 3",SET_PORT_DATA_BITS(4), false); - print_result("Invalid data bit 4",SET_PORT_DATA_BITS(9), false); - print_result("Valid data bit 1",SET_PORT_DATA_BITS(5), true); - print_result("Valid data bit 2",SET_PORT_DATA_BITS(6), true); - print_result("Valid data bit 3",SET_PORT_DATA_BITS(7), true); - print_result("Valid data bit 4",SET_PORT_DATA_BITS(com_port_data_bit), true); - - // control bit tests (0-2) - print_result("Invalid control bit 1",SET_PORT_FLOW_CONTROL(-1), false); - print_result("Invalid control bit 2",SET_PORT_FLOW_CONTROL(3), false); - print_result("Valid control bit 1",SET_PORT_FLOW_CONTROL(0), true); - print_result("Valid control bit 2",SET_PORT_FLOW_CONTROL(2), true); - print_result("Valid control bit 3",SET_PORT_FLOW_CONTROL(1), true); - print_result("Valid control bit 4",SET_PORT_FLOW_CONTROL(com_port_flow_ctrl), true); - - // parity bit tests (0-2) - print_result("Invalid parity bit 1",SET_PORT_PARITY(-1), false); - print_result("Invalid parity bit 2",SET_PORT_PARITY(3), false); - print_result("Valid parity bit 1",SET_PORT_PARITY(2), true); - print_result("Valid parity bit 2",SET_PORT_PARITY(1), true); - print_result("Valid parity bit 3",SET_PORT_PARITY(0), true); - print_result("Valid parity bit 4",SET_PORT_PARITY(com_port_parity), true); - - // connect-disconnect test - print_result("Connect 1",MC_PORT_CONNECT(), true); - print_result("Connect 2",MC_PORT_CONNECT(), true); - print_result("Disconnect 1",MC_PORT_DISCONNECT(), true); - print_result("Disconnect 2",MC_PORT_DISCONNECT(), true); + ECHO("Starting COM Port related tests..."); + // com port name tests + print_result("Invalid port connect 1", SET_PORT_NAME(""), false); + print_result("Invalid port connect 2",SET_PORT_NAME("123456789012345678901234567890"), false); + print_result("Valid port connect",SET_PORT_NAME(valid_com_port), true); + + // baudrate tests + print_result("Invalid baud rate",SET_PORT_BAUD(1000), false); + print_result("Valid baud rate 1",SET_PORT_BAUD(1200), true); + print_result("Valid baud rate 2",SET_PORT_BAUD(2400), true); + print_result("Valid baud rate 3",SET_PORT_BAUD(4800), true); + print_result("Valid baud rate 4",SET_PORT_BAUD(9600), true); + print_result("Valid baud rate 5",SET_PORT_BAUD(14400), true); + print_result("Valid baud rate 6",SET_PORT_BAUD(19200), true); + print_result("Valid baud rate 7",SET_PORT_BAUD(38400), true); + print_result("Valid baud rate 8",SET_PORT_BAUD(57600), true); + print_result("Valid baud rate 9",SET_PORT_BAUD(115200), true); + print_result("Valid baud rate 10",SET_PORT_BAUD(230400), true); + print_result("Valid baud rate 11",SET_PORT_BAUD(460800), true); + print_result("Valid baud rate 12",SET_PORT_BAUD(921600), true); + print_result("Valid baud rate 13",SET_PORT_BAUD(3000000), true); + print_result("Valid baud rate 14",SET_PORT_BAUD(3250000), true); + print_result("Valid baud rate 15",SET_PORT_BAUD(6000000), true); + print_result("Valid baud rate 16",SET_PORT_BAUD(6500000), true); + print_result("Valid baud rate 17",SET_PORT_BAUD(com_port_baud), true); + + // stop bit tests + print_result("Invalid stop bit 1",SET_PORT_STOP_BITS(-1), false); + print_result("Invalid stop bit 2",SET_PORT_STOP_BITS(0), false); + print_result("Invalid stop bit 3",SET_PORT_STOP_BITS(3), false); + print_result("Valid stop bit 1",SET_PORT_STOP_BITS(2), true); + print_result("Valid stop bit 2",SET_PORT_STOP_BITS(1), true); + print_result("Valid stop bit 3",SET_PORT_STOP_BITS(com_port_stop_bit), true); + + // data bit tests (5-8) + print_result("Invalid data bit 1",SET_PORT_DATA_BITS(-5), false); + print_result("Invalid data bit 2",SET_PORT_DATA_BITS(0), false); + print_result("Invalid data bit 3",SET_PORT_DATA_BITS(4), false); + print_result("Invalid data bit 4",SET_PORT_DATA_BITS(9), false); + print_result("Valid data bit 1",SET_PORT_DATA_BITS(5), true); + print_result("Valid data bit 2",SET_PORT_DATA_BITS(6), true); + print_result("Valid data bit 3",SET_PORT_DATA_BITS(7), true); + print_result("Valid data bit 4",SET_PORT_DATA_BITS(com_port_data_bit), true); + + // control bit tests (0-2) + print_result("Invalid control bit 1",SET_PORT_FLOW_CONTROL(-1), false); + print_result("Invalid control bit 2",SET_PORT_FLOW_CONTROL(3), false); + print_result("Valid control bit 1",SET_PORT_FLOW_CONTROL(0), true); + print_result("Valid control bit 2",SET_PORT_FLOW_CONTROL(2), true); + print_result("Valid control bit 3",SET_PORT_FLOW_CONTROL(1), true); + print_result("Valid control bit 4",SET_PORT_FLOW_CONTROL(com_port_flow_ctrl), true); + + // parity bit tests (0-2) + print_result("Invalid parity bit 1",SET_PORT_PARITY(-1), false); + print_result("Invalid parity bit 2",SET_PORT_PARITY(3), false); + print_result("Valid parity bit 1",SET_PORT_PARITY(2), true); + print_result("Valid parity bit 2",SET_PORT_PARITY(1), true); + print_result("Valid parity bit 3",SET_PORT_PARITY(0), true); + print_result("Valid parity bit 4",SET_PORT_PARITY(com_port_parity), true); + + // connect-disconnect test + print_result("Connect 1",MC_PORT_CONNECT(), true); + print_result("Connect 2",MC_PORT_CONNECT(), true); + print_result("Disconnect 1",MC_PORT_DISCONNECT(), true); + print_result("Disconnect 2",MC_PORT_DISCONNECT(), true); } // Tracing related tests void test_trace_macros(){ - ECHO("Starting Trace Port related tests..."); - - // trace port name tests - print_result("Invalid trace port name 1", SET_TPORT_NAME(""), false); - print_result("Invalid trace port name 2",SET_TPORT_NAME("123456789012345678901234567890"), false); - print_result("Valid trace port name",SET_TPORT_NAME(valid_trace_port), true); - - // baudrate tests - print_result("Invalid trace baud rate",SET_TPORT_BAUD(1000), false); - print_result("Valid trace baud rate 1",SET_TPORT_BAUD(1200), true); - print_result("Valid trace baud rate 2",SET_TPORT_BAUD(2400), true); - print_result("Valid trace baud rate 3",SET_TPORT_BAUD(4800), true); - print_result("Valid trace baud rate 4",SET_TPORT_BAUD(9600), true); - print_result("Valid trace baud rate 5",SET_TPORT_BAUD(14400), true); - print_result("Valid trace baud rate 6",SET_TPORT_BAUD(19200), true); - print_result("Valid trace baud rate 7",SET_TPORT_BAUD(38400), true); - print_result("Valid trace baud rate 8",SET_TPORT_BAUD(57600), true); - print_result("Valid trace baud rate 9",SET_TPORT_BAUD(115200), true); - print_result("Valid trace baud rate 10",SET_TPORT_BAUD(230400), true); - print_result("Valid trace baud rate 11",SET_TPORT_BAUD(460800), true); - print_result("Valid trace baud rate 12",SET_TPORT_BAUD(921600), true); - print_result("Valid trace baud rate 13",SET_TPORT_BAUD(3000000), true); - print_result("Valid trace baud rate 14",SET_TPORT_BAUD(3250000), true); - print_result("Valid trace baud rate 15",SET_TPORT_BAUD(6000000), true); - print_result("Valid trace baud rate 16",SET_TPORT_BAUD(6500000), true); - print_result("Valid trace baud rate 17",SET_TPORT_BAUD(trace_port_baud), true); - - // stop bit tests - print_result("Invalid trace stop bit 1",SET_TPORT_STOP_BITS(-1), false); - print_result("Invalid trace stop bit 2",SET_TPORT_STOP_BITS(0), false); - print_result("Invalid trace stop bit 3",SET_TPORT_STOP_BITS(3), false); - print_result("Valid trace stop bit 1",SET_TPORT_STOP_BITS(2), true); - print_result("Valid trace stop bit 2",SET_TPORT_STOP_BITS(1), true); - print_result("Valid trace stop bit 3",SET_TPORT_STOP_BITS(trace_port_stop_bit), true); - - // data bit tests (5-8) - print_result("Invalid trace data bit 1",SET_TPORT_DATA_BITS(-5), false); - print_result("Invalid trace data bit 2",SET_TPORT_DATA_BITS(0), false); - print_result("Invalid trace data bit 3",SET_TPORT_DATA_BITS(4), false); - print_result("Invalid trace data bit 4",SET_TPORT_DATA_BITS(9), false); - print_result("Valid trace data bit 1",SET_TPORT_DATA_BITS(5), true); - print_result("Valid trace data bit 2",SET_TPORT_DATA_BITS(6), true); - print_result("Valid trace data bit 3",SET_TPORT_DATA_BITS(7), true); - print_result("Valid trace data bit 4",SET_TPORT_DATA_BITS(trace_port_data_bit), true); - - // control bit tests (0-2) - print_result("Invalid trace control bit 1",SET_TPORT_FLOW_CONTROL(-1), false); - print_result("Invalid trace control bit 2",SET_TPORT_FLOW_CONTROL(3), false); - print_result("Valid trace control bit 1",SET_TPORT_FLOW_CONTROL(0), true); - print_result("Valid trace control bit 2",SET_TPORT_FLOW_CONTROL(2), true); - print_result("Valid trace control bit 3",SET_TPORT_FLOW_CONTROL(1), true); - print_result("Valid trace control bit 4",SET_TPORT_FLOW_CONTROL(trace_port_flow_ctrl), true); - - // parity bit tests (0-2) - print_result("Invalid trace parity bit 1",SET_TPORT_PARITY(-1), false); - print_result("Invalid trace parity bit 2",SET_TPORT_PARITY(3), false); - print_result("Valid trace parity bit 1",SET_TPORT_PARITY(2), true); - print_result("Valid trace parity bit 2",SET_TPORT_PARITY(1), true); - print_result("Valid trace parity bit 3",SET_TPORT_PARITY(0), true); - print_result("Valid trace parity bit 4",SET_TPORT_PARITY(trace_port_parity), true); - - // trace starting - print_result("Com Port connect for trace",MC_PORT_CONNECT(), true); - print_result("Start Trace, invalid trace number",MC_TRACE_START(trace_file_name, trace_at_cmd, 9), false); - print_result("Start Trace 1",MC_TRACE_START(trace_file_name, trace_at_cmd, trace_protocol), true); - print_result("Start Trace 2",MC_TRACE_START(trace_file_name, trace_at_cmd, trace_protocol), true); - - // send some AT commands - SENDAT("ATI0",2000,""); - SENDAT("ATI9",2000,""); - SENDAT("AT+COPS?",2000,""); - SENDAT("AT+CSQ",2000,""); - SENDAT("AT+CESQ",2000,""); - SENDAT("AT+CREG?",2000,""); - SENDAT("AT+CGREG?",2000,""); - SENDAT("AT+CEREG?",2000,""); - PAUSE(5000); - - // trace stop - print_result("Stop Trace 1",MC_TRACE_STOP(), true); - - if(socket_mode == 1){ - // socket tracing - print_result("Set socket invalid conf 1",SET_TRACE_SOCKET_PARAM("", socket_port), false); - print_result("Set socket invalid conf 2",SET_TRACE_SOCKET_PARAM(socket_ip, -1), false); - print_result("Set socket invalid conf 3",SET_TRACE_SOCKET_PARAM(socket_ip, 0), false); - print_result("Set socket invalid conf 3",SET_TRACE_SOCKET_PARAM(socket_ip, 70000), false); - print_result("Set socket conf",SET_TRACE_SOCKET_PARAM(socket_ip, socket_port), true); - print_result("Start socket 1",MC_TRACE_START(trace_file_name, trace_at_cmd, socket_protocol, socket_mode), true); - print_result("Start socket 2",MC_TRACE_START(trace_file_name, trace_at_cmd, socket_protocol, socket_mode), true); - - // send some AT commands - SENDAT("ATI0",2000,""); - SENDAT("ATI9",2000,""); - SENDAT("AT+COPS?",2000,""); - SENDAT("AT+CSQ",2000,""); - SENDAT("AT+CESQ",2000,""); - SENDAT("AT+CREG?",2000,""); - SENDAT("AT+CGREG?",2000,""); - SENDAT("AT+CEREG?",2000,""); - PAUSE(5000); - - // socket stop - print_result("Stop socket",MC_TRACE_STOP(), true); - } - -// TODO //print_result("Stop Trace 2",MC_TRACE_STOP(), true); - print_result("Com Port disconnect for trace",MC_PORT_DISCONNECT(), true); - + ECHO("Starting Trace Port related tests..."); + + // trace port name tests + print_result("Invalid trace port name 1", SET_TPORT_NAME(""), false); + print_result("Invalid trace port name 2",SET_TPORT_NAME("123456789012345678901234567890"), false); + print_result("Valid trace port name",SET_TPORT_NAME(valid_trace_port), true); + + // baudrate tests + print_result("Invalid trace baud rate",SET_TPORT_BAUD(1000), false); + print_result("Valid trace baud rate 1",SET_TPORT_BAUD(1200), true); + print_result("Valid trace baud rate 2",SET_TPORT_BAUD(2400), true); + print_result("Valid trace baud rate 3",SET_TPORT_BAUD(4800), true); + print_result("Valid trace baud rate 4",SET_TPORT_BAUD(9600), true); + print_result("Valid trace baud rate 5",SET_TPORT_BAUD(14400), true); + print_result("Valid trace baud rate 6",SET_TPORT_BAUD(19200), true); + print_result("Valid trace baud rate 7",SET_TPORT_BAUD(38400), true); + print_result("Valid trace baud rate 8",SET_TPORT_BAUD(57600), true); + print_result("Valid trace baud rate 9",SET_TPORT_BAUD(115200), true); + print_result("Valid trace baud rate 10",SET_TPORT_BAUD(230400), true); + print_result("Valid trace baud rate 11",SET_TPORT_BAUD(460800), true); + print_result("Valid trace baud rate 12",SET_TPORT_BAUD(921600), true); + print_result("Valid trace baud rate 13",SET_TPORT_BAUD(3000000), true); + print_result("Valid trace baud rate 14",SET_TPORT_BAUD(3250000), true); + print_result("Valid trace baud rate 15",SET_TPORT_BAUD(6000000), true); + print_result("Valid trace baud rate 16",SET_TPORT_BAUD(6500000), true); + print_result("Valid trace baud rate 17",SET_TPORT_BAUD(trace_port_baud), true); + + // stop bit tests + print_result("Invalid trace stop bit 1",SET_TPORT_STOP_BITS(-1), false); + print_result("Invalid trace stop bit 2",SET_TPORT_STOP_BITS(0), false); + print_result("Invalid trace stop bit 3",SET_TPORT_STOP_BITS(3), false); + print_result("Valid trace stop bit 1",SET_TPORT_STOP_BITS(2), true); + print_result("Valid trace stop bit 2",SET_TPORT_STOP_BITS(1), true); + print_result("Valid trace stop bit 3",SET_TPORT_STOP_BITS(trace_port_stop_bit), true); + + // data bit tests (5-8) + print_result("Invalid trace data bit 1",SET_TPORT_DATA_BITS(-5), false); + print_result("Invalid trace data bit 2",SET_TPORT_DATA_BITS(0), false); + print_result("Invalid trace data bit 3",SET_TPORT_DATA_BITS(4), false); + print_result("Invalid trace data bit 4",SET_TPORT_DATA_BITS(9), false); + print_result("Valid trace data bit 1",SET_TPORT_DATA_BITS(5), true); + print_result("Valid trace data bit 2",SET_TPORT_DATA_BITS(6), true); + print_result("Valid trace data bit 3",SET_TPORT_DATA_BITS(7), true); + print_result("Valid trace data bit 4",SET_TPORT_DATA_BITS(trace_port_data_bit), true); + + // control bit tests (0-2) + print_result("Invalid trace control bit 1",SET_TPORT_FLOW_CONTROL(-1), false); + print_result("Invalid trace control bit 2",SET_TPORT_FLOW_CONTROL(3), false); + print_result("Valid trace control bit 1",SET_TPORT_FLOW_CONTROL(0), true); + print_result("Valid trace control bit 2",SET_TPORT_FLOW_CONTROL(2), true); + print_result("Valid trace control bit 3",SET_TPORT_FLOW_CONTROL(1), true); + print_result("Valid trace control bit 4",SET_TPORT_FLOW_CONTROL(trace_port_flow_ctrl), true); + + // parity bit tests (0-2) + print_result("Invalid trace parity bit 1",SET_TPORT_PARITY(-1), false); + print_result("Invalid trace parity bit 2",SET_TPORT_PARITY(3), false); + print_result("Valid trace parity bit 1",SET_TPORT_PARITY(2), true); + print_result("Valid trace parity bit 2",SET_TPORT_PARITY(1), true); + print_result("Valid trace parity bit 3",SET_TPORT_PARITY(0), true); + print_result("Valid trace parity bit 4",SET_TPORT_PARITY(trace_port_parity), true); + + // trace starting + print_result("Com Port connect for trace",MC_PORT_CONNECT(), true); + print_result("Start Trace, invalid trace number",MC_TRACE_START(trace_file_name, trace_at_cmd, 9), false); + print_result("Start Trace 1",MC_TRACE_START(trace_file_name, trace_at_cmd, trace_protocol), true); + print_result("Start Trace 2",MC_TRACE_START(trace_file_name, trace_at_cmd, trace_protocol), true); + + // send some AT commands + SENDAT("ATI0",2000,""); + SENDAT("ATI9",2000,""); + SENDAT("AT+COPS?",2000,""); + SENDAT("AT+CSQ",2000,""); + SENDAT("AT+CESQ",2000,""); + SENDAT("AT+CREG?",2000,""); + SENDAT("AT+CGREG?",2000,""); + SENDAT("AT+CEREG?",2000,""); + PAUSE(5000); + + // trace stop + print_result("Stop Trace 1",MC_TRACE_STOP(), true); + + if(socket_mode == 1){ + // socket tracing + print_result("Set socket invalid conf 1",SET_TRACE_SOCKET_PARAM("", socket_port), false); + print_result("Set socket invalid conf 2",SET_TRACE_SOCKET_PARAM(socket_ip, -1), false); + print_result("Set socket invalid conf 3",SET_TRACE_SOCKET_PARAM(socket_ip, 0), false); + print_result("Set socket invalid conf 3",SET_TRACE_SOCKET_PARAM(socket_ip, 70000), false); + print_result("Set socket conf",SET_TRACE_SOCKET_PARAM(socket_ip, socket_port), true); + print_result("Start socket 1",MC_TRACE_START(trace_file_name, trace_at_cmd, socket_protocol, socket_mode), true); + print_result("Start socket 2",MC_TRACE_START(trace_file_name, trace_at_cmd, socket_protocol, socket_mode), true); + + // send some AT commands + SENDAT("ATI0",2000,""); + SENDAT("ATI9",2000,""); + SENDAT("AT+COPS?",2000,""); + SENDAT("AT+CSQ",2000,""); + SENDAT("AT+CESQ",2000,""); + SENDAT("AT+CREG?",2000,""); + SENDAT("AT+CGREG?",2000,""); + SENDAT("AT+CEREG?",2000,""); + PAUSE(5000); + + // socket stop + print_result("Stop socket",MC_TRACE_STOP(), true); + } + +// TODO //print_result("Stop Trace 2",MC_TRACE_STOP(), true); + print_result("Com Port disconnect for trace",MC_PORT_DISCONNECT(), true); + } // AT Terminal related test cases void test_at_terminal_macros(){ - // clear AT Terminal - MC_TERMINAL_LOGCLEAR(); - // set terminal log to true - print_result("Start AT Terminal logs before connect",MC_TERMINAL_LOG(true),false); - set_uart_settings(); - MC_PORT_CONNECT(); - print_result("Start AT Terminal logs after connect",MC_TERMINAL_LOG(true),true); - MC_PORT_DISCONNECT(); + // clear AT Terminal + MC_TERMINAL_LOGCLEAR(); + // set terminal log to true + print_result("Start AT Terminal logs before connect",MC_TERMINAL_LOG(true),false); + set_uart_settings(); + MC_PORT_CONNECT(); + print_result("Start AT Terminal logs after connect",MC_TERMINAL_LOG(true),true); + MC_PORT_DISCONNECT(); } // set the uart related settings void set_uart_settings(){ - SET_PORT_NAME(valid_uart_port); - SET_PORT_BAUD(uart_port_baud); - SET_PORT_FLOW_CONTROL(uart_port_flow_ctrl); - SET_PORT_DATA_BITS(uart_port_data_bit); - SET_PORT_STOP_BITS(uart_port_stop_bit); - SET_PORT_PARITY(uart_port_parity); + SET_PORT_NAME(valid_uart_port); + SET_PORT_BAUD(uart_port_baud); + SET_PORT_FLOW_CONTROL(uart_port_flow_ctrl); + SET_PORT_DATA_BITS(uart_port_data_bit); + SET_PORT_STOP_BITS(uart_port_stop_bit); + SET_PORT_PARITY(uart_port_parity); } void test_general_macros(){ // send at macro - - MC_PORT_CONNECT(); - - print_result("SENDAT correct", SENDAT("AT",200,"OK")=="OK", true); - print_result("SENDAT invalid", SENDAT("A",200,"OK")=="OK", false); - print_result("SENDAT exactline = false case", SENDAT("AT",200,"ERROR",false)=="OK\r\n", true); - print_result("SENDAT exactline = true case", SENDAT("AT",200,"ERROR",true)=="", true); - - // wait macro - SENDAT("ATE0",200,"OK"); - SENDAT("AT+CREG=2",200,"OK"); - SENDAT("AT+CFUN=0",5000,"OK"); - SENDAT("AT+CFUN=1",5000,"OK"); - - print_result("WAIT correct case", WAIT("+CREG", 10000).substr(0,5) == "+CREG", true); - - SENDAT("AT+CFUN=0",5000,"OK"); - SENDAT("AT+CFUN=1",5000,"OK"); - print_result("WAIT incomplete case", WAIT("+CR", 10000).substr(0,5) == "+CREG", true); - - SENDAT("AT+CFUN=0",5000,"OK"); - SENDAT("AT+CFUN=1",5000,"OK"); - print_result("WAIT exactline = false case", WAIT("+CGREG", 10000, false).substr(0,5) == "+CREG", true); - - SENDAT("AT+CFUN=0",5000,"OK"); - SENDAT("AT+CFUN=1",5000,"OK"); - print_result("WAIT exactline = true case", WAIT("+CGREG", 10000, true).substr(0,5) == "+CREG", false); - - // find macro - print_result("find macro case 1", FIND("A big Word", "big") != -1, true); - print_result("find macro case 2", FIND("A big Word", "not") == -1, true); - - // sendhex macro - print_result("SENDHEX macro",SENDHEX("41 54 0d 0a"), true); - PAUSE(200); - - // send text macro - print_result("SENDTEXT macro",SENDTEXT("AT\r\n"), true); - MC_PORT_DISCONNECT(); - - // SWAPENDIAN macro - print_result("SWAPENDIAN macro case 1",SWAPENDIAN("123456") == "563412", true); - print_result("SWAPENDIAN macro case 2",SWAPENDIAN("12345678") == "78563412", true); - print_result("SWAPENDIAN macro case 3",SWAPENDIAN("1234567") == "563412", true); - - // flow control checks macro - // Connect with uart before flow control tests - set_uart_settings(); - MC_PORT_CONNECT(); - - // rts macro tests - SETCOMRTS(false); - print_result("RTS false case",(SENDAT("AT",200,"OK")=="OK"),false); - SETCOMRTS(true); - print_result("RTS true case",(SENDAT("AT",200,"OK")=="OK"), true); - - // dtr macro tests - SENDAT("AT+UPSV=3",200,"OK"); - SETCOMDTR(false); - print_result("DTR false case",(SENDAT("AT",200,"OK")=="OK"),false); - SETCOMDTR(true); - print_result("DTR true case",(SENDAT("AT",200,"OK")=="OK"), true); - SENDAT("AT+UPSV=0",200,"OK"); - - //CTS PIN test - SENDAT("AT+CFUN=16",5000,"OK"); - PAUSE(1000); - print_result("CTS pin low case",GETCOMCTS(), false); - PAUSE(5000); - print_result("CTS pin high case",GETCOMCTS(), true); - - //DSR PIN test - SENDAT("AT&S0",200,"OK"); - print_result("DSR pin high case",GETCOMDSR(),true); - SENDAT("AT&S1",200,"OK"); - print_result("DSR pin low case",GETCOMDSR(),false); - - //DCD PIN test - SENDAT("AT&C0",200,"OK"); - print_result("DCD pin high case",GETCOMDCD(),true); - SENDAT("AT&C1",200,"OK"); - print_result("DCD pin low case",GETCOMDCD(),false); - - //RI test - print_result("RI pin low case",GETCOMRI(),false); - - MC_PORT_DISCONNECT(); + + MC_PORT_CONNECT(); + + print_result("SENDAT correct", SENDAT("AT",200,"OK")=="OK", true); + print_result("SENDAT invalid", SENDAT("A",200,"OK")=="OK", false); + print_result("SENDAT exactline = false case", SENDAT("AT",200,"ERROR",false)=="OK\r\n", true); + print_result("SENDAT exactline = true case", SENDAT("AT",200,"ERROR",true)=="", true); + + // wait macro + SENDAT("ATE0",200,"OK"); + SENDAT("AT+CREG=2",200,"OK"); + SENDAT("AT+CFUN=0",5000,"OK"); + SENDAT("AT+CFUN=1",5000,"OK"); + + print_result("WAIT correct case", WAIT("+CREG", 10000).substr(0,5) == "+CREG", true); + + SENDAT("AT+CFUN=0",5000,"OK"); + SENDAT("AT+CFUN=1",5000,"OK"); + print_result("WAIT incomplete case", WAIT("+CR", 10000).substr(0,5) == "+CREG", true); + + SENDAT("AT+CFUN=0",5000,"OK"); + SENDAT("AT+CFUN=1",5000,"OK"); + print_result("WAIT exactline = false case", WAIT("+CGREG", 10000, false).substr(0,5) == "+CREG", true); + + SENDAT("AT+CFUN=0",5000,"OK"); + SENDAT("AT+CFUN=1",5000,"OK"); + print_result("WAIT exactline = true case", WAIT("+CGREG", 10000, true).substr(0,5) == "+CREG", false); + + // find macro + print_result("find macro case 1", FIND("A big Word", "big") != -1, true); + print_result("find macro case 2", FIND("A big Word", "not") == -1, true); + + // sendhex macro + print_result("SENDHEX macro",SENDHEX("41 54 0d 0a"), true); + PAUSE(200); + + // send text macro + print_result("SENDTEXT macro",SENDTEXT("AT\r\n"), true); + MC_PORT_DISCONNECT(); + + // SWAPENDIAN macro + print_result("SWAPENDIAN macro case 1",SWAPENDIAN("123456") == "563412", true); + print_result("SWAPENDIAN macro case 2",SWAPENDIAN("12345678") == "78563412", true); + print_result("SWAPENDIAN macro case 3",SWAPENDIAN("1234567") == "563412", true); + + // flow control checks macro + // Connect with uart before flow control tests + set_uart_settings(); + MC_PORT_CONNECT(); + + // rts macro tests + SETCOMRTS(false); + print_result("RTS false case",(SENDAT("AT",200,"OK")=="OK"),false); + SETCOMRTS(true); + print_result("RTS true case",(SENDAT("AT",200,"OK")=="OK"), true); + + // dtr macro tests + SENDAT("AT+UPSV=3",200,"OK"); + SETCOMDTR(false); + print_result("DTR false case",(SENDAT("AT",200,"OK")=="OK"),false); + SETCOMDTR(true); + print_result("DTR true case",(SENDAT("AT",200,"OK")=="OK"), true); + SENDAT("AT+UPSV=0",200,"OK"); + + //CTS PIN test + SENDAT("AT+CFUN=16",5000,"OK"); + PAUSE(1000); + print_result("CTS pin low case",GETCOMCTS(), false); + PAUSE(5000); + print_result("CTS pin high case",GETCOMCTS(), true); + + //DSR PIN test + SENDAT("AT&S0",200,"OK"); + print_result("DSR pin high case",GETCOMDSR(),true); + SENDAT("AT&S1",200,"OK"); + print_result("DSR pin low case",GETCOMDSR(),false); + + //DCD PIN test + SENDAT("AT&C0",200,"OK"); + print_result("DCD pin high case",GETCOMDCD(),true); + SENDAT("AT&C1",200,"OK"); + print_result("DCD pin low case",GETCOMDCD(),false); + + //RI test + print_result("RI pin low case",GETCOMRI(),false); + + MC_PORT_DISCONNECT(); } // print fail test cases void print_result(){ - ECHO(" "); - ECHO("#######################################################"); - ECHO("###################RESULTS#############################"); - ECHO("#######################################################"); - if(fail_cases.length() >0){ - ECHO("###########Printing all fail test csaes ###############"); - for(int i =0; i < fail_cases.length();i++){ - ECHO("Fail test case " +fail_cases[i]); - } - } - else{ - ECHO("All test cases passed!!!"); - } - ECHO("#######################################################"); - ECHO(" "); + ECHO(" "); + ECHO("#######################################################"); + ECHO("###################RESULTS#############################"); + ECHO("#######################################################"); + if(fail_cases.length() >0){ + ECHO("###########Printing all fail test csaes ###############"); + for(int i =0; i < fail_cases.length();i++){ + ECHO("Fail test case " +fail_cases[i]); + } + } + else{ + ECHO("All test cases passed!!!"); + } + ECHO("#######################################################"); + ECHO(" "); } // main program void main(){ - starting_ECHO(); - test_at_terminal_macros(); - test_fs_macros(); - test_com_port_macro(); - test_trace_macros(); - test_general_macros(); - // print all test results - print_result(); + starting_ECHO(); + test_at_terminal_macros(); + test_fs_macros(); + test_com_port_macro(); + test_trace_macros(); + test_general_macros(); + // print all test results + print_result(); } diff --git a/at_scripts/system_functionalities/sys_all_multipleBaudTesting_basic.atl b/at_scripts/system_functionalities/sys_all_multipleBaudTesting_basic.atl index e696502..c0c1d17 100644 --- a/at_scripts/system_functionalities/sys_all_multipleBaudTesting_basic.atl +++ b/at_scripts/system_functionalities/sys_all_multipleBaudTesting_basic.atl @@ -13,49 +13,49 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sys_all_multipleBaudTesting_basic.atl -* Topic: system_functionalities -* Version: 1.0 -* Author: muaw +* Synopsis: sys_all_multipleBaudTesting_basic.atl +* Topic: system_functionalities +* Version: 1.0 +* Author: muaw * Description: -* This script has the purpose to test the AT port macros by configuring -* multiple baud rates. +* This script has the purpose to test the AT port macros by configuring +* multiple baud rates. ****************************************************************************** -* Modules: All Products -* Tested on: SARA-R42 +* Modules: All Products +* Tested on: SARA-R42 ******************************************************************************/ void main() { - ECHO("Port should be connected and AT should be working before running this script!"); - connect_port_with_baud(115200); - send_AT_command(); - connect_port_with_baud(230400); - send_AT_command(); - connect_port_with_baud(460800); - send_AT_command(); - connect_port_with_baud(921600); - send_AT_command(); - connect_port_with_baud(115200); - send_AT_command(); + ECHO("Port should be connected and AT should be working before running this script!"); + connect_port_with_baud(115200); + send_AT_command(); + connect_port_with_baud(230400); + send_AT_command(); + connect_port_with_baud(460800); + send_AT_command(); + connect_port_with_baud(921600); + send_AT_command(); + connect_port_with_baud(115200); + send_AT_command(); } void send_AT_command() { - SENDAT("AT",500, "OK"); - PAUSE(2000); + SENDAT("AT",500, "OK"); + PAUSE(2000); } void connect_port_with_baud(int baud) { - string command = "AT+IPR=" + baud; - string resp = SENDAT(command, 500, "OK"); - PAUSE(2000); - MC_PORT_DISCONNECT(); - SET_PORT_BAUD(baud); - SET_PORT_FLOW_CONTROL(0); - SET_PORT_DATA_BITS(8); - SET_PORT_STOP_BITS(1); - SET_PORT_PARITY(0); - MC_PORT_CONNECT(); + string command = "AT+IPR=" + baud; + string resp = SENDAT(command, 500, "OK"); + PAUSE(2000); + MC_PORT_DISCONNECT(); + SET_PORT_BAUD(baud); + SET_PORT_FLOW_CONTROL(0); + SET_PORT_DATA_BITS(8); + SET_PORT_STOP_BITS(1); + SET_PORT_PARITY(0); + MC_PORT_CONNECT(); } diff --git a/at_scripts/system_functionalities/sys_all_traceExample_basic.atl b/at_scripts/system_functionalities/sys_all_traceExample_basic.atl index 1b069c6..5f58809 100644 --- a/at_scripts/system_functionalities/sys_all_traceExample_basic.atl +++ b/at_scripts/system_functionalities/sys_all_traceExample_basic.atl @@ -13,55 +13,55 @@ * See the License for the specific language governing permissions and * limitations under the License. ****************************************************************************** -* Synopsis: sys_all_traceExample_basic.atl -* Topic: system_functionalities -* Version: 1.0 -* Author: muaw +* Synopsis: sys_all_traceExample_basic.atl +* Topic: system_functionalities +* Version: 1.0 +* Author: muaw * Description: -* This script has the purpose to set trace parameters and start the trace +* This script has the purpose to set trace parameters and start the trace ****************************************************************************** -* Modules: All Products -* Tested on: LARA-R2 +* Modules: All Products +* Tested on: LARA-R2 ******************************************************************************/ //----configuration settings------// -string trace_port_name = "COM13"; // trace port name -string trace_store_path = "C:\\trace_folder\\trace"; // path to store the file -int baud_rate = 115200; // supported baud rate -int stop_bits = 1; // 1 or 2 -int data_bits = 5; // 5-8 -int flow_control = 0; // 0:none, 1:hardware, 2:xon/xoff -int parity = 0; // 0:none, 1:even, 2:off -bool trace_AT_commands = true; // Turn trace AT commands on/off (true:ON, false:OFF) -int trace_protocol = 3; // 0: NONE, 1: LEON/SARA-G, 2: LISA-U/SARA-U, 3: TOBY-L2/MPCI-L2, 4: TOBY-R2/LARA-R2/TOBY-L4, 5: LARA-R3, 6: SARA-R5, 7: SARA-G4/SARA-N3 +string trace_port_name = "COM13"; // trace port name +string trace_store_path = "C:\\trace_folder\\trace"; // path to store the file +int baud_rate = 115200; // supported baud rate +int stop_bits = 1; // 1 or 2 +int data_bits = 5; // 5-8 +int flow_control = 0; // 0:none, 1:hardware, 2:xon/xoff +int parity = 0; // 0:none, 1:even, 2:off +bool trace_AT_commands = true; // Turn trace AT commands on/off (true:ON, false:OFF) +int trace_protocol = 3; // 0: NONE, 1: LEON/SARA-G, 2: LISA-U/SARA-U, 3: TOBY-L2/MPCI-L2, 4: TOBY-R2/LARA-R2/TOBY-L4, 5: LARA-R3, 6: SARA-R5, 7: SARA-G4/SARA-N3 //--------------------------------// void main() { - MC_TRACE_STOP(); // stop tracing if already running + MC_TRACE_STOP(); // stop tracing if already running - SET_TPORT_NAME(trace_port_name ); - SET_TPORT_BAUD(baud_rate); - SET_TPORT_STOP_BITS(stop_bits); - SET_TPORT_DATA_BITS(data_bits); - SET_TPORT_FLOW_CONTROL(flow_control); - SET_TPORT_PARITY(parity); + SET_TPORT_NAME(trace_port_name ); + SET_TPORT_BAUD(baud_rate); + SET_TPORT_STOP_BITS(stop_bits); + SET_TPORT_DATA_BITS(data_bits); + SET_TPORT_FLOW_CONTROL(flow_control); + SET_TPORT_PARITY(parity); - MC_TRACE_START(trace_store_path,trace_AT_commands,trace_protocol); + MC_TRACE_START(trace_store_path,trace_AT_commands,trace_protocol); - SENDAT("ATI0",2000,""); - SENDAT("ATI9",2000,""); - SENDAT("AT+COPS?",2000,""); - SENDAT("AT+CSQ",2000,""); - SENDAT("AT+CESQ",2000,""); - SENDAT("AT+CREG?",2000,""); - SENDAT("AT+CGREG?",2000,""); - SENDAT("AT+CEREG?",2000,""); + SENDAT("ATI0",2000,""); + SENDAT("ATI9",2000,""); + SENDAT("AT+COPS?",2000,""); + SENDAT("AT+CSQ",2000,""); + SENDAT("AT+CESQ",2000,""); + SENDAT("AT+CREG?",2000,""); + SENDAT("AT+CGREG?",2000,""); + SENDAT("AT+CEREG?",2000,""); - PAUSE(10000); + PAUSE(10000); - MC_TRACE_STOP(); + MC_TRACE_STOP(); } diff --git a/license/LICENSE_SCRIPTING b/license/LICENSE_SCRIPTING index 3085299..cdddf24 100644 --- a/license/LICENSE_SCRIPTING +++ b/license/LICENSE_SCRIPTING @@ -1,6 +1,6 @@ AngelCode Scripting Library -Copyright © 2003-2019 Andreas Jönsson +Copyright � 2003-2019 Andreas J�nsson This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.