SparkFun Phant library for Spark
C++ Arduino
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
firmware
LICENSE
README.md
spark.json

README.md

Phant database library for Spark

Supports clearing and writing data to Phant data streams

Scott Piette, Piette Technologies, LTD - scott.piette@gmail.com
Copyright 2014 Piette Technologies, LTD

Project supported by Open Source Beehives Project http://www.opensourcebeehives.net

Oct 16, 2014  - Initial release for Spark Core

VERSION: 0.3
PURPOSE: Phant database communication library for Spark
LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)

BASED ON:
Phant Arduino Library https://github.com/sparkfun/phant-arduino

PHANT GITHUB:       https://github.com/sparkfun/phant

METHODS:
sendData(method)
sends data to Phant server using the method passed, defaults to POST
add(name, value)
adds a data=value pair to the stream, returns the number of bytes added or '0' on error.  After you have added all data send the stream using sendData
getError()
returns the human readable text from the Phant server resulting from the last sendData

NOTES:
1 Does not use dynamic Strings as that can cause memory fragmentation
2 HTTP Header is consolidated into one 256 byte data buffer to improve performance
3 POST and CLEAR use the same header buffer - modified before sending
4 All POST data gets added to a 512 byte internal content buffer
5 HTTP and Phant responses from server are read using block reads into the remaining space from internal content buffer, or if space < 128 bytes we read using single byte reads from stream
6 sendData returns 1=success from Phant server or 0=failure if connect fails, no HTTP response, or Phant server returns status = 0
7 Currently only supports CLEAR STREAM,  and POST methods
8 There is a 64 byte buffer for the Phant response message. Use getError() to get the Phant response text.
9 The response buffer is used as a temporary buffer for addData so it's only valid after the sendData call and before any addData calls