pdcomm_gem_formatted_program_store_put
Function
Adds or replaces a formatted process program in the local store.
PdcommStatus pdcomm_gem_formatted_program_store_put(PdcommTcpEndpoint *endpoint, const PdcommSecsItem *id, const char *model, size_t model_length, const char *software_revision, size_t software_revision_length, const PdcommGemFormattedProgramStoreCommand *commands, size_t command_count, uint32_t action)Equipment only. The program is validated, copied, and stored according to action. Storing content identical to the existing entry does not change the store revision. The store limits and the command and parameter limits come from pdcomm_gem_configure_formatted_program_queries().
Parameters
| Name | Description |
|---|---|
endpoint | Equipment endpoint with the formatted program query service configured. |
id | PPID: a nonempty ASCII or Binary item of at most 120 bytes. |
model | MDLN bytes: at most 20 ASCII bytes. May be NULL when model_length is 0. |
model_length | Length of model in bytes. |
software_revision | SOFTREV bytes: at most 20 ASCII bytes. May be NULL when software_revision_length is 0. |
software_revision_length | Length of software_revision in bytes. |
commands | Array of command_count process commands. May be NULL when command_count is 0. |
command_count | Number of commands. |
action | #PDCOMM_GEM_FORMATTED_PROGRAM_CREATE_ONLY, #PDCOMM_GEM_FORMATTED_PROGRAM_REPLACE_ONLY, or #PDCOMM_GEM_FORMATTED_PROGRAM_UPSERT. |
Returns
#PDCOMM_OK when the store holds the program; #PDCOMM_INVALID_ARGUMENT when endpoint or id is NULL, a required array or item pointer is NULL, action is not a put action, or the PPID, MDLN, SOFTREV, or a CCODE is invalid; #PDCOMM_INVALID_STATE when the endpoint is not an Equipment, the query service is not configured, action is CREATE_ONLY and the PPID exists, action is REPLACE_ONLY and the PPID is absent, or a transfer response is updating the store; #PDCOMM_LIMIT_EXCEEDED when the program exceeds the query service's command or parameter limits, an item or the encoded program exceeds the endpoint's SECS-II limits, a store limit would be exceeded, or a revision counter is exhausted; #PDCOMM_BACKPRESSURE when a staged TCP event must be drained first; #PDCOMM_ALLOCATION_FAILED; #PDCOMM_POISONED when the endpoint is poisoned.
Notes
- Ownership: all inputs stay owned by the caller.
- Thread safety: serialize with every other call on
endpoint.