int camera_action(){ switch(a->action){ case ACT_SLAVE:break; default: camera_on(); } switch(a->action){ case ACT_35:camera_vshot(a->focal,a->height,a->width,a->overlap,36,24);break; case ACT_6x45:camera_vshot(a->focal,a->height,a->width,a->overlap,45,60);break; case ACT_45x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,45);break; case ACT_6x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,60);break; case ACT_6x7:camera_vshot(a->focal,a->height,a->width,a->overlap,70,60);break; case ACT_7x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,70);break; case ACT_6x8:camera_vshot(a->focal,a->height,a->width,a->overlap,80,60);break; case ACT_8x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,80);break; case ACT_6x9:camera_vshot(a->focal,a->height,a->width,a->overlap,90,60);break; case ACT_9x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,90);break; case ACT_6x17:camera_vshot(a->focal,a->height,a->width,a->overlap,170,60);break; case ACT_17x6:camera_vshot(a->focal,a->height,a->width,a->overlap,60,170);break; case ACT_TEST:camera_test();break; case ACT_SLAVE:slave_read();break; case ACT_VIRTUAL:camera_vshot(a->focal,a->height,a->width,a->overlap,a->vheight,a->vwidth);break; case ACT_SPHERE:camera_sphere(a->focal,a->height,a->width,a->overlap);break; case ACT_XXX:warning("Not Implemented yet");break; } switch(a->action){ case ACT_SLAVE:break; default: camera_off(); } }
void prep_response(char r) { char arg = incoming_packet[2]; switch(r) { //Prepare id to be sent case 'i': prepare_packet(from_int(slave_id), sizeof(int)); break; //Type case 't': prepare_packet( slave_type, strlen( slave_type ) ); break; //Name case 'n': prepare_packet(slave_name, strlen( slave_name ) ); break; //Deployment Date case 'd': prepare_packet(slave_init_date, sizeof(slave_init_date)); break; //Number of read channels case 'r': prepare_packet(from_int(slave_rcount),sizeof(int)); break; //Number of write channels case 'w': prepare_packet(from_int(slave_wcount),sizeof(int)); break; //Start measurment on channel case 'm': { //Wait for measurment unsigned wait = slave_measure(); prepare_packet( from_int(wait), sizeof( unsigned ) ); waiting_measure = 1; } break; //Channel value/output case 'q': if(arg < slave_rcount ) { char* valstr = slave_read( arg ); prepare_packet( valstr, strlen( valstr ) ); } else prep_err(); break; case 'f': prepare_packet(slave_info, strlen( slave_info ) ); break; //Echo case 'e': prepare_packet("e", 1); break; //Error default: prep_err(); break; } }