static CONTROL_SEL radio_options[] = {
{ "1", "Option 1" }, { "2", "Option 2" }, { "3", "Option 3" },
{ "4", "Option 4" }, { "5", "Option 5" }, { NULL },
};
// A bundle of controls.
static int custom_setport(CTL *cp, CONTROL *ct, CC_MODE mode);
static CONTROL_SEL enable_demo[] = { { "0", "Off" }, { "1", "On" }, {NULL} };
static int button_press(CTL *cp, CONTROL *ct, CC_MODE mode);
CONTROL control_controls[] = {
{ CTYPE_INT, "IP port", "http_port", 8001,1000,10000, NULL, NULL, custom_setport },
{ CTYPE_BOOL, "Boolean (check)", "dv_bool", FALSE, 0, 0 },
{ CTYPE_INT, "Integer", "dv_int", 1, 1, 10 },
{ CTYPE_SIZE, "Size", "dv_size", 0, 1, 1024 * 1024},
{ CTYPE_FLOAT, "Float", "dv_float", 1, 0, 10 },
{ CTYPE_DB, "Decibels", "dv_db", -12.0, 0.1, 3.0 },
{ CTYPE_PERCENT, "Percentage", "dv_percent", 2, 0.1, 5 },
{ CTYPE_SEC, "Time (s)", "dv_time", 0, 0, 300 },
{ CTYPE_RADIO, "Radio (on/off)", "df_onoff", 0,0,0, enable_demo },
{ CTYPE_RADIO, "Radio (Multi)", "df_radio", 0,0,0, radio_options, "1"},
{ CTYPE_RADIOLIST, "Radio (list)", "df_radiolist", 0,0,0, radio_options, "2" },
{ CTYPE_SELECT, "Selection", "df_select", 0,0,0, radio_options, "3" },
{ CTYPE_ANONBUTTON, "Button", "db_button", 0,0,0, NULL, NULL, button_press },
{ 0 }
};
//***********************************************************************
// The user has pressed this button.
//***********************************************************************
static int button_press(CTL *cp, CONTROL *ct, CC_MODE mode)
{
int done = FALSE;
if (mode == CC_SET)
{
char *text = "Please do not press this button again";
buffer_printf(cp->bp, "alert::::%s::::\n", text);
done = TRUE;
}
return done;
} |