-
public interface PassioSDK
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPassioSDK.Companion
-
Method Summary
Modifier and Type Method Description abstract Unitconfigure(PassioConfiguration passioConfiguration, Function1<PassioStatus, Unit> onComplete)Initializes the SDK with the given passioConfiguration. abstract UnitstartCamera(PassioCameraViewProvider passioCameraViewProvider, Integer displayRotation, PassioCameraViewProvider.CameraFacing cameraFacing, Boolean tapToFocus)Starts the camera preview with the given PassioCameraViewProvider. abstract UnitenableFlashlight(Boolean enabled)Turns the device's flashlight on or off. UnitshutDownPassioSDK()Finalizes the PassioSDK instance. abstract UnitsetPassioStatusListener(PassioStatusListener statusListener)If not null, the PassioStatusListener will provide callbacks when the internal state of the SDK's configuration process changes. abstract UnitstartDetection(ClassificationListener listener)Register a ClassificationListener to start receiving the results of the camera detection process. abstract UnitstopDetection()Stops the detection process, any listener registered at startDetection will stop emitting results. abstract IntegergetInstalledVersion(Context context, String projectId)Currently installed version of the platform ensemble. abstract StringgetSDKVersion()Current version of the Passio Platform SDK library. -
-
Method Detail
-
configure
abstract Unit configure(PassioConfiguration passioConfiguration, Function1<PassioStatus, Unit> onComplete)
Initializes the SDK with the given passioConfiguration. See PassioConfiguration for more information on the different types of SDK configuration. The initialization process includes downloading or reading a cached version of the license and loading the models into the TensorFlowLite runner. This process is being executed on a background thread, but the callback with the result of the configuration process will be called on the main thread. You may call startCamera or startFoodDetection before this method, there is no need to wait the onComplete callback.
- Parameters:
passioConfiguration- the input configuration for the SDK.onComplete- the callback that will be called at the end of the configuration process with the result in the form of the {@link ai.passio.passiosdk.core.config.
-
startCamera
abstract Unit startCamera(PassioCameraViewProvider passioCameraViewProvider, Integer displayRotation, PassioCameraViewProvider.CameraFacing cameraFacing, Boolean tapToFocus)
Starts the camera preview with the given PassioCameraViewProvider. Using CameraX (https://developer.android.com/training/camerax), the camera system will start rendering the frames onto the PreviewView. Also this method binds the camera with the lifecycle provider of the CameraViewProvider. When that lifecycle provider calls onStart() the camera preview will start and when it calls onStop() the camera preview will stop and start the shutdown process. android.view.Surface.ROTATION_
- Parameters:
passioCameraViewProvider- provides the PreviewView to render the camera frames, the lifecycle holder which will start and stop the camera, and also the context provider needed to open the camera.displayRotation- if the orientation changes are enabled, use this parameter to notify the camera of the display rotation.tapToFocus- set true to enable a tap listener on the passioCameraViewProvider's PreviewView that will start a manual focus operation.
-
enableFlashlight
abstract Unit enableFlashlight(Boolean enabled)
Turns the device's flashlight on or off.
- Parameters:
enabled- if enabled is set to true, it will turn the flashlight on.
-
shutDownPassioSDK
Unit shutDownPassioSDK()
Finalizes the PassioSDK instance. Deallocates the memory reserved for TFLite models, transformation matrices and shuts down all the background queues that power the SDK. To run the SDK again, configure must be called.
-
setPassioStatusListener
abstract Unit setPassioStatusListener(PassioStatusListener statusListener)
If not null, the PassioStatusListener will provide callbacks when the internal state of the SDK's configuration process changes. Passing null will unregister the listener.
-
startDetection
abstract Unit startDetection(ClassificationListener listener)
Register a ClassificationListener to start receiving the results of the camera detection process.
-
stopDetection
abstract Unit stopDetection()
Stops the detection process, any listener registered at startDetection will stop emitting results.
-
getInstalledVersion
abstract Integer getInstalledVersion(Context context, String projectId)
Currently installed version of the platform ensemble.
-
getSDKVersion
abstract String getSDKVersion()
Current version of the Passio Platform SDK library.
-
-
-
-