Skip to content

Commit 4a418dc

Browse files
added support for USSD commands
1 parent 42aa528 commit 4a418dc

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Diff for: examples/ReceiveSMS/ReceiveSMS.ino

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ void setup(){
5252
cellular.connect();
5353
Serial.println("Connected!");
5454

55+
// Send USSD command for cost control, if supported by the network provider
56+
// Some network providers send the response as an SMS message
57+
// Some network providers send the response as a USSD response
58+
//Serial.println("Sending USSD command...");
59+
//Serial.println(cellular.sendUSSDCommand("*123#"));
60+
5561
// Register interrupt based callback for new SMS
5662
attachInterrupt(digitalPinToInterrupt(NEW_SMS_INTERRUPT_PIN), onSMSReceived, RISING);
5763

Diff for: src/ArduinoCellular.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ std::vector<SMS> parseSMSData(const String& data) {
363363
return smsList;
364364
}
365365

366+
String ArduinoCellular::sendUSSDCommand(const char * command){
367+
return modem.sendUSSD(command);
368+
}
369+
366370
std::vector<SMS> ArduinoCellular::getReadSMS(){
367371
String rawMessages = sendATCommand("+CMGL=\"REC READ\"");
368372
if(rawMessages.indexOf("OK") == -1){

Diff for: src/ArduinoCellular.h

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ class ArduinoCellular {
184184
*/
185185
String sendATCommand(const char * command, unsigned long timeout = 1000);
186186

187+
String sendUSSDCommand(const char * command);
188+
189+
187190

188191
/**
189192
* @brief Gets the Network client. (OSI Layer 3)

0 commit comments

Comments
 (0)