diff --git a/CHANGELOG b/CHANGELOG index a1446c5..32e07d5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ ME310 0.0.0 - ????.??.?? +ME310 2.6.0 - 2021.10.14 +* File utilities improvements +* sketches code improvements +* code cleanup + ME310 2.5.0 - 2021.10.08 * Changed Bosch example to use BMA400-API library * Minor code cleanup diff --git a/README.md b/README.md index 02457cf..777464d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,60 @@ -# ME310G1 / Charlie official communication library for Arduino - -Code library for Arduino projects using ME310G1 devices (for example, on [Charlie Board](https://github.com/telit/arduino-charlie) ) - - +# ME310G1 / Charlie official communication library for Arduino + +Code library for Arduino projects using ME310G1 devices (for example, on [Charlie Board](https://github.com/telit/arduino-charlie) ) + + + +## Contents + +This Library will provide a set of APIs wrapping the AT commands to simplify the interaction with the ME310G1 device. + +### Classes + +The library provides the following classes: + + - **ME310** : _main class providing all the functionalities, the only needed for users' code_ + - **Parser** : _internal helper classes to simplify the AT command responses parsing_ + - **PathParsing** : _internal helper class to parse the file paths on the device_ + - **ATCommandDataParsing** : _internal class used to call Parser_ + + +### Examples + +The following examples are available: + + - **[AGNSS_example](examples/AGNSS_example/AGNSS_example.ino)** : _Simple example that shows how to configure the AGNSS functionality_ + - **[Bosch_sensor_example](examples/Bosch_sensor_example/Bosch_sensor_example.ino)** : _Shows how to retrieve info from the onboard Bosch BMA400 accelerometer_ + - **[CheckModule](examples/CheckModule/CheckModule.ino)** : _Turns the modem on and checks if it responsive_ + - **[CLIP_example](examples/CLIP_example/CLIP_example.ino)** : _Shows how to use Calling Line Identifier protocol_ + - **[FTP_example](examples/FTP_example/FTP_example.ino)** : _Connects to an FTP server and performs basic operations_ + - **[GNSS_example](examples/GNSS_example/GNSS_example.ino)** : _Simple GNSS example, it enables the GNSS receiver and provides raw location data_ + - **[LWM2M_example](examples/LWM2M_example/)** : _uses LwM2M protocol and the accelerometer to send data to the OneEdge portal_ + - **[LWM2M_example_2G](examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino)** : _example with 2G network_ + - **[LWM2M_example_4G](examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino)** : _example with 4G network_ + - **[M2M_example](examples/M2M_example/M2M_example.ino)** : _Communicates with the modem using the M2M commands to manage the filesystem_ + - **[ME310_AT_Test](examples/ME310_AT_Test/ME310_AT_Test.ino)** : _Communicates with the modem and provides info about it (ICCID, IMEI etc.)_ + - **[MQTT_example](examples/MQTT_example/MQTT_example.ino)** : _Communicate with a MQTT broker_ + - **[Ping_example](examples/Ping_example/Ping_example.ino)** : _Simple example that enables the connectivity and pings a server_ + - **[Socket_example](examples/Socket_example/Socket_example.ino)** : _Enables connectivity and uses a TCP socket example communicating with a demo server_ + - **[TransparentBridge](examples/TransparentBridge/TransparentBridge.ino)** : _Enable the modem and creates a bridge between Arduino serial and modem AT interface, allowing user to send AT commands manually_ + + +## Support + +If you need support, please open a ticket to our technical support by sending an email to: + + - ts-americas@telit.com if you are in the Americas region + - ts-emea@telit.com if you are in EMEA region + - ts-apac@telit.com if you are in APAC + + providing the following information: + + - module type + - answer to the commands (you can use the TrasparentBridge example to communicate with the modem) + - AT#SWPKGV + - AT+CPIN? + - AT+CCID + - AT+CGSN + - AT+CGDCONT? + +and add [Charlie][AppZone] in the e-mail object, and in the e-mail body refer to the opened issue on github. diff --git a/examples/AGNSS_example/AGNSS_example.ino b/examples/AGNSS_example/AGNSS_example.ino index 4e9166d..d0a9b96 100644 --- a/examples/AGNSS_example/AGNSS_example.ino +++ b/examples/AGNSS_example/AGNSS_example.ino @@ -14,11 +14,12 @@ In this example sketch, it is shown how to use AGNSS management, using ME310 library.\n AGNSS is enable, GNSS configuration, GNSS controller power management, GNSS nmea configuration functions are shown.\n GPS positions are acquired and response is printed. + NOTE:\n + For the sketch to work correctly, GNSS should be tested in open sky conditions to allow a fix. The fix may take a few minutes. - - @version + @version 1.0.0 - + @note @author @@ -29,7 +30,7 @@ */ #include -#include +#include /*When NMEA_DEBUG is 0 Unsolicited NMEA is disable*/ #define NMEA_DEBUG 0 @@ -40,21 +41,20 @@ using namespace me310; /* - * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n + * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n * Please refer to your board configuration in variant.h file. * Example: * Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS); - * ME310 myME310 (Serial1); + * ME310 myME310 (Serial1); */ ME310 myME310; -ME310::return_t rc; +ME310::return_t rc; int count = 0; void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); @@ -79,7 +79,7 @@ void setup() { // e.g. $GPSCFG: 0,4321,2,0 ///////////////////////////////////// Serial.println("Read GNSS configuration"); - myME310.read_gnss_configuration(); //issue command AT$GPSCFG? + myME310.read_gnss_configuration(); //issue command AT$GPSCFG? Serial.println(myME310.buffer_cstr(1)); ///////////////////////////////////// // Set GNSS priority @@ -99,7 +99,7 @@ void setup() { delay(5000); ///////////////////////////////////// - // Set constellations + // Set constellations // AT$GPSCFG=2,X // 0 : the constellation is selected automatically based on Mobile Country Code (MCC) of camped network // 1 : GPS+GLO @@ -149,7 +149,7 @@ void setup() { // Set GNGSA, GLGSV and GNRMC as available sentence in the unsolicited NMEA sentences. // AT$GPSNMUNEX=0,1,1,0,0,0,0,0,0,0,0,1,0 ///////////////////////////////////// - rc = myME310.gnss_nmea_extended_data_configuration(0,1,1,0,0,0,0,0,0,0,0,1,0); + rc = myME310.gnss_nmea_extended_data_configuration(0,1,1,0,0,0,0,0,0,0,0,1,0); if(rc == ME310::RETURN_VALID) { ///////////////////////////////////// @@ -180,7 +180,7 @@ void setup() { // AT$AGNSS=provider,status // :0 to disable // 1 to enable - ///////////////////////////////////// + ///////////////////////////////////// Serial.println("Set the AGNSS providers enable."); myME310.gnss_set_agnss_enable(0,1); @@ -202,7 +202,7 @@ void loop() { // Get Acquired Position // AT$GPSACP ///////////////////////////////////// - + rc = myME310.gps_get_acquired_position(); /*When the position is fixed, the led blinks*/ @@ -257,4 +257,4 @@ void loop() { exit(0); } count++; -} \ No newline at end of file +} diff --git a/examples/CLIP_example/CLIP_example.ino b/examples/CLIP_example/CLIP_example.ino index fa14ec9..eca083c 100644 --- a/examples/CLIP_example/CLIP_example.ino +++ b/examples/CLIP_example/CLIP_example.ino @@ -13,7 +13,9 @@ @details In this example sketch, the use of methods offered by the ME310 library for using AT commands is shown.\n The Calling line identify is enable and wait_for_unsolicited is call in loop part. The response is printed with buffer_cstr_raw.\n - To use this example is necessary a voice variant firmware and a SIM card that supports voice. + NOTE:\n + To use this example is necessary a voice variant firmware and a SIM card that supports voice.\n + For correct operation it is also necessary to set the right APN. @version 1.0.0 @@ -38,11 +40,11 @@ using namespace me310; /* - * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n + * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n * Please refer to your board configuration in variant.h file. * Example: * Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS); - * ME310 myME310 (Serial1); + * ME310 myME310 (Serial1); */ ME310 myME310; ME310::return_t rc; //Enum of return value methods @@ -56,7 +58,6 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/examples/CheckModule/CheckModule.ino b/examples/CheckModule/CheckModule.ino index e05359e..dfeccaf 100644 --- a/examples/CheckModule/CheckModule.ino +++ b/examples/CheckModule/CheckModule.ino @@ -13,7 +13,7 @@ @details In this example sketch, it is shown how to use a basic AT commands via ME310 library.\n - @version + @version 1.0.0 @note @@ -27,14 +27,14 @@ #include -/* +/* //sercom2 #define PIN_MODULE_RX 29 #define PIN_MODULE_TX 28 #define PAD_MODULE_TX UART_TX_PAD_0 #define PAD_MODULE_RX SERCOM_RX_PAD_1 #define PIN_MODULE_RTS 30 - #define PIN_MODULE_CTS 31 + #define PIN_MODULE_CTS 31 */ #ifndef ARDUINO_TELIT_SAMD_CHARLIE @@ -43,28 +43,39 @@ using namespace me310; /* - * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n + * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n * Please refer to your board configuration in variant.h file. * Example: * Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS); - * ME310 myME310 (Serial1); + * ME310 myME310 (Serial1); */ -ME310 myME310; +ME310 myME310; +bool ready = false; void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); myME310.begin(115200); delay(1000); myME310.powerOn(ON_OFF); + if(myME310.attention() == ME310::RETURN_VALID) + { + ready = true; + } } void loop() { - digitalWrite(LED_BUILTIN, HIGH); - delay(500); - digitalWrite(LED_BUILTIN, LOW); - delay(500); + if(ready) + { + digitalWrite(LED_BUILTIN, HIGH); + delay(500); + digitalWrite(LED_BUILTIN, LOW); + delay(500); + } + else + { + exit(0); + } } diff --git a/examples/FTP_example/FTP_example.ino b/examples/FTP_example/FTP_example.ino index 4a72910..faf2de2 100644 --- a/examples/FTP_example/FTP_example.ino +++ b/examples/FTP_example/FTP_example.ino @@ -12,6 +12,9 @@ @details In this example sketch, it is shown how to use FTP management, using ME310 library.\n + NOTE:\n + For correct operation it is necessary to set the correct APN, username and password. + @version 1.0.0 @@ -40,11 +43,11 @@ using namespace me310; /* - * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n + * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n * Please refer to your board configuration in variant.h file. * Example: * Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS); - * ME310 myME310 (Serial1); + * ME310 myME310 (Serial1); */ ME310 myME310; ME310::return_t rc; //Enum of return value methods @@ -57,7 +60,6 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); @@ -190,6 +192,6 @@ void loop() { Serial.println((String)"ERROR: " + myME310.return_string(rc)); } rc = myME310.ftp_close(); - Serial.println("The application has ended..."); + Serial.println("The application has ended..."); exit(0); } diff --git a/examples/GNSS_example/GNSS_example.ino b/examples/GNSS_example/GNSS_example.ino index 859ec83..b703307 100644 --- a/examples/GNSS_example/GNSS_example.ino +++ b/examples/GNSS_example/GNSS_example.ino @@ -14,22 +14,24 @@ In this example sketch, it is shown how to use GNSS management using ME310 library.\n GNSS configuration, GNSS controller power management, GNSS nmea configuration functions are shown.\n GPS positions are acquired and response is printed. + NOTE:\n + For the sketch to work correctly, GNSS should be tested in open sky conditions to allow a fix. The fix may take a few minutes. - @version + @version 1.0.0 - + @note @author Cristina Desogus - @date + @date 02/07/2021 */ #include -#include +#include /*When NMEA_DEBUG is 0 Unsolicited NMEA is disable*/ #define NMEA_DEBUG 0 @@ -40,11 +42,11 @@ using namespace me310; /* - * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n + * If a Telit-Board Charlie is not in use, the ME310 class needs the Uart Serial instance in the constructor, that will be used to communicate with the modem.\n * Please refer to your board configuration in variant.h file. * Example: * Uart Serial1(&sercom4, PIN_MODULE_RX, PIN_MODULE_TX, PAD_MODULE_RX, PAD_MODULE_TX, PIN_MODULE_RTS, PIN_MODULE_CTS); - * ME310 myME310 (Serial1); + * ME310 myME310 (Serial1); */ ME310 myME310; ME310::return_t rc; //Enum of return value methods @@ -54,7 +56,6 @@ int count = 0; void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); @@ -74,7 +75,7 @@ void setup() { /////////////////////////////////// myME310.report_mobile_equipment_error(2); //issue command AT+CMEE=2 and wait for answer or timeout - myME310.read_gnss_configuration(); //issue command AT$GPSCFG? + myME310.read_gnss_configuration(); //issue command AT$GPSCFG? Serial.println(myME310.buffer_cstr(1)); ///////////////////////////////////// @@ -92,7 +93,7 @@ void setup() { delay(5000); ///////////////////////////////////// - // Set constellations + // Set constellations // AT$GPSCFG=2,X // 0 : the constellation is selected automatically based on Mobile Country Code (MCC) of camped network // 1 : GPS+GLO @@ -121,8 +122,8 @@ void setup() { Serial.println(myME310.buffer_cstr(1)); } delay(5000); - - + + ///////////////////////////////////// // Set on/off GNSS controller // AT$GPSP= @@ -137,7 +138,7 @@ void setup() { // Set GNGSA, GLGSV and GNRMC as available sentence in the unsolicited NMEA sentences. // AT$GPSNMUNEX=0,1,1,0,0,0,0,0,0,0,0,1,0 ///////////////////////////////////// - rc = myME310.gnss_nmea_extended_data_configuration(0,1,1,0,0,0,0,0,0,0,0,1,0); + rc = myME310.gnss_nmea_extended_data_configuration(0,1,1,0,0,0,0,0,0,0,0,1,0); if(rc == ME310::RETURN_VALID) { ///////////////////////////////////// @@ -162,7 +163,7 @@ void loop() { // Get Acquired Position // AT$GPSACP ///////////////////////////////////// - + rc = myME310.gps_get_acquired_position(); /*When the position is fixed, the led blinks*/ @@ -181,10 +182,10 @@ void loop() { int len = tmp_pos.copy(valid_pos, ((len_pos2-1)-len_pos), len_pos+1); if(len > 2) { - digitalWrite(LED_BUILTIN, HIGH); + digitalWrite(LED_BUILTIN, HIGH); delay(6000); - digitalWrite(LED_BUILTIN, LOW); - delay(1000); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); } } } diff --git a/examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino b/examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino index 80ef9e4..64a0126 100644 --- a/examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino +++ b/examples/LWM2M_example/LWM2M_example_2G/LWM2M_example_2G.ino @@ -35,7 +35,7 @@ #include -#include "BMA400.h" +#include using namespace me310; float x = 0, y = 0, z = 0; const byte INTERRUPT = ACC_INT_1; @@ -62,12 +62,12 @@ void setup() { int rc; pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); - Serial.begin(115200); myME310.begin(115200); - delay(3000); + delay(1000); + myME310.powerOn(); + delay(5000); // issue command at#reboot myME310.module_reboot(); diff --git a/examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino b/examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino index 7b03242..193537c 100644 --- a/examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino +++ b/examples/LWM2M_example/LWM2M_example_4G/LWM2M_example_4G.ino @@ -35,7 +35,7 @@ #include -#include "BMA400.h" +#include using namespace me310; float x = 0, y = 0, z = 0; const byte INTERRUPT = ACC_INT_1; @@ -63,13 +63,13 @@ void setup() { int rc; pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); - delay(3000); - + delay(1000); + myME310.powerOn(); + delay(5000); // issue command at#reboot myME310.module_reboot(); diff --git a/examples/M2M_example/M2M_example.ino b/examples/M2M_example/M2M_example.ino index 6cec910..a245a90 100644 --- a/examples/M2M_example/M2M_example.ino +++ b/examples/M2M_example/M2M_example.ino @@ -52,8 +52,7 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); - + Serial.begin(115200); myME310.begin(115200); diff --git a/examples/ME310_AT_Test/ME310_AT_Test.ino b/examples/ME310_AT_Test/ME310_AT_Test.ino index e5a8095..0a89620 100644 --- a/examples/ME310_AT_Test/ME310_AT_Test.ino +++ b/examples/ME310_AT_Test/ME310_AT_Test.ino @@ -49,7 +49,6 @@ void print_buffer(ME310 &aME310, const char *term = "OK"); void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/examples/MQTT_example/MQTT_example.ino b/examples/MQTT_example/MQTT_example.ino index c1eb58c..864d0ca 100644 --- a/examples/MQTT_example/MQTT_example.ino +++ b/examples/MQTT_example/MQTT_example.ino @@ -13,7 +13,9 @@ @details In this example sketch, it is shown how to use MQTT management, using ME310 library.\n MQTT enable, MQTT configuration, MQTT connect, MQTT topic subscribe, MQTT publish, MQTT read - and MQTT disconnect methods are used and responses are printed.\ + and MQTT disconnect methods are used and responses are printed.\n + NOTE:\n + For the sketch to work properly, you need to set the correct APN, client_id, client_username, client_password. @version @@ -64,7 +66,6 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/examples/Ping_example/Ping_example.ino b/examples/Ping_example/Ping_example.ino index 18cb928..d3ecf1c 100644 --- a/examples/Ping_example/Ping_example.ino +++ b/examples/Ping_example/Ping_example.ino @@ -13,6 +13,8 @@ @details In this example sketch, the use of methods offered by the ME310 library for using AT commands is shown.\n The PDP context is defined, the registration status read, the context activated and finally the ping command is sent and the response printed.\n + NOTE:\n + For correct operation it is necessary to set the correct APN. @version @@ -57,7 +59,6 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/examples/Socket_example/Socket_example.ino b/examples/Socket_example/Socket_example.ino index ce74774..4180c50 100644 --- a/examples/Socket_example/Socket_example.ino +++ b/examples/Socket_example/Socket_example.ino @@ -12,6 +12,8 @@ @details In this example sketch, the use of sockets is shown through the commands offered by the ME310 library.\n + NOTE:\n + For correct operation it is necessary to set the correct APN. @version 1.0.0 @@ -57,7 +59,6 @@ void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/examples/TransparentBridge/TransparentBridge.ino b/examples/TransparentBridge/TransparentBridge.ino index b4a2959..894026f 100644 --- a/examples/TransparentBridge/TransparentBridge.ino +++ b/examples/TransparentBridge/TransparentBridge.ino @@ -11,9 +11,9 @@ Driver Library for ME310 Telit Modem @details - The library contains a single class that implements a C++ interface to all ME310 AT Commands. - It makes it easy to build Arduino applications that use the full power of ME310 module - + The library contains a single class that implements a C++ interface to all ME310 AT Commands.\n + It makes it easy to build Arduino applications that use the full power of ME310 module.\n + @version 1.0.0 @@ -47,7 +47,6 @@ ME310::return_t rc; //Enum of return value methods void setup() { pinMode(ON_OFF, OUTPUT); pinMode(LED_BUILTIN, OUTPUT); - digitalWrite(ON_OFF, LOW); Serial.begin(115200); myME310.begin(115200); diff --git a/library.properties b/library.properties index 081c826..121c59f 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ME310G1 -version=2.5.0 +version=2.6.0 author=Telit maintainer=Telit sentence=Allows communication with ME310G1 Telit module. diff --git a/src/ATCommandDataParsing.cpp b/src/ATCommandDataParsing.cpp index ebb094a..9b9010b 100644 --- a/src/ATCommandDataParsing.cpp +++ b/src/ATCommandDataParsing.cpp @@ -10,11 +10,11 @@ @details The class implements the data parsing function for AT command which need specific response.\n - It is possible obtain data payload + It is possible obtain data payload @version - 1.1.0 - + 1.2.1 + @note Dependencies: Arduino.h @@ -32,7 +32,7 @@ using namespace telitAT; //!\brief Class Constructor -/*! \details +/*! \details Calls findCommand to pars the command string and creates a specific parser class. /*! * \param str string to parse @@ -40,17 +40,25 @@ using namespace telitAT; ATCommandDataParsing::ATCommandDataParsing(const char* aCommand, const char* str, int flag, uint32_t option) { _str = (char* )str; + _buf = NULL; char* cmd; cmd = findCommand(aCommand); if(cmd == NULL && flag == -1) { _parser = nullptr; } - else + else { - if(flag != 0) + if(IS_BIT_SET(option, _M2MREAD_BIT)) { + _buf = (char*)str; _parser = new M2MReadParser(flag); + _parser->parse(_buf); + } + else if(IS_BIT_SET(option, _M2MWRITE_BIT)) + { + _parser = new GenericParser(); + _parser->parse(_str); } else { @@ -78,8 +86,9 @@ ATCommandDataParsing::ATCommandDataParsing(const char* aCommand, const char* str { _parser = new GenericParser(); } + _parser->parse(_str); } - _parser->parse(_str); + } } @@ -89,7 +98,7 @@ ATCommandDataParsing::ATCommandDataParsing(const char* aCommand, const char* str * \return payload string if parser class is different from null pointer otherwise return null. */ uint8_t * ATCommandDataParsing::extractedPayload() -{ +{ if(_parser == nullptr) { return NULL; @@ -99,7 +108,7 @@ uint8_t * ATCommandDataParsing::extractedPayload() //! \brief Implements the control to parser class exists /*! \details - + * \return true if parser class is different from null pointer otherwise return false. */ bool ATCommandDataParsing::parserIs() @@ -176,7 +185,7 @@ int ATCommandDataParsing::startPositionPayloadOffset() } //! \brief Implements the extraction of the command from the string /*! \details - Searches the string of command + Searches the string of command * \return command string if the format of string is right otherwise return null. */ char* ATCommandDataParsing::findCommand(const char* aCommand) @@ -184,7 +193,7 @@ char* ATCommandDataParsing::findCommand(const char* aCommand) string tmp_str; tmp_str = aCommand; memset(_command, 0, 64); - int len; + int len; std::size_t posColon = tmp_str.find_first_of("="); if(posColon != string::npos) { diff --git a/src/ATCommandDataParsing.h b/src/ATCommandDataParsing.h index 07bc3bd..7922cea 100644 --- a/src/ATCommandDataParsing.h +++ b/src/ATCommandDataParsing.h @@ -10,9 +10,9 @@ @details The class implements the data parsing function for AT command which need specific response.\n It is possible obtain data payload, receivedBytes - + @version - 1.2.0 + 1.2.1 @note Dependencies: @@ -40,7 +40,7 @@ using namespace telitAT; /*! \class ATCommandDataParsing \brief Implements the data parsing to AT command - \details + \details The class implements the data parsing function.\n */ class ATCommandDataParsing @@ -65,6 +65,7 @@ class ATCommandDataParsing int _exBytes; //!< Expected bytes int _recvBytes; //!< Received bytes string _str; + char* _buf; char _command[64]; //!< Array to command string Parser *_parser; //!< Pointer to class parser }; diff --git a/src/ME310.cpp b/src/ME310.cpp index f5ccca1..006271d 100644 --- a/src/ME310.cpp +++ b/src/ME310.cpp @@ -17,7 +17,7 @@ It makes it easy to build Arduino applications that use the full power of ME310 module @version - 2.4.0 + 2.6.0 @note @@ -5788,6 +5788,7 @@ This command stores a file in the file system. ME310::return_t ME310::m2m_write_file(const char *file_name, int size, int binToMod, char* data, tout_t aTimeout) { ME310::return_t ret; + SET_BIT_MASK(_option, _M2MWRITE_BIT); memset(mBuffer, 0, ME310_BUFFSIZE); if(ME310_BUFFSIZE-1 < size) { @@ -5808,9 +5809,10 @@ ME310::return_t ME310::m2m_write_file(const char *file_name, int size, int binTo { memset(mBuffer, 0, ME310_BUFFSIZE); memcpy(mBuffer, data, size); - ret = send_wait((char*)mBuffer, OK_STRING, TERMINATION_STRING, aTimeout); + ret = send_wait((char*)mBuffer, size, OK_STRING, NULL, aTimeout); } } + UNSET_BIT_MASK(_option, _M2MWRITE_BIT); return ret; } @@ -5838,6 +5840,7 @@ ME310::return_t ME310::m2m_list(tout_t aTimeout) { return m2m_list(".", aTimeout); } + //! \brief Implements the AT\#M2MREAD command and waits for OK answer /*! \details This command reports the content of a file stored in the File System. @@ -5847,16 +5850,23 @@ This command reports the content of a file stored in the File System. */ ME310::return_t ME310::m2m_read(const char *file_name, tout_t aTimeout) { + ME310::return_t ret; memset(mBuffer, 0, ME310_BUFFSIZE); PathParsing strPar((char*)file_name); m2m_list(strPar.getPath()); int fileSize = strPar.getFileSize((char*)buffer_cstr_raw()); + SET_BIT_MASK(_option, _M2MREAD_BIT); if(fileSize > ME310_BUFFSIZE-1) { - return RETURN_ERROR; + ret = RETURN_ERROR; + } + else + { + snprintf((char *)mBuffer, ME310_BUFFSIZE-1, F("AT#M2MREAD=\"%s\""), file_name); + ret = send_wait((char*)mBuffer, fileSize, OK_STRING, aTimeout); } - snprintf((char *)mBuffer, ME310_BUFFSIZE-1, F("AT#M2MREAD=\"%s\""), file_name); - return send_wait((char*)mBuffer, fileSize, OK_STRING, aTimeout); + UNSET_BIT_MASK(_option, _M2MREAD_BIT); + return ret; } //! \brief Implements the AT\#M2MRAM command and waits for OK answer @@ -6201,7 +6211,7 @@ ME310::return_t ME310::get_position_GTP_WWAN_service(tout_t aTimeout) return send_wait(F("AT#GTP"), OK_STRING, aTimeout); } -//! \brief Implements the AT$GPSACP command and waits for OK answer +//! \brief Implements the AT#GTPENA command and waits for OK answer /*! \details This command returns information about the last GPS position. * \param aTimeout timeout in ms @@ -6415,6 +6425,17 @@ void ME310::send(const char *aCommand, const char *aTerm) mSerial.write(aTerm); } +//! \brief Sends binary data to the ME310 serial +/*! + * \param data data buffer to be sent + * \param len amount of data to be written in bytes + */ +void ME310::send(const uint8_t* data, int len) +{ + on_command((char*)data); //callback + mSerial.write(data, len); +} + //! \brief Sends a read AT command and waits for answer or timeout /*! * \param aCommand command string to send @@ -6492,7 +6513,14 @@ ME310::return_t ME310::send_wait(const char *aCommand, int flag, const char *aA */ ME310::return_t ME310::send_wait(const char *aCommand, int flag, const char *aAnswer, const char* term, ME310::tout_t aTimeout) { - send(aCommand,term); // send with terminator + if(term) + { + send(aCommand,term); // send with terminator + } + else + { + send((uint8_t*) aCommand, flag); + } return wait_for(aCommand, flag, aAnswer, aTimeout); } @@ -6570,7 +6598,6 @@ return RETURN_TOUT; */ ME310::return_t ME310::wait_for(const char* aCommand, int flag, const char *aAnswer, ME310::tout_t aTimeout) { - /*TODO Check SRING SSLRING*/ char cmd[64]; strcpy(cmd, aCommand); ATCommandDataParsing* dataParsing; @@ -6589,7 +6616,7 @@ ME310::return_t ME310::wait_for(const char* aCommand, int flag, const char *aAns unsigned long timeout = 0; do { - if(mBuffLen != ME310_BUFFSIZE) + if(mBuffLen < ME310_BUFFSIZE) { int bytesRead = mSerial.readBytes(mpBuffer, ME310_BUFFSIZE-mBuffLen-1); if(bytesRead > 1) /* if full string add to buffer */ @@ -6597,7 +6624,7 @@ ME310::return_t ME310::wait_for(const char* aCommand, int flag, const char *aAns mpBuffer[bytesRead+1] = '\0'; bytesRead++; pBuffer = mpBuffer; - strcat(tmp_str, (char*)mpBuffer); + memcpy(tmp_str + mBuffLen, (char*)mpBuffer, bytesRead); mpBuffer += bytesRead; mBuffLen += bytesRead; rc = on_message((const char *)pBuffer); @@ -6633,6 +6660,7 @@ ME310::return_t ME310::wait_for(const char* aCommand, int flag, const char *aAns if(dataParsing->commandResponseResult()) { _payloadData = (uint8_t *) dataParsing->extractedPayload(); + if(str_equal(dataParsing->commandResponseString(), OK_STRING)) { rc = RETURN_VALID; @@ -6977,7 +7005,6 @@ This method converts buffer in IRA mode */ void ME310::ConvertBufferToIRA(uint8_t* recv_buf, uint8_t* out_buf, int size) { - /*TODO check out_buf len and return size*2*/ memset(out_buf, 0, (size*2)+1); for (unsigned int i = 0; i < size; i++) { diff --git a/src/ME310.h b/src/ME310.h index deab8e0..9563542 100644 --- a/src/ME310.h +++ b/src/ME310.h @@ -1,4 +1,4 @@ -/*Copyright (C) 2020 Telit Communications S.p.A. Italy - All Rights Reserved.*/ +/*Copyright (C) 2021 Telit Communications S.p.A. Italy - All Rights Reserved.*/ /* See LICENSE file in the project root for full license information. */ /** @@ -12,9 +12,9 @@ The library contains a single class that implements a C++ interface to all ME310 AT Commands. It makes it easy to build Arduino applications that use the full power of ME310 module - @version - 2.4.0 - + @version + 2.6.0 + @note Dependencies: Arduino.h @@ -54,15 +54,15 @@ namespace me310 Most functions have a read_function_name and/or a test_function_name that implements the ATcommand? and ATcommand=? respectively.\n These auxiliary function are generated with \_READ, \_TEST or \_READ_TEST macros.\n The generated functions have only the timeout as argument and return a return_t code.\n - + The strings returned by the modem are stored in the class memory buffer and can be requested using an index.\n - A null return value means end of string buffer.\n + A null return value means end of string buffer.\n */ class ME310 { public: - /*! \enum Return value + /*! \enum Return value \brief Enum of return value methods */ typedef enum { @@ -76,20 +76,20 @@ namespace me310 RETURN_ASYNC = -3 ///< Return Value for async call } return_t; - + /*! \enum Timeout \brief Timeout value in milliseconds */ - typedef enum + typedef enum { TOUT_0MS = 0, TOUT_100MS = 100, TOUT_200MS = 200, TOUT_300MS = 300, TOUT_400MS = 400, TOUT_500MS = 500, TOUT_600MS = 600, TOUT_700MS = 700, TOUT_800MS = 800, TOUT_900MS = 900, TOUT_1SEC = 1000, TOUT_2SEC = 2000, TOUT_3SEC = 3000, TOUT_4SEC = 4000, TOUT_5SEC = 5000, TOUT_6SEC = 6000, TOUT_7SEC = 7000, TOUT_8SEC = 8000, TOUT_9SEC = 9000, - TOUT_10SEC = 10000, TOUT_20SEC = 20000, TOUT_30SEC = 30000, TOUT_45SEC = 45000, + TOUT_10SEC = 10000, TOUT_20SEC = 20000, TOUT_30SEC = 30000, TOUT_45SEC = 45000, TOUT_1MIN = 60000, TOUT_2MIN = 120000 } tout_t; - + #ifdef ARDUINO_TELIT_SAMD_CHARLIE ME310(Uart &aSerial = SerialModule); #else @@ -97,7 +97,7 @@ namespace me310 #endif ~ME310(); - + #ifdef ARDUINO_TELIT_SAMD_CHARLIE void powerOn(unsigned int onoff_gpio = ON_OFF); #else @@ -106,15 +106,15 @@ namespace me310 void begin(unsigned long baudRate); void end(); - - // Command Line Prefixes ------------------------------------------------------- + + // Command Line Prefixes ------------------------------------------------------- return_t attention(tout_t aTimeout = TOUT_100MS); return_t repeat_last_auto(tout_t aTimeout = TOUT_100MS); return_t repeat_last(tout_t aTimeout = TOUT_100MS); // Generic Modem Control ------------------------------------------------------- return_t select_interface_style(int value = 2,tout_t aTimeout = TOUT_100MS); - _READ_TEST(select_interface_style,"AT#SELINT",TOUT_100MS) + _READ_TEST(select_interface_style,"AT#SELINT",TOUT_100MS) return_t set_factory_config(int value = 0,tout_t aTimeout = TOUT_100MS); return_t soft_reset(int value = 0,tout_t aTimeout = TOUT_100MS); @@ -123,48 +123,48 @@ namespace me310 return_t store_current_configuration(int value = 0,tout_t aTimeout = TOUT_100MS); return_t display_internal_phonebook_number(int value = 0,tout_t aTimeout = TOUT_100MS); return_t extended_reset(int value = 0,tout_t aTimeout = TOUT_100MS); - _TEST(extended_reset,"AT#Z",TOUT_100MS) - + _TEST(extended_reset,"AT#Z",TOUT_100MS) + return_t display_config_profile(tout_t aTimeout = TOUT_100MS); /*return_t country_installation(int value = 59,tout_t aTimeout = TOUT_100MS); _READ_TEST(country_installation,"AT+CGI",TOUT_100MS) */ return_t capabilities_list(tout_t aTimeout = TOUT_100MS); - _TEST(capabilities_list,"AT+GCAP",TOUT_100MS) - + _TEST(capabilities_list,"AT+GCAP",TOUT_100MS) + return_t manufacturer_identification(tout_t aTimeout = TOUT_100MS); - _TEST(manufacturer_identification,"AT+GMI",TOUT_100MS) - + _TEST(manufacturer_identification,"AT+GMI",TOUT_100MS) + return_t model_identification(tout_t aTimeout = TOUT_100MS); - _TEST(model_identification,"AT+GMM",TOUT_100MS) - + _TEST(model_identification,"AT+GMM",TOUT_100MS) + return_t revision_identification(tout_t aTimeout = TOUT_100MS); - _TEST(revision_identification,"AT+GMR",TOUT_100MS) - + _TEST(revision_identification,"AT+GMR",TOUT_100MS) + return_t serial_number(tout_t aTimeout = TOUT_100MS); - _TEST(serial_number,"AT+GSN",TOUT_100MS) - + _TEST(serial_number,"AT+GSN",TOUT_100MS) + return_t request_manufacturer_identification(tout_t aTimeout = TOUT_100MS); - _TEST(request_manufacturer_identification,"AT+CGMI",TOUT_100MS) - + _TEST(request_manufacturer_identification,"AT+CGMI",TOUT_100MS) + return_t request_model_identification(tout_t aTimeout = TOUT_100MS); - _TEST(request_model_identification,"AT+CGMM",TOUT_100MS) - + _TEST(request_model_identification,"AT+CGMM",TOUT_100MS) + return_t request_revision_identification(tout_t aTimeout = TOUT_100MS); - _TEST(request_revision_identification,"AT+CGMR",TOUT_100MS) - + _TEST(request_revision_identification,"AT+CGMR",TOUT_100MS) + return_t request_psn_identification(tout_t aTimeout = TOUT_100MS); - _TEST(request_psn_identification,"AT+CGSN",TOUT_100MS) + _TEST(request_psn_identification,"AT+CGSN",TOUT_100MS) return_t request_manufacturer_identification_echo(tout_t aTimeout = TOUT_100MS); - _TEST(request_manufacturer_identification_echo,"AT#CGMI",TOUT_100MS) - + _TEST(request_manufacturer_identification_echo,"AT#CGMI",TOUT_100MS) + return_t request_revision_identification_echo(tout_t aTimeout = TOUT_100MS); - _TEST(request_revision_identification_echo,"AT#CGMR",TOUT_100MS) - + _TEST(request_revision_identification_echo,"AT#CGMR",TOUT_100MS) + return_t request_psn_identification_echo(tout_t aTimeout = TOUT_100MS); - _TEST(request_psn_identification_echo,"AT#CGSN",TOUT_100MS) + _TEST(request_psn_identification_echo,"AT#CGSN",TOUT_100MS) return_t request_product_code(tout_t aTimeout = TOUT_100MS); _TEST(request_product_code,"AT#CGMF",TOUT_100MS) @@ -188,47 +188,47 @@ namespace me310 _TEST(mailbox_numbers,"AT#MBN",TOUT_100MS) return_t message_waiting_indication(int enable = 1, tout_t aTimeout = TOUT_100MS); - _READ_TEST(message_waiting_indication,"AT#MWI",TOUT_100MS) + _READ_TEST(message_waiting_indication,"AT#MWI",TOUT_100MS) return_t available_at_commands(tout_t aTimeout = TOUT_100MS); - _TEST(available_at_commands,"AT+CLAC",TOUT_100MS) + _TEST(available_at_commands,"AT+CLAC",TOUT_100MS) return_t select_language(const char * lan = "en", tout_t aTimeout = TOUT_100MS); - _READ_TEST(select_language,"AT#LANG",TOUT_100MS) + _READ_TEST(select_language,"AT#LANG",TOUT_100MS) return_t report_mobile_equipment_error(int n = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(report_mobile_equipment_error,"AT+CMEE",TOUT_100MS) + _READ_TEST(report_mobile_equipment_error,"AT+CMEE",TOUT_100MS) return_t extended_numeric_error_report(tout_t aTimeout = TOUT_100MS); - _TEST(extended_numeric_error_report,"AT#CEER",TOUT_100MS) - + _TEST(extended_numeric_error_report,"AT#CEER",TOUT_100MS) + return_t power_saving_mode_ring_indicator(int n = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(power_saving_mode_ring_indicator,"AT#PSMRI",TOUT_100MS) + _READ_TEST(power_saving_mode_ring_indicator,"AT#PSMRI",TOUT_100MS) return_t select_te_character_set(const char* chset = "IRA", tout_t aTimeout = TOUT_100MS); - _READ_TEST(select_te_character_set,"AT+CSCS",TOUT_100MS) + _READ_TEST(select_te_character_set,"AT+CSCS",TOUT_100MS) return_t multiplexing_mode(int mode = 0, int subset = 0, int port_speed = 5, int n1 = 31, int t1=10, int n2=3, int t2=30, int t3 = 10, int k=2, tout_t aTimeout = TOUT_100MS); - _READ_TEST(multiplexing_mode,"AT+CMUX",TOUT_100MS) + _READ_TEST(multiplexing_mode,"AT+CMUX",TOUT_100MS) return_t usb_configuration(int mode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(usb_configuration,"AT#USBCFG",TOUT_100MS) + _READ_TEST(usb_configuration,"AT#USBCFG",TOUT_100MS) return_t connect_physycal_port_sap(int variant = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(connect_physycal_port_sap,"AT#PORTCFG",TOUT_100MS) + _READ_TEST(connect_physycal_port_sap,"AT#PORTCFG",TOUT_100MS) return_t at_command_delay(int delay = 0, tout_t aTimeout = TOUT_100MS); - _TEST(at_command_delay,"AT#ATDELAY",TOUT_100MS) + _TEST(at_command_delay,"AT#ATDELAY",TOUT_100MS) return_t store_telephone_number(int n = 0, const char *nr = "", tout_t aTimeout = TOUT_100MS); return_t display_last_connection_statistics(tout_t aTimeout = TOUT_100MS); return_t request_imei_software_version(tout_t aTimeout = TOUT_100MS); - _TEST(request_imei_software_version,"AT+IMEISV",TOUT_100MS) + _TEST(request_imei_software_version,"AT+IMEISV",TOUT_100MS) return_t request_model_identification_echo(tout_t aTimeout = TOUT_100MS); - _TEST(request_model_identification_echo,"AT#CGMM",TOUT_100MS) + _TEST(request_model_identification_echo,"AT#CGMM",TOUT_100MS) return_t display_current_configuration_profile(tout_t aTimeout = TOUT_100MS); @@ -236,41 +236,41 @@ namespace me310 _READ_TEST(set_active_firmware_image, "AT#FWSWITCH", TOUT_100MS) return_t ims_pdp_apn_number_set(const char* pdpApnName, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ims_pdp_apn_number_set,"AT#IMSPDPSET",TOUT_100MS) + _READ_TEST(ims_pdp_apn_number_set,"AT#IMSPDPSET",TOUT_100MS) return_t request_telit_id(tout_t aTimeout = TOUT_100MS); - _TEST(request_telit_id,"AT#TID",TOUT_100MS) - + _TEST(request_telit_id,"AT#TID",TOUT_100MS) + // S Parameters ---------------------------------------------------------------- return_t number_rings_auto_answer(int n, tout_t aTimeout = TOUT_100MS); - _READ(number_rings_auto_answer,"ATS0",TOUT_100MS) - + _READ(number_rings_auto_answer,"ATS0",TOUT_100MS) + return_t ring_counter(tout_t aTimeout = TOUT_100MS); - _READ(ring_counter,"ATS1",TOUT_100MS) + _READ(ring_counter,"ATS1",TOUT_100MS) return_t escape_character(int chr = 43, tout_t aTimeout = TOUT_100MS); - _READ(escape_character,"ATS2",TOUT_100MS) + _READ(escape_character,"ATS2",TOUT_100MS) return_t command_line_terminator_character(int chr = 13, tout_t aTimeout = TOUT_100MS); - _READ(command_line_terminator_character,"ATS3",TOUT_100MS) + _READ(command_line_terminator_character,"ATS3",TOUT_100MS) return_t response_formatting_character(int chr = 10, tout_t aTimeout = TOUT_100MS); - _READ(response_formatting_character,"ATS4",TOUT_100MS) + _READ(response_formatting_character,"ATS4",TOUT_100MS) return_t command_line_editing_character(int chr = 8, tout_t aTimeout = TOUT_100MS); - _READ(command_line_editing_character,"ATS5",TOUT_100MS) + _READ(command_line_editing_character,"ATS5",TOUT_100MS) return_t connection_completed_timeout(int tout = 60, tout_t aTimeout = TOUT_100MS); - _READ(connection_completed_timeout,"ATS7",TOUT_100MS) + _READ(connection_completed_timeout,"ATS7",TOUT_100MS) return_t escaper_prompt_delay(int time = 50, tout_t aTimeout = TOUT_100MS); - _READ(escaper_prompt_delay,"ATS12",TOUT_100MS) + _READ(escaper_prompt_delay,"ATS12",TOUT_100MS) return_t delay_dtr_off(int time = 5, tout_t aTimeout = TOUT_100MS); - _READ(delay_dtr_off,"ATS25",TOUT_100MS) + _READ(delay_dtr_off,"ATS25",TOUT_100MS) return_t s_registers_display(tout_t aTimeout = TOUT_100MS); - + return_t carrier_off_firm_time(int n , tout_t aTimeout = TOUT_100MS); return_t extended_s_registers_display(tout_t aTimeout = TOUT_100MS); @@ -285,22 +285,22 @@ namespace me310 return_t data_terminal_ready_control(int n = 0, tout_t aTimeout = TOUT_100MS); return_t flow_control(int n = 3, tout_t aTimeout = TOUT_100MS); return_t data_set_ready_control(int n = 3, tout_t aTimeout = TOUT_100MS); - + return_t uart_dce_interface_speed(int rate = 115200, tout_t aTimeout = TOUT_100MS); - _READ_TEST(uart_dce_interface_speed,"AT+IPR",TOUT_100MS) + _READ_TEST(uart_dce_interface_speed,"AT+IPR",TOUT_100MS) return_t dte_modem_local_control_flow(int byDTE = 2, int byDCE = 2, tout_t aTimeout = TOUT_100MS); - _READ_TEST(dte_modem_local_control_flow,"AT+IFC",TOUT_100MS) + _READ_TEST(dte_modem_local_control_flow,"AT+IFC",TOUT_100MS) return_t dte_modem_character_framing(int format = 3, int parity = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(dte_modem_character_framing,"AT+ICF",TOUT_100MS) + _READ_TEST(dte_modem_character_framing,"AT+ICF",TOUT_100MS) return_t skip_escape_sequence(int mode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(skip_escape_sequence,"AT#SKIPESC",TOUT_100MS) - + _READ_TEST(skip_escape_sequence,"AT#SKIPESC",TOUT_100MS) + return_t escape_sequence_guard_time(int gt = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(escape_sequence_guard_time,"AT#E2ESC",TOUT_100MS) - + _READ_TEST(escape_sequence_guard_time,"AT#E2ESC",TOUT_100MS) + return_t extended_result_codes(int n = 1, tout_t aTimeout = TOUT_100MS); // Call Control ---------------------------------------------------------------- @@ -316,24 +316,24 @@ namespace me310 // Network --------------------------------------------------------------------- return_t subscriber_number(tout_t aTimeout = TOUT_100MS); - _TEST(subscriber_number,"AT+CNUM",TOUT_100MS) + _TEST(subscriber_number,"AT+CNUM",TOUT_100MS) return_t read_operator_names(tout_t aTimeout = TOUT_100MS); - _TEST(read_operator_names,"AT+COPN",TOUT_100MS) + _TEST(read_operator_names,"AT+COPN",TOUT_100MS) return_t network_registration_status(int mode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(network_registration_status,"AT+CREG",TOUT_100MS) - + _READ_TEST(network_registration_status,"AT+CREG",TOUT_100MS) + return_t operator_selection(int mode = 0, tout_t aTimeout = TOUT_100MS); return_t operator_selection(int mode, int format, const char *oper, int act, tout_t aTimeout = TOUT_100MS); return_t operator_selection(int mode, int format, int oper, int act, tout_t aTimeout = TOUT_100MS); - _READ_TEST(operator_selection,"AT+COPS",TOUT_100MS) + _READ_TEST(operator_selection,"AT+COPS",TOUT_20SEC) return_t facility_lock_unlock(const char * fac, int mode, const char *password, int classType, tout_t aTimeout = TOUT_100MS); return_t facility_lock_unlock(const char * fac, int mode, tout_t aTimeout = TOUT_100MS); return_t facility_lock_unlock(const char * fac, int mode, const char *password, tout_t aTimeout = TOUT_100MS); _TEST(facility_lock_unlock,"AT+CLCK",TOUT_100MS) - + return_t change_facility_password(const char * fac, const char *old_password, const char *new_password, tout_t aTimeout = TOUT_100MS); _TEST(change_facility_password,"AT+CPWD",TOUT_100MS) @@ -348,10 +348,10 @@ namespace me310 _READ_TEST(selection_preferred_plmn_list,"AT+CPLS",TOUT_100MS) return_t signal_quality(tout_t aTimeout = TOUT_100MS); - _TEST(signal_quality,"AT+CSQ",TOUT_100MS) - + _TEST(signal_quality,"AT+CSQ",TOUT_100MS) + return_t serving_cell_information(tout_t aTimeout = TOUT_100MS); - _TEST(serving_cell_information,"AT#SERVINFO",TOUT_100MS) + _TEST(serving_cell_information,"AT#SERVINFO",TOUT_100MS) return_t lock_to_single_BCCH_ARFCN(int lockedBcch = 1024, int lockedUarfcn = 0, int lockedPsc = 65535, int lockedEarfcn = 0, const char *lockedPci = "FFFF" , tout_t aTimeout = TOUT_100MS); _READ_TEST(lock_to_single_BCCH_ARFCN, "AT#BCCHLOCK", TOUT_100MS) @@ -364,10 +364,10 @@ namespace me310 return_t plmn_list_selection(int mode = 1, tout_t aTimeout = TOUT_100MS); _READ_TEST(plmn_list_selection,"AT#PLMNMODE",TOUT_100MS) - + return_t select_band(int band, int umts_band, int lte_band, int tdscdma_band, int lte_band_over_64, tout_t aTimeout = TOUT_100MS); _READ_TEST(select_band,"AT#BND",TOUT_100MS) - + return_t automatic_band_selection(int value = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(automatic_band_selection,"AT#AUTOBND",TOUT_100MS) @@ -375,8 +375,8 @@ namespace me310 _TEST(SET_subscriber_number,"AT#SNUM",TOUT_100MS) return_t extended_numeric_error_report_net(tout_t aTimeout = TOUT_100MS); - _TEST(extended_numeric_error_report_net,"AT#CEERNET",TOUT_100MS) - + _TEST(extended_numeric_error_report_net,"AT#CEERNET",TOUT_100MS) + return_t extended_error_report_network_reject_cause(int func = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(extended_error_report_network_reject_cause,"AT#CEERNETEXT",TOUT_100MS) @@ -393,8 +393,8 @@ namespace me310 _READ_TEST(set_mode_operation_eps,"AT+CEMODE",TOUT_100MS) return_t extended_signal_quality(tout_t aTimeout = TOUT_100MS); - _TEST(extended_signal_quality,"AT+CESQ",TOUT_100MS) - + _TEST(extended_signal_quality,"AT+CESQ",TOUT_100MS) + return_t enhanced_network_selection(int mode = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(enhanced_network_selection,"AT#ENS",TOUT_100MS) @@ -412,17 +412,17 @@ namespace me310 _READ_TEST(select_iot_technology,"AT#WS46",TOUT_100MS) return_t edrx_read_dynamic_parameters(tout_t aTimeout = TOUT_100MS); - _TEST(edrx_read_dynamic_parameters,"AT+CEDRXRDP",TOUT_100MS) - + _TEST(edrx_read_dynamic_parameters,"AT+CEDRXRDP",TOUT_100MS) + return_t eps_network_registration_status(int mode , tout_t aTimeout = TOUT_100MS); - _READ_TEST(eps_network_registration_status,"AT+CEREG",TOUT_100MS) - + _READ_TEST(eps_network_registration_status,"AT+CEREG",TOUT_100MS) + return_t read_current_network_status(tout_t aTimeout = TOUT_100MS); - _TEST(read_current_network_status,"AT#RFSTS",TOUT_100MS) - + _TEST(read_current_network_status,"AT#RFSTS",TOUT_100MS) + return_t read_sim_field_spn(tout_t aTimeout = TOUT_100MS); - _TEST(read_sim_field_spn,"AT#SPN",TOUT_100MS) - + _TEST(read_sim_field_spn,"AT#SPN",TOUT_100MS) + return_t extended_edrx_settings(int mode = 0, int acttype = 2, const char *req_edrx = "0000", const char *reqpagetimewindow = "0000", tout_t aTimeout = TOUT_100MS); _READ_TEST(extended_edrx_settings,"AT#CEDRXS",TOUT_100MS) @@ -438,7 +438,7 @@ namespace me310 return_t catm1_nbiot_band_setting(int m1_band_1_64, int m1_band_65_128, int nb1_band_1_64, int nb1_band_65_128 , tout_t aTimeout = TOUT_100MS); return_t catm1_nbiot_band_setting(tout_t aTimeout = TOUT_100MS); _READ_TEST(catm1_nbiot_band_setting,"AT#IOTBND",TOUT_100MS) - + return_t inter_RAT_timer_setting(int irat_timer = 60, int search_alignment = 20, tout_t aTimeout = TOUT_100MS); _READ_TEST(inter_RAT_timer_setting, "AT#IRATTIMER", TOUT_100MS) @@ -446,55 +446,55 @@ namespace me310 _READ_TEST(enable_NB2_mode, "AT#NB2ENA", TOUT_100MS) // SIM ------------------------------------------------------------------------- - + return_t enter_pin(const char* pin,tout_t aTimeout = TOUT_100MS); return_t enter_pin(const char* pin,const char* newpin, tout_t aTimeout = TOUT_100MS); - _READ_TEST(enter_pin,"AT+CPIN",TOUT_100MS) + _READ_TEST(enter_pin,"AT+CPIN",TOUT_100MS) return_t display_pin_counter(tout_t aTimeout = TOUT_100MS); - _TEST(display_pin_counter,"AT#PCT",TOUT_100MS) - + _TEST(display_pin_counter,"AT#PCT",TOUT_100MS) + return_t read_iccid(tout_t aTimeout = TOUT_100MS); - _TEST(read_iccid,"AT+CCID",TOUT_100MS) + _TEST(read_iccid,"AT+CCID",TOUT_100MS) return_t imsi(tout_t aTimeout = TOUT_100MS); - _TEST(imsi,"AT+CIMI",TOUT_100MS) + _TEST(imsi,"AT+CIMI",TOUT_100MS) return_t imsi_echo(tout_t aTimeout = TOUT_100MS); - _TEST(imsi_echo,"AT#CIMI",TOUT_100MS) + _TEST(imsi_echo,"AT#CIMI",TOUT_100MS) return_t sim_detection_mode(int mode = 2,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sim_detection_mode,"AT#SIMDET",TOUT_100MS) + _READ_TEST(sim_detection_mode,"AT#SIMDET",TOUT_100MS) return_t sim_presence_status(int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sim_presence_status,"AT#SIMPR",TOUT_100MS) + _READ_TEST(sim_presence_status,"AT#SIMPR",TOUT_100MS) return_t read_iccid_1(tout_t aTimeout = TOUT_100MS); - _TEST(read_iccid_1,"AT#CCID",TOUT_100MS) + _TEST(read_iccid_1,"AT#CCID",TOUT_100MS) return_t query_sim_status(int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(query_sim_status,"AT#QSS",TOUT_100MS) + _READ_TEST(query_sim_status,"AT#QSS",TOUT_100MS) return_t restricted_sim_access(int command, int field, int p1, int p2, int p3, const char *data, tout_t aTimeout = TOUT_100MS); - _TEST(restricted_sim_access,"AT+CRSM",TOUT_100MS) + _TEST(restricted_sim_access,"AT+CRSM",TOUT_100MS) return_t generic_sim_access(int length, const char *command, tout_t aTimeout = TOUT_100MS); - _TEST(generic_sim_access,"AT+CSIM",TOUT_100MS) + _TEST(generic_sim_access,"AT+CSIM",TOUT_100MS) return_t open_logical_channel(const char * dfname, tout_t aTimeout = TOUT_100MS); - _TEST(open_logical_channel,"AT+CCHO",TOUT_100MS) + _TEST(open_logical_channel,"AT+CCHO",TOUT_100MS) return_t close_logical_channel(int sessionid, tout_t aTimeout = TOUT_100MS); - _TEST(close_logical_channel,"AT+CCHC",TOUT_100MS) + _TEST(close_logical_channel,"AT+CCHC",TOUT_100MS) return_t generic_uicc_logical_channell_access(int sessionid, int length, const char *command,tout_t aTimeout = TOUT_100MS); - _TEST(generic_uicc_logical_channell_access,"AT+CGLA",TOUT_100MS) + _TEST(generic_uicc_logical_channell_access,"AT+CGLA",TOUT_100MS) return_t read_iccid_2(tout_t aTimeout = TOUT_100MS); _TEST(read_iccid_2, "AT+ICCID", TOUT_100MS) return_t simin_pin_configuration(int gpiopin, int simindetmode, tout_t aTimeout = TOUT_100MS); - _READ_TEST(simin_pin_configuration,"AT#SIMINCFG",TOUT_100MS) + _READ_TEST(simin_pin_configuration,"AT#SIMINCFG",TOUT_100MS) return_t automatic_switch_firmware(int mode = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(automatic_switch_firmware, "AT#FWAUTOSIM", TOUT_100MS) @@ -502,155 +502,155 @@ namespace me310 // SIM Toolkit ----------------------------------------------------------------- return_t simtoolkit_interface_action(int mode = 1, int timeout = 2, tout_t aTimeout = TOUT_100MS); - _READ_TEST(simtoolkit_interface_action,"AT#STIA",TOUT_100MS) + _READ_TEST(simtoolkit_interface_action,"AT#STIA",TOUT_100MS) return_t simtoolkit_get_information(int cmdType, tout_t aTimeout = TOUT_100MS); - _READ_TEST(simtoolkit_get_information,"AT#STGI",TOUT_100MS) + _READ_TEST(simtoolkit_get_information,"AT#STGI",TOUT_100MS) return_t simtoolkit_send_response(int cmdType, int userAction, const char *data, tout_t aTimeout = TOUT_100MS); - _READ_TEST(simtoolkit_send_response,"AT#STSR",TOUT_100MS) + _READ_TEST(simtoolkit_send_response,"AT#STSR",TOUT_100MS) // SMS & CB -------------------------------------------------------------------- return_t select_messaging_service(int service = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(select_messaging_service,"AT+CSMS",TOUT_100MS) + _READ_TEST(select_messaging_service,"AT+CSMS",TOUT_100MS) return_t preferred_message_storage(const char * memr = "SE", const char *memw = "SM", const char *mems = "SM", tout_t aTimeout = TOUT_100MS); - _READ_TEST(preferred_message_storage,"AT+CPMS",TOUT_100MS) + _READ_TEST(preferred_message_storage,"AT+CPMS",TOUT_100MS) return_t message_format(int mode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(message_format,"AT+CMGF",TOUT_100MS) + _READ_TEST(message_format,"AT+CMGF",TOUT_100MS) return_t service_center_address(const char *number, int type = 145, tout_t aTimeout = TOUT_100MS); - _READ_TEST(service_center_address,"AT+CSCA",TOUT_100MS) + _READ_TEST(service_center_address,"AT+CSCA",TOUT_100MS) return_t set_text_mode_parameters(int fo, const char *vp, int pid, int dcs, tout_t aTimeout = TOUT_100MS); return_t set_text_mode_parameters(int fo, int vp, int pid, int dcs, tout_t aTimeout = TOUT_100MS); - _READ_TEST(set_text_mode_parameters,"AT+CSMP",TOUT_100MS) + _READ_TEST(set_text_mode_parameters,"AT+CSMP",TOUT_100MS) return_t show_text_mode_parameters(int show = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(show_text_mode_parameters,"AT+CSDH",TOUT_100MS) + _READ_TEST(show_text_mode_parameters,"AT+CSDH",TOUT_100MS) return_t save_settings(int profile = 0, tout_t aTimeout = TOUT_100MS); - _TEST(save_settings,"AT+CSAS",TOUT_100MS) + _TEST(save_settings,"AT+CSAS",TOUT_100MS) return_t restore_settings(int profile = 0, tout_t aTimeout = TOUT_100MS); - _TEST(restore_settings,"AT+CRES",TOUT_100MS) + _TEST(restore_settings,"AT+CRES",TOUT_100MS) return_t more_message_send(int n = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(more_message_send,"AT+CMMS",TOUT_100MS) + _READ_TEST(more_message_send,"AT+CMMS",TOUT_100MS) return_t new_message_indications_TE(int mode = 0, int mt = 0, int bm = 0, int ds= 0, int bfr = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(new_message_indications_TE,"AT+CNMI",TOUT_100MS) + _READ_TEST(new_message_indications_TE,"AT+CNMI",TOUT_100MS) return_t new_message_ack(int n, int length, tout_t aTimeout = TOUT_100MS); return_t new_message_ack(tout_t aTimeout = TOUT_100MS); - _READ_TEST(new_message_ack,"AT+CNMA",TOUT_100MS) + _READ_TEST(new_message_ack,"AT+CNMA",TOUT_100MS) return_t list_messages(int stat, tout_t aTimeout = TOUT_100MS); return_t list_messages(const char *stat, tout_t aTimeout = TOUT_100MS); return_t list_messages(tout_t aTimeout = TOUT_100MS); - _TEST(list_messages,"AT+CMGL",TOUT_100MS) + _TEST(list_messages,"AT+CMGL",TOUT_100MS) return_t read_message(int index, tout_t aTimeout = TOUT_100MS); - _TEST(read_message,"AT+CMGR",TOUT_100MS) - + _TEST(read_message,"AT+CMGR",TOUT_100MS) + return_t send_short_message(int length, char* data, tout_t aTimeout = TOUT_100MS); return_t send_short_message(const char *da, const char *toda, char* data, tout_t aTimeout = TOUT_100MS); - _TEST(send_short_message,"AT+CMGS",TOUT_100MS) - + _TEST(send_short_message,"AT+CMGS",TOUT_100MS) + return_t send_message_from_storage(const char *index, const char *da, const char *toda,tout_t aTimeout = TOUT_100MS); - _TEST(send_message_from_storage,"AT+CMSS",TOUT_100MS) - + _TEST(send_message_from_storage,"AT+CMSS",TOUT_100MS) + return_t write_short_message_memory(int length, int stat, char *data, tout_t aTimeout = TOUT_100MS); return_t write_short_message_memory(const char *da, int toda, const char *stat, char *data, tout_t aTimeout = TOUT_100MS); - _TEST(write_short_message_memory,"AT+CMGW",TOUT_100MS) - + _TEST(write_short_message_memory,"AT+CMGW",TOUT_100MS) + return_t delete_message(int index, int delflag = 0,tout_t aTimeout = TOUT_100MS); - _TEST(delete_message,"AT+CMGD",TOUT_100MS) + _TEST(delete_message,"AT+CMGD",TOUT_100MS) return_t select_service_mo_sms(int service = 1,tout_t aTimeout = TOUT_100MS); - _READ_TEST(select_service_mo_sms,"AT+CGSMS",TOUT_100MS) + _READ_TEST(select_service_mo_sms,"AT+CGSMS",TOUT_100MS) return_t sms_commands_operation_mode(int mode = 1,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sms_commands_operation_mode,"AT#SMSMODE",TOUT_100MS) + _READ_TEST(sms_commands_operation_mode,"AT#SMSMODE",TOUT_100MS) return_t report_concatenated_sms_indexes(tout_t aTimeout = TOUT_100MS); - _TEST(report_concatenated_sms_indexes,"AT#CMGLCONCINDEX",TOUT_100MS) + _TEST(report_concatenated_sms_indexes,"AT#CMGLCONCINDEX",TOUT_100MS) return_t sms_ring_indicator(int n = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sms_ring_indicator,"AT#E2SMSRI",TOUT_100MS) + _READ_TEST(sms_ring_indicator,"AT#E2SMSRI",TOUT_100MS) return_t sms_overflow(int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sms_overflow,"AT#SMOV",TOUT_100MS) + _READ_TEST(sms_overflow,"AT#SMOV",TOUT_100MS) return_t sms_move(int index = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(sms_move,"AT#SMSMOVE",TOUT_100MS) + _READ_TEST(sms_move,"AT#SMSMOVE",TOUT_100MS) // Phonebook ------------------------------------------------------------------- - + return_t phonebook_select_memory_storage(const char *storage, const char *password, tout_t aTimeout = TOUT_100MS); return_t phonebook_select_memory_storage(const char *storage,tout_t aTimeout = TOUT_100MS); - _READ_TEST(phonebook_select_memory_storage,"AT+CPBS",TOUT_100MS) - + _READ_TEST(phonebook_select_memory_storage,"AT+CPBS",TOUT_100MS) + return_t phonebook_read_entries( int index1, int index2, tout_t aTimeout = TOUT_100MS); return_t phonebook_read_entries( int index1, tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_read_entries,"AT+CPBR",TOUT_100MS) - + _TEST(phonebook_read_entries,"AT+CPBR",TOUT_100MS) + return_t phonebook_find_entries(const char *findtext, tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_find_entries,"AT+CPBF",TOUT_100MS) - + _TEST(phonebook_find_entries,"AT+CPBF",TOUT_100MS) + return_t phonebook_write_entry(int index, const char *number, int type, const char *text, const char *group, const char * adnumber, int adtype, const char *secondtext, const char * email, int hidden, tout_t aTimeout = TOUT_100MS); return_t phonebook_write_entry(int index, const char *number, int type, const char *text, const char *group, tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_write_entry,"AT+CPBW",TOUT_100MS) - + _TEST(phonebook_write_entry,"AT+CPBW",TOUT_100MS) + return_t phonebook_read_group_entries( int indexFirst, int indexLast, tout_t aTimeout = TOUT_100MS); return_t phonebook_read_group_entries( int index, tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_read_group_entries,"AT#CPBGR",TOUT_100MS) - + _TEST(phonebook_read_group_entries,"AT#CPBGR",TOUT_100MS) + return_t phonebook_write_group_entry( int index, const char *text, tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_write_group_entry,"AT#CPBGW",TOUT_100MS) + _TEST(phonebook_write_group_entry,"AT#CPBGW",TOUT_100MS) return_t phonebook_delete_all_entries(tout_t aTimeout = TOUT_100MS); - _TEST(phonebook_delete_all_entries,"AT#CPBD",TOUT_100MS) + _TEST(phonebook_delete_all_entries,"AT#CPBD",TOUT_100MS) // Time & Alarm ---------------------------------------------------------------- return_t clock_management(const char *time, tout_t aTimeout = TOUT_100MS); - _READ_TEST(clock_management,"AT+CCLK",TOUT_100MS) + _READ_TEST(clock_management,"AT+CCLK",TOUT_100MS) return_t alarm_management(const char *time, int index = 0, int type = 1, const char *string ="", const char *recurr="", int silent = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(alarm_management,"AT+CALA",TOUT_100MS) + _READ_TEST(alarm_management,"AT+CALA",TOUT_100MS) return_t alarm_postpone(int sec = 0,tout_t aTimeout = TOUT_100MS); - _TEST(alarm_postpone,"AT+CAPD",TOUT_100MS) + _TEST(alarm_postpone,"AT+CAPD",TOUT_100MS) return_t setting_date_format(int mode = 1, int auxmode = 1,tout_t aTimeout = TOUT_100MS); - _READ_TEST(setting_date_format,"AT+CSDF",TOUT_100MS) + _READ_TEST(setting_date_format,"AT+CSDF",TOUT_100MS) return_t time_zone_reporting(int onoff = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(time_zone_reporting,"AT+CTZR",TOUT_100MS) + _READ_TEST(time_zone_reporting,"AT+CTZR",TOUT_100MS) return_t automatic_time_zone_update(int onoff = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(automatic_time_zone_update,"AT+CTZU",TOUT_100MS) + _READ_TEST(automatic_time_zone_update,"AT+CTZU",TOUT_100MS) return_t network_identity_time_zone(int val = 7, int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(network_identity_time_zone,"AT#NITZ",TOUT_100MS) + _READ_TEST(network_identity_time_zone,"AT#NITZ",TOUT_100MS) return_t clock_management_ext(const char *time,tout_t aTimeout = TOUT_100MS); - _READ_TEST(clock_management_ext,"AT#CCLK",TOUT_100MS) - + _READ_TEST(clock_management_ext,"AT#CCLK",TOUT_100MS) + return_t clock_mode(int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(clock_mode,"AT#CCLKMODE",TOUT_100MS) + _READ_TEST(clock_mode,"AT#CCLKMODE",TOUT_100MS) return_t wake_alarm_mode(int opmode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(wake_alarm_mode,"AT#WAKE",TOUT_100MS) + _READ_TEST(wake_alarm_mode,"AT#WAKE",TOUT_100MS) return_t setting_time_format(int mode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(setting_time_format,"AT+CSTF",TOUT_100MS) + _READ_TEST(setting_time_format,"AT+CSTF",TOUT_100MS) return_t alarm_delete(int n = 0,tout_t aTimeout = TOUT_100MS); - _TEST(alarm_delete,"AT+CALD",TOUT_100MS) + _TEST(alarm_delete,"AT+CALD",TOUT_100MS) // Audio ----------------------------------------------------------------------- return_t microphone_mute_control(int n, tout_t aTimeout = TOUT_100MS); @@ -664,404 +664,404 @@ namespace me310 return_t digital_voiceband_interface(int mode = 0, int dviport = 0, int clockmode = 1, tout_t aTimeout = TOUT_100MS); _READ_TEST(digital_voiceband_interface, "AT#DV", TOUT_100MS) - // HW and Radio Control -------------------------------------------------------- + // HW and Radio Control -------------------------------------------------------- return_t battery_charger_status(tout_t aTimeout = TOUT_100MS); - _TEST(battery_charger_status,"AT#CBC",TOUT_100MS) + _TEST(battery_charger_status,"AT#CBC",TOUT_100MS) return_t gpio_control(int pin, int mode = 0, int dir= 0, int save = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(gpio_control,"AT#GPIO",TOUT_100MS) + _READ_TEST(gpio_control,"AT#GPIO",TOUT_100MS) return_t alarm_pin_configuration(int pin = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(alarm_pin_configuration,"AT#ALARMPIN",TOUT_100MS) + _READ_TEST(alarm_pin_configuration,"AT#ALARMPIN",TOUT_100MS) return_t stat_led_gpio_setting(int mode = 5,int onDuration = 10, int offDuration = 10, tout_t aTimeout = TOUT_100MS); - _READ_TEST(stat_led_gpio_setting,"AT#SLED",TOUT_100MS) + _READ_TEST(stat_led_gpio_setting,"AT#SLED",TOUT_100MS) return_t stat_led_gpio_setting_save(tout_t aTimeout = TOUT_100MS); - _TEST(stat_led_gpio_setting_save,"AT#SLEDSAV",TOUT_100MS) + _TEST(stat_led_gpio_setting_save,"AT#SLEDSAV",TOUT_100MS) return_t adc_read(int adc = 1,int mode = 2, int dir = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(adc_read,"AT#ADC",TOUT_100MS) + _READ_TEST(adc_read,"AT#ADC",TOUT_100MS) return_t v24_output_pin_configuration(int pin = 0,int mode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(v24_output_pin_configuration,"AT#V24CFG",TOUT_100MS) + _READ_TEST(v24_output_pin_configuration,"AT#V24CFG",TOUT_100MS) return_t v24_output_pin_control(int pin = 0,int state = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(v24_output_pin_control,"AT#V24",TOUT_100MS) + _READ_TEST(v24_output_pin_control,"AT#V24",TOUT_100MS) return_t i2c_write(int sdaPin,int sclPin, int deviceId, int registerId, int len, char* data, tout_t aTimeout = TOUT_100MS); - _TEST(i2c_write,"AT#I2CWR",TOUT_100MS) + _TEST(i2c_write,"AT#I2CWR",TOUT_100MS) return_t i2c_read(int sdaPin,int sclPin, int deviceId, int registerId, int len, tout_t aTimeout = TOUT_100MS); - _TEST(i2c_read,"AT#I2CRD",TOUT_100MS) + _TEST(i2c_read,"AT#I2CRD",TOUT_100MS) return_t i2c_write_read(int sdaPin,int sclPin, int deviceId, int lenwr, int lenrd, char* data, tout_t aTimeout = TOUT_100MS); - _TEST(i2c_write_read,"AT#I2CCF",TOUT_100MS) + _TEST(i2c_write_read,"AT#I2CCF",TOUT_100MS) return_t test_mode_configuration(const char *cmd, tout_t aTimeout = TOUT_100MS); - _READ_TEST(test_mode_configuration,"AT#TESTMODE",TOUT_100MS) - - + _READ_TEST(test_mode_configuration,"AT#TESTMODE",TOUT_100MS) + + // Power Down ------------------------------------------------------------------ - + return_t module_reboot(tout_t aTimeout = TOUT_100MS); - _TEST(module_reboot,"AT#REBOOT",TOUT_100MS) - + _TEST(module_reboot,"AT#REBOOT",TOUT_100MS) + return_t periodic_reset(int mode, int delay = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(periodic_reset,"AT#ENHRST",TOUT_100MS) + _READ_TEST(periodic_reset,"AT#ENHRST",TOUT_100MS) return_t software_shutdown(tout_t aTimeout = TOUT_100MS); - _TEST(software_shutdown,"AT#SHDN",TOUT_100MS) - + _TEST(software_shutdown,"AT#SHDN",TOUT_100MS) + return_t system_turnoff(tout_t aTimeout = TOUT_100MS); - _READ_TEST(system_turnoff,"AT#SYSHALT",TOUT_100MS) + _READ_TEST(system_turnoff,"AT#SYSHALT",TOUT_100MS) return_t fast_shutdown_configuration(int enable, int gpio, tout_t aTimeout = TOUT_100MS); return_t fast_shutdown_configuration(tout_t aTimeout = TOUT_100MS); - _READ_TEST(fast_shutdown_configuration,"AT#FASTSHDN",TOUT_100MS) + _READ_TEST(fast_shutdown_configuration,"AT#FASTSHDN",TOUT_100MS) // Easy Scan ------------------------------------------------------------------- return_t network_survey(int s, int e, tout_t aTimeout = TOUT_100MS); return_t network_survey(tout_t aTimeout = TOUT_100MS); - + return_t nertwork_survey_numeric_format(int s, int e, tout_t aTimeout = TOUT_100MS); return_t nertwork_survey_numeric_format( tout_t aTimeout = TOUT_100MS); return_t network_survey_format(int format = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(network_survey_format,"AT#CSURVF",TOUT_100MS) + _READ_TEST(network_survey_format,"AT#CSURVF",TOUT_100MS) return_t network_survey_crlf(int value = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(network_survey_crlf,"AT#CSURVNLF",TOUT_100MS) + _READ_TEST(network_survey_crlf,"AT#CSURVNLF",TOUT_100MS) return_t network_survey_extended(int value = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(network_survey_extended,"AT#CSURVEXT",TOUT_100MS) - + _READ_TEST(network_survey_extended,"AT#CSURVEXT",TOUT_100MS) + // Jamming Detection and Report -------------------------------------------------- return_t jamming_detect_report(int mode = 0, int sat2G = 45, int carrNum2G = 100, int pRxLevT2G = 15, int p_rssi_t4g = 20, int p_rsrq_t4g = 20, tout_t aTimeout = TOUT_100MS); - _READ_TEST(jamming_detect_report,"AT#JDRENH2",TOUT_100MS) + _READ_TEST(jamming_detect_report,"AT#JDRENH2",TOUT_100MS) return_t jamming_detect_threshold(int p_rsrp_t4g = 20, int p_rsrq_t4g = 20, int initial_delay = 500, int sampling_number = 100,int p_rssi_s4g = -50, tout_t aTimeout = TOUT_100MS); - _READ_TEST(jamming_detect_threshold,"AT#JDR4GCFG",TOUT_100MS) + _READ_TEST(jamming_detect_threshold,"AT#JDR4GCFG",TOUT_100MS) // Packet Domain --------------------------------------------------------------- - - return_t define_pdp_context(int cid, const char *pdp_type, const char * apn, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(define_pdp_context,"AT+CGDCONT",TOUT_100MS) - return_t show_pdp_address(int cid, tout_t aTimeout = TOUT_1SEC); - return_t show_pdp_address(tout_t aTimeout = TOUT_1SEC); - _TEST(show_pdp_address,"AT+CGPADDR",TOUT_100MS) + return_t define_pdp_context(int cid, const char *pdp_type, const char * apn, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(define_pdp_context,"AT+CGDCONT",TOUT_100MS) + + return_t show_pdp_address(int cid, tout_t aTimeout = TOUT_1SEC); + return_t show_pdp_address(tout_t aTimeout = TOUT_1SEC); + _TEST(show_pdp_address,"AT+CGPADDR",TOUT_100MS) + + return_t auto_attach_property(int _auto = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(auto_attach_property,"AT#AUTOATT",TOUT_100MS) + + return_t multislot_class_control(int _class = 33, int autoattach = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(multislot_class_control,"AT#MSCLASS",TOUT_100MS) + + return_t ppp_data_connection_auth_type(int type = 3, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(ppp_data_connection_auth_type,"AT#GAUTH",TOUT_100MS) - return_t auto_attach_property(int _auto = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(auto_attach_property,"AT#AUTOATT",TOUT_100MS) + return_t define_pdp_context_auth_params(int cid, int auth_type, const char *username, const char *password, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(define_pdp_context_auth_params,"AT+CGAUTH",TOUT_100MS) - return_t multislot_class_control(int _class = 33, int autoattach = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(multislot_class_control,"AT#MSCLASS",TOUT_100MS) + return_t pdp_context_read_dynamic_parameters(tout_t aTimeout = TOUT_1SEC); + return_t pdp_context_read_dynamic_parameters(int cid, tout_t aTimeout = TOUT_1SEC); + _TEST(pdp_context_read_dynamic_parameters,"AT+CGCONTRDP",TOUT_100MS) - return_t ppp_data_connection_auth_type(int type = 3, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(ppp_data_connection_auth_type,"AT#GAUTH",TOUT_100MS) + return_t printing_ip_address_format(int ipv6_addressFormat = 0, int ipv6_subnetNotation = 0, int ipv6_leadingZeros = 0, int ipv6_compressZeros = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(printing_ip_address_format,"AT+CGPIAF",TOUT_100MS) - return_t define_pdp_context_auth_params(int cid, int auth_type, const char *username, const char *password, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(define_pdp_context_auth_params,"AT+CGAUTH",TOUT_100MS) + return_t pdp_context_activate(int cid, int stat, tout_t aTimeout = TOUT_1SEC); + return_t pdp_context_activate(tout_t aTimeout = TOUT_1SEC); + _READ_TEST(pdp_context_activate,"AT+CGACT",TOUT_100MS) - return_t pdp_context_read_dynamic_parameters(tout_t aTimeout = TOUT_1SEC); - return_t pdp_context_read_dynamic_parameters(int cid, tout_t aTimeout = TOUT_1SEC); - _TEST(pdp_context_read_dynamic_parameters,"AT+CGCONTRDP",TOUT_100MS) + return_t packet_domain_event_reporting(int mode = 0, int bfr = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(packet_domain_event_reporting,"AT+CGEREP",TOUT_100MS) - return_t printing_ip_address_format(int ipv6_addressFormat = 0, int ipv6_subnetNotation = 0, int ipv6_leadingZeros = 0, int ipv6_compressZeros = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(printing_ip_address_format,"AT+CGPIAF",TOUT_100MS) + return_t ppp_configuration(int mode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(ppp_configuration,"AT#PPPCFG",TOUT_100MS) - return_t pdp_context_activate(int cid, int stat, tout_t aTimeout = TOUT_1SEC); - return_t pdp_context_activate(tout_t aTimeout = TOUT_1SEC); - _READ_TEST(pdp_context_activate,"AT+CGACT",TOUT_100MS) - - return_t packet_domain_event_reporting(int mode = 0, int bfr = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(packet_domain_event_reporting,"AT+CGEREP",TOUT_100MS) - - return_t ppp_configuration(int mode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(ppp_configuration,"AT#PPPCFG",TOUT_100MS) - - return_t gprs_network_registration_status(int mode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(gprs_network_registration_status,"AT+CGREG",TOUT_100MS) + return_t gprs_network_registration_status(int mode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(gprs_network_registration_status,"AT+CGREG",TOUT_100MS) - return_t ps_attach_detach(int state, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(ps_attach_detach,"AT+CGATT",TOUT_100MS) + return_t ps_attach_detach(int state, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(ps_attach_detach,"AT+CGATT",TOUT_100MS) - return_t sending_originating_data(int cid, int cpdataLength, const char *cpdata, int rai = 0, int typeOfUserData = 0, tout_t aTimeout = TOUT_1SEC); - _TEST(sending_originating_data,"AT+CSODCP",TOUT_100MS) + return_t sending_originating_data(int cid, int cpdataLength, const char *cpdata, int rai = 0, int typeOfUserData = 0, tout_t aTimeout = TOUT_1SEC); + _TEST(sending_originating_data,"AT+CSODCP",TOUT_100MS) - return_t reporting_terminating_data(int reporting = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(reporting_terminating_data,"AT+CRTDCP",TOUT_100MS) + return_t reporting_terminating_data(int reporting = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(reporting_terminating_data,"AT+CRTDCP",TOUT_100MS) // IPEasy ---------------------------------------------------------------------- - return_t context_activation(int cid, int stat, const char *userid, const char *pwd, tout_t aTimeout = TOUT_1SEC); - return_t context_activation(int cid, int stat, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(context_activation,"AT#SGACT",TOUT_100MS) - - return_t pdp_context_auth_type(int type = 1, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(pdp_context_auth_type,"AT#SGACTAUTH",TOUT_100MS) - - return_t pdp_automatic_context_activation(int cid, int retry = 0, int delay = 180, int urcmode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(pdp_automatic_context_activation,"AT#SGACTCFG",TOUT_100MS) - - return_t extended_pdp_context_activation(int cid, int abortAttemptEnable = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(extended_pdp_context_activation,"AT#SGACTCFGEXT",TOUT_100MS) - - return_t socket_configuration(int connId, int cid, int pktSz = 300, int maxTo = 90, int connTo = 600, int txTo = 50, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_configuration,"AT#SCFG",TOUT_100MS) - - return_t socket_configuration_extended(int connId = 1, int srMode = 0, int recvDataMode = 0, int keepalive = 0, int listenAutoRsp = 0, int sendDataMode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_configuration_extended,"AT#SCFGEXT",TOUT_100MS) - - return_t socket_configuration_extended_2(int connId, int bufferStart = 0, int abortConnAttempt= 0, int unusedB = 0, int unusedC = 0, int noCarrierMode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_configuration_extended_2,"AT#SCFGEXT2",TOUT_100MS) - + return_t context_activation(int cid, int stat, const char *userid, const char *pwd, tout_t aTimeout = TOUT_1SEC); + return_t context_activation(int cid, int stat, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(context_activation,"AT#SGACT",TOUT_100MS) + + return_t pdp_context_auth_type(int type = 1, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(pdp_context_auth_type,"AT#SGACTAUTH",TOUT_100MS) + + return_t pdp_automatic_context_activation(int cid, int retry = 0, int delay = 180, int urcmode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(pdp_automatic_context_activation,"AT#SGACTCFG",TOUT_100MS) + + return_t extended_pdp_context_activation(int cid, int abortAttemptEnable = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(extended_pdp_context_activation,"AT#SGACTCFGEXT",TOUT_100MS) + + return_t socket_configuration(int connId, int cid, int pktSz = 300, int maxTo = 90, int connTo = 600, int txTo = 50, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_configuration,"AT#SCFG",TOUT_100MS) + + return_t socket_configuration_extended(int connId = 1, int srMode = 0, int recvDataMode = 0, int keepalive = 0, int listenAutoRsp = 0, int sendDataMode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_configuration_extended,"AT#SCFGEXT",TOUT_100MS) + + return_t socket_configuration_extended_2(int connId, int bufferStart = 0, int abortConnAttempt= 0, int unusedB = 0, int unusedC = 0, int noCarrierMode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_configuration_extended_2,"AT#SCFGEXT2",TOUT_100MS) + return_t socket_parameters_reset(tout_t aTimeout = TOUT_100MS); - _TEST(socket_parameters_reset,"AT#SKTRST",TOUT_100MS) - - return_t socket_dial(int connId, int txProt, int rPort, const char *IPaddr, int closureType, int lPort = 0, int connMode = 0, int txTime = 0, int userIpType = 0, tout_t aTimeout = TOUT_1SEC); - return_t socket_dial(int connId, int txProt, int rPort, const char *IPaddr, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_dial,"AT#SD",TOUT_100MS) - - return_t socket_restore(int connId, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_restore,"AT#SO",TOUT_100MS) - - return_t socket_shutdown(int connId, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_shutdown,"AT#SH",TOUT_100MS) - - return_t socket_listen(int connId, int listenState, int listenPort, int lingerT = 255, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_listen,"AT#SL",TOUT_100MS) - - return_t socket_listen_UDP(int connId, int listenState, int listenPort, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_listen_UDP,"AT#SLUDP",TOUT_100MS) - - return_t socket_accept(int connId, int connMode = 0, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_accept,"AT#SA",TOUT_100MS) - - return_t socket_send_data_command_mode(int connId, char* data,int rai = 1, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_send_data_command_mode,"AT#SSEND",TOUT_100MS) - - return_t socket_send_data_command_mode_extended(int connId, int bytesToSend, char* data, int rai = 1, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_send_data_command_mode_extended,"AT#SSENDEXT",TOUT_100MS) - - return_t socket_receive_data_command_mode(int connId, int maxByte, int udpInfo = 0, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_receive_data_command_mode,"AT#SRECV",TOUT_100MS) - - return_t socket_send_udp_data_specific_remote_host(int connId, const char *remoteIP, int remotePort, int rai, char* data, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_send_udp_data_specific_remote_host,"AT#SSENDUDP",TOUT_100MS) - - return_t socket_send_udp_data_specific_remote_host_extended(int connId, int bytesToSend, const char *remoteIP, int remotePort, int rai, char* data, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_send_udp_data_specific_remote_host_extended,"AT#SSENDUDPEXT",TOUT_100MS) - - return_t socket_detect_cause_disconnection(int connId, tout_t aTimeout = TOUT_1SEC); - _TEST(socket_detect_cause_disconnection,"AT#SLASTCLOSURE",TOUT_100MS) + _TEST(socket_parameters_reset,"AT#SKTRST",TOUT_100MS) + + return_t socket_dial(int connId, int txProt, int rPort, const char *IPaddr, int closureType, int lPort = 0, int connMode = 0, int txTime = 0, int userIpType = 0, tout_t aTimeout = TOUT_1SEC); + return_t socket_dial(int connId, int txProt, int rPort, const char *IPaddr, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_dial,"AT#SD",TOUT_100MS) + + return_t socket_restore(int connId, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_restore,"AT#SO",TOUT_100MS) + + return_t socket_shutdown(int connId, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_shutdown,"AT#SH",TOUT_100MS) + + return_t socket_listen(int connId, int listenState, int listenPort, int lingerT = 255, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_listen,"AT#SL",TOUT_100MS) + + return_t socket_listen_UDP(int connId, int listenState, int listenPort, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_listen_UDP,"AT#SLUDP",TOUT_100MS) + + return_t socket_accept(int connId, int connMode = 0, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_accept,"AT#SA",TOUT_100MS) + + return_t socket_send_data_command_mode(int connId, char* data,int rai = 1, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_send_data_command_mode,"AT#SSEND",TOUT_100MS) + + return_t socket_send_data_command_mode_extended(int connId, int bytesToSend, char* data, int rai = 1, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_send_data_command_mode_extended,"AT#SSENDEXT",TOUT_100MS) + + return_t socket_receive_data_command_mode(int connId, int maxByte, int udpInfo = 0, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_receive_data_command_mode,"AT#SRECV",TOUT_100MS) + + return_t socket_send_udp_data_specific_remote_host(int connId, const char *remoteIP, int remotePort, int rai, char* data, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_send_udp_data_specific_remote_host,"AT#SSENDUDP",TOUT_100MS) + + return_t socket_send_udp_data_specific_remote_host_extended(int connId, int bytesToSend, const char *remoteIP, int remotePort, int rai, char* data, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_send_udp_data_specific_remote_host_extended,"AT#SSENDUDPEXT",TOUT_100MS) + + return_t socket_detect_cause_disconnection(int connId, tout_t aTimeout = TOUT_1SEC); + _TEST(socket_detect_cause_disconnection,"AT#SLASTCLOSURE",TOUT_100MS) return_t socket_status(tout_t aTimeout = TOUT_100MS); return_t socket_status(int connId, tout_t aTimeout = TOUT_100MS); - _TEST(socket_status,"AT#SS",TOUT_100MS) + _TEST(socket_status,"AT#SS",TOUT_100MS) - return_t socket_info(int connId, tout_t aTimeout = TOUT_1SEC); + return_t socket_info(int connId, tout_t aTimeout = TOUT_1SEC); return_t socket_info(tout_t aTimeout = TOUT_1SEC); - _TEST(socket_info,"AT#SI",TOUT_100MS) + _TEST(socket_info,"AT#SI",TOUT_100MS) - return_t socket_type(int connId, tout_t aTimeout = TOUT_1SEC); + return_t socket_type(int connId, tout_t aTimeout = TOUT_1SEC); return_t socket_type(tout_t aTimeout = TOUT_1SEC); - _TEST(socket_type,"AT#ST",TOUT_100MS) - - return_t pad_command_features(int mode, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(pad_command_features,"AT#PADCMD",TOUT_100MS) - - return_t pad_forward_character(int _char = 13, int mode = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(pad_forward_character,"AT#PADFWD",TOUT_100MS) - - return_t base64_encode(int connId, int enc = 0, int dec = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(base64_encode,"AT#BASE64",TOUT_100MS) - - return_t firewall_setup(int action, const char *ip_addr = "000.000.000.000", const char *net_mask = "000.000.000.000", tout_t aTimeout = TOUT_1SEC); - _READ_TEST(firewall_setup,"AT#FRWL",TOUT_100MS) - - return_t socket_listen_ring_indicator(int n = 0, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(socket_listen_ring_indicator,"AT#E2SLRI",TOUT_100MS) - - return_t ping_support(int mode = 1, tout_t aTimeout = TOUT_1SEC); - _READ_TEST(ping_support,"AT#ICMP",TOUT_100MS) - + _TEST(socket_type,"AT#ST",TOUT_100MS) + + return_t pad_command_features(int mode, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(pad_command_features,"AT#PADCMD",TOUT_100MS) + + return_t pad_forward_character(int _char = 13, int mode = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(pad_forward_character,"AT#PADFWD",TOUT_100MS) + + return_t base64_encode(int connId, int enc = 0, int dec = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(base64_encode,"AT#BASE64",TOUT_100MS) + + return_t firewall_setup(int action, const char *ip_addr = "000.000.000.000", const char *net_mask = "000.000.000.000", tout_t aTimeout = TOUT_1SEC); + _READ_TEST(firewall_setup,"AT#FRWL",TOUT_100MS) + + return_t socket_listen_ring_indicator(int n = 0, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(socket_listen_ring_indicator,"AT#E2SLRI",TOUT_100MS) + + return_t ping_support(int mode = 1, tout_t aTimeout = TOUT_1SEC); + _READ_TEST(ping_support,"AT#ICMP",TOUT_100MS) + return_t ping(const char *ipaddr, int retryNum, int len, int timeout, int ttl, tout_t aTimeout); return_t ping(const char *ipaddr, tout_t aTimeout = TOUT_1SEC); - _TEST(ping,"AT#PING",TOUT_100MS) - + _TEST(ping,"AT#PING",TOUT_100MS) + return_t dns_query(const char *host_name, tout_t aTimeout = TOUT_1SEC); - _TEST(dns_query,"AT#QDNS",TOUT_100MS) + _TEST(dns_query,"AT#QDNS",TOUT_100MS) return_t dns_from_network(int cid, tout_t aTimeout = TOUT_1SEC); - return_t dns_from_network(tout_t aTimeout = TOUT_1SEC); - _TEST(dns_from_network,"AT#NWDNS",TOUT_100MS) + return_t dns_from_network(tout_t aTimeout = TOUT_1SEC); + _TEST(dns_from_network,"AT#NWDNS",TOUT_100MS) return_t ntp(const char *ntpaddress, int ntpport, int updModClock =1, int timeout = 2, int timezone = 4, tout_t aTimeout = TOUT_100MS); - _TEST(ntp,"AT#NTP",TOUT_100MS) - + _TEST(ntp,"AT#NTP",TOUT_100MS) + return_t configure_ntp_parameters(int cid, int authType = 0, int keyID = 0, char* keysFilePath = "", tout_t aTimeout = TOUT_100MS); - _READ_TEST(configure_ntp_parameters,"AT#NTPCFG",TOUT_100MS) - + _READ_TEST(configure_ntp_parameters,"AT#NTPCFG",TOUT_100MS) + return_t socket_configuration_extended3(int connId, int immRsp = 0, int closureType = 0, int fastSRing = 0,int ssendTimeout = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(socket_configuration_extended3,"AT#SCFGEXT3",TOUT_100MS) + _READ_TEST(socket_configuration_extended3,"AT#SCFGEXT3",TOUT_100MS) // FTPEasy --------------------------------------------------------------------- - + return_t ftp_append(const char *fileName, char* data, int connMode = 0, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_append,"AT#FTPAPP",TOUT_100MS) + _TEST(ftp_append,"AT#FTPAPP",TOUT_100MS) return_t ftp_append_extended(int bytesToSend, char* data, int eof = 0, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_append_extended,"AT#FTPAPPEXT",TOUT_100MS) + _TEST(ftp_append_extended,"AT#FTPAPPEXT",TOUT_100MS) return_t ftp_close(tout_t aTimeout = TOUT_1SEC); - _TEST(ftp_close,"AT#FTPCLOSE",TOUT_100MS) + _TEST(ftp_close,"AT#FTPCLOSE",TOUT_100MS) return_t ftp_change_working_directory(const char *dirname, tout_t aTimeout = TOUT_100MS); return_t ftp_change_working_directory(tout_t aTimeout = TOUT_100MS); - _TEST(ftp_change_working_directory,"AT#FTPCWD",TOUT_100MS) + _TEST(ftp_change_working_directory,"AT#FTPCWD",TOUT_100MS) return_t ftp_delete(const char *filename, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_delete,"AT#FTPDELE",TOUT_100MS) + _TEST(ftp_delete,"AT#FTPDELE",TOUT_100MS) return_t ftp_get_file_size(const char *filename, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_get_file_size,"AT#FTPFSIZE",TOUT_100MS) + _TEST(ftp_get_file_size,"AT#FTPFSIZE",TOUT_100MS) return_t ftp_get(const char *filename, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_get,"AT#FTPGET",TOUT_100MS) + _TEST(ftp_get,"AT#FTPGET",TOUT_100MS) return_t ftp_get_command_mode(const char *filename, int viewMode = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_get_command_mode,"AT#FTPGETPKT",TOUT_100MS) + _READ_TEST(ftp_get_command_mode,"AT#FTPGETPKT",TOUT_100MS) return_t ftp_list(const char *name, tout_t aTimeout = TOUT_100MS); return_t ftp_list(tout_t aTimeout = TOUT_100MS); - _TEST(ftp_list,"AT#FTPLIST",TOUT_100MS) + _TEST(ftp_list,"AT#FTPLIST",TOUT_100MS) return_t ftp_read_message(tout_t aTimeout = TOUT_100MS); - _TEST(ftp_read_message,"AT#FTPMSG",TOUT_100MS) + _TEST(ftp_read_message,"AT#FTPMSG",TOUT_100MS) return_t ftp_open(const char *server_port,const char *username, const char *password,int viewMode, int cid, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_open,"AT#FTPOPEN",TOUT_100MS) + _TEST(ftp_open,"AT#FTPOPEN",TOUT_100MS) return_t ftp_put(const char *filename, int connMode = 0, tout_t aTimeout = TOUT_100MS); - _TEST(ftp_put,"AT#FTPPUT",TOUT_100MS) + _TEST(ftp_put,"AT#FTPPUT",TOUT_100MS) return_t ftp_print_working_directory(tout_t aTimeout = TOUT_100MS); - _TEST(ftp_print_working_directory,"AT#FTPPWD",TOUT_100MS) + _TEST(ftp_print_working_directory,"AT#FTPPWD",TOUT_100MS) return_t ftp_receive_data_command_mode(int block_size, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_receive_data_command_mode,"AT#FTPRECV",TOUT_100MS) + _READ_TEST(ftp_receive_data_command_mode,"AT#FTPRECV",TOUT_100MS) return_t ftp_restart_posizion_get(int restartPosition, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_restart_posizion_get,"AT#FTPREST",TOUT_100MS) + _READ_TEST(ftp_restart_posizion_get,"AT#FTPREST",TOUT_100MS) return_t ftp_time_out(int tout = 100, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_time_out,"AT#FTPTO",TOUT_100MS) + _READ_TEST(ftp_time_out,"AT#FTPTO",TOUT_100MS) return_t ftp_type(int type = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_type,"AT#FTPTYPE",TOUT_100MS) + _READ_TEST(ftp_type,"AT#FTPTYPE",TOUT_100MS) return_t ftp_configuration(int tout = 100, int ipPIgnoring=0, int ftpSen = 0, int ftpext = 1, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ftp_configuration,"AT#FTPCFG",TOUT_100MS) + _READ_TEST(ftp_configuration,"AT#FTPCFG",TOUT_100MS) - /* + /* return_t cache_dns(int mode, tout_t aTimeout = TOUT_100MS); - _READ_TEST(cache_dns,"AT#CACHEDNS",TOUT_100MS) - + _READ_TEST(cache_dns,"AT#CACHEDNS",TOUT_100MS) + return_t manual_dns(int cid, const char *primary, const char *secondary, tout_t aTimeout = TOUT_100MS); - _READ_TEST(manual_dns,"AT#DNS",TOUT_100MS) - */ + _READ_TEST(manual_dns,"AT#DNS",TOUT_100MS) + */ // SMTP ------------------------------------------------------------------------ - + return_t smtp_mail_server(const char *smtp, tout_t aTimeout = TOUT_100MS); - _READ_TEST(smtp_mail_server,"AT#ESMTP",TOUT_100MS) + _READ_TEST(smtp_mail_server,"AT#ESMTP",TOUT_100MS) return_t smtp_read_message(tout_t aTimeout = TOUT_100MS); - _TEST(smtp_read_message,"AT#EMAILMSG",TOUT_100MS) + _TEST(smtp_read_message,"AT#EMAILMSG",TOUT_100MS) return_t smtp_configure(int ssl_enabled = 0, int port = 25, int mode = 0, int un1 = 0, int un2 = 0, int cid = 1, tout_t aTimeout = TOUT_100MS); - _READ_TEST(smtp_configure,"AT#SMTPCFG",TOUT_100MS) + _READ_TEST(smtp_configure,"AT#SMTPCFG",TOUT_100MS) return_t smtp_reset_parameters(tout_t aTimeout = TOUT_100MS); - _TEST(smtp_reset_parameters,"AT#ERST",TOUT_100MS) - + _TEST(smtp_reset_parameters,"AT#ERST",TOUT_100MS) + return_t smtp_user(const char *eUser, tout_t aTimeout = TOUT_100MS); - _READ_TEST(smtp_user,"AT#EUSER",TOUT_100MS) + _READ_TEST(smtp_user,"AT#EUSER",TOUT_100MS) return_t smtp_save_parameters(tout_t aTimeout = TOUT_100MS); - _TEST(smtp_save_parameters,"AT#ESAV",TOUT_100MS) + _TEST(smtp_save_parameters,"AT#ESAV",TOUT_100MS) return_t smtp_password(const char *ePwd, tout_t aTimeout = TOUT_100MS); - _TEST(smtp_password,"AT#EPASSW",TOUT_100MS) + _TEST(smtp_password,"AT#EPASSW",TOUT_100MS) return_t smtp_mail_send(const char *da, const char *subj, char* data, tout_t aTimeout = TOUT_100MS); - _TEST(smtp_mail_send,"AT#EMAILD",TOUT_100MS) + _TEST(smtp_mail_send,"AT#EMAILD",TOUT_100MS) return_t smtp_sender_address(const char *eAddr, tout_t aTimeout = TOUT_100MS); - _READ_TEST(smtp_sender_address,"AT#EADDR",TOUT_100MS) + _READ_TEST(smtp_sender_address,"AT#EADDR",TOUT_100MS) // HTTP ------------------------------------------------------------------------ return_t configure_http_parameters(int prof_id, const char *server_address, int server_port, int auth_type, const char *username = "", const char *password = "", int ssl_enabled = 0, int timeout=120, int cid=1, int pkt_size = 0,tout_t aTimeout = TOUT_100MS); return_t configure_http_parameters(int prof_id, const char *server_address, int server_port, int auth_type, int ssl_enabled = 0, int timeout=120, int cid=1,tout_t aTimeout = TOUT_100MS); - _READ_TEST(configure_http_parameters,"AT#HTTPCFG",TOUT_100MS) + _READ_TEST(configure_http_parameters,"AT#HTTPCFG",TOUT_100MS) return_t send_http_query(int prof_id, int command, const char *resource, const char *extra_header_line,tout_t aTimeout = TOUT_100MS); return_t send_http_query(int prof_id, int command, const char *resource, tout_t aTimeout = TOUT_100MS); - _TEST(send_http_query,"AT#HTTPQRY",TOUT_100MS) + _TEST(send_http_query,"AT#HTTPQRY",TOUT_100MS) return_t send_http_send(int prof_id, int command, const char *resource, int data_len, char *data, const char *post_param ="", const char *extra_header_line = "",tout_t aTimeout = TOUT_100MS); - _TEST(send_http_send,"AT#HTTPSND",TOUT_100MS) - + _TEST(send_http_send,"AT#HTTPSND",TOUT_100MS) + void receive_http_data_start(int prof_id, int max_byte = 0); return_t receive_http_data(int prof_id, int max_byte = 0,tout_t aTimeout = TOUT_100MS); - _TEST(receive_http_data,"AT#HTTPRCV",TOUT_100MS) - + _TEST(receive_http_data,"AT#HTTPRCV",TOUT_100MS) + // SSL ------------------------------------------------------------------------- return_t ssl_configure_general_param(int ssid , int cid, int pktSx =0, int maxTo = 90, int defTo = 100, int txTo = 50, int SSLSRingMode = 0, int noCarrierMode = 0, int skipHostMismatch = 1, int equalizeTx = 0, int unused1 = 0, int unused2 = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(ssl_configure_general_param,"AT#SSLCFG",TOUT_100MS) - + _READ_TEST(ssl_configure_general_param,"AT#SSLCFG",TOUT_100MS) + return_t ssl_configure_security_param(int ssid, int cipherSuite = 0, int authMode = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(ssl_configure_security_param,"AT#SSLSECCFG",TOUT_100MS) + _READ_TEST(ssl_configure_security_param,"AT#SSLSECCFG",TOUT_100MS) return_t ssl_enable(int ssid, int enable = 0,tout_t aTimeout = TOUT_100MS); - _READ_TEST(ssl_enable,"AT#SSLEN",TOUT_100MS) - + _READ_TEST(ssl_enable,"AT#SSLEN",TOUT_100MS) + return_t ssl_socket_open(int ssid, int rPort, const char *IPAddress, int closureType = 0, int connMode = 1, int timeout = 100, tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_open,"AT#SSLD",TOUT_100MS) - + _TEST(ssl_socket_open,"AT#SSLD",TOUT_100MS) + return_t ssl_socket_restore(int ssid,tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_restore,"AT#SSLO",TOUT_100MS) - + _TEST(ssl_socket_restore,"AT#SSLO",TOUT_100MS) + return_t ssl_socket_close(int ssid, int closureType = 0, tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_close,"AT#SSLH",TOUT_100MS) - + _TEST(ssl_socket_close,"AT#SSLH",TOUT_100MS) + return_t ssl_socket_send_data(int ssid, char* data, int timeout = 100, tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_send_data,"AT#SSLSEND",TOUT_100MS) - + _TEST(ssl_socket_send_data,"AT#SSLSEND",TOUT_100MS) + return_t ssl_socket_receive_data(int ssid, int maxNumByte, int timeout = 100, tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_receive_data,"AT#SSLRECV",TOUT_100MS) - + _TEST(ssl_socket_receive_data,"AT#SSLRECV",TOUT_100MS) + return_t ssl_socket_status(int ssid,tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_status,"AT#SSLS",TOUT_100MS) - + _TEST(ssl_socket_status,"AT#SSLS",TOUT_100MS) + return_t ssl_socket_info(int ssid,tout_t aTimeout = TOUT_100MS); return_t ssl_socket_info(tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_info,"AT#SSLI",TOUT_100MS) - + _TEST(ssl_socket_info,"AT#SSLI",TOUT_100MS) + return_t ssl_socket_send_data_command_mode(int ssid, int bytestosend, char* data, int timeout = 100, tout_t aTimeout = TOUT_100MS); - _TEST(ssl_socket_send_data_command_mode,"AT#SSLSENDEXT",TOUT_100MS) + _TEST(ssl_socket_send_data_command_mode,"AT#SSLSENDEXT",TOUT_100MS) return_t ssl_security_data(int ssid, int action, int dataType, int size = 0, int md5WhenReading = 0, char* data= "", tout_t aTimeout = TOUT_100MS); - _READ_TEST(ssl_security_data,"AT#SSLSECDATA",TOUT_100MS) + _READ_TEST(ssl_security_data,"AT#SSLSECDATA",TOUT_100MS) return_t ssl_additional_parameters(int ssid, int version = 4, int SNI = 0, int preloadedCA = 1, int customCA = 1, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ssl_additional_parameters,"AT#SSLSECCFG2",TOUT_100MS) + _READ_TEST(ssl_additional_parameters,"AT#SSLSECCFG2",TOUT_100MS) // CIoT Optimization ----------------------------------------------------------- return_t ciot_optimization_configuration(int n = 0, int supportedUEopt = 3, int preferredUEopt = 0, tout_t aTimeout = TOUT_100MS); @@ -1108,19 +1108,19 @@ namespace me310 return_t m2m_chdir(const char *path,tout_t aTimeout = TOUT_100MS); _READ_TEST(m2m_chdir,"AT#M2MCHDIR",TOUT_100MS) - + return_t m2m_mkdir(const char *directory_name,tout_t aTimeout = TOUT_100MS); _TEST(m2m_mkdir,"AT#M2MMKDIR",TOUT_100MS) - + return_t m2m_set_backup(int enable,tout_t aTimeout = TOUT_100MS); _READ_TEST(m2m_set_backup,"AT#M2MBACKUP",TOUT_100MS) - + return_t m2m_rmdir(const char *directory_name,tout_t aTimeout = TOUT_100MS); _TEST(m2m_rmdir,"AT#M2MRMDIR",TOUT_100MS) - + return_t m2m_application_execution(int mode = 0, int delay = 10,tout_t aTimeout = TOUT_100MS); _READ_TEST(m2m_application_execution,"AT+M2M",TOUT_100MS) - + return_t m2m_set_run_file_permission(int mode, const char * file_bin, int delay = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(m2m_set_run_file_permission,"AT#M2MRUN",TOUT_100MS) @@ -1129,7 +1129,7 @@ namespace me310 return_t m2m_write_file(const char *file_name, int size, int binToMod, char* data, tout_t aTimeout = TOUT_100MS); _TEST(m2m_write_file,"AT#M2MWRITE",TOUT_100MS) - + return_t m2m_list(const char *path,tout_t aTimeout = TOUT_100MS); return_t m2m_list(tout_t aTimeout = TOUT_100MS); _TEST(m2m_list,"AT#M2MLIST",TOUT_100MS) @@ -1139,7 +1139,7 @@ namespace me310 return_t m2m_ram_info(tout_t aTimeout = TOUT_100MS); _TEST(m2m_ram_info,"AT#M2MRAM",TOUT_100MS) - + return_t m2m_set_arguments(const char* file_bin, tout_t aTimeout = TOUT_100MS); _READ_TEST(m2m_set_arguments, "AT#M2MARG", TOUT_100MS) @@ -1199,10 +1199,10 @@ namespace me310 _TEST(gnss_reset_GPS_controller, "AT$GPSR", TOUT_100MS) return_t gnss_nmea_data_configuration(int enable = 0, int gga = 0, int gll = 0, int gsa = 0, int gsv = 0, int rmc = 0, int vtg = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(gnss_nmea_data_configuration,"AT$GPSNMUN",TOUT_100MS) - + _READ_TEST(gnss_nmea_data_configuration,"AT$GPSNMUN",TOUT_100MS) + return_t gnss_nmea_extended_data_configuration(int gngns = 0, int gngsa = 0, int glgsv = 0, int gpgrs = 0, int gagsv = 0, int gagsa = 0, int gavtg = 0, int gpgga = 0, int pqgsa = 0, int pqgsv = 0, int gnvtg = 0, int gnrmc = 0, int gngga = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(gnss_nmea_extended_data_configuration,"AT$GPSNMUNEX",TOUT_100MS) + _READ_TEST(gnss_nmea_extended_data_configuration,"AT$GPSNMUNEX",TOUT_100MS) return_t get_position_GTP_WWAN_service(tout_t aTimeout = TOUT_100MS); _TEST(get_position_GTP_WWAN_service, "AT#GTP", TOUT_100MS) @@ -1219,19 +1219,19 @@ namespace me310 // Mobile Broadband ------------------------------------------------------------ return_t ecm_setup(int cid, int did = 0, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ecm_setup,"AT#ECM",TOUT_100MS) + _READ_TEST(ecm_setup,"AT#ECM",TOUT_100MS) return_t ecm_shutdown(int did, tout_t aTimeout = TOUT_100MS); - _READ_TEST(ecm_shutdown,"AT#ECMD",TOUT_100MS) + _READ_TEST(ecm_shutdown,"AT#ECMD",TOUT_100MS) // PSM ------------------------------------------------------------------------- return_t psm_setting(int mode, const char * reqPeriodicRau, const char * reqGPRSreadyTimer, const char * reqPeriodicTau, const char * reqActiveTime, tout_t aTimeout = TOUT_100MS); - _READ_TEST(psm_setting,"AT+CPSMS",TOUT_100MS) + _READ_TEST(psm_setting,"AT+CPSMS",TOUT_100MS) return_t psm_setting2(int mode, int reqPeriodicRau, int reqGPRSreadyTimer, int reqPeriodicTau, int reqActiveTime, int psmVersion, int psmThreshold, tout_t aTimeout = TOUT_100MS); - _READ_TEST(psm_setting2,"AT#CPSMS",TOUT_100MS) - + _READ_TEST(psm_setting2,"AT#CPSMS",TOUT_100MS) + return_t psm_URC(int en = 0, tout_t aTimeout = TOUT_100MS); _READ_TEST(psm_URC, "AT#PSMURC", TOUT_100MS) //IMS -------------------------------------------------------------------------- @@ -1249,22 +1249,22 @@ namespace me310 const char * buffer_cstr(int aIndex = 0); const char * buffer_cstr_raw(); void ConvertBufferToIRA(uint8_t* recv_buf, uint8_t* out_buf, int size); - + virtual void on_command(const char *aCommand) {/*Serial.println(aCommand);*/} //!< Callback function on command issued virtual void on_receive() {} //!< Callback function on string received virtual void on_error(const char *aMessage) {} //!< Callback function on error string received virtual void on_valid(const char *aMessage) {} //!< Callback function on valid string received - virtual void on_timeout(void) {} //!< Callback function on receive timeout event - virtual return_t on_message(const char *aMessage) //!< Callback function on message received + virtual void on_timeout(void) {} //!< Callback function on receive timeout event + virtual return_t on_message(const char *aMessage) //!< Callback function on message received {return RETURN_CONTINUE;} virtual const char* on_pending_receive(const char *aMessage) //!< Callback function on string received - {return aMessage;} - + {return aMessage;} + return_t read_line(const char *aAnswer, tout_t aTimeout = TOUT_1SEC); virtual return_t wait_for(const char *aAnswer = OK_STRING, tout_t aTimeout = TOUT_200MS); virtual return_t wait_for(const char* aCommand, int flag = 0, const char *aAnswer = OK_STRING, tout_t aTimeout = TOUT_200MS); virtual return_t wait_for_unsolicited(tout_t aTimeout = TOUT_200MS); - + static const char *str_start(const char *buffer, const char *string); static const char *str_equal(const char *buffer, const char *string); static const char *return_string(return_t rc); @@ -1274,6 +1274,7 @@ namespace me310 protected: void send(const char *aCommand, const char *aTerm = "\r"); + void send(const uint8_t* data, int len); return_t read_send_wait(const char *aCommand, const char *aAnswer = OK_STRING, tout_t aTimeout = TOUT_200MS); return_t test_send_wait(const char *aCommand, const char *aAnswer = OK_STRING, tout_t aTimeout = TOUT_200MS); return_t send_wait(const char *aCommand, const char *aAnswer = OK_STRING, tout_t aTimeout = TOUT_200MS); @@ -1282,18 +1283,18 @@ namespace me310 return_t send_wait(const char *aCommand, int flag, const char *aAnswer = OK_STRING, const char* term = TERMINATION_STRING, tout_t aTimeout = TOUT_200MS); void CheckIRAOption(char* str); - + Uart &mSerial; //!< Reference to Uart used for communication uint32_t mBaudrate; //! uint8_t mBuffer[ME310_BUFFSIZE]; //!< Transmission buffer uint8_t *mpBuffer = 0; //!< Pointer to free position in buffer - size_t mBuffLen = 0; //!< Buffer length + size_t mBuffLen = 0; //!< Buffer length uint8_t *_payloadData = 0; //!< Pointer to free position in buffer for payload data uint32_t _option = 0; bool _isIRARx, _isIRATx; - + static const char CTRZ[1]; static const char *OK_STRING; diff --git a/src/Parser.cpp b/src/Parser.cpp index 874b1ef..baf350d 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -13,9 +13,9 @@ This library contains a interface that implements a parsing functions for AT command.\n Parser is an abstract class and handles common methods, like gets and parse.\n The concrete classes, derived by Parser, implement the parsing methods for the specific AT command.\n - @version - 1.0.0 - + @version + 1.1.1 + @note Dependencies: Parser.h @@ -48,7 +48,7 @@ namespace telitAT return ch - 'A' + 10; return 0; } - + static void ConvertBufferIRAToOctet(uint8_t* in, uint8_t* out, unsigned int len) { uint8_t LV_reg; @@ -90,6 +90,29 @@ namespace telitAT } } + //! \brief Implements the parse method. + /*! \details + This methods calls the methods to parser the different part of received string. + * \param buf pointer to char buffer. + * \return 0 if the string is different from null, else -1. + */ + int Parser::parse(char *buf) + { + _rawData = buf; + _buf = buf; + if (_rawData.size() != 0) + { + _recvBytes = receivedBytes(); + _startPayloadOffset = findPayloadStart(); + _response = searchCommandResponseString(); + _payload = extractedData(); + return 0; + } + else + { + return -1; + } + } //! \brief Class Destructor /*! */ @@ -110,7 +133,7 @@ namespace telitAT { return _recvBytes; } - + //! \brief Gets the payload string /*! \details This method gets payload pointer. Before calling this method it is mandatory to call the parse() method. @@ -132,7 +155,7 @@ namespace telitAT } //! \brief Gets the command response string - /*! \details + /*! \details This method gets command response string pointer. Before calling this method it is mandatory to call the parse() method. /*! \return pointer of command response string */ @@ -142,7 +165,7 @@ namespace telitAT } //! \brief Gets the command response is - /*! \details + /*! \details This method gets a boolean value of command response, if the command response is present, return true, else return false.\n Before calling this method it is mandatory to call the parse() method. /*! \return true if the command response string is in the string, otherwise false @@ -219,7 +242,7 @@ namespace telitAT tmp_str = _rawData; char expBytes[16]; size_t posComma = 0; - + posComma = tmp_str.find_first_of(",", posComma + 1); if(posComma != string::npos) { @@ -244,7 +267,7 @@ namespace telitAT //! \brief Implements the search for payload data /*! \details This method parses the string to search the payload data, it is specific for #SRECV AT command.\n - It returns a pointer to payload data. + It returns a pointer to payload data. /*! \return pointer to payload data if the format is right otherwise return null pointer. */ uint8_t * SRECVParser::extractedData() @@ -260,11 +283,11 @@ namespace telitAT int len = tmp_str.copy((char*)_payloadData, tmp_recvBytes, _startPayloadOffset+1); if(len != string::npos) { - _payloadData[len] = '\0'; + _payloadData[len] = '\0'; if(_isIRA) { ConvertBufferIRAToOctet(_payloadData, _payloadData, len); - } + } return _payloadData; } else @@ -292,7 +315,7 @@ namespace telitAT posComma = tmp_str.find_first_of(",", posComma + 1); if(posComma != string::npos) { - posComma = tmp_str.find_first_of(",", posComma + 1); + posComma = tmp_str.find_first_of(",", posComma + 1); } if(posComma == string::npos) { @@ -307,18 +330,18 @@ namespace telitAT { int len = tmp_str.copy(recvBytes, ((posSecondNewRow-1) - posComma), posComma+1); recvBytes[len] = '\0'; - return atoi(recvBytes); + return atoi(recvBytes); } else { return posSecondNewRow; } - } + } else { return posComma; } - } + } else { return posDots; @@ -331,12 +354,12 @@ namespace telitAT /*! \return true if the format is right otherwise return false. */ bool SRECVParser::searchCommandResponseString() - { + { memset(_commandResponse, 0, MAX_CMD_RESPONSE); string tmp_str; tmp_str = _rawData; int len = tmp_str.copy(_commandResponse, tmp_str.length() - (_startPayloadOffset + _recvBytes), _startPayloadOffset + _recvBytes); - + if(len != string::npos) { _commandResponse[len] = '\0'; @@ -485,7 +508,7 @@ namespace telitAT } } else - { + { return posDots; } } @@ -535,7 +558,7 @@ namespace telitAT strcpy(_commandResponse, CME_ERROR_STRING); return true; } - return false; + return false; } else { @@ -657,7 +680,7 @@ namespace telitAT { int len = tmp_str.copy(recvBytes, ((posSecondNewRow-1) - posSecondComma), posSecondComma+1); recvBytes[len] = '\0'; - return atoi(recvBytes); + return atoi(recvBytes); } else { @@ -787,20 +810,8 @@ namespace telitAT uint8_t * M2MReadParser::extractedData() { memset(_payloadData, 0, MAX_PAYLOAD); - string tmp_str; - tmp_str = _rawData; - char pl[MAX_PAYLOAD]; - int len = tmp_str.copy(pl, _recvBytes, _startPayloadOffset); - if(len != string::npos) - { - pl[len] = '\0'; - memcpy(_payloadData, pl, len); - return _payloadData; - } - else - { - return nullptr; - } + memcpy(_payloadData, _buf + _startPayloadOffset, _recvBytes); + return _payloadData; } //! \brief Implements the search for received bytes @@ -822,8 +833,8 @@ namespace telitAT { memset(_commandResponse, 0, MAX_CMD_RESPONSE); string tmp_str; - tmp_str = _rawData; - int len = tmp_str.copy(_commandResponse, tmp_str.length() - (_startPayloadOffset + _recvBytes), _startPayloadOffset + _recvBytes); + tmp_str = _buf + (_startPayloadOffset + _recvBytes); + int len = tmp_str.copy(_commandResponse, tmp_str.length()); if(len != string::npos) { _commandResponse[len] = '\0'; @@ -914,7 +925,7 @@ namespace telitAT std::size_t pos1 = tmp.find("#"); string tmp1 = tmp.substr(0, pos1); pld.insert(pld.length(),tmp1); - + while(pos != string::npos) { pos = tmp.find(":"); @@ -924,7 +935,7 @@ namespace telitAT pld.insert(pld.length(),tmp1); pos = tmp.find(":"); } - + len = pld.copy(pl, pld.length()); pl[len] = '\0'; memcpy(_payloadData, pl, len); diff --git a/src/Parser.h b/src/Parser.h index a48e482..7186373 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -13,7 +13,7 @@ Parser is an abstract class and handles common methods, like gets and parse.\n The concrete classes, derived by Parser, implement the parsing methods for the specific AT command.\n @version - 1.1.0 + 1.1.1 @note Dependencies: @@ -44,6 +44,9 @@ using namespace std; #define _IS_IRA_TX_BIT 0x00 #define _IS_IRA_RX_BIT 0x01 #define _UDP_INFO_BIT 0x02 +#define _M2MWRITE_BIT 0x04 +#define _M2MREAD_BIT 0x08 + #define SET_BIT_MASK(m, L) (m |= (1 << L)) @@ -65,7 +68,8 @@ namespace telitAT class Parser { public: - virtual int parse(string str); + virtual int parse(string str); + virtual int parse(char *buf); virtual int getReceivedBytes(); virtual uint8_t * getPayload(); virtual int getPayloadStart(); @@ -84,6 +88,7 @@ namespace telitAT char _commandResponse[MAX_CMD_RESPONSE]; //!< Command Response buffer uint8_t *_payload; //!< Pointer to payload string string _rawData; //!< Pointer to string data received + char *_buf; int _recvBytes; //!< Received bytes int _startPayloadOffset; //!< Start position to payload offset bool _response; //!< Command Response flag diff --git a/src/PathParsing.cpp b/src/PathParsing.cpp index f8cf46b..5159c80 100644 --- a/src/PathParsing.cpp +++ b/src/PathParsing.cpp @@ -13,7 +13,7 @@ @version 1.0.0 - + @note Dependencies: PathParsing.h @@ -39,7 +39,7 @@ namespace telitAT const char *ResponseFind::NO_CARRIER_STRING = "NO CARRIER"; ///< String for NO CARRIER modem answer //! \brief Class Constructor - /*! + /*! * \param str pointer to a char string */ PathParsing::PathParsing(char* str) @@ -47,12 +47,12 @@ namespace telitAT memset(_path, 0, 128); memset(_filename,0,64); string tmp_str; - + tmp_str = str; std::size_t found = tmp_str.find_last_of("/\\"); if(found != string::npos) { - int len = tmp_str.copy(_path, found, 0); + int len = tmp_str.copy(_path, found, 0); _path[len] = '\0'; len = tmp_str.copy(_filename, tmp_str.length() - len, found + 1); _filename[len] = '\0'; @@ -74,7 +74,7 @@ namespace telitAT return _path; } - //! \brief Gets the file name + //! \brief Gets the file name /*! \details This method returns the file name identified within the string passed to the constructor. /*! \return file name string @@ -84,9 +84,9 @@ namespace telitAT return _filename; } - //! \brief Gets the file size + //! \brief Gets the file size /*! \details - Returns the size of the file identified in the list. The file name is the one identified in the constructor. + Returns the size of the file identified in the list. The file name is the one identified in the constructor. The value of the size is an integer, if the file is not found, -1 is returned. * \param list list to parse. * \return file size @@ -102,7 +102,7 @@ namespace telitAT { int posComma = str.find_first_of(",", posFilename); int posNewRow = str.find_first_of("\n", posComma); - int len = str.copy(sizeFile, posNewRow - posComma,posComma+1); + int len = str.copy(sizeFile, posNewRow - posComma,posComma+1); sizeFile[len] = '\0'; return atoi(sizeFile); } @@ -143,7 +143,7 @@ namespace telitAT strcpy(_commandResponse, NO_CARRIER_STRING); return true; } - return false; + return false; } char* ResponseFind::getResponse(char* str) @@ -151,7 +151,7 @@ namespace telitAT if(findResponse(str)) { return _commandResponse; - } + } else { return nullptr; diff --git a/src/PathParsing.h b/src/PathParsing.h index 129342d..d76cb7c 100644 --- a/src/PathParsing.h +++ b/src/PathParsing.h @@ -8,13 +8,13 @@ Parsing string @details - - - @version + + + @version 1.0.0 @note - Dependencies: + Dependencies: string.h @author @@ -38,8 +38,8 @@ namespace telitAT /*! \class PathParsing \brief Implements the path parsing. - \details - The class implements the path parsing function.\n + \details + The class implements the path parsing function.\n The constructor receives a string from which to extract the path, the file name and the file size. These values ​​are returned by their respective get functions as a string. */ class PathParsing @@ -64,7 +64,7 @@ namespace telitAT public: bool findResponse(char* str); char* getResponse(char* str); - + private: char _commandResponse[64]; @@ -74,7 +74,7 @@ namespace telitAT static const char *ERROR_STRING; static const char *CME_ERROR_STRING; static const char *NO_CARRIER_STRING; - + }; } //end namespace