There is rendered doxygen available here.
What is a file context, ie. OtaFileContext_t * pFileContext = &( otaAgent.fileContext );
A data structure used for duration of OTA which stores necessary data, such as stream source ID, parsed from the OTA Job document. It also holds other data for tracking the state of the download.
How does processJobHandler() work?
How is the OTA update initiated? How does OTA_Init() work?
There’s a state machine table defined here. Per the FSM, when
OtaAgentEventReceivedJobDocument event occurs,
processJobHandler is called. It attempts to populate a file context with aforementioned data, as presented in OTA Job JSON. Internally it eventually calls
parseJobDoc which may call
validateAndStartJob to kick off the download.
OTA_Init initializes required interfaces and memory for the OTA agent.
in parseJobDoc(), what does it do? What are the inputs? What does it mean by returning a OtaFileContext_t type?
Parameters and even code examples are documented in the doxygen. They’re also present in the code such as here. It attempts to parse a minimum set of values from a JSON “job document”, required for OTA. These values are stored in a file context.
What does getFileContextFromJob() do? How does the “job document” look like? What does it mean by “getting the file context”?
It’s similar to
parseJobDoc in that it’s trying to get a valid file context that can OTA, but it also takes care of more than just the JSON parsing aspect, doing other higher level tasks like memory allocation, creating a file buffer for storing download contents on device, etc.
OtaFileContext_t is defined here. The job document structure isn’t documented anywhere to my knowledge, but I have one handy:
"certfile": "Code Verify Key",
Would highly recommend the doxygen documents linked here, and these supplemental AWS dev docs here