Example #1
0
int main()
{
    init();
    /* Run forever */
    while (1)
    {
        if (menu_flag)
        {
          disable_leds();
          handle_prompt(&counts);
          menu_flag = false;
        }

        red_led_task(&counts.red_led);

        if (hough_released_flag)
        {
            hough_transform_task(&counts.hough);
            counts.hough++;
            hough_released_flag = false;
        }
    }
}
Example #2
0
void	handle_command(t_client *client, char cmd[], int size)
{
  int	i;
  int	cmd_size;

  if (strlen(cmd) < 1)
  {
    handle_prompt(client, NULL, 0);
    return ;
  }
  i = 0;
  while (local_cmds[i].cmd)
  {
    cmd_size = strlen(local_cmds[i].cmd);
    if (strncmp(local_cmds[i].cmd, cmd, cmd_size) == 0)
    {
      (local_cmds[i].func)(client, &cmd[cmd_size], size - cmd_size);
      return ;
    }
    ++i;
  }
  dprintf(client->sockfd, "COMMAND:%s%s", cmd, TCP_SEPARATOR);
  client->wait_data = 1;
}