gnustep-CameraKit-20041011/000075500000000000000000000000001227725370400152765ustar00rootroot00000000000000gnustep-CameraKit-20041011/GNUmakefile000064400000000000000000000021141227725370400173460ustar00rootroot00000000000000# # GNUmakefile # # Compile the CameraKit Framework (part of ImageKits). # # Copyright (C) 2003 Nicolas SANCHEZ (nicolas.sanchez@evhr.net) # # This Makefile is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # See the GNU General Public License for more details. # include $(GNUSTEP_MAKEFILES)/common.make FRAMEWORK_NAME=CameraKit CameraKit_HEADER_FILES = \ GSGPhoto2.h \ GSCamera.h Camera_OBJC_FILES = \ GSGPhoto2.m \ GSCamera.m CameraKit_RESOURCE_FILES = ADDITIONAL_INCLUDE_DIRS = -I/usr/include/gphoto2 ADDITIONAL_OBJCFLAGS = -Wall ADDITIONAL_LDFLAGS = -lgphoto2 -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/framework.make include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUmakefile.postamble gnustep-CameraKit-20041011/GSCamera.h000064400000000000000000000013441227725370400170730ustar00rootroot00000000000000#ifndef _GSCAMERA_H_ #define _GSCAMERA_H_ #include #include @interface GSCamera: NSObject { NSString *theName; NSString *thePort; Camera *theCamera; } - (id) initWithName: (NSString *) aName Port: (NSString *) aPort Camera: (Camera *) aCamera; - (void) dealloc; - (NSString *) name; - (NSString *) port; - (NSArray *) filesInPath: (NSString *) aPath; - (NSArray *) foldersInPath: (NSString *) aPath; - (void) getFile: (NSString *)aFile from: (NSString *)srcPath to: (NSString *)destPath; - (void) deleteFile: (NSString *)file from: (NSString *)path; - (void) putFile: (NSString *)file from: (NSString *)srcPath to: (NSString *)destPath; - (NSString *) description; @end #endif gnustep-CameraKit-20041011/GSCamera.m000064400000000000000000000051071227725370400171010ustar00rootroot00000000000000#include "GSCamera.h" @implementation GSCamera - (id) initWithName: (NSString *) aName Port: (NSString *) aPort Camera: (Camera *) aCamera { [super init]; theName = [[NSString alloc] initWithString: aName]; thePort = [[NSString alloc] initWithString: aPort]; theCamera = aCamera; return self; } - (void) dealloc { RELEASE(theName); RELEASE(thePort); free(theCamera); } - (NSString *) name { return theName; } - (NSString *) port { return thePort; } - (NSArray *) filesInPath: (NSString *) aPath { CameraList *list; GPContext *context; int i, count; NSMutableArray *ar = [[NSMutableArray alloc] init]; context = gp_context_new(); gp_list_new(&list); gp_camera_folder_list_files(theCamera, [aPath cString], list, context); count = gp_list_count (list); for (i=0; i #include "GSCamera.h" @interface GSGPhoto2: NSObject { id theCameraList; } - (id) init; - (void) reinit; - (void) dealloc; - (unsigned) numberOfCameras; - (NSString *) nameOfCameraAtIndex: (int) anIndex; - (int) indexOfCameraNamed: (NSString *) aName; - (GSCamera *) cameraAtIndex: (int) anIndex; @end #endif gnustep-CameraKit-20041011/GSGPhoto2.m000064400000000000000000000046031227725370400171730ustar00rootroot00000000000000#include "GSGPhoto2.h" #include @implementation GSGPhoto2 - (id) init { [super init]; [self reinit]; return self; } - (void) reinit { NSAutoreleasePool *pool; GPContext *context; CameraList *list; CameraAbilitiesList *al = NULL; GPPortInfoList *il = NULL; int count, i; pool = [NSAutoreleasePool new]; context = gp_context_new(); gp_list_new (&list); gp_abilities_list_new (&al); gp_abilities_list_load (al, context); gp_port_info_list_new (&il); gp_port_info_list_load (il); gp_abilities_list_detect (al, il, list, context); gp_abilities_list_free (al); gp_port_info_list_free (il); count = gp_list_count (list); theCameraList = [[NSMutableArray alloc] init]; for (i = 0; i < count; i++) { Camera *camera; char *name; char *value; CameraAbilitiesList *abilities_list = NULL; CameraAbilities a; GPPortInfo info; GSCamera *cam; int m, p; gp_list_get_name (list, i, &name); gp_list_get_value (list, i, &value); gp_camera_new(&camera); gp_abilities_list_new (&abilities_list); gp_abilities_list_load (abilities_list, context); gp_port_info_list_new (&il); gp_port_info_list_load (il); m = gp_abilities_list_lookup_model(abilities_list, name); gp_abilities_list_get_abilities (abilities_list, m, &a); gp_camera_set_abilities (camera, a); p = gp_port_info_list_lookup_path (il, value); gp_port_info_list_get_info (il, p, &info); gp_camera_set_port_info (camera, info); gp_setting_set ("campics", "model", name); gp_setting_set ("campics", "port", value); gp_port_info_list_free(il); cam = [[GSCamera alloc] initWithName: [NSString stringWithCString: name] Port: [NSString stringWithCString: value] Camera: camera]; [theCameraList addObject: cam]; RELEASE(cam); free(name); free(value); } RELEASE(pool); } - (void) dealloc { RELEASE(theCameraList); [super dealloc]; } - (unsigned) numberOfCameras { return [theCameraList count]; } - (NSString *) nameOfCameraAtIndex: (int) anIndex { GSCamera *cam; cam = [theCameraList objectAtIndex: anIndex]; return [cam name]; } - (int) indexOfCameraNamed: (NSString *) aName { } - (GSCamera *) cameraAtIndex: (int) anIndex { return [theCameraList objectAtIndex: anIndex]; } @end