Skip to content

Commit

Permalink
Add camera ref #130
Browse files Browse the repository at this point in the history
  • Loading branch information
DaSpood committed Dec 5, 2023
1 parent 87faf55 commit 54ff015
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 3 deletions.
81 changes: 81 additions & 0 deletions docs/api/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,85 @@
:class: attention

This documentation is a work in progress.
:::

**enioka Scan** can still be used to manage barcodes scanned using the Android camera. For that, it
exposes the `CameraBarcodeScanView` and a series of helper classes to handle compatibility with both
Camera 1 and Camera 2 hardware APIs.

This page regroups all information needed to control this special scanner at a deeper level.

## The `CameraBarcodeScanView` class

This is the base Android `FrameLayout` used by the activity to display the camera. This view wraps
the API-specific `CameraBarcodeScanViewBase` implementation and handles the API selection based on
the device's properties.

For most users, this is the class they will interact with if they need to interact with the Camera
hardware and not just the [`Scanner`](scanner) instance.

:::{method} setReaderMode(CameraReader readerMode) -> void

Change the library used to read barcodes from the camera feed.

:param CameraReader readerMode: The library to use, between `CameraReader.ZBAR` and
`CameraReader.ZXing`
:::

:::{method} addSymbology(BarcodeType barcodeType) -> void

Add a symbology to detect. By default, only `CODE_128` is used.

:param BarcodeType barcodeType: The symbology to add.
:::

:::{method} setResultHandler(ResultHandler handler) -> void

Change the callback used when a barcode is read.

Used by `CameraBarcodeScanViewScanner` to register itself with the view and correctly propagate
barcodes read by the camera as any regular scanner reads.

:param ResultHandler handler: the
[`ResultHandler`](scanner_callbacks.md#the-camerabarcodescanviewresulthandler-interface)
implementation
:::

:::{method} setTorch(boolean value) -> void

Switch the camera's torch on or off.

:param boolean value: Indicate if the torch should be turned on (true) or off (false)
:::

:::{method} getSupportTorch() -> boolean

:returns: true if the camera supports torch activation. false otherwise.
:::

:::{method} getTorchOn() -> boolean

:returns: true if the camera's torch is on, false otherwise.
:::

:::{method} cleanUp() -> void

Unhooks all camera callbacks and closes it. After this method is called, the camera becomes unusable
and the view needs to be reinitialized.
:::

:::{method} pauseCamera() -> void

Pauses the camera's capture.
:::

:::{method} resumeCamera() -> void

Resumes the camera's capture.
:::

:::{method} getLatestSuccessfulScanJpeg() -> byte[]

:returns: The JPEG data of the image used in the latest successful scan, or null if there is no
previous scan data.
:::
6 changes: 4 additions & 2 deletions docs/api/scanner_activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ The layout used by the activity when using the camera as a scanner. May be repla

:::{cpp:var} int cameraViewId = R.id.camera_scan_view

The ID of the [`CameraBarcodeScanView`](camera.md#cameraBarcodeScanView) inside the `layoutIdCamera`
layout.
The ID of the [`CameraBarcodeScanView`](camera.md#the-camerabarcodescanview-class) inside the
`layoutIdCamera` layout.
:::

:::{cpp:var} int cameraToggleId = R.id.scanner_bt_camera
Expand Down Expand Up @@ -120,6 +120,8 @@ Initialized by the [`onStart()`](#onStart) and [`onResume()`](#onResume) methods
:::{cpp:var} CameraBarcodeScanViewScanner cameraScanner;

The instance of the camera scanner, can be used to access camera methods but should not be replaced.
`CameraBarcodeScanViewScanner` is a simple provider-less implementation of the [`Scanner`](scanner)
API.

Initialized by the [`initCamera()`](#initCamera) method.
:::
Expand Down
10 changes: 10 additions & 0 deletions docs/api/scanner_callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,14 @@ Called if the provider can manage the device.
:::{method} cannotManage() -> void

Called if the provider can not manage the device.
:::

## The `CameraBarcodeScanView.ResultHandler` interface

Callback used by the camera reader when a barcode is read from the camera feed.

:::{method} handleScanResult(String result, BarcodeType type) -> void

:param String result: The barcode data
:param BarcodeType type: The barcode symbology
:::
2 changes: 1 addition & 1 deletion docs/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ devices.

| Artefact | Provider name | Supported devices | Tested devices | Device type | External requirements | Device compatible if |
|-------------------------|----------------------------------|-----------------------------------------------------|------------------------------------|---------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `scanner` | Android camera (default) | Any device with a camera | Smartphones, integrated devices... | Camera | | Device has a camera |
| `scanner` | `CAMERA_SCANNER` (no provider) | Any device with a camera | Smartphones, integrated devices... | Camera | | Device has a camera |
| `scanner` | `AthesiE5LProvider` | Athesi E5L | Athesi E5L | Integrated | | Device name is strictly `RD50TE` |
| `scanner` | `AthesiHHTProvider` | Athesi SPA43 | Athesi SPA43 | Integrated | | Device name is strictly `SPA43LTE` |
| `scanner` | `BluebirdProvider` | Bluebird integrated scanners | Bluebird EF500 | Integrated | Bluebird service (should be preinstalled on device) | Intent `kr.co.bluebird.android.bbapi.action.BARCODE_OPEN` has a listener |
Expand Down

0 comments on commit 54ff015

Please sign in to comment.