Wombat Environmental Node 1.0
An environmental node for SDI-12 and digital sensors.
Loading...
Searching...
No Matches
wombat Namespace Reference

Functions

const char * stripTrailingZeros (const float value)
 Returns a pointer to a string representation of value, with trailing zeros removed. More...
 
size_t stripLeadingWS (char *str)
 Removes leading whitespace characters from str. More...
 
size_t stripTrailingWS (char *str)
 Removes trailing whitespace characters from str. More...
 
size_t stripWS (char *str)
 Removes leading and trailing whitespace characters from str. More...
 
bool get_cp_destination (const char *input_ptr, const size_t input_len, int &dest, const char **dest_filename_ptr, size_t &dest_output_len)
 extract the destination type and filename from a string of the form dest:filename. More...
 

Function Documentation

◆ get_cp_destination()

bool wombat::get_cp_destination ( const char *  input_ptr,
const size_t  input_len,
int &  dest,
const char **  dest_filename_ptr,
size_t &  dest_output_len 
)

extract the destination type and filename from a string of the form dest:filename.

When copying files between the SD card filesystem, SPIFFS, and the modem, the destination filename must be prefixed with the destination device. Eg r5:msg.txt, sd:msg.json, spiffs:msg.json.

Parameters
input_ptr[IN] A pointer to the first character of the dest:filename string.
input_len[IN] The length of input_ptr, excluding any trailing null.
dest[OUT] A reference to a file_copy_dest variable.
dest_filename_ptr[OUT] A pointer to a pointer that will receive the address of the filename portion of dest:filename.
dest_output_len[OUT] The length of the filename portion of dest:filename
Returns

◆ stripLeadingWS()

size_t wombat::stripLeadingWS ( char *  str)

Removes leading whitespace characters from str.

Any character with a value of less than space is considered to be whitespace.

Parameters
strthe string whose leading whitespace is stripped.
Returns
the new length of str, or 0 if str is null or a zero-length string.

◆ stripTrailingWS()

size_t wombat::stripTrailingWS ( char *  str)

Removes trailing whitespace characters from str.

Any character with a value of less than space is considered to be whitespace.

Parameters
strthe string whose trailing whitespace is stripped.
Returns
the new length of str, or 0 if str is null or a zero-length string.

◆ stripTrailingZeros()

const char * wombat::stripTrailingZeros ( const float  value)

Returns a pointer to a string representation of value, with trailing zeros removed.

The default f formatter is used to get the initial string representation, so 6 digits after the decimal point. From that, trailing zeros are removed.

The pointer returned from this function must not be passed to free. This function is not re-entrant.

Parameters
valuethe value to convert to a string.
Returns
a pointer to a string representation of value, with trailing zeros removed.

◆ stripWS()

size_t wombat::stripWS ( char *  str)

Removes leading and trailing whitespace characters from str.

Any character with a value of less than space is considered to be whitespace.

Parameters
strthe string whose leading and trailing whitespace is stripped.
Returns
the new length of str, or 0 if str is null or a zero-length string.