I believe you are trying to create a .json data and send that onto your local server. WICED has two json libraries to help you with the parsing part (43xxx_Wi-Fi/libraries/utilities/cJSON, 43xxx_Wi-Fi/libraries/utilities/JSON_parser) . Maybe, you can manually create that using sprintf or a char pointer for fixed size data or use the cJSON library itself to create the JSON formatted data.
- For sprintf reference, you can look at 43xxx_Wi-Fi/apps/demo/iot_gateway/gateway.c
- For a fixed size data,
const char* const json_string =
- For cJSON library to create the data and print, you can refer to 43xxx_Wi-Fi/libraries/utilities/cJSON/README.md
If all of the above fails, you can use some open-source third party library to create and parse json as well; e.g. 43xxx_Wi-Fi/libraries/third_party/arrow/libs/acn_sdk_c/src/json (not sure whether this is available in broad market SDK). If you are following the WICED WIFI 101 lesson, CypressAcademy_WW101_Files/Projects/ww101key/04 at master · cypresssemiconductorco/CypressAcademy_WW101_Files · GitHub, should provide you with two examples of creating and parsing json object. Once, you are comfortable with the json side of things, you can use your WICED device as a HTTP client and use something like mongoose to test it on a local PC (provided STA and the PC has to be connected to the same network)
Hope this helps!
Thank-you for your time and interest in answering this question. I would like to learn through development of application, and I appreciate this support. Perhaps I can be more explicit.
I would like to adapt the script from the following:
This script is already assembling a JSON format file. I would like to write this data to an IP address, such as localhost of computer, or some other location for recording the datalog. The data can then be parsed / plotted offline using other tools, but the important function of remotely writing data via WIFI using this template is my interest.
Could you suggest edits I can make to this example to achieve this end? This is a development project for implementing wireless monitoring in our manufacturing facility and would be quite useful.
In the mentioned example, to connect to a local server, you just need to change the following two macros:
SERVER_HOST and SERVER_PORT based on the server ip address and the port at which it is hosted at. If you are not using TLS, you can modify HTTP_NO_SECURITY in line #672 when you are trying to connect.