This class needs to be a base class for the template argument of the Logon Handler.
More...
#include <Logon.hxx>
|
| unsigned | num_locos () |
| |
| bool | is_valid_loco_id (unsigned loco_id) |
| |
| uint8_t & | loco_flags (unsigned loco_id) |
| | Finds the storage cell for a locomotive and returns the flag byte for it.
|
| |
| uint64_t | loco_did (unsigned loco_id) |
| | Retrieves the decoder unique ID.
|
| |
| unsigned | create_or_lookup_loco (uint64_t decoder_id) |
| | Creates a new locomotive by decoder ID, or looks up an existing locomotive by decoder ID.
|
| |
| void | run_address_policy (unsigned loco_id, uint16_t desired_address) |
| | Runs the locomotive address policy.
|
| |
| uint16_t | assigned_address (unsigned loco_id) |
| |
| void | assign_complete (unsigned loco_id) |
| | Invoked when the address assignment completes for a decoder.
|
| |
This class needs to be a base class for the template argument of the Logon Handler.
Definition at line 48 of file Logon.hxx.
◆ Flags
Flags for the logon handler module.
| Enumerator |
|---|
| FLAG_NEEDS_GET_SHORTINFO | This decoder needs a get shortinfo command.
|
| FLAG_PENDING_GET_SHORTINFO | We sent a get shortinfo command.
|
| FLAG_NEEDS_ASSIGN | This decoder needs an assign command.
|
| FLAG_PENDING_ASSIGN | We sent an assign command.
|
| FLAG_COMPLETE | 1 if we completed the address assignment.
|
| FLAG_ERROR_STATE | 1 if we ended up in an error state for this loco.
|
| FLAG_PENDING_RETRY | 1 if we have asked for a re-try.
|
| FLAG_PENDING_TICK | This is a 1-bit pre-scaler on a shared 50 msec timer that controls the delay of re-tries.
This makes a retry happen in 50 to 100 msec time from the original failed attempt.
|
Definition at line 93 of file Logon.hxx.
◆ assign_complete()
| void dcc::LogonHandlerModule::assign_complete |
( |
unsigned |
loco_id | ) |
|
Invoked when the address assignment completes for a decoder.
- Parameters
-
◆ assigned_address()
| uint16_t dcc::LogonHandlerModule::assigned_address |
( |
unsigned |
loco_id | ) |
|
- Parameters
-
- Returns
- the address to be assigned to this locomotive. 14-bit.
◆ create_or_lookup_loco()
| unsigned dcc::LogonHandlerModule::create_or_lookup_loco |
( |
uint64_t |
decoder_id | ) |
|
Creates a new locomotive by decoder ID, or looks up an existing locomotive by decoder ID.
- Parameters
-
| decoder_id | 44-bit decoder ID (aligned to LSb). |
- Returns
- locomotive ID for this cell.
◆ is_valid_loco_id()
| bool dcc::LogonHandlerModule::is_valid_loco_id |
( |
unsigned |
loco_id | ) |
|
- Parameters
-
| loco_id | a locomotive identifier |
- Returns
- true if this is valid and belongs to a loco we know about.
◆ loco_did()
| uint64_t dcc::LogonHandlerModule::loco_did |
( |
unsigned |
loco_id | ) |
|
Retrieves the decoder unique ID.
- Parameters
-
| loco_id | the dense locomotive identifier. |
- Returns
- the decoder unique ID (44 bit, LSb-aligned).
◆ loco_flags()
| uint8_t & dcc::LogonHandlerModule::loco_flags |
( |
unsigned |
loco_id | ) |
|
Finds the storage cell for a locomotive and returns the flag byte for it.
- Parameters
-
| loco_id | a valid locomotive ID. |
- Returns
- the flag byte for this loco.
◆ num_locos()
| unsigned dcc::LogonHandlerModule::num_locos |
( |
| ) |
|
- Returns
- the number of locomotives known. The locomotive IDs are 0..num_locos() - 1.
◆ run_address_policy()
| void dcc::LogonHandlerModule::run_address_policy |
( |
unsigned |
loco_id, |
|
|
uint16_t |
desired_address |
|
) |
| |
Runs the locomotive address policy.
After the address policy is run, the loco should have the ability to answer the assigned_address question.
- Parameters
-
| loco_id | which locomotive this is |
| desired_address | the S-9.2.1.1 encoded desired address for this decoder. |
The documentation for this class was generated from the following file: