Пример #1
0
void setBG()
{
	

	gchar command[2500];
	//g_print("Using the program %s.\n", program);
	strcpy(command, "");
	strcpy(command, program);
	strcat(command, " ");
	switch (currentOption)
	{
		case 0:
			strcat(command, scaleOption);
			break;
		case 1:
			strcat(command, centerOption);
			break;
		case 2:
			strcat(command, tileOption);
			break;
		case 3:
			g_print("No options.\n");
			break;
	}
	strcat(command, " ");
	if (filename[0] != '\0')
	{
		strcat(command, filename);
		system(command);
		saveLast();
	}
	return;
}
Пример #2
0
//GET THREAD
//Gets Files over USB. Camera -> Memory
void * GetEvents(void*aaa){
    CameraFile* my_File;
    CameraEventType my_Type;
    void* retevent;
    struct timespec time;
    char filename[40];
    while(1){
        CameraControl();
        do{
            //Wait for camera to fire an event. Most are useless/not used by us
            //When a picture is taken (triggered on camera), FILE_ADDED event fired
            //retevent will contain a CameraFilePath object with name/loc on camera of file
            //Timeout is 100 <units, probably ms>
            gp_camera_wait_for_event(getMyCamera(), 100, &my_Type, &retevent, getMyContext());
            if(my_Type == GP_EVENT_FILE_ADDED){
                CameraFilePath* my_FP = (CameraFilePath*)retevent;

                gp_file_new(&my_File);

                //Get the file from the given location to memory
                gp_camera_file_get(getMyCamera(), my_FP->folder, my_FP->name, GP_FILE_TYPE_NORMAL, my_File, getMyContext());

                //Get time in ms since Epoch -> used for filename for Skynet purposes
                clock_gettime(CLOCK_REALTIME, &time);
                long long time_millis = time.tv_sec * 1000 + time.tv_nsec / 1000000; 
                sprintf(filename, "%s/%llu.jpg", ImagesFolder.c_str(), time_millis);
                
                AddFile(my_File, filename);

                //Save the last obtained Telemetry/GPS to disk, with the same filename we just used
                saveLast(time_millis);

                //Tell the Save Thread that there is a new CameraFile enqueued
                sem_post(&NewFileSem);
                free(my_FP);
            }
        } while(decrementWaitCounter() > 0); 
        //WaitCounter is a variable used to cycle through images possibly still on the camera
        //Used to cycle out images before switching quality, see CameraControl.c
        setWaitCounter(0); 
    }
    return NULL;
}
AREXPORT void ArLineFinder::getLinesAndSaveThem(void)
{
  getLines();
  saveLast();
}