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

minor changes

parent 27c9edba
No related branches found
No related tags found
1 merge request!4Dev to Master
...@@ -16,13 +16,13 @@ setCallback KEYWORD2 ...@@ -16,13 +16,13 @@ setCallback KEYWORD2
setStream KEYWORD2 setStream KEYWORD2
handleNetwork KEYWORD2 handleNetwork KEYWORD2
isDataToSend KEYWORD2 isDataToSend KEYWORD2
setInterval KEYWORD2
publish KEYWORD2 publish KEYWORD2
publishOnChange KEYWORD2
subscribe KEYWORD2 subscribe KEYWORD2
unsubscribe KEYWORD2 unsubscribe KEYWORD2
edgeDetected KEYWORD2
valueChanged KEYWORD2
timeElapsed KEYWORD2 timeElapsed KEYWORD2
readSerialData KEYWORD2 readSerialData KEYWORD2
...@@ -46,6 +46,7 @@ MAX_LEN_PAYLOAD LITERAL1 ...@@ -46,6 +46,7 @@ MAX_LEN_PAYLOAD LITERAL1
DN_ASCII_CR LITERAL1 DN_ASCII_CR LITERAL1
DN_ASCII_NL LITERAL1 DN_ASCII_NL LITERAL1
DN_PUBLISH_SUCCESSULL LITERAL1
DN_ERROR_NO_ERROR LITERAL1 DN_ERROR_NO_ERROR LITERAL1
DN_ERROR_TOPIC_LEN LITERAL1 DN_ERROR_TOPIC_LEN LITERAL1
DN_ERROR_PAYLOAD_LEN LITERAL1 DN_ERROR_PAYLOAD_LEN LITERAL1
\ No newline at end of file
...@@ -160,7 +160,7 @@ int didacticPSNetClient::publish(char* topic, char* payload){ ...@@ -160,7 +160,7 @@ int didacticPSNetClient::publish(char* topic, char* payload){
} }
int didacticPSNetClient::publish(char* topic, int topicLength, char* payload , int payloadLength){ int didacticPSNetClient::publish(char* topic, int topicLength, char* payload , int payloadLength){
int error = DN_ERROR_NO_ERROR; int error = DN_PUBLISH_SUCCESSULL;
_sendBufferMessage[0] = MSG_PRELIMITER; _sendBufferMessage[0] = MSG_PRELIMITER;
_sendBufferMessage[1] = MSG_PUBLISH; _sendBufferMessage[1] = MSG_PUBLISH;
...@@ -198,7 +198,7 @@ int didacticPSNetClient::publish(char* topic, int data){ ...@@ -198,7 +198,7 @@ int didacticPSNetClient::publish(char* topic, int data){
} }
int didacticPSNetClient::publish(char* topic, bool data){ int didacticPSNetClient::publish(char* topic, bool data){
char sendPayload[MAX_LEN_PAYLOAD]; char sendPayload[2];
itoa(data, sendPayload, 10); itoa(data, sendPayload, 10);
return publish(topic, sendPayload); return publish(topic, sendPayload);
...@@ -206,9 +206,8 @@ int didacticPSNetClient::publish(char* topic, bool data){ ...@@ -206,9 +206,8 @@ int didacticPSNetClient::publish(char* topic, bool data){
int didacticPSNetClient::publishOnChange(char* topic, bool input){ int didacticPSNetClient::publishOnChange(char* topic, bool input){
if(edgeDetected(input)){ if(edgeDetected(input)){
return publish(topic, (int)input); return publish(topic, input);
} }
//TODO: change NO_ERROR to PUBLISHED in basic publish()
return DN_ERROR_NO_ERROR; return DN_ERROR_NO_ERROR;
} }
...@@ -216,7 +215,6 @@ int didacticPSNetClient::publishOnChange(char* topic, int input, int threshold){ ...@@ -216,7 +215,6 @@ int didacticPSNetClient::publishOnChange(char* topic, int input, int threshold){
if(valueChanged(input, threshold)){ if(valueChanged(input, threshold)){
return publish(topic, input); return publish(topic, input);
} }
//TODO: change NO_ERROR to PUBLISHED in basic publish()
return DN_ERROR_NO_ERROR; return DN_ERROR_NO_ERROR;
} }
... ...
......
...@@ -39,10 +39,12 @@ ...@@ -39,10 +39,12 @@
#define MAX_LEN_TOPICS 10 #define MAX_LEN_TOPICS 10
#define MAX_LEN_PAYLOAD 20 #define MAX_LEN_PAYLOAD 20
#define DN_PUBLISH_SUCCESSULL 1
#define DN_ERROR_NO_ERROR 0 #define DN_ERROR_NO_ERROR 0
#define DN_ERROR_TOPIC_LEN -1 #define DN_ERROR_TOPIC_LEN -1
#define DN_ERROR_PAYLOAD_LEN -2 #define DN_ERROR_PAYLOAD_LEN -2
//little helpers //little helpers
#define DN_ASCII_CR 13 #define DN_ASCII_CR 13
#define DN_ASCII_NL 10 #define DN_ASCII_NL 10
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment