The framework expects the end-user to create "Nugget Screens". These are self-contained units of business logic. In a nutshell, each "Nugget Screen" is responsible for implementing two functions: draw() and update(). There is one active screen at all times. Screens that are navigated to are added to a screen stack, so that we can go "back" to previous screens. When a button is pressed, the framework will call the update() function of the active screen, passing the pressed button as an argument. A Nugget Screen's update function is expected to change internal state of the screen as necessary. The draw() function provides the NuggetScreen the opportunity to draw something to the screen.
The USB Nugget has two NuggetScreens: class DirScreen and class ScriptRunnerScreen. DirScreen is responsible for directory traversal of the filesystem and ScriptRunnerScreen for running payloads.
The NuggetInterface framework also provides a function injectScreen that allows for a screen to be added to the stack safely in multithreaded contexts, which is essential for supporting running payloads from the web interface.
This PR adds a NuggetInterface framework, and allows us to refactor much of the existing code into more discrete chunks.
The original design doc is here, though it was written months ago: https://docs.google.com/document/d/1XPg7yks70QIYavU-Fff-gvLjK3W4ij9CsQxlBEF5DIQ/edit#heading=h.2rl72lxr3i5w
The framework expects the end-user to create "Nugget Screens". These are self-contained units of business logic. In a nutshell, each "Nugget Screen" is responsible for implementing two functions:
draw()
andupdate()
. There is one active screen at all times. Screens that are navigated to are added to a screen stack, so that we can go "back" to previous screens. When a button is pressed, the framework will call theupdate()
function of the active screen, passing the pressed button as an argument. A Nugget Screen's update function is expected to change internal state of the screen as necessary. Thedraw()
function provides the NuggetScreen the opportunity to draw something to the screen.The USB Nugget has two NuggetScreens:
class DirScreen
andclass ScriptRunnerScreen
. DirScreen is responsible for directory traversal of the filesystem and ScriptRunnerScreen for running payloads.The NuggetInterface framework also provides a function
injectScreen
that allows for a screen to be added to the stack safely in multithreaded contexts, which is essential for supporting running payloads from the web interface.