00001 #include "prosilica/prosilica.h"
00002 #include <cstdio>
00003 #include <cassert>
00004
00005 int main(int argc, char** argv)
00006 {
00007 if (argc < 3) {
00008 printf("Usage: %s <IP address> <file>\n", argv[0]);
00009 return 0;
00010 }
00011
00012 char buffer[prosilica::Camera::USER_MEMORY_SIZE];
00013 FILE* file = fopen(argv[2], "rb");
00014 assert(file);
00015 fseek(file, 0, SEEK_END);
00016 size_t size = ftell(file);
00017 if (size > prosilica::Camera::USER_MEMORY_SIZE) {
00018 printf("File is too big!\n");
00019 return -1;
00020 }
00021 fseek(file, 0, SEEK_SET);
00022 fread(buffer, 1, size, file);
00023 fclose(file);
00024
00025 prosilica::init();
00026
00027
00028 {
00029 prosilica::Camera cam(argv[1]);
00030 cam.writeUserMemory(buffer, size);
00031 }
00032
00033 prosilica::fini();
00034
00035 return 0;
00036 }