NetBurner 3.5.6
PDF Version
Nesting Config Objects

NetBurner Config System - Nesting Config Objects

Overview

This application demonstrates the NetBurner configuration system, specifically showcasing how configuration objects can be nested to create hierarchical data structures. The config system is used to store both boot/interface information and user-defined persistent variables in flash memory as JSON data.

Application Description

The NestingConfigObjects example builds upon the basic ConfigClass example by creating nested configuration classes that demonstrate a real-world thermostat control system. The application models a group of thermostats, each with their own temperature settings, location information, and operational parameters.

Class Hierarchy

The application uses a three-level inheritance and nesting structure:

1. TempRange (Base Class)

  • Purpose: Defines basic temperature range parameters
  • Members:
    • m_maxTemp: Maximum temperature (default: 100)
    • m_setTemp: Set temperature (default: 30)
    • m_minTemp: Minimum temperature (default: 10)

2. Thermostat (Extends TempRange)

  • Purpose: Represents a complete thermostat with additional features
  • Members:
    • Inherits all TempRange members
    • m_tempRec1: Temperature record 1 (default: 101)
    • m_tempRec2: Temperature record 2 (default: 102)
    • m_active: Active status (default: true)
    • m_location: Location string (default: "Warehouse 1")
    • m_tempScale: Temperature scale chooser (Fahrenheit/Celsius/Kelvin)

3. ThermoGroup (Container Class)

  • Purpose: Groups multiple thermostats together
  • Members:
    • thermo_1: First thermostat instance
    • thermo_2: Second thermostat instance

Available Config Object Types

The NetBurner config system supports the following object types:

Interactive Commands

The application provides a serial console interface with the following commands:

  • C: Show complete configuration tree
  • L: Show and set thermostat locations
  • M: Show and set maximum temperatures
  • N: Show and set minimum temperatures
  • S: Show and set target temperatures
  • T: Display recorded temperature values
  • ?: Show command list

Key Features

Persistent Storage

  • All configuration changes are automatically saved to flash memory
  • Data persists across power cycles and system resets
  • Storage format is JSON for human readability

Hierarchical Organization

  • Nested structure allows logical grouping of related parameters
  • Each object has a unique name for identification
  • Clear parent-child relationships in the configuration tree

Real-time Updates

  • Configuration changes take effect immediately
  • Interactive console allows runtime modification
  • No need to restart the application after changes

Usage Instructions

  1. Compile and Deploy: Build the application and deploy to your NetBurner device
  2. Connect Serial Console: Use a terminal program to connect at 115200 baud
  3. View Network Info: The application displays IP address, AutoIP, and gateway on startup
  4. Access Commands: Type '?' to see available commands
  5. Modify Settings: Use the letter commands to update thermostat parameters
  6. View Configuration: Use 'C' to display the complete configuration tree

Important Notes

  • Unique Names: Each config object must have a unique name to avoid conflicts
  • Global Scope: Config objects should be declared at global scope
  • ConfigEndMarker: Always include this marker after the last data member in each class
  • Automatic Persistence: Changes are automatically saved to flash storage

Development Guidelines

When extending this example:

  1. Always use unique names for config objects
  2. Place ConfigEndMarker after the last data member in each class
  3. Attach config objects to the appdata config object for proper integration
  4. Use appropriate default values that make sense for your application
  5. Consider the hierarchical structure when designing your config classes