Bi-monthly release with minor bug fixes and improvements
0x000000000040cf56 in GPhotoCCD::create_switch (this=0xbdf2c0,
basestr=0xc30804 "whitebiaspresetno", options=0xc89c60, max_opts=1,
setidx=0) at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:821
Please Log in or Create an account to join the conversation.
int gphoto_read_widget(gphoto_widget *widget)
{
char *ptr=NULL;
int i;
int ret = GP_OK;
switch(widget->type) {
case GP_WIDGET_TEXT:
/* some code here */
case GP_WIDGET_RADIO:
case GP_WIDGET_MENU:
ret = gp_widget_get_value (widget->widget, &ptr);
/* the first time precessing the whitebiaspresetno widget, ret = GP_OK, and ptr still NULL */
if (ret != GP_OK)
return ret;
if (! widget->choices) {
widget->choice_cnt = gp_widget_count_choices (widget->widget);
widget->choices = calloc(sizeof(char *), widget->choice_cnt + 1);
/* allocate memery */
for ( i=0; i<widget->choice_cnt; i++) {
const char *choice=NULL;
ret = gp_widget_get_choice (widget->widget, i, &choice);
/ * ret = GP_OK and choice = "0" */
if (ret != GP_OK)
return ret;
if (ptr && choice)
{
if (strcmp(choice, ptr) == 0)
widget->value.index = i;
widget->choices[i] = choice;
}
else
return GP_ERROR;
/* ptr = NULL, so return GP_ERROR, but widget->choices is not NULL */
}
}
break;
case GP_WIDGET_DATE:
ret = gp_widget_get_value (widget->widget, &widget->value.date);
break;
default:
fprintf(stderr, "WARNING: Widget type: %d is unsupported\n", widget->type);
}
return ret;
}
gphoto_widget *gphoto_get_widget_info(gphoto_driver *gphoto, gphoto_widget_list **iter)
{
gphoto_widget *widget;
if(! *iter)
return NULL;
widget = (*iter)->widget;
int ret = gphoto_read_widget(widget);
/* ret = GP_ERROR */
if (ret == GP_OK)
{
*iter=(*iter)->next;
return widget;
}
else
return NULL;
/* so iter still point to whitbiaspresetno widget */
}
int gphoto_read_widget(gphoto_widget *widget)
{
char *ptr=NULL;
int i;
int ret = GP_OK;
switch(widget->type) {
case GP_WIDGET_TEXT:
/* some code here */
case GP_WIDGET_RADIO:
case GP_WIDGET_MENU:
ret = gp_widget_get_value (widget->widget, &ptr);
/* the second time precessing the whitebiaspresetno widget, ret = GP_OK, and ptr still NULL */
if (ret != GP_OK)
return ret;
/* the last time widget whitbiaspresetno's choices's memery is allocated , but value of choices[0] is 0x0 */
/* this time func will directly return ret value, GP_OK */
if (! widget->choices) {
widget->choice_cnt = gp_widget_count_choices (widget->widget);
widget->choices = calloc(sizeof(char *), widget->choice_cnt + 1);
for ( i=0; i<widget->choice_cnt; i++) {
const char *choice=NULL;
ret = gp_widget_get_choice (widget->widget, i, &choice);
if (ret != GP_OK)
return ret;
if (ptr && choice)
{
if (strcmp(choice, ptr) == 0)
widget->value.index = i;
widget->choices[i] = choice;
}
else
return GP_ERROR;
}
}
break;
case GP_WIDGET_DATE:
ret = gp_widget_get_value (widget->widget, &widget->value.date);
break;
default:
fprintf(stderr, "WARNING: Widget type: %d is unsupported\n", widget->type);
}
return ret;
}
gphoto_widget *gphoto_get_widget_info(gphoto_driver *gphoto, gphoto_widget_list **iter)
{
gphoto_widget *widget;
if(! *iter)
return NULL;
widget = (*iter)->widget;
int ret = gphoto_read_widget(widget);
*iter=(*iter)->next;
if (ret == GP_OK)
{
return widget;
}
else
return NULL;
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.