Examples‎ > ‎

Configuration Page

The configuration API is a powerful toolkit that automatically creates configuration parameters for the device. With this example we will see how easy we can create these parameters, and how they are published in different ways to the user.

The first step is to create an internal data structure where the programmer will receive the values that the user configures.

typedef struct VoipCfg
    CFG_SIP sip; // Session Initiation Protocol
    BOOL autoconnect; // Automaticaly connect incoming calls
    BOOL pushToTalk; // User must keep button pushed to talk
    BOOL echoCanceller; // Cancel acoustic echo
    BOOL noiseSuppression; // Suppress the background noise

    USHORT volume; // Speaker volume control
// very high  = VOLUME_VERY_HIGH
// high = VOLUME_HIGH
// medium = VOLUME_MEDIUM
// low = VOLUME_LOW

    USHORT portRTP; // Real Time Protocol port
    UCHAR codec; // Voice codec for transmition
// u-Law = AUDIO_G711U
// A-Law = AUDIO_G711A
// G721 = AUDIO_G721

    USHORT packetTime; // Rtp packet length
// 20 ms = 20
// 40 ms = 40
    CFG_PAGING paging; // Audio paging configuration
    CFG_MESSAGE message; // Audio information messages to the user

extern CFG_VOIP VoIP; // Voice over IP

You can see the comments in each parameter. They are very important because the are the information that the system will show to the user to describe such parameter. Also, there are comments assigning values to a string. That is, "description" = <numeric value>. So, the system is going to show the description better than the value, and the user can choose a option instead to type the value.
You can include structures inside structures as a maximun of three levels, and also tables. 

Once, we have the structure, we must embed it in our EasyTasks system. First, we buid it to generate the C source code.

BuildCfg.exe VoIP

This will generate the CfgTable.c file. Thats all. Now, the users can configure our embedded system using:

A ".ini" like file:

autoconnect  = yes
sip.port             = 5060
portRTP = 5004
codec                = A-Law
packetTime           = 20
paging.ipMulticast   =
paging.portMulticast = 5004

A WEB page: