This sample project is fublished on our website under the name test_stg_lib.zip:
Let's build a sample application. It will have a listening control socket through which you will be able to send control commands and get replies. These commands will allow you to write and read settings. One of the settings, with multiple members, will define a number of LED patterns. Another setting will select the current pattern to be played. Yet another setting will let you put the selected pattern into play and check if it is still playing.
This application, although largely useless, will demonstrate all of the fine points and advantages of the settings library.
The project uses five settings:
- DN (Device Name) — stores a string that can uniquely identify the device. This setting does nothing for the program's functionality, but it is a nice touch to be able to name the device.
- IP (IP address) — stores the IP address of the device.
- PN (Port Number) — stores the port number on which the device will accept a TCP connection. You will use this TCP connection to send commands and receive replies.
- PTN (PaTterNs) — has three members, each member stores one LED pattern.
- CPTN (Current PaTterN) — specifies which pattern is currently selected.