@@ -57,11 +57,11 @@ boolean GoogleHomeNotifier::ip(IPAddress ip, const char *locale, uint16_t port)
5757}
5858
5959boolean GoogleHomeNotifier::notify (const char *phrase, WiFiClientSecure* pClient) {
60- return this ->cast (phrase, NULL , pClient);
60+ return this ->cast (phrase, nullptr , pClient);
6161}
6262
6363boolean GoogleHomeNotifier::play (const char *mp3Url, WiFiClientSecure* pClient) {
64- return this ->cast (NULL , mp3Url, pClient);
64+ return this ->cast (nullptr , mp3Url, pClient);
6565}
6666
6767boolean GoogleHomeNotifier::cast (const char *phrase, const char *mp3Url, WiFiClientSecure* pClient)
@@ -72,15 +72,14 @@ boolean GoogleHomeNotifier::cast(const char *phrase, const char *mp3Url, WiFiCli
7272 return false ;
7373 }
7474 String speechUrl;
75- if (pClient != NULL ) {
76- if (m_client != NULL ) delete m_client;
75+ if (pClient != nullptr ) {
7776 m_client = pClient;
7877 m_clientCreated = false ;
7978 } else if (!m_client) {
8079 m_client = new WiFiClientSecure ();
8180 m_clientCreated = true ;
8281 }
83- if (phrase != NULL ) {
82+ if (phrase != nullptr ) {
8483 tts.setWiFiClientSecure (m_client);
8584 speechUrl = tts.getSpeechUrl (phrase, m_locale);
8685 delay (1 );
@@ -89,17 +88,17 @@ boolean GoogleHomeNotifier::cast(const char *phrase, const char *mp3Url, WiFiCli
8988 this ->setLastError (" Failed to get TTS url." );
9089 if (m_clientCreated == true ) {
9190 delete m_client;
92- m_client = NULL ;
91+ m_client = nullptr ;
9392 }
9493 return false ;
9594 }
96- } else if (mp3Url != NULL ) {
95+ } else if (mp3Url != nullptr ) {
9796 speechUrl = mp3Url;
9897 } else {
99- this ->setLastError (" Both TTS phrase and mp3 url are NULL ." );
98+ this ->setLastError (" Both TTS phrase and mp3 url are nullptr ." );
10099 if (m_clientCreated == true ) {
101100 delete m_client;
102- m_client = NULL ;
101+ m_client = nullptr ;
103102 }
104103 return false ;
105104 }
@@ -157,7 +156,7 @@ boolean GoogleHomeNotifier::sendMessage(const char *sourceId, const char *destin
157156 message.payload_utf8 .funcs .encode = &(GoogleHomeNotifier::encode_string);
158157 message.payload_utf8 .arg = (void *)data;
159158
160- uint8_t * buf = NULL ;
159+ uint8_t * buf = nullptr ;
161160 uint32_t bufferSize = 0 ;
162161 uint8_t packetSize[4 ];
163162 boolean status;
@@ -304,7 +303,7 @@ void GoogleHomeNotifier::disconnect() {
304303 if (m_client->connected ()) m_client->stop ();
305304 if (m_clientCreated == true ) {
306305 delete m_client;
307- m_client = NULL ;
306+ m_client = nullptr ;
308307 }
309308 }
310309}
0 commit comments