Class Property<T>
- Type Parameters:
T
- Type of the property.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
get
(OnReceived<T> onReceived, OnRemoteError onError) Gets a property value asynchronously.getSync()
Gets a property value synchronously (blocking).boolean
Check if this property is available.void
set
(T value, OnCompletion onCompletion, OnRemoteError onError) Sets a property value asynchronously.Sets a property value synchronously (blocking).subscribe
(OnReceived<T> onReceived) Listen for when the Property changes.void
Revoke subscription.
-
Method Details
-
isAvailable
Check if this property is available. This method is blocking. Some properties are only supported by some types of cameras. Use this method to check if this property is supported before reading/writing.Note: this method may throw a
RuntimeException
if communication with the remote camera fails or some other problem occurs. -
get
Gets a property value asynchronously.- Parameters:
onReceived
- Callback that is invoked with the remote value if it was successfully fetched.onError
- Callback that is invoked if any error occurred during update.
-
getSync
Gets a property value synchronously (blocking).Note: this method may throw a
RuntimeException
if communication with the remote camera fails or some other problem occurs.- Returns:
- The remote value on success, or throws an exception on failure.
-
set
Sets a property value asynchronously.Note: this may throw
UnsupportedOperationException
if the operation is not supported (i.e. when trying to set read-only properties).- Parameters:
value
- The new value to set.onCompletion
- Callback that is invoked if the value was successfully updated.onError
- Callback that is invoked if any error occurred during update.
-
setSync
Sets a property value synchronously (blocking).Note: this may throw
UnsupportedOperationException
if the operation is not supported (i.e. when trying to set read-only properties).- Parameters:
value
- The new value to set.- Returns:
- Returns
null
if operation succeeded, otherwise returns an error code, indicating that the operation failed.
-
subscribe
Listen for when the Property changes. This method is blocking until subscription is set up or an error is returned.Note: this may throw
UnsupportedOperationException
if the operation is not supported (i.e. when a property is not subscribable).- Parameters:
onReceived
- Callback to receive the new value when this property has been updated. It's called on a background thread.- Returns:
- Returns
null
if operation succeeded, otherwise returns an error code, indicating that the operation failed.
-
unsubscribe
Revoke subscription. This method is blocking.Note: this method may throw a
RuntimeException
if communication with the remote camera fails or some other problem occurs.Note: this may throw
UnsupportedOperationException
if the operation is not supported (i.e. when a property is not subscribable).
-