Ejemplo n.º 1
0
func (c *Camera) Init() int {
	c.context = C.gp_context_new()

	C.gp_camera_new(&c.camera)
	err := C.gp_camera_init(c.camera, c.context)
	return int(err)
}
Ejemplo n.º 2
0
//GetNewGPhotoContext returns a new gphoto context
func GetNewGPhotoContext() (*Context, error) {
	var gpContext *C.GPContext
	fmt.Printf("Gpcontext before call %#v\n", gpContext)
	gpContext = C.gp_context_new()
	fmt.Printf("Gpcontext after call %#v\n", gpContext)

	if gpContext == nil {
		return nil, fmt.Errorf("Could not initialize libgphoto2 context")
	}

	C.gp_context_set_error_func(gpContext, (*[0]byte)(C.ctx_error_func), nil)
	C.gp_context_set_status_func(gpContext, (*[0]byte)(C.ctx_status_func), nil)
	return &Context{
		gpContext: gpContext,
	}, nil
}