Skip to content
Snippets Groups Projects
Verified Commit 61e4487a authored by Anian Bühler's avatar Anian Bühler
Browse files

adderd erroro-codes for getTopic

and updated Readme
parent 0c11fbf3
No related branches found
No related tags found
1 merge request!9update master from dev2
......@@ -59,6 +59,17 @@ int psnClient.subscribe(char* topic, int length);
// return ERROR-Wert: DN_ERROR_NO_ERROR,
// DN_ERROR_TOPIC_LEN (Topic zu lang - wird abgeschnitten)
#Anzahl der aboonierten Topics ausgeben
int getMaxNrTopics();
// return: Anzahl der abbonierten Topics
#Bezeichnung eines abonnierten Topics ausgeben
int getSubscribedTopic(char*, int);
// param1: char-Array in das die Topic-Bezeichnung eingetragen wird
// param2: Nummer welches Topic ausgegeben werden soll (0 - getMaxNrTopics())
// return ERROR-WERT: DN_ERROR_NO_ERROR,
// DN_ERROR_NO_TOPIC (Topic unter der angegebenen Nummer nicht verfügbar)
#Topic eines anderen Clients entfernen
bool psnClient.unsubscribe(char* topic);
// param: Topic String/char-Array
......@@ -222,6 +233,7 @@ DN_PUBLISH_SUCCESSULL 1
DN_ERROR_NO_ERROR 0
DN_ERROR_TOPIC_LEN -1
DN_ERROR_PAYLOAD_LEN -2
DN_ERROR_NO_TOPIC -3
#Frame
MSG_PRELIMITER '<'
......
......@@ -331,8 +331,11 @@ int DidacticPSNetClient::getFreeTopicNr() {
}
int DidacticPSNetClient::getSubscribedTopic(char* topic, int number){
strcpy(topic, _topic[number]);
return 1;
if(number > 0 && number < getMaxNrTopics()){
strcpy(topic, _topic[number]);
return DN_ERROR_NO_ERROR;
}
return DN_ERROR_NO_TOPIC;
}
int DidacticPSNetClient::getMaxNrTopics(){
......
......@@ -49,6 +49,7 @@
#define DN_ERROR_NO_ERROR 0
#define DN_ERROR_TOPIC_LEN -1
#define DN_ERROR_PAYLOAD_LEN -2
#define DN_ERROR_NO_TOPIC -3
//little helpers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment