Example #1
0
int		exec_command(t_cam *c, char *command, char **param)
{
  t_func	*tmp = NULL;
  int		flag = 0;

  if (strcmp(command, "liveview") != 0 && c->liveview == 1)
    {
      printf("enter inside here\n");
      c->liveview = 0;
      flag = 1;
      sleep(1);
    }
  tmp = c->first_func_ptr;
  while (tmp != NULL)
    {
      if (strcmp(command, tmp->name) == 0)
	{
	  tmp->func_ptr(c, param);
	  break;
	}
      tmp = tmp->next;
    }
  if (tmp == NULL)
    generic_exec(c, command, param);
  if (flag == 1)
    liveview(c, NULL);
  return (0);
}
Example #2
0
int cameraFunction(int command) {
    int i, retval, ss, commandint;

    gp_camera_new(&canon);
    canoncontext = gp_context_new();
    gp_log_add_func(GP_LOG_ERROR, errordumper, NULL);
    printf("Camera init.  Takes about 3 seconds.\n");
    retval = gp_camera_init(canon, canoncontext);
    if (retval != GP_OK) {
        printf("  Retval: %d\n", retval);
        exit(1);
    } else {
        printf("okay");
    }

    canon_enable_capture(canon, TRUE, canoncontext);


    printf("ready to rock\n");

    //i = getchar();
    //getchar();
    //commandint = atoi(command);
    switch (command) {
    case 'c': {
        capture(canon, canoncontext);
        break;
    }
    case 's': {
        ss = getchar();
        getchar();
        printf("ss is %c\n", ss);
        shutterchange(canon, canoncontext, ss);
        break;
    }
    case 'a': {
        int ap;
        ap = getchar();
        getchar();
        aperturechange(canon, canoncontext, ap);
        printf("aperture: %d", ap);
        break;
    }
    case 'i': {
        int iso;
        iso = getchar();
        getchar();
        isochange(canon, canoncontext, iso);
        printf("iso: %d", iso);
        break;
    }
    case 'l': {
        while (1) {
            liveview(canon, canoncontext);
        }
        break;
    }
    case 'q': {
        gp_camera_exit(canon, canoncontext);
        break;
    }
    default:
        capture(canon, canoncontext);
        return 0;

    }

    return 0;
} //end of code