From b7f58c75518a53710f9c00ac957ca2ba4728e3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Thu, 1 Mar 2018 16:58:56 +0100 Subject: [PATCH] * added function to disable power save on the modem --- src/Sodaq_nbIOT.cpp | 10 ++++++++++ src/Sodaq_nbIOT.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Sodaq_nbIOT.cpp b/src/Sodaq_nbIOT.cpp index 100d155..c7c0c64 100644 --- a/src/Sodaq_nbIOT.cpp +++ b/src/Sodaq_nbIOT.cpp @@ -519,6 +519,8 @@ bool Sodaq_nbIOT::connectSocket() return false; } + powerSaveOff(); + println(R"(AT+COPS=1,2,"21630")"); readResponse(); @@ -530,6 +532,14 @@ bool Sodaq_nbIOT::connectSocket() return waitForSignalQuality(); } +bool Sodaq_nbIOT::powerSaveOff() { + println(R"(AT+CEDRXS=0,5,"0101")"); + readResponse(); + + println(R"(AT+CPSMS=0,,,"01000001","00000101")"); + return readResponse() == ResponseOK; +} + bool Sodaq_nbIOT::reconnectSocket() { println(R"(AT+COPS=1,2,"21630")"); readResponse(); diff --git a/src/Sodaq_nbIOT.h b/src/Sodaq_nbIOT.h index 6c77259..757983a 100644 --- a/src/Sodaq_nbIOT.h +++ b/src/Sodaq_nbIOT.h @@ -48,6 +48,7 @@ class Sodaq_nbIOT: public Sodaq_AT_Device bool isAlive(); // returns true if modem is registered on the network bool isRegistered(); + bool powerSaveOff(); bool reconnectSocket(); // Returns the default baud rate of the modem.