Class Cast
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Boolean result callback.static interface
Connection callback.static interface
Firmware version callback.static interface
Clarius Cast callbacks.static interface
Probe info callback.static interface
Callback when the raw data was retrieved from the probe.static interface
Callback when the raw data availability request was completed.static interface
Callback when the raw data request was completed.static interface
Capture creation callback. -
Constructor Summary
ConstructorsConstructorDescriptionCast
(android.content.Context context, Cast.Listener listener) Deprecated.Cast
(String nativeLibraryDir, Cast.Listener listener) Load the Clarius Cast library. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addImageOverlay
(int captureID, byte[] bytes, int width, int height, float red, float green, float blue, float alpha) Add an image overlay to a started captureboolean
addLabelOverlay
(int captureID, String text, double x, double y, double width, double height) Add a label overlay to a started captureboolean
addMeasurement
(int captureID, MeasurementType type, String label, PointF[] points) Add a measurement to a started capturevoid
connect
(String ipAddress, int port, Optional<Long> networkID, String certificate, Cast.ConnectionResult resultFn) Connect to a probe that is on the same network as the caller.void
disconnect
(Cast.BooleanResult resultFn) Disconnect from an existing connection.void
finishCapture
(int captureID, Cast.BooleanResult resultFn) Finish a previously started capture and send it to the app.void
getFirmwareVersion
(Platform platform, Cast.FirmwareVersionResult resultFn) Retrieve the firmware version for a given platform.void
getProbeInfo
(Cast.ProbeInfoResult resultFn) Retrieve the probe info.void
initialize
(String sslDir, Cast.BooleanResult resultFn) Initialize the Clarius Cast library to enable connection.boolean
Check if Clarius Cast is currently connected to a probe.boolean
Check if Clarius Cast has been initialized.void
readRawData
(Cast.ReadRawDataCallback resultFn) Retrieve raw data from a previous request.void
release()
Unload the Clarius Cast library, any subsequent call will be no-op.void
requestRawData
(long start, long end, boolean lzo, Cast.RequestRawDataCallback resultFn) Request raw data from the probe.void
Request raw data availability.void
separateOverlays
(boolean enable) Set a flag to separate overlays into separate images.void
setFormat
(ImageFormat format) Set the format for processed images, by default the format will be uncompressed ARGB32.void
setOutputSize
(int width, int height) Set the dimensions of the output display for scan conversion.void
startCapture
(long timestamp, Cast.StartCaptureResult resultFn) Create a capture request locally for sending to the app.void
userFunction
(UserFunction userFunction, double value, Cast.BooleanResult resultFn) Perform a user function on a connected probe.
-
Constructor Details
-
Cast
Deprecated.This constructor is no longer acceptable, useCast(String, Listener)
instead.The Context object was used to obtain the path to the native JNI libraries, the new constructor lets user specify their own path if needed. The default path is: requireContext().getApplicationInfo().nativeLibraryDir.
Deprecated in version 10.3.0.
Load the Clarius Cast library.- Parameters:
context
- the application context.listener
- API callbacks.
-
Cast
Load the Clarius Cast library.- Parameters:
nativeLibraryDir
- full path to the directory where native JNI libraries are stored. The Clarius Cast library will look for Qt plugins inside this directory. The path can be obtained from requireContext().getApplicationInfo().nativeLibraryDir.listener
- API callbacks.
-
-
Method Details
-
release
public void release()Unload the Clarius Cast library, any subsequent call will be no-op. -
initialize
Initialize the Clarius Cast library to enable connection.- Parameters:
sslDir
- the directory to store security keys.resultFn
- the result callback.
-
isInitialized
public boolean isInitialized()Check if Clarius Cast has been initialized.- Returns:
- true if Clarius Cast has been initialized.
-
connect
public void connect(String ipAddress, int port, Optional<Long> networkID, String certificate, Cast.ConnectionResult resultFn) Connect to a probe that is on the same network as the caller.NOTE: The network ID is used when attempting to connect to the probe's Wi-Fi that was auto-joined with Android Wi-Fi Network Request API. It can be obtained from the Network object obtained in the NetworkCallback.onAvailable() callback. It can also be obtained in the launch intent sent from the Clarius App in the Marketplace workflow.
- Parameters:
ipAddress
- the IP address of the probe.port
- the probe's TCP port to connect to.networkID
- the Wi-Fi network ID obtained when auto-joining Wi-Fi.certificate
- the certificate for authenticating the probe.resultFn
- the result callback.
-
disconnect
Disconnect from an existing connection.- Parameters:
resultFn
- the result callback.
-
isConnected
public boolean isConnected()Check if Clarius Cast is currently connected to a probe.- Returns:
- true if Clarius Cast is connected to a probe.
-
setOutputSize
public void setOutputSize(int width, int height) Set the dimensions of the output display for scan conversion.The output will always result in a 1:1 pixel ratio, depending on geometry of scanning array, and parameters the frame will have various sizes of black borders around the image.
- Parameters:
width
- the number of horizontal pixels in the output.height
- the number of vertical pixels in the output.
-
separateOverlays
public void separateOverlays(boolean enable) Set a flag to separate overlays into separate images.For example if color/power Doppler or strain imaging is enabled, two callbacks will be generated: one with the grayscale frame and the other with the overlay.
- Parameters:
enable
- the enable flag for separating overlays.
-
setFormat
Set the format for processed images, by default the format will be uncompressed ARGB32.- Parameters:
format
- the format of the image.
-
userFunction
Perform a user function on a connected probe.- Parameters:
userFunction
- the command to run.value
- the value to set if the function supports setting of values, see UserFunction enumerations for details.resultFn
- the result callback.
-
getProbeInfo
Retrieve the probe info.- Parameters:
resultFn
- the result callback.
-
getFirmwareVersion
Retrieve the firmware version for a given platform.- Parameters:
platform
- the platform for which to retrieve the firmware version.resultFn
- the result callback.
-
requestRawDataAvailability
Request raw data availability.NOTE: probe must be frozen and in a raw data buffering mode in order for the call to succeed.
- Parameters:
resultFn
- the result callback.
-
requestRawData
Request raw data from the probe.NOTE: probe must be frozen and in a raw data buffering mode in order for the call to succeed.
Usage:
- Request raw data with this function first
- On success, read raw data with
readRawData(ReadRawDataCallback)
- Parameters:
start
- the first frame to request, as determined by timestamp in nanoseconds, set start and end to 0 to requests all data in buffer.end
- the last frame to request, as determined by timestamp in nanoseconds, set start and end to 0 to requests all data in buffer.lzo
- flag to package the raw data with lzo compressionresultFn
- the result callback.
-
readRawData
Retrieve raw data from a previous request.NOTE: call
requestRawData(long, long, boolean, RequestRawDataCallback)
first.- Parameters:
resultFn
- the result callback.
-
startCapture
Create a capture request locally for sending to the app.NOTE: not strictly required for probe to be frozen, but it gives a lower chance of synchronization errors.
- Parameters:
timestamp
- the frame to request, in nanoseconds.resultFn
- the result callback.
-
addImageOverlay
public boolean addImageOverlay(int captureID, byte[] bytes, int width, int height, float red, float green, float blue, float alpha) Add an image overlay to a started capture- Parameters:
captureID
- the ID of the capture which is to be added tobytes
- the image bytes (8-bit grayscale)width
- width of the image data which is to be added; must match the width from setOutputSizeheight
- height of the image data which is to be added; must match the height from setOutputSizered
- the value of red use in colorizing the overlay, should be between 0.0 and 1.0green
- the value of green use in colorizing the overlay, should be between 0.0 and 1.0blue
- the value of blue use in colorizing the overlay, should be between 0.0 and 1.0alpha
- the value of alpha (opacity) use in colorizing the overlay, should be between 0.0 and 1.0- Returns:
- true the image overlay was successfully added to the capture.
-
addLabelOverlay
public boolean addLabelOverlay(int captureID, String text, double x, double y, double width, double height) Add a label overlay to a started capture- Parameters:
captureID
- the ID of the capture which is to be added totext
- string of the label to be addedx
- x-position of the label in pixels (same scale as the width from setOutputSize)y
- y-position of the label in pixels (same scale as the height from setOutputSize)width
- width of the label in pixels (same scale as the width from setOutputSize)height
- height of the label in pixels (same scale as the height from setOutputSize)- Returns:
- true the label overlay was successfully added to the capture.
-
addMeasurement
Add a measurement to a started capture- Parameters:
captureID
- the ID of the capture which is to be added totype
- the type of measurement to be addedlabel
- string label for the measurementpoints
- NSValue holding an array of CGPoint/NSPoint in pixels (same scale as the width/height from cusCastInit)- Returns:
- true the measurement overlay was successfully added to the capture.
-
finishCapture
Finish a previously started capture and send it to the app.NOTE: call startCapture() first.
- Parameters:
captureID
- the ID of the capture which is to be finishedresultFn
- the result callback.
-
Cast(String, Listener)
instead.