Skip to content
Start free evaluation

pdcomm_gem_equipment_status_register

Function

Registers an equipment status variable (SV).

PdcommStatus pdcomm_gem_equipment_status_register(PdcommTcpEndpoint *endpoint, uint32_t id, const char *name, size_t name_length, const char *units, size_t units_length, const PdcommSecsItem *value)

Declared in: #include <pdcomm_gem.h>

The equipment answers S1F3 and S1F11 from this registry. The value item is cloned, never consumed, and its top-level format becomes the declared format of the variable. On any error the registry is unchanged.

Parameters

NameDescription
endpointLive TCP endpoint with an equipment role, in #PDCOMM_TCP_STOPPED.
idStatus variable ID (SVID); must not be registered yet.
nameSV name (SVNAME) as ASCII bytes without a terminator; may be NULL when name_length is 0.
name_lengthNumber of bytes at name.
unitsUnits (UNITS) as ASCII bytes without a terminator; may be NULL when units_length is 0.
units_lengthNumber of bytes at units.
valueInitial value. Must not be NULL.

Returns

#PDCOMM_OK when the variable was registered; #PDCOMM_INVALID_ARGUMENT when endpoint or value is NULL, a text pointer is NULL with a nonzero length, the name or units is not ASCII, or id is already registered; #PDCOMM_INVALID_STATE when the endpoint is not stopped or has no equipment role; #PDCOMM_LIMIT_EXCEEDED when max_variables, max_metadata_bytes, max_value_bytes, or an item limit would be exceeded; #PDCOMM_BACKPRESSURE when a staged TCP event exists; #PDCOMM_ALLOCATION_FAILED or #PDCOMM_POISONED.

Notes

  • Registration order is the order used by S1F3 and S1F11 requests for all variables and by pdcomm_gem_equipment_status_id_at().