Interface PolarRestServiceApi

    • Constructor Detail

    • Method Detail

      • putNotification

         abstract Completable putNotification(String identifier, String notification, String path)

        Notify device via a REST API in the device.

        Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_FILE_TRANSFER

        Parameters:
        identifier - Polar device ID or BT address
        notification - content of the notification in JSON format.
        path - the API endpoint that will be notified; the path of the REST API file in device + REST API parameters.
        Returns:

        Completable with success or error

      • receiveRestApiEvents

         abstract <T extends RestApiEventPayload> Flowable<List<T>> receiveRestApiEvents(String identifier, Function1<String, T> mapper)

        Streams for received device REST API events parameters decoded as given type T endlessly. Only dispose , take(1) etc ... stops stream.

        Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_FILE_TRANSFER

        Normally requires event action that subscribes to the events using putNotification()

        Parameters:
        identifier - Polar device ID or BT address
        mapper - lambda that converts JSON string to type T
        Returns:

        Flowable stream of REST API event parameters decoded from JSON format using mapper lambda to type T. SDK provides default decoding using String.toObject<T>() where T should be a subclass of RestApiEventPayload abstract class. Example of such class is PolarSleepRecordingStatusData. Produces onNext after successfully received notification and decoded as List<T>. onCompleted not produced unless stream is further configured. onError, see BlePsFtpException, BleGattException