Interface PolarRestServiceApi

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • getRestApiDescription

         abstract Single<PolarDeviceRestApiServiceDescription> getRestApiDescription(String identifier, String path)

        Get details related to particular REST API.

        Parameters:
        identifier - Polar Device ID or BT address
        path - the REST API path corresponding to a named service returned by listRestApiServices
        Returns:

        Single object with detailed description of the service, or error

      • putNotification

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

        Notify device via a REST API in the device.

        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. 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