DeviceCommunication

The interface the SOCommMediaClient uses to communicate with a remote device.

This structure / architectural approach has been chosen to be able to use the SOCommMediaClient with different SwarovskiOptik devices which are connected to using different techniques.

Each specific device (or better: their communication artifact) should expose a specific implementation of this interface, that needs to be passed in the SOCommMediaClientBuilder.

Types

Link copied to clipboard
data class DownloadedFile(val file: File, val fileName: String)

A POJO that contains information about a downloaded file, specifically the downloaded location of the file file as well as the original name of the file fileName.

Link copied to clipboard
data class NewItemAdded(val fileName: String, val data: ByteArray, val isFullResolutionImage: Boolean)

A POJO that contains all fields that a thumbnail consists of.

Functions

Link copied to clipboard
@CheckReturnValue
abstract fun availableItemsObservable(mediaType: MediaType): Observable<List<String>>
Link copied to clipboard
@CheckReturnValue
abstract fun fullResolutionItemReceivedObservable(mediaType: MediaType): Flowable<DeviceCommunication.DownloadedFile>
Link copied to clipboard
@CheckReturnValue
abstract fun isInStateToDownloadFullResolutionImages(mediaType: MediaType): Observable<Boolean>
Link copied to clipboard
@CheckReturnValue
abstract fun isInStateToDownloadThumbnails(mediaType: MediaType): Observable<Boolean>
Link copied to clipboard
@CheckReturnValue
abstract fun publishFileReceived(fileName: String, mediaType: MediaType): Completable
Link copied to clipboard
open fun setLocalMediaItemsProvider(mediaType: MediaType, single: Single<List<MediaItem.Local>>)

A method that will be invoked by the SOCommMediaClient with a Single that can be used to retrieve the current locally stored media items, e.g. to be able to check whether some items should be downloaded or are already downloaded from the remote device.

Link copied to clipboard
@CheckReturnValue
abstract fun startObservingForFullResolutionImages(mediaType: MediaType): Completable

Starts to observe for full resolution items from the remote device, which will be emitted at fullResolutionItemReceivedObservable.

Link copied to clipboard
@CheckReturnValue
abstract fun startObservingForThumbnails(shouldThumbnailBeFetched: (fileName: String) -> Single<Boolean>, maxNumberOfThumbnailsToFetch: Int, mediaType: MediaType): Completable

Starts to observe for thumbnails from the remote device, which will be emitted at thumbnailReceivedObservable.

Link copied to clipboard
@CheckReturnValue
abstract fun stopObservingForFullResolutionImages(mediaType: MediaType): Completable

Stops observing for full resolution items (that has been started by calling startObservingForFullResolutionImages).

Link copied to clipboard
@CheckReturnValue
abstract fun stopObservingForThumbnails(mediaType: MediaType): Completable

Stops observing for thumbnails (that has been started by calling startObservingForThumbnails).

Link copied to clipboard
@CheckReturnValue
abstract fun thumbnailReceivedObservable(mediaType: MediaType): Observable<DeviceCommunication.NewItemAdded>