Skip to content

Instantly share code, notes, and snippets.

@SamPenrose
Last active April 14, 2021 00:22
Show Gist options
  • Save SamPenrose/671041e5f7b3f5f9fd1d3bd575178371 to your computer and use it in GitHub Desktop.
Save SamPenrose/671041e5f7b3f5f9fd1d3bd575178371 to your computer and use it in GitHub Desktop.
PAYG Accessory&
PAYG Accessory&
Link State
Unlinked*
valid_link_challenge_received->Authenticating Link
Linking
Authenticating Link
authenticated_ok->Respond Confirming Link
failed_authentication-> Error During Linking
Respond Confirming Link
respond_success->Linked
Error During Linking
send_error_message->Unlinked
Linked
Linked Idle
TICK->Link Timeout Expired?
valid_unlink_command_received->Unlinking
unlink_button_pressed->Unlinking
PAYG Credit
Disabled*
set_credit_greater_than_0_rcvd->Enabled
Enabled
credit_expires->Disabled
set_credit_equal_0_rcvd->Disabled
Link Timeout Expired?
# We assume that an accessory that doesn't detect activity from a controller
# for a certain 'Link Timeout' simply unlinks itself...
timeout expired?->Unlinked
timeout not expired?->Linked
Unlinking
send_delete_link_message->Unlinked
function render(model){
let payg_state_name = model.active_states[1].name;
let link_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current link state is: ${link_state_name}, PAYG state is ${payg_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment