|
Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
|
#include <curl/curl.h>#include <cjson/cJSON.h>#include <time.h>#include <log.h>#include "http.h"#include "utils.h"Go to the source code of this file.
Data Structures | |
| struct | FA_HarvestArea_TypeDef |
| Harvest area status information. More... | |
Macros | |
| #define | FA_MAX_BUFFER 150 |
| Buffer size for each HTML value from NSW Food Authority. More... | |
| #define | FA_HA_CLYDE_MOONLIGHT "Moonlight" |
| Moonlight harvest area. More... | |
| #define | FA_HA_CLYDE_ROCKY_PT "Rocky" |
| Rocky point harvest area. More... | |
| #define | FA_HA_CLYDE_WATERFALL "Waterfall" |
| Waterfall harvest area. More... | |
Functions | |
| CURLcode | FA_GetHarvestAreaStatus (const char *harvest_name, FA_HarvestArea_TypeDef *ha_status) |
| Harvest area of interest status information. More... | |
| void | FA_ParseResponse (char *data, FA_HarvestArea_TypeDef *harvest_area) |
| Parse HTML data to populate status information data. More... | |
| #define FA_HA_CLYDE_MOONLIGHT "Moonlight" |
Moonlight harvest area.
| #define FA_HA_CLYDE_ROCKY_PT "Rocky" |
Rocky point harvest area.
| #define FA_HA_CLYDE_WATERFALL "Waterfall" |
Waterfall harvest area.
| #define FA_MAX_BUFFER 150 |
Buffer size for each HTML value from NSW Food Authority.
| CURLcode FA_GetHarvestAreaStatus | ( | const char * | harvest_name, |
| FA_HarvestArea_TypeDef * | harvest_area | ||
| ) |
Harvest area of interest status information.
Gets harvest area status information from NSW Food Authority.
NSW Food Authority provides a JSON response with XML data as values. The XML data basically contains generic cards that are used on the NSW FA website. This function parses out the relevent XML data and used helper functions to pull out a struct containing relevent data.
The havest area names for Batemans Bay are as follow:
Other harvest areas can be checked using this function (just need to know their name and use it as the harvest_name variable.
| harvest_name | Name of harvest area. |
| harvest_area | Harvest area struct to populate with status information. |
| void FA_ParseResponse | ( | char * | data, |
| FA_HarvestArea_TypeDef * | harvest_area | ||
| ) |
Parse HTML data to populate status information data.
Takes a character array containing HTML data and formats a struct containing relevent harvest area status information.
Search terms are taken from the HTML input and the corresponding values (i.e. the text between relevent tags) are added to the corresponding struct.
| data | The string to parse. |
| harvest_area | The struct to populate with values. |
Convert time to tm struct