PowerDelivery Entity

group PowerDeliveryEntity

PowerDeliveryClass: Power Delivery or PD is a power specification which allows more charging options and device behaviors within the USB interface. This Entity will allow you to directly access the vast landscape of PD.

void powerdelivery_getConnectionState(unsigned int *id, struct Result *result, const int index)

Gets the current state of the connection in the form of an enumeration.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getNumberOfPowerDataObjects(unsigned int *id, struct Result *result, const int index, const unsigned char partner, const unsigned char powerRole)

Gets the number of Power Data Objects (PDOs) for a given partner and power role.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Indicates which power role of PD connection is in question.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • numRules – Variable to be filled with the number of PDOs.

Returns:

Returns common entity return values

void powerdelivery_getPowerDataObject(unsigned int *id, struct Result *result, const int index, const unsigned char partner, const unsigned char powerRole, const unsigned char ruleIndex)

Gets the Power Data Object (PDO) for the requested partner, powerRole and index.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Indicates which power role of PD connection is in question.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – The index of the PDO in question. Valid index are 1-7.

  • pdo – Variable to be filled with the requested power rule.

Returns:

Returns common entity return values

void powerdelivery_setPowerDataObject(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole, const unsigned char ruleIndex, const unsigned int pdo)

Sets the Power Data Object (PDO) of the local partner for a given power role and index.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Indicates which power role of PD connection is in question.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – The index of the PDO in question. Valid index are 1-7.

  • pdo – Power Data Object to be set.

Returns:

Returns common entity return values

void powerdelivery_resetPowerDataObjectToDefault(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole, const unsigned char ruleIndex)

Resets the Power Data Object (PDO) of the Local partner for a given power role and index.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Indicates which power role of PD connection is in question.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – The index of the PDO in question. Valid index are 1-7.

Returns:

Returns common entity return values

void powerdelivery_getPowerDataObjectList(unsigned int *id, struct Result *result, const int index, unsigned int *buffer, const int bufferLength)

Gets all Power Data Objects (PDOs). Equivalent to calling PowerDeliveryClass::getPowerDataObject() on all partners, power roles, and index’s.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • buffer – pointer to the start of a c style buffer to be filled The order of which is:

    • Rules 1-7 Local Source

    • Rules 1-7 Local Sink

    • Rules 1-7 Partner Source

    • Rules 1-7 Partner Sink.

  • bufLength – Length of the buffer to be filed

  • unloadedLength – Length that was actually received and filled. On success this value should be 28 (7 rules * 2 partners * 2 power roles)

Returns:

Returns common entity return values

void powerdelivery_getPowerDataObjectEnabled(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole, const unsigned char ruleIndex)

Gets the enabled state of the Local Power Data Object (PDO) for a given power role and index. Enabled refers to whether the PDO will be advertised when a PD connection is made. This does not indicate the currently active rule index. This information can be found in Request Data Object (RDO).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • ruleIndex – The index of the PDO in question. Valid index are 1-7.

  • enabled – Variable to be filled with enabled state.

Returns:

Returns common entity return values

void powerdelivery_setPowerDataObjectEnabled(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole, const unsigned char ruleIndex, const unsigned char enabled)

Sets the enabled state of the Local Power Data Object (PDO) for a given powerRole and index. Enabled refers to whether the PDO will be advertised when a PD connection is made. This does not indicate the currently active rule index. This information can be found in Request Data Object (RDO).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Indicates which power role of PD connection is in question.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – The index of the PDO in question. Valid index are 1-7.

  • enabled – The state to be set.

Returns:

Returns common entity return values

void powerdelivery_getPowerDataObjectEnabledList(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole)

Gets all Power Data Object enables for a given power role. Equivalent of calling PowerDeliveryClass::getPowerDataObjectEnabled() for all indexes.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • enabledList – Variable to be filled with a mapped representation of the enabled PDOs for a given power role. Values align with a given rule index (bits 1-7, bit 0 is invalid)

Returns:

Returns common entity return values

void powerdelivery_getRequestDataObject(unsigned int *id, struct Result *result, const int index, const unsigned char partner)

