diff --git a/.gitignore b/.gitignore index fc37afa..0eab9be 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,5 @@ test/spec/*.js.map .vscode /.nyc_output/ -/test/integration/app/spec/swagger.json \ No newline at end of file +/test/integration/app/spec/swagger.json +/examples/*.jpeg \ No newline at end of file diff --git a/README.md b/README.md index fd3734a..1cb1728 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,13 @@ cameraList.close(); ## Examples -Some example +Some example are available in the `examples` directory. + +Before run example, run `npm run build` then `node examples/camera.js`. ## Contributors -Please read [contributing guidelines here](./CONTRIBUTING.md). + +Contributors and PR are welcome. Before, just read [contributing guidelines here](./CONTRIBUTING.md) ;) diff --git a/examples/abilities-list.js b/examples/abilities-list.js index 8ac8de8..04c7ea2 100644 --- a/examples/abilities-list.js +++ b/examples/abilities-list.js @@ -1,4 +1,4 @@ -import { checkCode } from '../src/driver'; +const { checkCode } = require('../lib/driver'); const { AbilitiesList, PortInfoList, GPhoto2Driver } = require('../src'); const ref = require('ref'); diff --git a/examples/camera-autoselect.js b/examples/camera-autoselect.js index 93806a6..5e5df71 100644 --- a/examples/camera-autoselect.js +++ b/examples/camera-autoselect.js @@ -1,4 +1,4 @@ -const { Camera, closeQuietly } = require('../src'); +const { Camera, closeQuietly } = require('../lib'); const path = require('path'); const camera = new Camera(); diff --git a/examples/camera-info.js b/examples/camera-info.js index c5303d3..3183ca6 100644 --- a/examples/camera-info.js +++ b/examples/camera-info.js @@ -1,6 +1,6 @@ const SegfaultHandler = require('segfault-handler'); const path = require('path'); -const { CameraList, closeQuietly } = require('../src'); +const { CameraList, closeQuietly } = require('../lib'); SegfaultHandler.registerHandler('crash.log'); diff --git a/examples/camera-list-autodetect.js b/examples/camera-list-autodetect.js index c56190f..90682ee 100644 --- a/examples/camera-list-autodetect.js +++ b/examples/camera-list-autodetect.js @@ -1,5 +1,5 @@ const SegfaultHandler = require('segfault-handler'); -const { CameraList } = require('../src'); +const { CameraList, PortInfoList } = require('../lib'); SegfaultHandler.registerHandler('crash.log'); diff --git a/examples/camera-list-populate.js b/examples/camera-list-populate.js index 0b1582e..0991808 100644 --- a/examples/camera-list-populate.js +++ b/examples/camera-list-populate.js @@ -1,5 +1,5 @@ const SegfaultHandler = require('segfault-handler'); -const { CameraList, PortInfoList } = require('../src'); +const { CameraList, PortInfoList } = require('../lib'); SegfaultHandler.registerHandler('crash.log'); diff --git a/examples/camera-scenario-async.js b/examples/camera-scenario-async.js index 3637707..90eb55d 100644 --- a/examples/camera-scenario-async.js +++ b/examples/camera-scenario-async.js @@ -1,4 +1,4 @@ -const { Camera, closeQuietly, CameraWidgets } = require('../src'); +const { Camera, closeQuietly, CameraWidgets } = require('../lib'); const path = require('path'); const camera = new Camera(); diff --git a/examples/camera-scenario.js b/examples/camera-scenario.js index 30ebb6f..818a736 100644 --- a/examples/camera-scenario.js +++ b/examples/camera-scenario.js @@ -1,4 +1,4 @@ -const { Camera, closeQuietly, CameraWidgets } = require('../src'); +const { Camera, closeQuietly, CameraWidgets } = require('../lib'); const path = require('path'); const camera = new Camera(); diff --git a/examples/camera.js b/examples/camera.js index 8ae381c..0012b6f 100644 --- a/examples/camera.js +++ b/examples/camera.js @@ -1,6 +1,6 @@ const SegfaultHandler = require('segfault-handler'); const path = require('path'); -const { CameraList, closeQuietly } = require('../src'); +const { CameraList, closeQuietly } = require('../lib'); SegfaultHandler.registerHandler('crash.log'); diff --git a/examples/capture-1.jpeg b/examples/capture-1.jpeg deleted file mode 100644 index c70bad5..0000000 Binary files a/examples/capture-1.jpeg and /dev/null differ diff --git a/examples/port-list.js b/examples/port-list.js index f077c49..78b5661 100644 --- a/examples/port-list.js +++ b/examples/port-list.js @@ -1,4 +1,4 @@ -const { PortInfoList } = require('../src'); +const { PortInfoList } = require('../lib'); const portList = new PortInfoList(); diff --git a/examples/widgets.js b/examples/widgets.js index 7adbbb9..c63f708 100644 --- a/examples/widgets.js +++ b/examples/widgets.js @@ -1,5 +1,5 @@ const path = require('path'); -const { CameraList, closeQuietly } = require('../src'); +const { CameraList, closeQuietly } = require('../lib'); SegfaultHandler.registerHandler('crash.log'); diff --git a/src/driver/modules/GPFileModule.ts b/src/driver/modules/GPFileModule.ts index ce80f06..beabdf3 100644 --- a/src/driver/modules/GPFileModule.ts +++ b/src/driver/modules/GPFileModule.ts @@ -7,6 +7,8 @@ export const GP_FILE_MODULE_ASYNC_KEYS: string[] = ["gp_file_save"]; // tslint:disable-next-line: variable-name export const GPFileModuleDescription = { gp_file_new: ["int", [refType(RefCameraFile)]], + gp_file_new_from_fd: ["int", [refType(RefCameraFile), "int"]], + gp_file_get_mime_type: ["int", [RefCameraFile, refType(types.CString)]], gp_file_ref: ["int", [RefCameraFile]], gp_file_clean: ["int", [RefCameraFile]], gp_file_save: ["int", [RefCameraFile, types.CString]], @@ -22,6 +24,22 @@ export interface IGPFileModule { */ gp_file_new(buffer: PointerOf): GPCodes; + /** + * Create new {@link CameraFile} object from a UNIX filedescriptor. + * @param {PointerOf} buffer + * @param {number} fd + * @returns {GPCodes} + */ + gp_file_new_from_fd(buffer: PointerOf, fd: number): GPCodes; + + /** + * + * @param {PointerCameraFile} file + * @param {PointerOf} mime + * @returns {GPCodes} + */ + gp_file_get_mime_type(file: PointerCameraFile, mime: PointerOf): GPCodes; + /** * * @param {PointerCameraFile} cameraFile