Ejemplo n.º 1
0
void GPhotoCCD::AddWidget(gphoto_widget *widget)
{
	IPerm perm;
	struct tm *tm;

	if(! widget)
		return;

	perm = widget->readonly ? IP_RO : IP_RW;

	cam_opt *opt = new cam_opt();
	opt->widget = widget;

    switch(widget->type)
    {
	case GP_WIDGET_RADIO:
	case GP_WIDGET_MENU:
		opt->item.sw = create_switch(widget->name, widget->choices, widget->choice_cnt, widget->value.index);
        IUFillSwitchVector(&opt->prop.sw, opt->item.sw, widget->choice_cnt, getDeviceName(),
			widget->name, widget->name, widget->parent, perm, ISR_1OFMANY, 60, IPS_IDLE);
		IDDefSwitch(&opt->prop.sw, NULL);
		break;
	case GP_WIDGET_TEXT:
		IUFillText(&opt->item.text, widget->name, widget->name, widget->value.text);
        IUFillTextVector(&opt->prop.text, &opt->item.text, 1, getDeviceName(),
			widget->name, widget->name, widget->parent, perm, 60, IPS_IDLE);
		IDDefText(&opt->prop.text, NULL);
		break;
	case GP_WIDGET_TOGGLE:
        opt->item.sw = create_switch(widget->name, (char **)on_off, 2, widget->value.toggle ? 0 : 1);
        IUFillSwitchVector(&opt->prop.sw, opt->item.sw, 2, getDeviceName(),
			widget->name, widget->name, widget->parent, perm, ISR_1OFMANY, 60, IPS_IDLE);
		IDDefSwitch(&opt->prop.sw, NULL);
		break;
	case GP_WIDGET_RANGE:
		IUFillNumber(&opt->item.num, widget->name, widget->name, "%5.2f",
			widget->min, widget->max, widget->step, widget->value.num);
        IUFillNumberVector(&opt->prop.num, &opt->item.num, 1, getDeviceName(),
			widget->name, widget->name, widget->parent, perm, 60, IPS_IDLE);
		break;
	case GP_WIDGET_DATE:
		tm = gmtime((time_t *)&widget->value.date);
		IUFillText(&opt->item.text, widget->name, widget->name, asctime(tm));
        IUFillTextVector(&opt->prop.text, &opt->item.text, 1, getDeviceName(),
			widget->name, widget->name, widget->parent, perm, 60, IPS_IDLE);
		IDDefText(&opt->prop.text, NULL);
		break;
	default:
		delete opt;
		return;
	}
	
	CamOptions[widget->name] = opt;
	
}
Ejemplo n.º 2
0
void LX200_16::ISGetProperties (const char *dev)
{

if (dev && strcmp (thisDevice, dev))
    return;

  // process parent first
  LX200Autostar::ISGetProperties(dev);

  IDDefNumber (&horNum, NULL);

  IDDefSwitch (&FanStatusSw, NULL);
  IDDefSwitch (&HomeSearchSw, NULL);
  IDDefSwitch (&FieldDeRotatorSw, NULL);

}