Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
chdk_pipe.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include "chdk_pipe.h"
+ Include dependency graph for chdk_pipe.c:

Go to the source code of this file.

Macros

#define READ   0
 
#define WRITE   1
 
#define MAX_FILENAME   255
 
#define SHELL   "/root/develop/allthings_obc2014/src/popcorn/popcorn.sh"
 

Functions

static void wait_for_cmd (int timeout)
 Wait for the commandline to be available TODO: add timeout. More...
 
static void wait_for_img (char *filename, int timeout)
 Wait for the image to be available TODO: add timeout. More...
 
static pid_t popen2 (const char *command, int *infp, int *outfp)
 Open a process with stdin and stdout. More...
 
void chdk_pipe_init (void)
 Initialize the CHDK pipe. More...
 
void chdk_pipe_deinit (void)
 Deinitialize CHDK pipe. More...
 
void chdk_pipe_shoot (char *filename)
 Shoot an image. More...
 

Variables

const char * setup
 
static int fo
 
static int fi
 

Macro Definition Documentation

◆ MAX_FILENAME

#define MAX_FILENAME   255

Definition at line 17 of file chdk_pipe.c.

◆ READ

#define READ   0

Definition at line 15 of file chdk_pipe.c.

◆ SHELL

#define SHELL   "/root/develop/allthings_obc2014/src/popcorn/popcorn.sh"

Definition at line 18 of file chdk_pipe.c.

◆ WRITE

#define WRITE   1

Definition at line 16 of file chdk_pipe.c.

Function Documentation

◆ chdk_pipe_deinit()

void chdk_pipe_deinit ( void  )

Deinitialize CHDK pipe.

Definition at line 79 of file chdk_pipe.c.

References fi.

Referenced by main().

+ Here is the caller graph for this function:

◆ chdk_pipe_init()

void chdk_pipe_init ( void  )

Initialize the CHDK pipe.

Definition at line 50 of file chdk_pipe.c.

References fi, fo, popen2(), setup, SHELL, and wait_for_cmd().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chdk_pipe_shoot()

void chdk_pipe_shoot ( char *  filename)

Shoot an image.

Definition at line 92 of file chdk_pipe.c.

References fi, and wait_for_img().

Referenced by handle_msg_shoot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ popen2()

static pid_t popen2 ( const char *  command,
int *  infp,
int *  outfp 
)
static

Open a process with stdin and stdout.

Definition at line 137 of file chdk_pipe.c.

References READ, and WRITE.

Referenced by chdk_pipe_init().

+ Here is the caller graph for this function:

◆ wait_for_cmd()

static void wait_for_cmd ( int  timeout)
static

Wait for the commandline to be available TODO: add timeout.

Definition at line 126 of file chdk_pipe.c.

References fo.

Referenced by chdk_pipe_init(), and wait_for_img().

+ Here is the caller graph for this function:

◆ wait_for_img()

static void wait_for_img ( char *  filename,
int  timeout 
)
static

Wait for the image to be available TODO: add timeout.

Definition at line 102 of file chdk_pipe.c.

References fo, timeout, and wait_for_cmd().

Referenced by chdk_pipe_shoot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ fi

int fi
static

Definition at line 24 of file chdk_pipe.c.

Referenced by chdk_pipe_deinit(), chdk_pipe_init(), and chdk_pipe_shoot().

◆ fo

int fo
static

Definition at line 24 of file chdk_pipe.c.

Referenced by chdk_pipe_init(), wait_for_cmd(), and wait_for_img().

◆ setup

const char* setup
Initial value:
=
"lua props=require(\"propcase\");print(\"SetupScript\");set_prop(props.ISO_MODE,3200);set_prop(props.FLASH_MODE,2);set_prop(props.RESOLUTION,0);set_prop(props.DATE_STAMP,0);set_prop(props.AF_ASSIST_BEAM,0);set_prop(props.QUALITY,0);print(\"Ready\");\n"

Definition at line 21 of file chdk_pipe.c.

Referenced by chdk_pipe_init().