Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
esphome::home_io_control::decisions::AttemptPlan Struct Reference

How one exchange spends its attempts. Handed to ExchangeEngine::send_and_receive(). More...

#include <hub_decisions.h>

Collaboration diagram for esphome::home_io_control::decisions::AttemptPlan:

Public Member Functions

uint16_t window_for_attempt (uint8_t attempt, uint8_t attempts) const

Public Attributes

uint8_t max_attempts {EXCHANGE_RETRY_COUNT}
 Most transmissions of the request, [1, EXCHANGE_MAX_ATTEMPTS].
uint16_t gap_ms {EXCHANGE_RETRY_DELAY_MS}
 Wait before each attempt after the first; 0 for none.
uint16_t window_ms {RESPONSE_START_WAIT_MS}
 How long the last attempt listens for the first reply.
uint16_t early_window_ms {0}
 How long every attempt before the last listens; 0 means the same as window_ms.
bool short_lead {false}
 True when the first attempt is a short lead to a low-power receiver in an unknown state (WakeBelief::UNKNOWN): the short start preamble, a brief window of its own (LOW_POWER_SHORT_LEAD_WINDOW_MS), and the wake-up attempts after it.
bool state_unknown {false}
 True when the caller asked for the read to treat the receiver's state as unknown (AttemptRequest::with_state_unknown()).
uint32_t budget_allowance_ms {0}
 Time the exchange may run past exchange_total_budget_ms.

Detailed Description

How one exchange spends its attempts. Handed to ExchangeEngine::send_and_receive().

Definition at line 446 of file hub_decisions.h.

Member Function Documentation

◆ window_for_attempt()

uint16_t esphome::home_io_control::decisions::AttemptPlan::window_for_attempt ( uint8_t attempt,
uint8_t attempts ) const
inlinenodiscard
Parameters
attempt1-based number of the attempt about to listen.
attemptsAttempts the exchange makes in all (the last one listens window_ms).
Returns
How long that attempt listens for the first reply.

Definition at line 473 of file hub_decisions.h.

Member Data Documentation

◆ budget_allowance_ms

uint32_t esphome::home_io_control::decisions::AttemptPlan::budget_allowance_ms {0}

Time the exchange may run past exchange_total_budget_ms.

0 unless the short lead does not fit with its wake-up attempts inside the budget; then the cost of the lead (short_lead_cost_ms()), so the attempts after it get the budget the plan without it had and none is dropped. The engine's guard adds it to the budget, so plan and guard agree. The exchange never runs past the budget by more than this.

Definition at line 468 of file hub_decisions.h.

◆ early_window_ms

uint16_t esphome::home_io_control::decisions::AttemptPlan::early_window_ms {0}

How long every attempt before the last listens; 0 means the same as window_ms.

A mains target answers within tens of milliseconds or not at all, so the early attempts need not wait the whole window: the last one does, to still catch a device that answers late.

Definition at line 453 of file hub_decisions.h.

◆ gap_ms

uint16_t esphome::home_io_control::decisions::AttemptPlan::gap_ms {EXCHANGE_RETRY_DELAY_MS}

Wait before each attempt after the first; 0 for none.

Definition at line 448 of file hub_decisions.h.

◆ max_attempts

uint8_t esphome::home_io_control::decisions::AttemptPlan::max_attempts {EXCHANGE_RETRY_COUNT}

Most transmissions of the request, [1, EXCHANGE_MAX_ATTEMPTS].

Definition at line 447 of file hub_decisions.h.

◆ short_lead

bool esphome::home_io_control::decisions::AttemptPlan::short_lead {false}

True when the first attempt is a short lead to a low-power receiver in an unknown state (WakeBelief::UNKNOWN): the short start preamble, a brief window of its own (LOW_POWER_SHORT_LEAD_WINDOW_MS), and the wake-up attempts after it.

A moving receiver hears the short one and a resting one the wake-up. It counts in max_attempts.

Definition at line 458 of file hub_decisions.h.

◆ state_unknown

bool esphome::home_io_control::decisions::AttemptPlan::state_unknown {false}

True when the caller asked for the read to treat the receiver's state as unknown (AttemptRequest::with_state_unknown()).

The exchange engine resolves the wake belief with it on sending too, so the plan and the tries agree (wake_belief()).

Definition at line 462 of file hub_decisions.h.

◆ window_ms

uint16_t esphome::home_io_control::decisions::AttemptPlan::window_ms {RESPONSE_START_WAIT_MS}

How long the last attempt listens for the first reply.

Definition at line 449 of file hub_decisions.h.


The documentation for this struct was generated from the following file: