From b72540c935363c10e79dc922b1be5a53732b9355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anian=20B=C3=BChler?= <anian.buehler@reutlingen-university.de> Date: Mon, 4 Jul 2022 10:02:32 +0200 Subject: [PATCH] changed clientCallback to newData --- examples/sPSN_Chat/sPSN_Chat.ino | 4 ++-- examples/sPSN_Client1/sPSN_Client1.ino | 4 ++-- examples/sPSN_Client2/sPSN_Client2.ino | 4 ++-- examples/sPSN_ClientMinimal/sPSN_ClientMinimal.ino | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/sPSN_Chat/sPSN_Chat.ino b/examples/sPSN_Chat/sPSN_Chat.ino index e7b228b..bc309b4 100644 --- a/examples/sPSN_Chat/sPSN_Chat.ino +++ b/examples/sPSN_Chat/sPSN_Chat.ino @@ -36,7 +36,7 @@ char topicSub[MAX_LEN_TOPICS] = {""}; //Array für neues Empfangs-Topi char topicPub[MAX_LEN_TOPICS] = {""}; //Array für eigenes Sende-Topic //Callback-Funktion wird bei neuen Daten automatisch aufgerufen -void clientCallback(char* mTopic, int mToLength, char* mData, int mDaLength) { +void newData(char* mTopic, int mToLength, char* mData, int mDaLength) { Serial.print(mTopic); Serial.print(":\t"); Serial.println(mData); @@ -54,7 +54,7 @@ void setup() { sSerial.begin(SERIAL_BAUD); //Starte SoftwareSerielle Schnittstelle (zu IR-Link-Modulen) - psnClient.begin(sSerial, clientCallback); //Starte PubSubClient mit SoftwareSerial und Callbackfunktion "clientCallback" + psnClient.begin(sSerial, newData); //Starte PubSubClient mit SoftwareSerial und Callbackfunktion "clientCallback" sReader.begin(Serial); //AUSGABE INFOTEXT diff --git a/examples/sPSN_Client1/sPSN_Client1.ino b/examples/sPSN_Client1/sPSN_Client1.ino index e170050..116aa54 100644 --- a/examples/sPSN_Client1/sPSN_Client1.ino +++ b/examples/sPSN_Client1/sPSN_Client1.ino @@ -42,7 +42,7 @@ DidacticPSNetClient psnClient; //Erzeuge PubSub-Client-Instanz //Callback-Funktion - wird beim Empfang neuer Daten aufgerufen -void clientCallback(char* mTopic, int mToLength, char* mData, int mDaLength) { +void newData(char* mTopic, int mToLength, char* mData, int mDaLength) { Serial.print("CB: "); Serial.print(mTopic); Serial.print(" | "); @@ -65,7 +65,7 @@ void setup() { pinMode(LED_PIN,OUTPUT); - psnClient.begin(sSerial, clientCallback); //Starte PubSub Client an SoftwareSerial Schnittstelle + psnClient.begin(sSerial, newData); //Starte PubSub Client an SoftwareSerial Schnittstelle //psnClient.begin(Serial, clientCallback); //Starte PubSub Client an Serial Schnittstelle psnClient.subscribe(topicSubscribe); //Lege fest zu welchem Topic Daten empfangen werden sollen diff --git a/examples/sPSN_Client2/sPSN_Client2.ino b/examples/sPSN_Client2/sPSN_Client2.ino index 5e49f51..98193ec 100644 --- a/examples/sPSN_Client2/sPSN_Client2.ino +++ b/examples/sPSN_Client2/sPSN_Client2.ino @@ -41,7 +41,7 @@ UnblockingTimer uTimer; //Callback-Funktion - wird beim Empfang neuer Daten aufgerufen -void clientCallback(char* mTopic, int mToLength, char* mData, int mDaLength) { +void newData(char* mTopic, int mToLength, char* mData, int mDaLength) { Serial.print("CB: "); Serial.print(mTopic); Serial.print(" | "); @@ -62,7 +62,7 @@ void setup() { Serial.begin(SERIAL_BAUD); //Starte Serielle Schnittstelle (zum PC) sSerial.begin(SERIAL_BAUD); //Starte SoftwareSerielle Schnittstelle (zu IR-Link-Modulen) - psnClient.begin(sSerial, clientCallback); //Starte PubSub Client an SoftwareSerial Schnittstelle + psnClient.begin(sSerial, newData); //Starte PubSub Client an SoftwareSerial Schnittstelle //psnClient.begin(Serial, clientCallback); //Starte PubSub Client an Serial Schnittstelle psnClient.subscribe(topicSubscribe); //Lege fest zu welchem Topic Daten empfangen werden sollen diff --git a/examples/sPSN_ClientMinimal/sPSN_ClientMinimal.ino b/examples/sPSN_ClientMinimal/sPSN_ClientMinimal.ino index 9dbedea..dfd3f23 100644 --- a/examples/sPSN_ClientMinimal/sPSN_ClientMinimal.ino +++ b/examples/sPSN_ClientMinimal/sPSN_ClientMinimal.ino @@ -29,7 +29,7 @@ SoftwareSerial sSerial(10, 11); //Erzeuge SoftwareSerial-Instanz mit Rx = Pin10 DidacticPSNetClient psnClient; //Erzeuge PubSub-Client-Instanz //Callback-Funktion - wird beim Empfang neuer Daten aufgerufen -void clientCallback(char* mTopic, int mToLength, char* mPayload, int mPayloadLength) { +void newData(char* mTopic, int mToLength, char* mPayload, int mPayloadLength) { Serial.print("Nachricht von: "); Serial.print(mTopic); Serial.print(" - "); @@ -42,7 +42,7 @@ void setup() { Serial.begin(2400); //Starte Serielle Schnittstelle (zum PC) sSerial.begin(2400); //Starte SoftwareSerielle Schnittstelle (zu IR-Link-Modulen) - psnClient.begin(sSerial, clientCallback); //Starte PubSub Client an SoftwareSerial Schnittstelle + psnClient.begin(sSerial, newData); //Starte PubSub Client an SoftwareSerial Schnittstelle //Hier EMPFANGS-TOPIC ANPASSEN -> default "client2" psnClient.subscribe("client2"); //Lege fest zu welchem Topic Daten empfangen werden sollen -- GitLab