Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion firmware/httpsclient-particle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ void httpsclientSetPath(const char * path) {
g_path = path;
}

int httpsclientSetup(const char * host, const char * path) {
void (*g_weatherCallback_func)(unsigned char*, int);

int httpsclientSetup(const char * host, const char * path, void (*pFunc)(unsigned char*, int)) {
int rc;
g_host = host;
g_path = path;
g_weatherCallback_func = pFunc;
if ((rc = matrixSslOpen()) < 0) {
if (g_https_trace) _psTrace("MatrixSSL library init failure.");
return rc;
Expand Down Expand Up @@ -455,6 +458,7 @@ int httpsClientConnection(unsigned char * requestContent, uint32 msg_len,
case MATRIXSSL_APP_DATA:
case MATRIXSSL_APP_DATA_COMPRESSED:
g_bytes_received += len;
(*g_weatherCallback_func)(g_buf,len);
if (g_https_trace) {
for (int i = 0 ; i < len; i++) {
Serial.print((char)g_buf[i]);
Expand Down
5 changes: 4 additions & 1 deletion firmware/httpsclient-particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ extern TCPClient client;
extern bool g_https_complete;
extern uint32 g_bytes_received;
extern const bool g_https_trace;

typedef void (*callback_function)(unsigned char*, int);
extern callback_function g_weatherCallback_func;

int httpsclientSetup(const char * host, const char * path);
int httpsclientSetup(const char * host, const char * path, callback_function pFunc);
int httpsClientConnection(unsigned char * requestContent, uint32 msg_len,
const char * msg);
void httpsclientCleanUp();
Expand Down
2 changes: 1 addition & 1 deletion spark.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "httpsclient-particle",
"author": "Vamsi Vytla",
"license": "GPL",
"version": "0.0.8",
"version": "0.0.9",
"description": "A library that helps photon boards talk https to web servers"
}