KPN Things Device SDK
ThingsML Namespace Reference

Data Structures

class  HttpFirmwareDownload
 

Functions

size_t httpPost (char buffer[], int bufferSize, const char key[], const char host[], const char path[], SenMLBasePack &body)
 
int getHttpBodyStart (const char response[], int responseLength)
 
int strstr_n (const char data[], int dataLength, const char needle[], int needleLength)
 

Function Documentation

◆ getHttpBodyStart()

int ThingsML::getHttpBodyStart ( const char  response[],
int  responseLength 
)

Finds where the http headers end and the body begins. Will return the beginning if the end of the http headers could not be found.

Returns
the index of the body

◆ httpPost()

size_t ThingsML::httpPost ( char  buffer[],
int  bufferSize,
const char  key[],
const char  host[],
const char  path[],
SenMLBasePack body 
)

Generates a complete http POST request ready to be sent over an tcp socket.

Parameters
bufferoutput buffer
bufferSizethe size of the output buffer
keythe secret as configured for the device
hostthe http host for the http Host: header
paththe http path for the http start
Returns
the size of the body or -1 if the buffer is too small.

◆ strstr_n()

int ThingsML::strstr_n ( const char  data[],
int  dataLength,
const char  needle[],
int  needleLength 
)

Fixed length strstr implementation

Parameters
datathe data to search
dataLengththe length of data
needlethe needle to search for
needleLengththe length of the needle
Returns
the index of the start of the needle or -1 if the needle could not be found