Application-related classes and types, including application lifecycle, event handling, display and frames, and hardware interfaces. More...
![]() |
Data Structures | |
class | GPIO |
The GPIO class. More... | |
class | LED |
The LED class. More... | |
class | Application |
The main application class that coordinates application-wide functionality. More... | |
class | NXTimer |
The NXTimer class. More... | |
protocol | <ApplicationDelegate> |
A protocol that defines the methods for an application delegate. More... | |
protocol | <GPIODelegate> |
A protocol that defines the methods for a GPIO delegate. More... | |
protocol | <InputManagerSource> |
A protocol that defines the methods for an input manager source. More... | |
protocol | <InputManagerDelegate> |
A protocol that defines the methods for an input manager delegate. More... | |
protocol | <TimerDelegate> |
A protocol that defines the methods for a timer delegate. More... | |
Enumerations | |
enum | GPIOEvent { GPIOEventRising = HW_GPIO_RISING, GPIOEventFalling = HW_GPIO_FALLING, GPIOEventChanged } |
GPIO input types for handling GPIO events. More... | |
enum | NXApplicationSignal { NXApplicationSignalNone = 0, NXApplicationSignalTerm, NXApplicationSignalInt, NXApplicationSignalQuit = (1 << 2), NXApplicationPowerSourceUSB = (1 << 3), NXApplicationPowerSourceBattery, NXApplicationWatchdogDidReset } |
Application signal types for handling system events. More... | |
enum | NXApplicationCapability { NXApplicationCapabilityNone = 0, NXApplicationCapabilityMulticore = (1 << 0), NXApplicationCapabilityPower = (1 << 1), NXApplicationCapabilityWatchdog = (1 << 2) } |
Application capabilities. More... | |
Functions | |
int | NXApplicationMain (int argc, char *argv[], Class delegate, NXApplicationCapability capabilities) |
Main entry point for NXApplication-based programs. More... | |
Application-related classes and types, including application lifecycle, event handling, display and frames, and hardware interfaces.
enum GPIOEvent |
GPIO input types for handling GPIO events.
Enumerator | |
---|---|
GPIOEventRising | Rising edge detected. |
GPIOEventFalling | Falling edge detected. |
GPIOEventChanged | Both edges detected. |
Definition at line 15 of file GPIOTypes.h.
Application capabilities.
Define capabilities to enable in the application. These are passed to NXApplicationMain which then enables the corresponding features.
NXApplicationCapabilityMulticore enables the use of multiple CPU cores to process tasks concurrently. NXApplicationCapabilityPower enables power management features, which means additional signals are passed to the application for power-related events, such as power source and battery changes.
NXApplicationCapabilityWatchdog enables the use of a watchdog timer to monitor the application's health, and resets the device if it becomes unresponsive.
Definition at line 60 of file NXApplication+Types.h.
enum NXApplicationSignal |
Application signal types for handling system events.
This enum defines the various signals that the application delegate can receive related to system events.
NXApplicationSignalInt indicates that the application is being interrupted, usually by the user pressing Ctrl+C. NXApplicationSignalQuit indicates that the application is being asked to quit, typically by the user sending a SIGQUIT signal. NXApplicationSignalTerm indicates that the application is being terminated, typically by the user sending a SIGTERM signal. When the watchdog is enabled, it may also indicate that the application manually triggered a restart.
NXApplicationSignalPowerSourceUSB indicates that the power source has changed to USB. NXApplicationSignalPowerSourceBattery indicates that either the power source has changed to battery, or the battery level has changed. The battery level can be monitored using the appropriate APIs.
Enumerator | |
---|---|
NXApplicationSignalNone | No signal. |
NXApplicationSignalTerm | Termination signal (SIGTERM equivalent) |
NXApplicationSignalInt | Interrupt signal (SIGINT/Ctrl+C equivalent) |
NXApplicationSignalQuit | Quit signal (SIGQUIT equivalent) |
NXApplicationPowerSourceUSB | Power source changed to USB. |
NXApplicationPowerSourceBattery | Power source changed to battery, or battery level changed. |
NXApplicationWatchdogDidReset | Application was reset by a watchdog timer. |
Definition at line 29 of file NXApplication+Types.h.
int NXApplicationMain | ( | int | argc, |
char * | argv[], | ||
Class | delegate, | ||
NXApplicationCapability | capabilities | ||
) |
Main entry point for NXApplication-based programs.
argc | The number of command-line arguments passed to the program. |
argv | An array of command-line argument strings. |
delegate | The class to use as the application delegate. |
capabilities | The capabilities to enable for the application. |
This function serves as the main entry point for applications built with the Application framework. It initializes the application runtime, sets up the event loop, and manages the application lifecycle from startup to shutdown.
The function handles:
This function should be called from your program's main() function, typically by simply returning the result of NXApplicationMain().