// Opens the device and prepares it for use. This must be the first call made on the Device. func (device *Device) Open() int { rc := int(C.freenect_open_device(device.freenect.ctx, &device.dev, C.int(device.index))) if rc == 0 { C.freenect_set_user(device.dev, unsafe.Pointer(device)) } return rc }
//FREENECTAPI void freenect_set_user(freenect_device *dev, void *user); func (dev *Device) SetUser(user unsafe.Pointer) { C.freenect_set_user(dev.ptr(), user) }
// Closes the device and releases its resources. func (device *Device) Close() int { C.freenect_set_user(device.dev, nil) return int(C.freenect_close_device(device.dev)) }