Skip to content

Instantly share code, notes, and snippets.

@ricehornet
ricehornet / SketchSystems.spec
Created September 10, 2021 23:50
RDG Usage Data Collection*
RDG Usage Data Collection*
Idle*
Sample Data
Reply to PAYG MCU
@ricehornet
ricehornet / SketchSystems.spec
Last active June 22, 2021 04:22
# In the previous model, we used Credit Leading/Following to capture PAYG credit behaviors. Credit Leading basically meant "use your local credit and POST to accessories"
# In the previous model, we used Credit Leading/Following to capture PAYG credit behaviors. Credit Leading basically meant "use your local credit and POST to accessories"
# and Credit Following meant "be POSTed to by a Leader". The addition of "unlocked" complicated the model due to scenarios where accessories would need to use local credit
# but had no accessories of their own. The concept of a "credit origin" can handle this case, where Leading and Following are now specific cases. When the Credit Origin
# Self, it means "use your local credit"; when it is "External" it means "be POSTed to by an external source".
PAYG Credit Resource Behavior with NXC Links and Credit Origin
# Initial state
Credit origin is Self*
# 'local credit' is what the 'nxp' interface reports for PAYG credit (what it was last updated to by a Nexus message, either keycode or channel)
@ricehornet
ricehornet / SketchSystems.spec
Last active June 21, 2021 19:11 — forked from jjmilburn/SketchSystems.spec
PAYG Credit Resource Interaction with NXC Links and Credit Origin
PAYG Credit Resource Interaction with NXC Links and Credit Origin
# Initial state -
# implies that link state should be initialized before PAYG credit initializes
NXC Linked?*
No links? -> No NXC links
Any linked accessory has PAYG credit resource? -> Credit Leading
Any linked controller has PAYG credit resource? -> Credit Following
No NXC links
@ricehornet
ricehornet / SketchSystems.spec
Last active January 7, 2021 22:13
Generating ruralspark keycode
Generating ruralspark keycode
Angaza index is X*
# X/index is unit last message id
get_ruralspark_server_latest_token_data -> unit number exists on ruralspark server?
unit number exists on ruralspark server?
# do not have to worry about init case of last token index is 0 because this is handled in the units constructor
yes? -> ruralspark latest token index is equal to X?
no? -> Raise error require ticket to add unit on ruralspark side
ruralspark latest token index is equal to X?
# we DO NOT increment the index on our side unless we get a keycode back from ruralspark
@ricehornet
ricehornet / SketchSystems.spec
Last active December 4, 2020 00:58 — forked from jjmilburn/SketchSystems.spec
Generating dlight unit keycode
Generating dlight unit keycode
#dlight server index is unknown
Angaza index is X*
get_dlight_server_latest_token_data -> unit number exists on dlight server?
unit number exists on dlight server?
yes? -> dlight latest token index is X minus 1 or None?
no? -> Raise error require ticket to add unit on dlight side
dlight latest token index is X minus 1 or None?
yes? -> dlight_create_token_with_id_x
no? -> is dlight server index and token value equal to Angaza index and requested value?
@ricehornet
ricehornet / SketchSystems.spec
Last active November 24, 2020 04:49
PAYG Credit Resource
PAYG Credit Resource
Disconnected*
reset or init -> link state?
link or unlink event -> link state?
Leading
reset -> Disconnected
link or unlink event -> link state?
Following
reset -> Disconnected
link or unlink event -> link state?
@ricehornet
ricehornet / SketchSystems.spec
Created February 9, 2020 19:40
ASP Accessory Symmetric Key Link Manager
ASP Accessory Symmetric Key Link Manager
Unlinked
Unlinked Idle*
link_manager_process_ticks->Broadcast Timeout Expired?
valid_asp_link_challenge_received->Computing Link Key
Broadcasting Identity
notify_core_accessory_unlinked->Unlinked Idle
Broadcast Timeout Expired?
timeout expired?->Broadcasting Identity
timeout not expired?->Unlinked Idle