Gets the current Request Data Object (RDO) for a given partner. RDOs: Are provided by the sinking device. Exist only after a successful PD negotiation (Otherwise zero). Only one RDO can exist at a time. i.e. Either the Local or Remote partner RDO

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • rdo – Variable to be filled with the current RDO. Zero indicates the RDO is not active.

Returns:

Returns common entity return values

void powerdelivery_setRequestDataObject(unsigned int *id, struct Result *result, const int index, const unsigned char partner, const unsigned int rdo)

Sets the current Request Data Object (RDO) for a given partner. (Only the local partner can be changed.) RDOs: Are provided by the sinking device. Exist only after a successful PD negotiation (Otherwise zero). Only one RDO can exist at a time. i.e. Either the Local or Remote partner RDO

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • partner – Indicates which side of the PD connection is in question.

    • Local = 0 = powerdeliveryPartnerLocal

  • rdo – Request Data Object to be set.

Returns:

Returns common entity return values

void powerdelivery_getPowerRole(unsigned int *id, struct Result *result, const int index)

Gets the power role that is currently being advertised by the local partner. (CC Strapping).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_setPowerRole(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole)

Set the current power role to be advertised by the Local partner. (CC Strapping).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Value to be applied.

    • Disabled = 0 = powerdeliveryPowerRoleDisabled

    • Source = 1= powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

    • Source/Sink = 3 = powerdeliveryPowerRoleSourceSink (Dual Role Port)

Returns:

Returns common entity return values

void powerdelivery_getPowerRolePreferred(unsigned int *id, struct Result *result, const int index)

Gets the preferred power role currently being advertised by the Local partner. (CC Strapping).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_setPowerRolePreferred(unsigned int *id, struct Result *result, const int index, const unsigned char powerRole)

Set the preferred power role to be advertised by the Local partner (CC Strapping).

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • powerRole – Value to be applied.

    • Disabled = 0 = powerdeliveryPowerRoleDisabled

    • Source = 1= powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

Returns:

Returns common entity return values

void powerdelivery_getCableVoltageMax(unsigned int *id, struct Result *result, const int index)

Gets the maximum voltage capability reported by the e-mark of the attached cable.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getCableCurrentMax(unsigned int *id, struct Result *result, const int index)

Gets the maximum current capability report by the e-mark of the attached cable.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getCableSpeedMax(unsigned int *id, struct Result *result, const int index)

Gets the maximum data rate capability reported by the e-mark of the attached cable.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getCableType(unsigned int *id, struct Result *result, const int index)

Gets the cable type reported by the e-mark of the attached cable.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getCableOrientation(unsigned int *id, struct Result *result, const int index)

Gets the current orientation being used for PD communication

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_request(unsigned int *id, struct Result *result, const int index, const unsigned char request)

Requests an action of the Remote partner. Actions are not guaranteed to occur.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • request – Request to be issued to the remote partner

    • pdRequestHardReset (0)

    • pdRequestSoftReset (1)

    • pdRequestDataReset (2)

    • pdRequestPowerRoleSwap (3)

    • pdRequestPowerFastRoleSwap (4)

    • pdRequestDataRoleSwap (5)

    • pdRequestVconnSwap (6)

    • pdRequestSinkGoToMinimum (7)

    • pdRequestRemoteSourcePowerDataObjects (8)

    • pdRequestRemoteSinkPowerDataObjects (9)

Returns:

The returned error represents the success of the request being sent to the partner only. The success of the request being serviced by the remote partner can be obtained through PowerDeliveryClass::requestStatus() Returns common entity return values

void powerdelivery_requestStatus(unsigned int *id, struct Result *result, const int index)

Gets the status of the last request command sent.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_getOverride(unsigned int *id, struct Result *result, const int index)

Gets the current enabled overrides

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_setOverride(unsigned int *id, struct Result *result, const int index, const unsigned int overrides)

Sets the current enabled overrides

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • overrides – Overrides to be set in a bit mapped representation.

Returns:

Returns common entity return values

void powerdelivery_resetEntityToFactoryDefaults(unsigned int *id, struct Result *result, const int index)
void powerdelivery_getFlagMode(unsigned int *id, struct Result *result, const int index, const unsigned char flag)

Gets the current mode of the local partner flag/advertisement. These flags are apart of the first Local Power Data Object and must be managed in order to accurately represent the system to other PD devices. This API allows overriding of that feature. Overriding may lead to unexpected behaviors.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • mode – Variable to be filled with the current mode.

    • Disabled (0)

    • Enabled (1)

    • Auto (2) default

Returns:

Returns common entity return values

void powerdelivery_setFlagMode(unsigned int *id, struct Result *result, const int index, const unsigned char flag, const unsigned char mode)

Sets how the local partner flag/advertisement is managed. These flags are apart of the first Local Power Data Object and must be managed in order to accurately represent the system to other PD devices. This API allows overriding of that feature. Overriding may lead to unexpected behaviors.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • flag – Flag/Advertisement to be modified

  • mode – Value to be applied.

    • Disabled (0)

    • Enabled (1)

    • Auto (2) default

Returns:

Returns common entity return values

void powerdelivery_getPeakCurrentConfiguration(unsigned int *id, struct Result *result, const int index)

Gets the Peak Current Configuration for the Local Source. The peak current configuration refers to the allowable tolerance/overload capabilities in regards to the devices max current. This tolerance includes a maximum value and a time unit.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_setPeakCurrentConfiguration(unsigned int *id, struct Result *result, const int index, const unsigned char configuration)

Sets the Peak Current Configuration for the Local Source. The peak current configuration refers to the allowable tolerance/overload capabilities in regards to the devices max current. This tolerance includes a maximum value and a time unit.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • configuration – An enumerated value referring to the configuration to be set

    • Allowable values are 0 - 4

Returns:

Returns common entity return values

void powerdelivery_getFastRoleSwapCurrent(unsigned int *id, struct Result *result, const int index)

Gets the Fast Role Swap Current The fast role swap current refers to the amount of current required by the Local Sink in order to successfully preform the swap.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

Returns:

Returns common entity return values

void powerdelivery_setFastRoleSwapCurrent(unsigned int *id, struct Result *result, const int index, const unsigned char swapCurrent)

Sets the Fast Role Swap Current The fast role swap current refers to the amount of current required by the Local Sink in order to successfully preform the swap.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • swapCurrent – An enumerated value referring to value to be set.

    • 0A (0)

    • 900mA (1)

    • 1.5A (2)

    • 3A (3)

Returns:

Returns common entity return values

void powerdelivery_packDataObjectAttributes(unsigned int *id, struct Result *result, const int index, const unsigned char partner, const unsigned char powerRole, const unsigned char ruleIndex)

Helper function for packing Data Object attributes. This value is used as a subindex for all Data Object calls with the BrainStem Protocol.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone and the requested value on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • partner – Indicates which side of the PD connection.

    • Local = 0 = powerdeliveryPartnerLocal

    • Remote = 1 = powerdeliveryPartnerRemote

  • powerRole – Indicates which power role of PD connection.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – Data object index.

Returns:

aErrNone on success; aErrParam with bad input.

void powerdelivery_unpackDataObjectAttributes(unsigned int *id, struct Result *result, const int index, const unsigned char attributes, unsigned char *partner, unsigned char *powerRole, unsigned char *ruleIndex)

Helper function for unpacking Data Object attributes. This value is used as a subindex for all Data Object calls with the BrainStem Protocol.

Parameters:
  • id – The id assigned by the create stem vi.

  • result – Object containing aErrNone on success. Non-zero error code on failure.

  • index – The index of the entity in question.

  • attributes – variable to be filled with packed values.

  • partner – Indicates which side of the PD connection.

    • Local = 0 = powerdeliveryPartnerLocal

    • Remote = 1 = powerdeliveryPartnerRemote

  • powerRole – Indicates which power role of PD connection.

    • Source = 1 = powerdeliveryPowerRoleSource

    • Sink = 2 = powerdeliveryPowerRoleSink

  • ruleIndex – Data object index.

Returns:

aErrNone on success; aErrParam with bad input.