Skip to content

Commit 0172d7b

Browse files
committed
Use sender instead of number
1 parent ac19030 commit 0172d7b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/ArduinoCellular.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ SMS parseSMSEntry(const String& entry, const String& message) {
277277
sms.index = entry.substring(entry.indexOf(command) + command.length(), entry.indexOf(',')).toInt();
278278

279279
// Extracting number and raw timestamp
280-
sms.number = entry.substring(thirdQuoteIndex + 1, fourthQuoteIndex);
280+
sms.sender = entry.substring(thirdQuoteIndex + 1, fourthQuoteIndex);
281281
String rawTimestamp = entry.substring(commaIndexBeforeTimestamp + 2, entry.indexOf('+', commaIndexBeforeTimestamp) + 3);
282282

283283
// Parse the timestamp

src/ArduinoCellular.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ enum ModemModel {
3636
*/
3737
class SMS {
3838
public:
39-
String number; /**< The phone number associated with the SMS. */
4039
int16_t index; /**< The index of the SMS message. */
40+
String sender; /**< The phone number associated with the SMS. */
4141
String message; /**< The content of the SMS message. */
4242
Time timestamp; /**< The timestamp when the SMS was received. */
4343

@@ -46,20 +46,21 @@ class SMS {
4646
* Initializes the number, message, and timestamp to empty values.
4747
*/
4848
SMS() {
49-
this->number = "";
5049
this->index = -1;
50+
this->sender = "";
5151
this->message = "";
5252
this->timestamp = Time();
5353
}
5454

5555
/**
5656
* Constructor for SMS.
5757
* @param index The index of the SMS message.
58-
* @param number The phone number associated with the SMS.
58+
* @param sender The phone number associated with the sender of the SMS.
5959
* @param message The content of the SMS message.
6060
* @param timestamp The timestamp when the SMS was received.
6161
*/
62-
SMS(int16_t index, String number, String message, Time timestamp) {
62+
SMS(int16_t index, String sender, String message, Time timestamp) {
63+
this->sender = sender;
6364
this->message = message;
6465
this->timestamp = timestamp;
6566
}

0 commit comments

Comments
 (0)