plotly interface based on ardunio sample code

Dependents:   Plotly_HelloWorld

Library for plotting a simple x/y scatter chart on the plot.ly website.

See plotly_HelloWorld for sample usage.

Committer:
AndyA
Date:
Tue Jul 29 11:45:09 2014 +0000
Revision:
6:e57d6e9313f4
Parent:
2:d53d74ed68ac
Child:
7:9409a72ab6c0
Added support for multiple traces;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AndyA 0:96532c59670f 1 #ifndef plotly_streaming_ethernet_h
AndyA 0:96532c59670f 2 #define plotly_streaming_ethernet_h
AndyA 0:96532c59670f 3
AndyA 0:96532c59670f 4 #include <EthernetInterface.h>
AndyA 0:96532c59670f 5 #include <TCPSocketConnection.h>
AndyA 0:96532c59670f 6
AndyA 2:d53d74ed68ac 7 #define k_bufferSize 512
AndyA 2:d53d74ed68ac 8
AndyA 0:96532c59670f 9 class plotly
AndyA 0:96532c59670f 10 {
AndyA 0:96532c59670f 11 public:
AndyA 6:e57d6e9313f4 12 plotly(const char *username, const char *api_key, const char* stream_tokens[], const char *filename, int nTraces);
AndyA 0:96532c59670f 13 ~plotly();
AndyA 0:96532c59670f 14 bool init();
AndyA 6:e57d6e9313f4 15
AndyA 6:e57d6e9313f4 16 void openStreams();
AndyA 6:e57d6e9313f4 17 void closeStreams();
AndyA 6:e57d6e9313f4 18
AndyA 6:e57d6e9313f4 19 void openStream(int stream);
AndyA 6:e57d6e9313f4 20 void closeStream(int stream);
AndyA 6:e57d6e9313f4 21 void reconnectStream(int stream);
AndyA 0:96532c59670f 22
AndyA 6:e57d6e9313f4 23 void plot(unsigned long x, int y, int stream = 0);
AndyA 6:e57d6e9313f4 24 void plot(unsigned long x, float y, int stream = 0);
AndyA 6:e57d6e9313f4 25 void plot(float x, float y, int stream = 0);
AndyA 0:96532c59670f 26
AndyA 0:96532c59670f 27 int log_level;
AndyA 0:96532c59670f 28 bool dry_run;
AndyA 0:96532c59670f 29 int maxpoints;
AndyA 0:96532c59670f 30 bool world_readable;
AndyA 0:96532c59670f 31 bool convertTimestamp;
AndyA 0:96532c59670f 32 char *timezone;
AndyA 0:96532c59670f 33 char *fileopt;
AndyA 0:96532c59670f 34
AndyA 0:96532c59670f 35 private:
AndyA 6:e57d6e9313f4 36
AndyA 6:e57d6e9313f4 37 bool print_(int d,int stream = 0);
AndyA 6:e57d6e9313f4 38 bool print_(unsigned long d,int stream = 0);
AndyA 6:e57d6e9313f4 39 bool print_(float d,int stream = 0);
AndyA 6:e57d6e9313f4 40 bool print_(char *d,int stream = 0) {return print_((const char *)d, stream);};
AndyA 6:e57d6e9313f4 41 bool print_(const char *d,int stream = 0);
AndyA 6:e57d6e9313f4 42 bool printHex_(uint16_t d,int stream = 0);
AndyA 2:d53d74ed68ac 43
AndyA 6:e57d6e9313f4 44 bool sendFormatedText(char* data, int size,int stream = 0);
AndyA 0:96532c59670f 45
AndyA 2:d53d74ed68ac 46 char buffer[512];
AndyA 2:d53d74ed68ac 47 // char rxBuffer[128];
AndyA 6:e57d6e9313f4 48 TCPSocketConnection **sockets;
AndyA 0:96532c59670f 49
AndyA 0:96532c59670f 50 unsigned long fibonacci_;
AndyA 6:e57d6e9313f4 51 const char *username_;
AndyA 6:e57d6e9313f4 52 const char *api_key_;
AndyA 6:e57d6e9313f4 53 const char** stream_tokens_;
AndyA 6:e57d6e9313f4 54 const char *filename_;
AndyA 0:96532c59670f 55 int nTraces_;
AndyA 1:d532e96fca12 56
AndyA 1:d532e96fca12 57 bool initalised;
AndyA 0:96532c59670f 58
AndyA 0:96532c59670f 59 };
AndyA 0:96532c59670f 60 #endif