From 13b972f1c565cdc609b97c9a94fef821788d174b Mon Sep 17 00:00:00 2001 From: matsfunk Date: Sun, 14 Jan 2018 18:38:35 +0100 Subject: [PATCH] fixed distribution packaging mechanism and folder structure fixed examples added multichannel example fixed keywords and properties --- .project | 11 + README.md | 2 +- build/makedistribution.xml | 15 + dist/OOCSI.cpp | 623 --------------- dist/OOCSI.h | 88 --- .../OOCSI_receiver/OOCSI_receiver.ino | 87 --- dist/examples/OOCSI_sender/OOCSI_sender.ino | 48 -- dist/library.properties | 9 - dist/oocsi.zip | Bin 0 -> 10305 bytes dist/oocsi/OOCSI.cpp | 719 ++++++++++++++++++ dist/oocsi/OOCSI.h | 98 +++ .../OOCSI_multichannel_receiver.ino | 82 ++ .../OOCSI_receiver/OOCSI_receiver.ino | 94 +++ .../examples/OOCSI_sender/OOCSI_sender.ino | 70 ++ dist/{ => oocsi}/keywords.txt | 24 +- dist/oocsi/library.properties | 9 + 16 files changed, 1114 insertions(+), 865 deletions(-) create mode 100644 .project create mode 100644 build/makedistribution.xml delete mode 100644 dist/OOCSI.cpp delete mode 100644 dist/OOCSI.h delete mode 100644 dist/examples/OOCSI_receiver/OOCSI_receiver.ino delete mode 100644 dist/examples/OOCSI_sender/OOCSI_sender.ino delete mode 100644 dist/library.properties create mode 100644 dist/oocsi.zip create mode 100644 dist/oocsi/OOCSI.cpp create mode 100644 dist/oocsi/OOCSI.h create mode 100644 dist/oocsi/examples/OOCSI_multichannel_receiver/OOCSI_multichannel_receiver.ino create mode 100644 dist/oocsi/examples/OOCSI_receiver/OOCSI_receiver.ino create mode 100644 dist/oocsi/examples/OOCSI_sender/OOCSI_sender.ino rename dist/{ => oocsi}/keywords.txt (78%) create mode 100644 dist/oocsi/library.properties diff --git a/.project b/.project new file mode 100644 index 0000000..ba6c2e3 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + oocsi-esp + + + + + + + + diff --git a/README.md b/README.md index 1a1129f..9f9885a 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# oocsi-arduino \ No newline at end of file +OOCSI for ESP \ No newline at end of file diff --git a/build/makedistribution.xml b/build/makedistribution.xml new file mode 100644 index 0000000..1b554c0 --- /dev/null +++ b/build/makedistribution.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/dist/OOCSI.cpp b/dist/OOCSI.cpp deleted file mode 100644 index d470503..0000000 --- a/dist/OOCSI.cpp +++ /dev/null @@ -1,623 +0,0 @@ -/*************************************************************************** - * The OOCSI library for the ESP8266 is created to conntect the ESP8266 - * to the OOCSI platform (https://github.com/iddi/oocsi). - * It allows to send and receive from the OOCSI platform and allows for easy - * set-up of the ESP8266 platform as an OOCSI client. - * Built by Jort Band - **************************************************************************/ - - - -#include "OOCSI.h" - -OOCSI::OOCSI(String Name, char* hostServer, void(*func)()){ - //function for setting up the OOSI send - //connect to the hostServer and setup the receiver. - OOCSIName= ""; - OOCSIName.concat(Name); - OOCSIName.concat(";"); - OOCSIName.concat('\n'); - host = hostServer; - manageWifi = false; - -} - -OOCSI::OOCSI(const char* Name, const char* hostServer, const char* Wifissid, const char* Wifipassword, void (*func)()){ - //function for setting up the whole Oocsi enviroment and login on the WiFi network - ssid = Wifissid; - password = Wifipassword; - receivedMessage = false; - theMessage = ""; - processMessage = func; - manageWifi = true; - - OOCSIName= ""; - OOCSIName.concat(Name); - OOCSIName.concat("(JSON)"); - OOCSIName.concat('\n'); - host = hostServer; - - - -} - -void OOCSI::connectWifi(){ - //function for connecting wifi, setup and reconnection is handled automagically - WiFi.mode(WIFI_STA); - WiFi.begin(ssid,password); - int counter = 0; - Serial.print("connecting"); - boolean connected = false; - - while(WiFi.status() !=WL_CONNECTED && counter<500){ - - if(WiFi.status() == WL_CONNECTED){ - if(counter>0){ - Serial.println(); - Serial.println("Wifi connection established"); - } - connected = true; - break; - } - delay(200); - counter++; - Serial.print("."); - } - if(!connected && WiFi.status() !=WL_CONNECTED ){ - Serial.println("Wifi connection attempt failed"); - } -} - -void OOCSI::subscribe(String chan){ - //function for subscribing to an OOCSI channel, function can be called multiple times - channel = ""; - channel.concat("subscribe "); - channel.concat( chan); - client.println(channel); - //Serial.println(channel); -} - -void OOCSI::unsubscribe(String chan){ - channel = ""; - channel.concat("unsubscribe "); - channel.concat(chan); - client.println(channel); -} - -boolean OOCSI::connectOocsi(){ - if(manageWifi){ - connectWifi(); - } - - //Serial.println("connecting client: "); - - static int connectionAttemptCounter = 0; - if(!client.connect(host,port)){ - //then it failed. so do it again - if(connectionAttemptCounter<100){ - connectOocsi(); - connectionAttemptCounter++; - }else{ - Serial.println("setting up OOCSI Connection failed"); - return false; - } - }else{ - //continue with setting up. - client.print(OOCSIName); - //wait for a response from the server. - while(!client.available()){ - delay(500); - } - Serial.println("connected to OOCSI"); - String message; - message = client.readStringUntil('\r'); - Serial.println(message); - prevTime = millis(); - if(message.indexOf("welcome") ==-1){ - //already connected once before, wait a second then connect again - delay(2000); - connectOocsi(); - } - - return true; - } -} - -void OOCSI::check(){ - //function which checks for new messages or pings periodically - //check if we are connected - - if(WiFi.status() !=WL_CONNECTED){ - //if not connect oocsi again - connectOocsi(); - } - - if(!client.connected()){ - //reconnect client - connectOocsi(); - } - - String message; - - while(client.available()){ - message = client.readStringUntil('\n'); - } - /* - Serial.print("Message: "); - Serial.print(message); - Serial.print("theindex of ping: "); - Serial.println(message.indexOf("ping")); - */ - if(message.indexOf("ping")>=0 || message == " " ){ - //do not process the message - Serial.println("ping;"); - //client.print("sendraw hello hello=hello\n"); - }else if(message.length()>0){ - theMessage = message; - receivedMessage = true; - processMessage(); - } - - if(millis()-prevTime>30000){ - client.println("."); - prevTime = millis(); - } - -} - -void OOCSI::printMessage(){ - //function which prints the entire incoming message - Serial.print(theMessage); -} - -int OOCSI::getInt(String key, int standard){ - - int index = theMessage.indexOf(key); - if(index ==-1){ - return standard; - }else{ - index+= key.length(); - index = index +2; //to get past the ": chars - int endindex = theMessage.indexOf(' ', index) -1; //search for the first seperation char (a space) - //Serial.print("theindex is: "); - //Serial.println(index); - String numbers = theMessage.substring(index, endindex+1); - int result = numbers.toInt(); - return result; - } -} - -long OOCSI::getLong(String key, long standard){ - - int index = theMessage.indexOf(key); - if(index ==-1){ - return standard; - }else{ - index+= key.length(); - index = index +2; //to get past the ": chars - int endindex = theMessage.indexOf(' ', index) -1; //search for the first seperation char (a space) - //Serial.print("theindex is: "); - //Serial.println(index); - String numbers = theMessage.substring(index, endindex+1); - long result = numbers.toInt(); - return result; - } -} - -float OOCSI::getFloat(String key, float standard){ - int index = theMessage.indexOf(key); - //Serial.print("theindex is: "); - //Serial.println(index); - if(index ==-1){ - return standard; - }else{ - index+= key.length(); - index = index +2; //to get past the ": chars - int endindex = theMessage.indexOf(' ', index) -1; //search for the first seperation char (a space) - //Serial.print("theindex is: "); - //Serial.println(index); - String numbers = theMessage.substring(index, endindex+1); - float result = numbers.toFloat(); - return result; - } -} - -String OOCSI::getString(String key, String standard){ - int index = theMessage.indexOf(key); - if(index ==-1){ - return standard; - }else{ - index+= key.length() + 3; //to get past the ": chars - int endindex = theMessage.indexOf('"', index); //search for the end char a: " - String result = theMessage.substring(index, endindex); - return result; - } -} - -void OOCSI::getIntArray(String key, int standard[], int* passArray, int arrayLength){ - //array opens with [, closes with ], seperation with: , so example:"data:[1,2,3,4]" - int index = theMessage.indexOf(key); - if(index ==-1){ - passArray = standard; - }else{ - index += key.length() + 3; - int closingindex = theMessage.indexOf("]", index); - int endindex = theMessage.indexOf(",", index); - boolean breakAfter = false; - for(int i = 0; i< arrayLength; i++){ - passArray[i] = theMessage.substring(index, endindex).toInt(); - index = endindex + 1; - endindex = theMessage.indexOf(",", index); - if(breakAfter){ - break; - } - if(endindex == -1 || endindex>=closingindex){ - breakAfter = true; - } - } - } -} - -void OOCSI::getFloatArray(String key, float standard[], float* passArray, int arrayLength){ - //array opens with [, closes with ], seperation with: , so example:"data:[1,2,3,4]" - int index = theMessage.indexOf(key); - if(index ==-1){ - passArray = standard; - }else{ - index += key.length() + 3; - int closingindex = theMessage.indexOf("]", index); - int endindex = theMessage.indexOf(",", index); - boolean breakAfter = false; - for(int i = 0; i< arrayLength; i++){ - passArray[i] = theMessage.substring(index, endindex).toFloat(); - index = endindex + 1; - endindex = theMessage.indexOf(",", index); - if(breakAfter){ - break; - } - if(endindex == -1 || endindex>=closingindex){ - breakAfter = true; - } - } - } -} - -void OOCSI::getStringArray(String key, String standard[], String* passArray, int arrayLength){ - int index = theMessage.indexOf(key); - if(index ==-1){ - passArray = standard; - }else{ - index += key.length() + 3; - int closingindex = theMessage.indexOf("]" , index); - int endindex = theMessage.indexOf(",", index); - boolean breakAfter = false; - for(int i = 0; i=closingindex){ - breakAfter = true; - } - } - } -} - - -String OOCSI::getSender(){ - int index = theMessage.indexOf("sender"); - String result; - if(index ==-1){ - result = ""; - return result; - }else{ - index += 9; //sender has 6 chars + 3 - int closingindex = theMessage.indexOf('"' , index); - result = theMessage.substring(index,closingindex); - return result; - } -} - -String OOCSI::getRecipient(){ - int index = theMessage.indexOf("recipient"); - String result; - if(index ==-1){ - result = ""; - return result; - }else{ - index += 9; //sender has 6 chars + 3 - int closingindex = theMessage.indexOf('"' , index); - result = theMessage.substring(index,closingindex); - return result; - } -} - -long OOCSI::getTimeStamp(){ - int index = theMessage.indexOf("timestamp"); - if(index ==-1){ - return 0; - }else{ - index+= 9; //timestamp is nine chars long - index = index +2; //to get past the ": chars - int endindex = theMessage.indexOf(',', index) -1; //search for the first seperation char (a comma) - //Serial.print("theindex is: "); - //Serial.println(index); - //check if numbers is longer then 10 (to prevent overflowing the number) - Serial.print("startindex: "); - Serial.print(index); - Serial.print("\tendindex: "); - Serial.print(endindex); - if(endindex-index > 10){ - //cut the string - index = endindex - 9; - } - Serial.print("\tstartindex2: "); - Serial.println(index); - String numbers = theMessage.substring(index, endindex+1); - Serial.print("temp timestamp: "); - Serial.println(numbers); - - long result = numbers.toInt(); - return result; - } -} - -boolean OOCSI::has(String key){ - int index = theMessage.indexOf(key); - if(index == -1){ - return false; - }else{ - return true; - } -} - -String OOCSI::keys(){ - //function for outputting all the keys in the message - //after{ and before [, then after ] - - int i = 0; - //first search for the first entry and the { , [ and ] symbols - int comma = theMessage.indexOf(","); - int bracket = theMessage.indexOf("{"); - int endofKey = theMessage.indexOf(":"); - - //first key - String thekeys = ""; - //get substring of key - String firstKey = theMessage.substring(bracket+2, endofKey-2); - thekeys.concat(firstKey); - - String restMessage = theMessage.substring(endofKey + 1); - boolean gotKeys = true; - - while(gotKeys){ - //go through the message. - //check for the smallest sentence - //finding the next either after a , or { - comma = restMessage.indexOf(","); - bracket = restMessage.indexOf("{"); - endofKey = restMessage.indexOf(":"); - - //check if there still is a key otherwise break - if(comma == -1 && bracket == -1){ - gotKeys = false; - break; - } - String tempkey; - if(bracket>comma){ - //use the comma as entry point - tempkey = restMessage.substring(comma + 2, endofKey -2); //+2 to skip over - - }else{ - tempkey = restMessage.substring(bracket + 2, endofKey -2); - } - - thekeys.concat(", "); - thekeys.concat(tempkey); - //now reitterate again. - restMessage = restMessage.substring(endofKey +1); - } -} - -void OOCSI::newMessage(String receiver){ - //function for setting up a new message for sending over OOCSI - //basically clears the old message and sets the receiver - messageReceiver = receiver; - outgoingMessage = "sendraw "; - outgoingMessage.concat(receiver); - outgoingMessage.concat(" {"); - firstval=true; -} - -void OOCSI::sendInt(String key, int value){ - //function for sending an int to OOCSI - if(firstval){ - outgoingMessage.concat('"'); - }else{ - outgoingMessage.concat(","); - outgoingMessage.concat('"'); - } - outgoingMessage.concat(key); - outgoingMessage.concat('"'); - outgoingMessage.concat(":"); - //outgoingMessage.concat('"'); - String no = String(value,DEC); - outgoingMessage.concat(no); - //outgoingMessage.concat('"'); -} -void OOCSI::sendLong(String key, long value){ - //function for sending an int to OOCSI - if(firstval){ - outgoingMessage.concat('"'); - }else{ - outgoingMessage.concat(","); - outgoingMessage.concat('"'); - } - outgoingMessage.concat(key); - outgoingMessage.concat('"'); - outgoingMessage.concat(":"); - //outgoingMessage.concat('"'); - String no = String(value,DEC); - outgoingMessage.concat(no); - //outgoingMessage.concat('"'); -} - -void OOCSI::sendFloat(String key, float value){ - //function for sending a float to OOCSI - if(firstval){ - outgoingMessage.concat('"'); - }else{ - outgoingMessage.concat(","); - outgoingMessage.concat('"'); - } - outgoingMessage.concat(key); - outgoingMessage.concat('"'); - outgoingMessage.concat(":"); - //outgoingMessage.concat('"'); - String no = String(value,DEC); - outgoingMessage.concat(no); - //outgoingMessage.concat('"'); -} -void OOCSI::sendString(String key, String value){ - if(firstval){ - outgoingMessage.concat('"'); - }else{ - outgoingMessage.concat(","); - outgoingMessage.concat('"'); - } - outgoingMessage.concat(key); - outgoingMessage.concat('"'); - outgoingMessage.concat(":"); - outgoingMessage.concat('"'); - outgoingMessage.concat(value); - outgoingMessage.concat('"'); -} -void OOCSI::sendIntArray(String key, int* value, int len){ - //function for sending an array of ints - if(firstval){ - outgoingMessage.concat('"'); - }else{ - outgoingMessage.concat(","); - outgoingMessage.concat('"'); - } - outgoingMessage.concat(key); - outgoingMessage.concat('"'); - outgoingMessage.concat(":"); - outgoingMessage.concat('['); - for(int i = 0; i -class OOCSI{ - public: - //setup functions - OOCSI(String Name, char* hostServer, void (*func)()); - OOCSI(const char* Name, const char* hostServer, const char* Wifissid, const char* wifipassword, void (*func)()); - boolean connectOocsi(); - void check(); - void subscribe(String chan); - void unsubscribe(String chan); //TODO: test - - //retrieve data functions - void printMessage(); - int getInt(String key, int standard); - long getLong(String key, long standard); //TODO: test - float getFloat(String key, float standard); - String getString(String key, String standard); - void getIntArray(String key, int standard[], int* passArray, int arrayLength); //make it return a string pointer, use struct??, need size. - void getFloatArray(String key, float standard[], float* passArray, int arrayLength); //make it return a float pointer - void getStringArray(String key, String standard[], String* passArray, int arrayLength); //make it return a string pointer - String getSender(); //TODO: test - String getRecipient(); //TODO: test - long getTimeStamp(); //TODO: test //TODO: test - boolean has(String key); //TODO: test - String keys(); //TODO: test - - - - //send data functions - void newMessage(String receiver); - void sendInt(String key, int value); - void sendLong(String key, long value); - void sendFloat(String key, float value); - void sendString(String key, String value); - void sendIntArray(String key, int* value, int len); - void sendFloatArray(String key, float* value, int len); - void sendStringArray(String key, String* value, int len); - void sendMessage(); - void printSendMessage(); - - //misc functions - String getClients(); //TODO: test - String getChannels(); //TODO: test/create - boolean containsClient(String clientName); //TODO: test - //void removeSlashes(); //To cope with random popping up slashes //TODO: test - - - - private: - WiFiClient client; - boolean manageWifi; - void connectWifi(); - void checkPing(); - const uint16_t port = 4444; - String theMessage; - String outgoingMessage; - String messageReceiver; - boolean firstval; - String OOCSIName; - const char* host; - const char* ssid; - const char* password; - String channel; - //uint16_t connectionAttemptCounter ; - boolean receivedMessage; - void (*processMessage)(); - boolean OOCSIConnected; - long prevTime; -}; - -#endif diff --git a/dist/examples/OOCSI_receiver/OOCSI_receiver.ino b/dist/examples/OOCSI_receiver/OOCSI_receiver.ino deleted file mode 100644 index ce4782d..0000000 --- a/dist/examples/OOCSI_receiver/OOCSI_receiver.ino +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************** - * Example of the OOCSI library connecting to WiFi and receiving messages - * over OOCSI. Designed to work with the processing OOCSI DataSender example - **************************************************************************/ - -#include -#include "OOCSI.h" - -const char* OOCSIName = "ESP8266_OOCSI_CLIENT_RECEIVER"; //name for connecting with OOCSI -const char* hostserver = "your.server.adres"; //put the adress of your OOCSI server here, can be a web page or an IP adres string -const char* ssid = "yourssid"; //SSID of your Wifi network, the library currently does not support WPA2 Enterprise networks -const char* password = "yourpassword"; //Password of your Wifi network. -const char* OOCSIChannel = "testchannel"; //name of the channel you want to subscribe to (can subscribe to multiple channels) - -OOCSI oocsi(OOCSIName, hostserver, ssid, password, proccessOOCSI); //setting up OOCSI. processOOCSI is the name of the fucntion to call when receiving messages, can be a random function name. - - -void setup() { - // put your setup code here, to run once: - Serial.begin(115200); - Serial.println("connecting Wifi"); - oocsi.connectOocsi(); //connect wifi and OOCSI to the server. - Serial.println("subscribing"); - oocsi.subscribe(OOCSIChannel); //subscribe to a channel - - //now print out the clients and channels - Serial.print("the clients: "); - Serial.println(oocsi.getClients()); //WARNING: do not use the function getClients in the oocsi processing function - Serial.print("the channels: "); - Serial.println(oocsi.getChannels()); //WARNING: Do not use the getChannels function in the oocsi processing function - - //check if we are in the client list - Serial.print("is "); - Serial.print(OOCSIName); - Serial.print(" a client?: "); - Serial.println(oocsi.containsClient(OOCSIName)); -} - -void loop() { - // put your main code here, to run repeatedly: - oocsi.check(); //function needs to be checked in order for OOCSI to process incoming data. -} - -void proccessOOCSI(){ - //function which OOCSI calls when an OOCSI message is received. - oocsi.printMessage(); //function for printing the raw incoming message (JSON string). - Serial.println(); - - //printing the output of different variables of the message. - //Standard setup is (key, standardvalue). The standard value will be returned when the key is not included in the OOCSI message. - Serial.print("string: " ); - Serial.print(oocsi.getString("string","-200")); - Serial.print("\tfloat: "); - Serial.print(oocsi.getFloat("float",-200.0)); - Serial.print("\t int: "); - Serial.print(oocsi.getInt("integer",-200)); - Serial.print("\t long: "); - Serial.print(oocsi.getInt("long",-200)); - Serial.print("\t intArray: "); - - //printing out an Array requires you to pass the maximum length of the array and an array to be used to display the results in. - int standardarray[] = {1,2}; - int results[] = {0,0}; - oocsi.getIntArray("array", standardarray, results, 3); - Serial.print(results[0]); - Serial.print(','); - Serial.print(results[1]); - - - float standAr[] = {1.0,2.0}; - float res[] = {0.0,0.0}; - oocsi.getFloatArray("array", standAr, res, 2); - Serial.print("\t floatArray: "); - Serial.print(res[0]); - Serial.print(", "); - Serial.print(res[1]); - - Serial.print("\t sender: "); - Serial.print(oocsi.getSender()); - Serial.print("\t recipient: "); - Serial.print(oocsi.getRecipient()); - Serial.print("\t sender: "); - Serial.print(oocsi.getSender()); - Serial.print("\t Timestamp: "); - Serial.print(oocsi.getTimeStamp()); - Serial.println(); -} diff --git a/dist/examples/OOCSI_sender/OOCSI_sender.ino b/dist/examples/OOCSI_sender/OOCSI_sender.ino deleted file mode 100644 index 529224d..0000000 --- a/dist/examples/OOCSI_sender/OOCSI_sender.ino +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************** -* Example of the OOCSI library connecting to WiFi and sending messages -* over OOCSI. -**************************************************************************/ - -#include -#include "OOCSI.h" - -const char* OOCSIName = "ESP8266_OOCSI_CLIENT_SENDER"; //name for connecting with OOCSI -const char* hostserver = "your.server.adres"; //put the adress of your OOCSI server here, can be a web page or an IP adres string -const char* ssid = "yourssid"; //SSID of your Wifi network, the library currently does not support WPA2 Enterprise networks -const char* password = "yourpassword"; //Password of your Wifi network. -const char* OOCSIChannel = "testchannel"; //name of the channel you want to subscribe to (can subscribe to multiple channels) - -OOCSI oocsi(OOCSIName, hostserver, ssid, password, proccessOOCSI); //setting up OOCSI. processOOCSI is the name of the fucntion to call when receiving messages, can be a random function name. - - -void setup() { -// put your setup code here, to run once: -Serial.begin(115200); -Serial.println("connecting Wifi"); -oocsi.connectOocsi(); //connect wifi and OOCSI to the server. -Serial.println("subscribing"); -oocsi.subscribe(OOCSIChannel); //subscribe to a channel - -} - -void loop() { -// put your main code here, to run repeatedly: -oocsi.newMessage((String) OOCSIChannel); // -oocsi.sendInt("int", 40); -oocsi.sendLong("long", (long) 51250220); -oocsi.sendFloat("float", 50.0); -oocsi.sendString("string" , "hello world"); -int theIntArray[] = {45,55,60}; -oocsi.sendIntArray("intArray" ,theIntArray , 3); -float theFloatArray[] = {55.0,65.0,75.0}; -oocsi.sendFloatArray("floatArray", theFloatArray, 3); -String stringArrayToSend[] = {"Batman", "Superman", "Deadpool"}; -oocsi.sendStringArray("stringArray", stringArrayToSend, 3); -oocsi.sendMessage(); -oocsi.printSendMessage(); //prints out the message how it is send to the OOCSI server -oocsi.check(); //function needs to be checked in order for OOCSI to process incoming data. -delay(500); -} - -void proccessOOCSI(){ -} \ No newline at end of file diff --git a/dist/library.properties b/dist/library.properties deleted file mode 100644 index d606a39..0000000 --- a/dist/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=OOCSI -version=1.01 -author=Jort Band -maintainer=Jort Band -sentence=OOCSI client library for the ESP8266 -paragraph=Library for easy connection and configuration of the ESP8266 module with the OOCSI platform -category=Communication -url=https://github.com/iddi/oocsi -architectures=esp8266 \ No newline at end of file diff --git a/dist/oocsi.zip b/dist/oocsi.zip new file mode 100644 index 0000000000000000000000000000000000000000..41c1d39fb1da83b7e5eed845b49520d5e4024d2f GIT binary patch literal 10305 zcmaKS1yo$w(sko5!QI_0xVyW%LnDnR5G-g27TklodvFcX1Sbh@!QI{d@aCUP-ZwL^ zdaYi4*QveFx##rVT~%GG3Q*99002Ay0Gq&~2>8ule|~myvTy^ks{ZmRi1}|Hv|m0} zo@S2D4pwfzId{kZw=?74omEsMG~`SiJsjMD7Pe*}kd=dptCfWn@RgP8Z$uKY|4l^l zZ$$rqCHp^EqJP7>S%EBnn-v}~@pJhgb`mi zvIqrL%Km(dlID%d@-k9v%gPqgGs=7=d*zyk3N8_5?D zwGTc!=;Ar^)T~v@9dB+p#|GVM{hguvfWqnIAzS%O+WW<*_~3c_XjC}Nnj8H0t zzB!e_jVqyBswsg%xn&$COnqr7y|lOB5{)${Tk4W<;Stu890L zGc}#SehqFY<@kgMK82RXhp5NB4{F_ti7H)MCdKd4qj3aFuh%V(!OF$K5-o@ZmEOh>^5=luLc&4C_9%NmVT;xE0B+ zM@Q?eFXm?J%tit~y`7wcxHeQXjzb8-A9%ZEGbl6^$DCv}Kw6A}8zLn~!Y2X6JsmU+ zKO0Urf=UCU2!m3ZPUBCejrjuCCs$^zM|k)#vcPwmKePpbavMhUa~}iq4Mw3J7*`S6 zxI4yDELb#9et)V~6qFWp5q~>-E3ObqcfxoPm&ufjFw|8n&SQV+S2j#qrFh%OZZ32A zI(n9}zCbNVNy${U%8}nuT;M%NKSlsOOLIO99P4N3Q0Q9y%Tkw49Mknd^cEH@0#n#n zv4AR#R5hH|RiC)w^8~5;Gu;8WpaWdQIa;$WRZdy@J}NpqGV-sYu8W+mDDOBLR;{g( z!v^KzEFeCrWqSGLq-G)Gz)_AVaeX%0L4ptR)O4dUQmrInfHtxU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 c@qgDIRRx&mo 0) { + println(); + println("Wifi connection established"); + } + connected = true; + break; + } + + if(activityLEDPin > -1) { + digitalWrite(activityLEDPin, HIGH); + delay(20); + digitalWrite(activityLEDPin, LOW); + delay(20); + digitalWrite(activityLEDPin, HIGH); + delay(20); + digitalWrite(activityLEDPin, LOW); + delay(100); + } + print("."); + + // new line + if (counter % 80 == 0) { + println(); + print("Connecting to Wifi"); + } + + // wait before next attempt + delay(200); + } + if (!connected && WiFi.status() != WL_CONNECTED ) { + println("Wifi connection attempt failed"); + } +} + +// function for subscribing to an OOCSI channel, function can be called multiple times +void OOCSI::subscribe(const char* chan) { + String channel = ""; + channel.concat("subscribe "); + channel.concat(chan); + client.println(channel); +} + +// function for unsubscribing from an OOCSI channel, function can be called multiple times +void OOCSI::unsubscribe(const char* chan) { + String channel = ""; + channel.concat("unsubscribe "); + channel.concat(chan); + client.println(channel); +} + +// function to internally connect to OOCSI (needs all variables set up) +boolean OOCSI::internalConnect() { + if (manageWifi) { + connectWifi(); + } + + println(); + println("Connecting to OOCSI"); + + static int connectionAttemptCounter = 0; + if (!client.connect(host, port)) { + //then it failed. so do it again + if (connectionAttemptCounter++ < 100) { + internalConnect(); + } else { + println("setting up OOCSI Connection failed"); + return false; + } + } else { + // continue with client-server handshake + client.print(OOCSIName); + + // wait for a response from the server (max. 20 sec) + int waitingResponseCounter = 0; + while (!client.available() && waitingResponseCounter++ < 40) { + delay(500); + } + + if (client.available()) { + String message = client.readStringUntil('\n'); + println(message); + prevTime = millis(); + + if (message.indexOf("welcome") == -1) { + // wait before connecting again + delay(2000); + return internalConnect(); + } + + return true; + } else { + return false; + } + } +} + +// function which checks for new messages or pings periodically +void OOCSI::check() { + //check if we are connected to the WIFI + if (WiFi.status() != WL_CONNECTED) { + //if not connect oocsi again + internalConnect(); + } + if (!client.connected()) { + //reconnect client + internalConnect(); + } + + String message; + while (client.available() && message.length() == 0) { + message = client.readStringUntil('\n'); + } + + if (message.indexOf("ping") >= 0 || message == " " ) { + // it's a heart beat, send one back + println("ping;"); + client.println(".\n"); + prevTime = millis(); + } else if (message.length() > 0) { + // process the message + theMessage = message; + receivedMessage = true; + processMessage(); + + if(activityLEDPin > -1) { + delay(20); + digitalWrite(activityLEDPin, HIGH); + delay(20); + digitalWrite(activityLEDPin, LOW); + delay(20); + digitalWrite(activityLEDPin, HIGH); + delay(20); + digitalWrite(activityLEDPin, LOW); + } + } + + if (millis() - prevTime > 30000) { + client.println("."); + prevTime = millis(); + } +} + +void OOCSI::printMessage() { + //function which prints the entire incoming message + print(theMessage); +} + +int OOCSI::getInt(const char* key, int standard) { + + int index = theMessage.indexOf(*key); + if (index == -1) { + return standard; + } else { + index += strlen(key); + index = index + 2; //to get past the ": chars + int endindex = theMessage.indexOf(' ', index) - 1; //search for the first seperation char (a space) + //print("theindex is: "); + //println(index); + String numbers = theMessage.substring(index, endindex + 1); + int result = numbers.toInt(); + return result; + } +} + +long OOCSI::getLong(const char* key, long standard) { + + int index = theMessage.indexOf(key); + if (index == -1) { + return standard; + } else { + index += strlen(key); + index = index + 2; //to get past the ": chars + int endindex = theMessage.indexOf(' ', index) - 1; //search for the first seperation char (a space) + //print("theindex is: "); + //println(index); + String numbers = theMessage.substring(index, endindex + 1); + long result = numbers.toInt(); + return result; + } +} + +float OOCSI::getFloat(const char* key, float standard) { + int index = theMessage.indexOf(key); + //print("theindex is: "); + //println(index); + if (index == -1) { + return standard; + } else { + index += strlen(key); + index = index + 2; //to get past the ": chars + int endindex = theMessage.indexOf(' ', index) - 1; //search for the first seperation char (a space) + //print("theindex is: "); + //println(index); + String numbers = theMessage.substring(index, endindex + 1); + float result = numbers.toFloat(); + return result; + } +} + +String OOCSI::getString(const char* key, const char* standard) { + int index = theMessage.indexOf(key); + if (index == -1) { + return standard; + } else { + index += strlen(key) + 3; //to get past the ": chars + int endindex = theMessage.indexOf('"', index); //search for the end char a: " + String result = theMessage.substring(index, endindex); + return result; + } +} + +void OOCSI::getIntArray(const char* key, int standard[], int* passArray, int arrayLength) { + //array opens with [, closes with ], seperation with: , so example:"data:[1,2,3,4]" + int index = theMessage.indexOf(key); + if (index == -1) { + passArray = standard; + } else { + index += strlen(key) + 3; + int closingindex = theMessage.indexOf("]", index); + int endindex = theMessage.indexOf(',', index); + boolean breakAfter = false; + for (int i = 0; i < arrayLength; i++) { + passArray[i] = theMessage.substring(index, endindex).toInt(); + index = endindex + 1; + endindex = theMessage.indexOf(',', index); + if (breakAfter) { + break; + } + if (endindex == -1 || endindex >= closingindex) { + breakAfter = true; + } + } + } +} + +void OOCSI::getFloatArray(const char* key, float standard[], float* passArray, int arrayLength) { + //array opens with [, closes with ], seperation with: , so example:"data:[1,2,3,4]" + int index = theMessage.indexOf(key); + if (index == -1) { + passArray = standard; + } else { + index += strlen(key) + 3; + int closingindex = theMessage.indexOf("]", index); + int endindex = theMessage.indexOf(',', index); + boolean breakAfter = false; + for (int i = 0; i < arrayLength; i++) { + passArray[i] = theMessage.substring(index, endindex).toFloat(); + index = endindex + 1; + endindex = theMessage.indexOf(',', index); + if (breakAfter) { + break; + } + if (endindex == -1 || endindex >= closingindex) { + breakAfter = true; + } + } + } +} + +// void OOCSI::getStringArray(const char* key, char* standard[], char* passArray[], int arrayLength) { +// int index = theMessage.indexOf(key); +// if (index == -1) { +// passArray = standard; +// } else { +// index += strlen(key) + 3; +// int closingindex = theMessage.indexOf("]" , index); +// int endindex = theMessage.indexOf(',', index); +// boolean breakAfter = false; +// for (int i = 0; i < arrayLength; i++) { +// passArray[i] = theMessage.substring(index, endindex).c_str(); +// index = endindex + 1; +// endindex = theMessage.indexOf(',', index); +// if (breakAfter) { +// break; +// } +// if (endindex == -1 || endindex >= closingindex) { +// breakAfter = true; +// } +// } +// } +// } + +String OOCSI::getSender() { + int index = theMessage.indexOf("sender"); + String result; + if (index == -1) { + result = ""; + return result; + } else { + // sender has 6 chars + 3 for delimiters + index += 6 + 3; + int closingindex = theMessage.indexOf('"' , index); + result = theMessage.substring(index, closingindex); + return result; + } +} + +String OOCSI::getRecipient() { + int index = theMessage.indexOf("recipient"); + String result; + if (index == -1) { + result = ""; + return result; + } else { + // recipient has 9 chars + 3 for delimiters + index += 9 + 3; + int closingindex = theMessage.indexOf('"' , index); + result = theMessage.substring(index, closingindex); + return result; + } +} + +long OOCSI::getTimeStamp() { + int index = theMessage.indexOf("timestamp"); + if (index == -1) { + return -0; + } else { + // timestamp has 9 chars long + 2 for delimiters + index += 9 + 2; + int endindex = theMessage.indexOf(',', index) - 1; //search for the first seperation char (a comma) + + //check if numbers is longer then 10 (to prevent overflowing the number) + // print("startindex: "); + // print(index); + // print("\tendindex: "); + // print(endindex); + if (endindex - index > 10) { + //cut the string + index = endindex - 9; + } + // print("\tstartindex2: "); + // println(index); + String numbers = theMessage.substring(index, endindex + 1); + // print("temp timestamp: "); + // println(numbers); + + long result = numbers.toInt(); + return result; + } +} + +boolean OOCSI::has(const char* key) { + int index = theMessage.indexOf(key); + if (index == -1) { + return false; + } else { + return true; + } +} + +String OOCSI::keys() { + //function for outputting all the keys in the message + //after{ and before [, then after ] + + int i = 0; + //first search for the first entry and the { , [ and ] symbols + int comma = theMessage.indexOf(','); + int bracket = theMessage.indexOf('{'); + int endofKey = theMessage.indexOf(':'); + + //first key + String thekeys = ""; + //get substring of key + String firstKey = theMessage.substring(bracket + 2, endofKey - 2); + thekeys.concat(firstKey); + + String restMessage = theMessage.substring(endofKey + 1); + boolean gotKeys = true; + + while (gotKeys) { + //go through the message. + //check for the smallest sentence + //finding the next either after a , or { + comma = restMessage.indexOf(','); + bracket = restMessage.indexOf('{'); + endofKey = restMessage.indexOf(':'); + + //check if there still is a key otherwise break + if (comma == -1 && bracket == -1) { + gotKeys = false; + break; + } + String tempkey; + if (bracket > comma) { + //use the comma as entry point + tempkey = restMessage.substring(comma + 2, endofKey - 2); //+2 to skip over + + } else { + tempkey = restMessage.substring(bracket + 2, endofKey - 2); + } + + thekeys.concat(", "); + thekeys.concat(tempkey); + //now reitterate again. + restMessage = restMessage.substring(endofKey + 1); + } +} + +// function for setting up a new message for sending over OOCSI +OOCSI OOCSI::newMessage(const char* receiver) { + //basically clears the old message and sets the receiver + outgoingMessage = "sendraw "; + outgoingMessage.concat(receiver); + outgoingMessage.concat(" {"); + firstval = true; + + return *this; +} + +// function for sending an int to OOCSI +OOCSI OOCSI::addInt(const char* key, int value) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + String no = String(value, DEC); + outgoingMessage.concat(no); + + return *this; +} + +// function for sending an int to OOCSI +OOCSI OOCSI::addLong(const char* key, long value) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + String no = String(value, DEC); + outgoingMessage.concat(no); + + return *this; +} + +// function for sending a float to OOCSI +OOCSI OOCSI::addFloat(const char* key, float value) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + String no = String(value, DEC); + outgoingMessage.concat(no); + + return *this; +} + +OOCSI OOCSI::addString(const char* key, const char* value) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + outgoingMessage.concat('"'); + outgoingMessage.concat(value); + outgoingMessage.concat('"'); + + return *this; +} + +// function for sending an array of ints +OOCSI OOCSI::addIntArray(const char* key, int* value, int len) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + outgoingMessage.concat('['); + for (int i = 0; i < len; i++) { + String no = String(value[i], DEC); + outgoingMessage.concat(no); + if (i < len - 1) { + outgoingMessage.concat(','); + } + } + outgoingMessage.concat(']'); + + return *this; +} + +// function for sending an array of floats +OOCSI OOCSI::addFloatArray(const char* key, float* value, int len) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + outgoingMessage.concat('['); + for (int i = 0; i < len; i++) { + String no = String(value[i], DEC); + outgoingMessage.concat(no); + if (i < len - 1) { + outgoingMessage.concat(','); + } + } + outgoingMessage.concat(']'); + + return *this; +} + +//function for sending an array of Strings +OOCSI OOCSI::addStringArray(const char* key, const char* value, int len) { + if (firstval) { + outgoingMessage.concat('"'); + firstval = false; + } else { + outgoingMessage.concat(','); + outgoingMessage.concat('"'); + } + outgoingMessage.concat(key); + outgoingMessage.concat('"'); + outgoingMessage.concat(':'); + outgoingMessage.concat('['); + for (int i = 0; i < len; i++) { + outgoingMessage.concat('"'); + outgoingMessage.concat(value[i]); + outgoingMessage.concat('"'); + if (i < len - 1) { + outgoingMessage.concat(','); + } + } + outgoingMessage.concat(']'); + + return *this; +} + +// close and send out the message +void OOCSI::sendMessage() { + outgoingMessage.concat('}'); + outgoingMessage.concat('\n'); + client.println(outgoingMessage); +} + +// log the outgoing message +void OOCSI::printSendMessage() { + println(outgoingMessage); +} + + +String OOCSI::getClients() { + //basically send a message and then wait for the response client list. + //first read the standard messages + check(); + //now send and receive + client.println("clients"); + String message; + //keep waiting for a message + while (!client.available()) { + delay(20); + } + while (client.available()) { + message = client.readStringUntil('\n'); + } + return message; +} + +String OOCSI::getChannels() { + //basically send a message and then wait for the response channels list. + //first read the standard messages + check(); + //now send and receive + client.println("channels"); + String message; + //keep waiting for a message + while (!client.available()) { + delay(20); + } + while (client.available()) { + message = client.readStringUntil('\n'); + } + return message; +} + +boolean OOCSI::containsClient(const char* clientName) { + //check for the client. + String clientlist = getClients(); + if (clientlist.indexOf(clientName) == -1) { + //not found + return false; + } + + return true; +} + +void OOCSI::print(const String &message) { + if(logging) + Serial.print(message); +} + +void OOCSI::print(char message) { + if(logging) + Serial.print(message); +} + +void OOCSI::println() { + if(logging) + Serial.println(); +} + +void OOCSI::println(const String &message) { + if(logging) + Serial.println(message); +} + +void OOCSI::println(char message) { + if(logging) + Serial.println(message); +} + +void OOCSI::setActivityLEDPin(int ledPin) { + activityLEDPin = ledPin; +} + +void OOCSI::setLogging(boolean log) { + logging = log; +} + +/* + void OOCSI::removeSlashes(){ + int slashloc = theMessage.indexOf((char) 92); + while(slashloc != -1) + theMessage.remove(slashloc); //92 is a: \ + slashloc = theMessage.indexOf((char) 92); + } +*/ diff --git a/dist/oocsi/OOCSI.h b/dist/oocsi/OOCSI.h new file mode 100644 index 0000000..18a3fab --- /dev/null +++ b/dist/oocsi/OOCSI.h @@ -0,0 +1,98 @@ +/*************************************************************************** + * The OOCSI library for the ESP32 and ESP 8266 is created to connect ESPs + * to the OOCSI platform (https://github.com/iddi/oocsi). + * It allows to send and receive from the OOCSI platform and allows for easy + * set-up of the ESP32 and ESP8266 platforms as OOCSI clients. + * + * Developed by Jort Band, Mathias Funk + **************************************************************************/ + +#ifndef OOCSI_h +#define OOCSI_h + +#ifdef ESP32 +#include +#else +#include +#endif + +class OOCSI{ + public: + + // setup, connection, subscription + OOCSI(); + boolean connect(const char* Name, const char* hostServer, void (*func)()); + boolean connect(const char* Name, const char* hostServer, const char* Wifissid, const char* wifipassword, void (*func)()); + void check(); + void subscribe(const char* chan); + void unsubscribe(const char* chan); //TODO: test + + // sending data + OOCSI newMessage(const char* receiver); + OOCSI addInt(const char* key, int value); + OOCSI addLong(const char* key, long value); + OOCSI addFloat(const char* key, float value); + OOCSI addString(const char* key, const char* value); + OOCSI addIntArray(const char* key, int* value, int len); + OOCSI addFloatArray(const char* key, float* value, int len); + OOCSI addStringArray(const char* key, const char* value, int len); + void sendMessage(); + void printSendMessage(); + + // receiving data + String getSender(); //TODO: test + String getRecipient(); //TODO: test + int getInt(const char* key, int standard); + long getLong(const char* key, long standard); //TODO: test + float getFloat(const char* key, float standard); + String getString(const char* key, const char* standard); + void getIntArray(const char* key, int standard[], int* passArray, int arrayLength); //make it return a string pointer, use struct??, need size. + void getFloatArray(const char* key, float standard[], float* passArray, int arrayLength); //make it return a float pointer + // void getStringArray(const char* key, char* standard[], char* passArray[], int arrayLength); //make it return a string pointer + long getTimeStamp(); //TODO: test //TODO: test + boolean has(const char* key); //TODO: test + String keys(); //TODO: test + void printMessage(); + void setActivityLEDPin(int ledPin); + void setLogging(boolean log); + + // misc functions + String getClients(); //TODO: test + String getChannels(); //TODO: test/create + boolean containsClient(const char* clientName); //TODO: test + //void removeSlashes(); //To cope with random popping up slashes //TODO: test + + + private: + // OOCSI + String OOCSIName; + const char* host; + const uint16_t port = 4444; + boolean OOCSIConnected; + long prevTime; + + // WIFI + const char* ssid; + const char* password; + WiFiClient client; + boolean manageWifi; + + // messaging + String theMessage; + String outgoingMessage; + boolean receivedMessage; + boolean firstval; + int activityLEDPin; + boolean logging; + + void print(const String &message); + void print(char message); + void println(); + void println(const String &message); + void println(char message); + void connectWifi(); + boolean internalConnect(); + void (*processMessage)(); +}; + +#endif diff --git a/dist/oocsi/examples/OOCSI_multichannel_receiver/OOCSI_multichannel_receiver.ino b/dist/oocsi/examples/OOCSI_multichannel_receiver/OOCSI_multichannel_receiver.ino new file mode 100644 index 0000000..ea03605 --- /dev/null +++ b/dist/oocsi/examples/OOCSI_multichannel_receiver/OOCSI_multichannel_receiver.ino @@ -0,0 +1,82 @@ +/**************************************************************************** + Example of the OOCSI-ESP library connecting to WiFi and receiving messages + over OOCSI. Designed to work with the Processing OOCSI DataSender example + ****************************************************************************/ + +#include "OOCSI.h" + +// use this if you want the OOCSI-ESP library to manage the connection to the Wifi +// SSID of your Wifi network, the library currently does not support WPA2 Enterprise networks +const char* ssid = "yourssid"; +// Password of your Wifi network. +const char* password = "yourpassword"; + +// name for connecting with OOCSI (unique handle) +const char* OOCSIName = "ESP_OOCSI_CLIENT_MC_RECEIVER"; +// put the adress of your OOCSI server here, can be URL or IP address string +const char* hostserver = "your OOCSI server address"; +// name of the channel you want to subscribe to (can subscribe to multiple channels) +const char* channel1 = "testchannel1"; +const char* channel2 = "testchannel2"; +const char* channel3 = "testchannel3"; + +// OOCSI reference for the entire sketch +OOCSI oocsi = OOCSI(); + +// put your setup code here, to run once: +void setup() { + Serial.begin(115200); + + // output OOCSI activity on pin 5 (LED) + pinMode(5, OUTPUT); + oocsi.setActivityLEDPin(5); + + // use this to switch off logging to Serial + // oocsi.setLogging(false); + + // setting up OOCSI. processOOCSI is the name of the fucntion to call when receiving messages, can be a random function name + // connect wifi and OOCSI to the server + oocsi.connect(OOCSIName, hostserver, ssid, password, processOOCSI); + + // subscribe to a channel + Serial.println("subscribing"); + oocsi.subscribe(channel1); + oocsi.subscribe(channel2); + oocsi.subscribe(channel3); +} + +void loop() { + // put your main code here, to run repeatedly + + // let OOCSI check to process incoming data + oocsi.check(); +} + +// function which OOCSI calls when an OOCSI message is received +void processOOCSI() { + if (oocsi.getRecipient() == channel1) { + Serial.print("A message for channel1 from sender '"); + Serial.print(oocsi.getSender()); + Serial.print("' at "); + Serial.print(oocsi.getTimeStamp()); + Serial.println(); + } else if (oocsi.getRecipient() == channel2) { + Serial.print("A message for channel2 from sender '"); + Serial.print(oocsi.getSender()); + Serial.print("' at "); + Serial.print(oocsi.getTimeStamp()); + Serial.println(); + } else if (oocsi.getRecipient() == channel3) { + Serial.print("A message for channel3 from sender '"); + Serial.print(oocsi.getSender()); + Serial.print("' at "); + Serial.print(oocsi.getTimeStamp()); + Serial.println(); + } else if (oocsi.getRecipient() == OOCSIName) { + Serial.print("A direct message for just me from sender '"); + Serial.print(oocsi.getSender()); + Serial.print("' at "); + Serial.print(oocsi.getTimeStamp()); + Serial.println(); + } +} diff --git a/dist/oocsi/examples/OOCSI_receiver/OOCSI_receiver.ino b/dist/oocsi/examples/OOCSI_receiver/OOCSI_receiver.ino new file mode 100644 index 0000000..2528126 --- /dev/null +++ b/dist/oocsi/examples/OOCSI_receiver/OOCSI_receiver.ino @@ -0,0 +1,94 @@ +/**************************************************************************** + Example of the OOCSI-ESP library connecting to WiFi and receiving messages + over OOCSI. Designed to work with the Processing OOCSI DataSender example + ****************************************************************************/ + +#include "OOCSI.h" + +// use this if you want the OOCSI-ESP library to manage the connection to the Wifi +// SSID of your Wifi network, the library currently does not support WPA2 Enterprise networks +const char* ssid = "yourssid"; +// Password of your Wifi network. +const char* password = "yourpassword"; + +// name for connecting with OOCSI (unique handle) +const char* OOCSIName = "ESP_OOCSI_CLIENT_RECEIVER"; +// put the adress of your OOCSI server here, can be URL or IP address string +const char* hostserver = "your OOCSI server address"; + +// OOCSI reference for the entire sketch +OOCSI oocsi = OOCSI(); + +// put your setup code here, to run once: +void setup() { + Serial.begin(115200); + + // output OOCSI activity on pin 5 (LED) + pinMode(5, OUTPUT); + oocsi.setActivityLEDPin(5); + + // use this to switch off logging to Serial + // oocsi.setLogging(false); + + // setting up OOCSI. processOOCSI is the name of the fucntion to call when receiving messages, can be a random function name + // connect wifi and OOCSI to the server + oocsi.connect(OOCSIName, hostserver, ssid, password, processOOCSI); + + // subscribe to a channel + Serial.println("subscribing to testchannel"); + oocsi.subscribe("testchannel"); + + // check if we are in the client list + Serial.print("is "); + Serial.print(OOCSIName); + Serial.print(" a client? --> "); + Serial.println(oocsi.containsClient(OOCSIName)); +} + +void loop() { + // put your main code here, to run repeatedly: + + // let OOCSI check to process incoming data + oocsi.check(); +} + +// function which OOCSI calls when an OOCSI message is received +void processOOCSI() { + + // printing the output of different variables of the message; standard call is get(key, standard value) + // the standard value -200 will be returned when the key is not included in the OOCSI message + Serial.print("string: " ); + Serial.print(oocsi.getString("string", "-200")); + Serial.print("\tfloat: "); + Serial.print(oocsi.getFloat("float", -200.0)); + Serial.print("\t int: "); + Serial.print(oocsi.getInt("integer", -200)); + Serial.print("\t long: "); + Serial.print(oocsi.getInt("long", -200)); + Serial.print("\t intArray: "); + + // printing out an array requires you to pass the maximum length of the array + // and an array to be used to display the results in + int standardarray[] = {1, 2}; + int results[] = {0, 0}; + oocsi.getIntArray("array", standardarray, results, 3); + Serial.print(results[0]); + Serial.print(','); + Serial.print(results[1]); + + float standAr[] = {1.0, 2.0}; + float res[] = {0.0, 0.0}; + oocsi.getFloatArray("array", standAr, res, 2); + Serial.print("\t floatArray: "); + Serial.print(res[0]); + Serial.print(", "); + Serial.print(res[1]); + + Serial.print("\t sender: "); + Serial.print(oocsi.getSender()); + Serial.print("\t recipient: "); + Serial.print(oocsi.getRecipient()); + Serial.print("\t Timestamp: "); + Serial.print(oocsi.getTimeStamp()); + Serial.println(); +} diff --git a/dist/oocsi/examples/OOCSI_sender/OOCSI_sender.ino b/dist/oocsi/examples/OOCSI_sender/OOCSI_sender.ino new file mode 100644 index 0000000..3b6c8ac --- /dev/null +++ b/dist/oocsi/examples/OOCSI_sender/OOCSI_sender.ino @@ -0,0 +1,70 @@ +/*********************************************************************8*8****** + Example of the OOCSI-ESP library connecting to WiFi and sending messages + over OOCSI. Designed to work with the Processing OOCSI DataReceiver example + **********************************************************************8*8*****/ + +#include "OOCSI.h" + +// use this if you want the OOCSI-ESP library to manage the connection to the Wifi +// SSID of your Wifi network, the library currently does not support WPA2 Enterprise networks +const char* ssid = "yourssid"; +// Password of your Wifi network. +const char* password = "yourpassword"; + +// name for connecting with OOCSI (unique handle) +const char* OOCSIName = "ESP_OOCSI_CLIENT_SENDER"; +// put the adress of your OOCSI server here, can be URL or IP address string +const char* hostserver = "your OOCSI server address"; + +// OOCSI reference for the entire sketch +OOCSI oocsi = OOCSI(); + +// put your setup code here, to run once: +void setup() { + Serial.begin(115200); + + // output OOCSI activity on pin 5 (LED) + pinMode(5, OUTPUT); + oocsi.setActivityLEDPin(5); + + // use this to switch off logging to Serial + // oocsi.setLogging(false); + + // setting up OOCSI. processOOCSI is the name of the function to call when receiving messages, can be a random function name + // connect wifi and OOCSI to the server + oocsi.connect(OOCSIName, hostserver, ssid, password, processOOCSI); +} + +// put your main code here, to run repeatedly: +void loop() { + // create a new message + oocsi.newMessage("testchannel"); + + // add data (primitive data types int, float, long, string) + // the labels such as "count" or "timestamp" are completely free to choose + oocsi.addInt("count", 40); + oocsi.addLong("timestamp", (long) 51250220); + oocsi.addFloat("float_point", 50.0); + oocsi.addString("greeting" , "hello world"); + + // sending arrays + int theIntArray[] = {45, 55, 60}; + oocsi.addIntArray("intArray" , theIntArray , 3); + + float theFloatArray[] = {55.0, 65.0, 75.0}; + oocsi.addFloatArray("floatArray", theFloatArray, 3); + + // this command will send the message; don't forget to call this after creating a message + oocsi.sendMessage(); + + // prints out the raw message (how it is sent to the OOCSI server) + // oocsi.printSendMessage(); + + // needs to be checked in order for OOCSI to process incoming data. + oocsi.check(); + delay(500); +} + +void processOOCSI() { + // don't do anything; we are sending only +} diff --git a/dist/keywords.txt b/dist/oocsi/keywords.txt similarity index 78% rename from dist/keywords.txt rename to dist/oocsi/keywords.txt index e71c5e4..ad011c8 100644 --- a/dist/keywords.txt +++ b/dist/oocsi/keywords.txt @@ -12,11 +12,12 @@ OOCSI KEYWORD1 ####################################### # Methods and Functions (KEYWORD2) ####################################### -connectOocsi KEYWORD2 +connect KEYWORD2 check KEYWORD2 subscribe KEYWORD2 unsubscribe KEYWORD2 -printMessage KEYWORD2 + + getInt KEYWORD2 getLong KEYWORD2 getFloat KEYWORD2 @@ -29,16 +30,21 @@ getRecipient KEYWORD2 getTimeStamp KEYWORD2 has KEYWORD2 keys KEYWORD2 +printMessage KEYWORD2 +setActivityLEDPin KEYWORD2 +setLogging KEYWORD2 + newMessage KEYWORD2 -sendInt KEYWORD2 -sendLong KEYWORD2 -sendFloat KEYWORD2 -sendString KEYWORD2 -sendIntArray KEYWORD2 -sendFloatArray KEYWORD2 -sendStringArray KEYWORD2 +addInt KEYWORD2 +addLong KEYWORD2 +addFloat KEYWORD2 +addString KEYWORD2 +addIntArray KEYWORD2 +addFloatArray KEYWORD2 +addStringArray KEYWORD2 sendMessage KEYWORD2 printSendMessage KEYWORD2 + getClients KEYWORD2 getChannels KEYWORD2 containsClient KEYWORD2 diff --git a/dist/oocsi/library.properties b/dist/oocsi/library.properties new file mode 100644 index 0000000..5d8a2b0 --- /dev/null +++ b/dist/oocsi/library.properties @@ -0,0 +1,9 @@ +name=OOCSI +version=1.2 +author=Jort Band, Mathias Funk +maintainer=Mathias Funk +sentence=OOCSI client library for the ESP32 and ESP8266 +paragraph=Library for easy connection and communication with the ESP32 and ESP8266 modules over the OOCSI platform +category=Communication +url=https://github.com/iddi/oocsi +architectures=esp32,esp8266 \ No newline at end of file