10 #define MAX_FILENAME 512
11 #define MAX_PROCESSING_THREADS 8
12 #define MAX_IMAGE_BUFFERS 25
15 #define SODA "/root/develop/allthings_obc2014/src/soda/soda"
23 static pthread_mutex_t
mut = PTHREAD_MUTEX_INITIALIZER;
25 int main(
int argc,
char *argv[])
32 printf(
"CATIA:\tStarting Camera Application Triggering Image Analysis\n");
36 printf(
"CATIA:\tfailed to open /dev/ttySAC0\n");
39 pthread_mutex_init(&
mut, NULL);
55 if (read(
fd, &c, 1) > 0) {
57 }
else if (errno != 11) {
58 printf(
"CATIA:\nSerial error: %d\n" , errno);
73 printf(
"CATIA:\tSHOT %d,%d\n", shoot->
data.nr, shoot->
data.phi);
100 printf(
"CATIA:\tShutdown\n");
110 pthread_mutex_lock(&
mut);
112 pthread_mutex_unlock(&
mut);
113 printf(
"CATIA-%d:\tShooting: too fast\n", shoot->
data.nr);
122 pthread_mutex_unlock(&
mut);
124 printf(
"CATIA-%d:\tShooting: start\n", shoot->
data.nr);
126 printf(
"CATIA-%d:\tShooting: got image %s\n", shoot->
data.nr, filename);
128 pthread_mutex_lock(&
mut);
130 pthread_mutex_unlock(&
mut);
133 sprintf(soda_call,
"%s %s %d %d %d %d %d %d %d %d %d %d",
SODA, filename,
135 shoot->
data.vground, shoot->
data.course, shoot->
data.groundalt);
136 printf(
"CATIA-%d:\tCalling '%s'\n", shoot->
data.nr, soda_call);
137 short int ret = system(soda_call);
138 printf(
"CATIA-%d:\tShooting: soda return %d of image %s\n", shoot->
data.nr, ret, filename);
140 pthread_mutex_lock(&
mut);
142 pthread_mutex_unlock(&
mut);
153 printf(
"CATIA:\thandle_msg_buffer: Send %d\n",
image_idx);
169 struct mora_status_struct status_msg;
170 char *buffer = (
char *) &status_msg;
172 pthread_mutex_lock(&
mut);
176 status_msg.extra = 0;
177 pthread_mutex_unlock(&
mut);
#define MORA_SHOOT_MSG_SIZE
static volatile int is_shooting
static volatile int image_count
#define MoraPutUint8(_byte)
void chdk_pipe_deinit(void)
Deinitialize CHDK pipe.
static volatile int shooting_thread_count
struct mora_transport mora_protocol
#define MAX_PROCESSING_THREADS
struct dc_shot_union::@15 data
uint8_t bin[MORA_SHOOT_MSG_SIZE]
#define MORA_BUFFER_EMPTY
void socket_init(int is_server)
static void * handle_msg_shoot(void *ptr)
#define MORA_PAYLOAD_MSG_SIZE
static char image_buffer[MAX_IMAGE_BUFFERS][IMAGE_SIZE]
int socket_recv(char *buffer, int len)
int main(int argc, char *argv[])
void chdk_pipe_shoot(char *filename)
Shoot an image.
static void send_msg_status(void)
#define MoraHeader(msg_id, payload_len)
int serial_init(char *port_name)
void chdk_pipe_init(void)
Initialize the CHDK pipe.
static pthread_mutex_t mut
#define MAX_IMAGE_BUFFERS
static volatile int image_idx
static volatile int shooting_count
static volatile int shooting_idx
#define MORA_STATUS_MSG_SIZE
void parse_mora(struct mora_transport *t, uint8_t c)
static void send_msg_image_buffer(void)