|
NetBurner 3.5.7
PDF Version |
A NetBurner embedded application demonstrating advanced configuration system capabilities with custom validation objects and range-limited configuration variables.
This application showcases the NetBurner Config system by implementing custom configuration object classes that extend the base config_obj functionality. The demo specifically focuses on creating configuration variables with custom validation logic, including a novel color brightness validator.
The application demonstrates several built-in NetBurner configuration object types:
config_string_limit - String with length constraints (1-10 characters)config_int_limit - Integer with range validation (-200 to 200)config_uint_limit - Unsigned integer with range validation (0 to 300)config_double_limit - Double with range and precision validation (-10.0 to 10.0, 0.01 step)config_pass_limit - Password field with length constraints (5-128 characters)The centerpiece of this demo is the config_color_brightlimit class, which validates HTML color strings based on perceived brightness:
#rrggbb (e.g., #00ccff)The luminance calculation uses the ITU standard coefficients:
The application defines several global configuration variables:
| Variable | Type | Default | Range/Limit | Description |
|---|---|---|---|---|
gSingleString | config_string_limit | "SNameLimit" | 1-10 chars | String length demo |
gMyOwnVal | config_int_limit | 199 | -200 to 200 | Integer range demo |
gMyOwnuVal | config_uint_limit | 299 | 0 to 300 | Unsigned int range demo |
gMyOwndVal | config_double_limit | 9.0 | -10.0 to 10.0 | Double precision demo |
gMyOwnpVal | config_pass_limit | "" | 5-128 chars | Password field demo |
gMyDarkColor | config_color_brightlimit | "#331122" | 0-50% brightness | Dark color validator |
gMyLightColor | config_color_brightlimit | "#cceeff" | 50-100% brightness | Light color validator |
The application provides a serial console interface with the following commands:
The config_color_brightlimit class demonstrates several advanced concepts:
TestNewValue() method provides robust server-side validation with custom error messagesExtendedSchema() method adds HTML pattern validation for web-based configurationLogParseError() to provide user-friendly error messagesThe application shows how to:
FixNonStaticObject() for runtime-created config variablesThe configuration system automatically generates a web-based configuration interface at the device's IP address. The custom validation rules are enforced both in the web UI (client-side) and on the device (server-side).
Upon startup, the application displays:
This application is designed for NetBurner embedded systems. Ensure you have:
All configuration changes are automatically persisted to non-volatile storage using the NetBurner configuration system. Changes survive device reboots and power cycles.
This demo is particularly useful for:
The application includes comprehensive error handling for:
The framework demonstrated here can be extended to create custom validators for: