pdcomm_secs_primitive
Function
Creates a primitive item from raw payload bytes.
PdcommStatus pdcomm_secs_primitive(uint8_t format, const uint8_t *data, size_t length, const PdcommSecsLimits *options, PdcommSecsItem **out)The payload is the item body exactly as it appears on the wire: numeric elements are big-endian, as SEMI E5 requires. The bytes are copied.
Parameters
| Name | Description |
|---|---|
format | A primitive PDCOMM_SECS_* format code (not #PDCOMM_SECS_LIST). |
data | Payload bytes. May be NULL when length is 0, which creates an empty item. |
length | Payload length in bytes; must be a multiple of the element width of format and at most 16777215. |
options | Limits to enforce; struct_size must be at least sizeof(PdcommSecsLimits). |
out | Receives the new item; NULL after every failure. |
Returns
#PDCOMM_OK on success; #PDCOMM_INVALID_ARGUMENT when out or options is NULL, options->struct_size is too small, format is unknown or is #PDCOMM_SECS_LIST, or data is NULL with a nonzero length; #PDCOMM_INVALID_DATA when length does not match the element width or ASCII data contains a byte above 0x7F; #PDCOMM_LIMIT_EXCEEDED when a limit in options is exceeded; #PDCOMM_ALLOCATION_FAILED or #PDCOMM_INTERNAL_ERROR.
Notes
- Ownership: release the item with pdcomm_secs_destroy().