NetBurner 3.5.6
PDF Version
System Diagnostics

System Diagnostics Example

Overview

This application demonstrates how to integrate system diagnostics into a NetBurner device application. The program enables a web-based diagnostic interface that displays both system information and custom application variables through the device's Configuration Server web page.

Features

  • System Diagnostics: Enables built-in system diagnostic information display
  • Custom Variable Monitoring: Demonstrates how to add application-specific variables to the diagnostic web page
  • Web Interface: Provides access to diagnostics through HTTP server on port 80
  • Real-time Updates: Variables are updated in real-time and can be monitored through the web interface

Application Components

Main Functionality

The application performs the following operations:

  1. Initializes the network stack
  2. Enables system diagnostics functionality
  3. Starts the HTTP web server on default port 80
  4. Waits for network connectivity
  5. Continuously increments a counter variable every second

Monitored Variables

The application includes two example variables that are displayed on the diagnostic web page:

  • myInt: An integer counter that increments every second
  • myString: A string variable initialized with "My String Variable"

Code Structure

Key Components

  • Network Initialization: Standard NetBurner network stack setup
  • Diagnostic Integration: Uses EnableSystemDiagnostics() to activate the diagnostic interface
  • Variable Monitoring: Implements DiagVarMon and DiagStrMon for custom variable display
  • Web Server: HTTP server provides access to the diagnostic interface

Header Dependencies

#include <init.h>
#include <nbrtos.h>
#include <system.h>
#include <string.h>
#include <diagnostics.h>
NetBurner Diagnostics System.
NetBurner System Initialization Header File.
NetBurner Real-Time Operating System (NBRTOS) API.
NetBurner System Functions.

Usage Instructions

Building and Running

  1. Compile the application using the NetBurner development tools
  2. Deploy to your NetBurner device
  3. Ensure the device is connected to your network
  4. The application will display network information on the console

Accessing Diagnostics

  1. Open a web browser
  2. Navigate to your device's IP address (port 80)
  3. Access the Configuration Server web page
  4. Click the "Diagnostics" button to view system and application variables

Adding Custom Variables

To add your own variables to the diagnostic display:

For Integer Variables

int yourVariable;
static DiagVarMon YourVarMon("Variable Description", yourVariable);
Monitor and report the value of numeric variables.
Definition diagnostics.h:97

For String Variables

char yourString[SIZE];
static DiagStrMon YourStrMon("String Description", yourString);
Monitor and report string values.
Definition diagnostics.h:242

Supported Variable Types

  • Integers (DiagVarMon)
  • Strings (DiagStrMon)
  • Floats (using appropriate diagnostic monitor classes)
  • Other data types as supported by the diagnostics library

Important Notes

Production Considerations

  • The EnableSystemDiagnostics() function should likely be removed or conditionally compiled for production code
  • Consider security implications of exposing diagnostic information in production environments
  • The web server runs on port 80 by default and may conflict with other web services

Network Requirements

  • Device must be connected to an active network
  • The application waits up to 5 seconds for network connectivity before proceeding
  • HTTP server accessibility depends on network configuration and firewall settings

Output Example

When running, the application displays:

Web Application: System Diagnostics Example
NNDK Revision: [Current NetBurner SDK Version]

The web diagnostic interface will show:

  • Standard system diagnostic information
  • "My Int": Incrementing counter value
  • "My String": "My String Variable"