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.

Revision:
8:d4f705ba2ea5
Parent:
7:9409a72ab6c0
diff -r 9409a72ab6c0 -r d4f705ba2ea5 plotly.h.orig
--- a/plotly.h.orig	Tue Jul 29 13:30:31 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-#ifndef plotly_streaming_ethernet_h
-#define plotly_streaming_ethernet_h
-
-#include <EthernetInterface.h>
-#include <TCPSocketConnection.h>
-
-// size of the large buffer used for constructing messages.
-#define k_bufferSize 400
-
-
-/** Create a plot on plot.ly
-*
-* Based on the Ardunio code supplied by plot.ly
-*
-* Creates a streaming X/Y scatter plot with line on the plot.ly site.
-* Update periods can be between 50ms and 60s due to limitations imposed by plot.ly.
-* 
-* Requires an mbed with network support.
-* 
-* Provided as is, it works for me but your mileage may vary. Sorry, I don't have time to offer much support on this.
-* 
-* You will need to create a plot.ly account and then go to https://plot.ly/settings to get your API key and a streaming token.
-* 
-* See Plotly_HelloWorld for a sample implimentation.
-* 
-*/
-
-class plotly
-{
-    public:
-    /**
-    @param username Your plot.ly username
-    @param api_key Your plot.ly API key
-    @param stream_token A plot.ly streaming token for your plot.ly account
-    @param filename The name of the file to save the chart as
-    */
-        plotly(char *username, char *api_key, char* stream_token, char *filename);
-        /**
-        */
-        ~plotly();
-        
-        /** Initalises the chart
-        
-        This fucntion creates a blank chart on the plot.ly system and configures it to recieve streamed data using the specified token
-        
-        Time taken for this function can vary depending on network delays.
-        
-        If you wish to change any of the options line max points or world readability then make sure you change them BEFORE calling this function.       
-        */
-        bool init();
-
-        /**
-        Adds a point to the chart. The chart MUST be initalised before calling this.
-        Note, if the streaming network port is closed then this will attempt to open the port and re-establish the stream connection, this could block for a while.
-        
-        @param x The X value.
-        @param y The y value.
-        */
-        void plot(unsigned long x, int y);
-        /**
-        Adds a point to the chart. The chart MUST be initalised before calling this.
-        Note, if the streaming network port is closed then this will attempt to open the port and re-establish the stream connection, this could block for a while.
-        
-        @param x The X value.
-        @param y The y value.
-        */
-        void plot(unsigned long x, float y);
-
-        /**
-        Adds a point to the chart. The chart MUST be initalised before calling this.
-        Note, if the streaming network port is closed then this will attempt to open the port and re-establish the stream connection, this could block for a while.
-        
-        @param x The X value.
-        @param y The y value.
-        */
-        void plot(float x, float y);
-
-        /**
-        Opens the streaming connection.
-        
-        Normally you'd do this after a sucessful call to init() and before starting plotting in order to avoid a connection delays when you first call plot()
-        */
-        bool openStream();
-        /**
-        closes the streaming connection
-        */
-        void closeStream();
-
-        /**
-         output message level
-         Messages are sent to stderr (which defaults to the mBed USB programing/debug port).
-          0 = Debugging, 1 = Informational, 2 = Status, 3 = Errors (default), 4 = Quiet
-          */
-        int log_level;
-
-        /**
-        set true to not actually connect to the network..
-        */
-        bool dry_run;
-
-        /**
-        Maximum points to display on the streaming chart, once you go over this old points will no longer be displayed.
-        Defaults to 30
-        */
-        int maxpoints;
-        
-        /**
-        Sets whether the chart will be public or not.
-        Defaults to true
-        */
-        bool world_readable;
-        
-        /**
-        Converts timestamps to the local time zone
-        */
-        bool convertTimestamp;
-        /**
-        Timezone string to use
-        */
-        char *timezone;
-        /**
-        Sets what to do if the file already exists, valid options are:
-        "new","overwrite" (default),"append","extend"
-        */
-        char *fileopt;
-
-    private:
-
-        void reconnectStream();
-
-        bool print_(int d);
-        bool print_(unsigned long d);
-        bool print_(float d);
-        bool print_(char *d);
-        bool printNetTerminator_();
- 
-        
-        bool sendFormatedText(char* data, int size);
-
-        char buffer[512];
-//        char rxBuffer[128];
-        TCPSocketConnection *socket;
-        
-        char *username_;
-        char *api_key_;
-        char *stream_token_;
-        char *filename_;
-        
-        bool initalised;
-
-};
-#endif