Skip to content
Start free evaluation

pdcomm_gem_result_program_item

Function

Copies a PPID or PPBODY from a program result.

PdcommStatus pdcomm_gem_result_program_item(const PdcommGemResult *result, uint32_t field, size_t index, PdcommSecsItem **out_item)

Declared in: #include <pdcomm_gem_programs.h>

  • #PDCOMM_GEM_PROGRAM_ID with index below id_count returns a request PPID or a PPID from an S7F6 or S7F20 reply.
  • #PDCOMM_GEM_PROGRAM_BODY with index 0 returns the body of an S7F3 request or an S7F6 reply. For an S7F6 carrying the unknown sentinel the call returns #PDCOMM_OK with *out_item NULL, which is distinct from a stored empty body.

Parameters

NameDescription
resultProgram request or response result.
field#PDCOMM_GEM_PROGRAM_ID or #PDCOMM_GEM_PROGRAM_BODY.
indexZero-based PPID index, or 0 for the body.
out_itemReceives a new item, or NULL as described above. Set to NULL first. Must not be NULL.

Returns

#PDCOMM_OK on success; #PDCOMM_INVALID_ARGUMENT when out_item or result is NULL or field is unknown; #PDCOMM_INVALID_STATE when the result has no program data or the body is requested from a kind without one; #PDCOMM_OUT_OF_RANGE when index is past the PPIDs or nonzero for the body; #PDCOMM_ALLOCATION_FAILED or #PDCOMM_INTERNAL_ERROR.

Notes

  • Ownership: release a non-NULL *out_item with pdcomm_secs_destroy().