Skip to content

Instantly share code, notes, and snippets.

@jjmilburn
Forked from ricehornet/SketchSystems.spec
Last active November 25, 2020 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjmilburn/2e15a1a5a92e17999ade68ce97a277b5 to your computer and use it in GitHub Desktop.
Save jjmilburn/2e15a1a5a92e17999ade68ce97a277b5 to your computer and use it in GitHub Desktop.
# Theoretically, do we want to allow an 'independent' mode where PAYG credit is always independent of link state?
# Theoretically, do we want to allow an 'independent' mode where PAYG credit is always independent of link state?
1 or more NX Channel Links
link or unlink event -> link state?
reset -> Credit Independent
Credit Leading&
tick? -> push credit update to accessory
event indicates PAYG credit has updated? -> push credit update to accessory
Credit Following&
tick? -> poll controller for latest credit
push credit update to accessory
retry sending request up to X times -> Credit Leading
poll controller for latest credit
was following gets credit response -> Credit Following
no response from controller after timeout -> zero credit
# implies that link state should be initialized before PAYG credit initializes
link state?
no links? -> Did I lose the link to a device leading my own credit?
am I controlling any accessory PAYG state? -> Credit Leading
is a controller managing my PAYG state? -> Credit Following
# 'independent' is a PAYG credit state like following, relaying, leading
No NX Channel Links*
init or link event -> link state?
Credit Independent
zero credit*
credit independently controlled
# Question here around accessories being unlocked and then unlinked (should they go to zero credit?)
Did I lose the link to a device leading my own credit?
yes? -> zero credit
no? -> credit independently controlled
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment