Interface PolarRestServiceApi
-
- All Implemented Interfaces:
public interface PolarRestServiceApi
-
-
Method Summary
Modifier and Type Method Description abstract Single<PolarDeviceRestApiServices>
listRestApiServices(String identifier)
Discover available services from device abstract Single<PolarDeviceRestApiServiceDescription>
getRestApiDescription(String identifier, String path)
Get details related to particular REST API. abstract Completable
putNotification(String identifier, String notification, String path)
Notify device via a REST API in the device. 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. -
-
Method Detail
-
listRestApiServices
abstract Single<PolarDeviceRestApiServices> listRestApiServices(String identifier)
Discover available services from device
- Parameters:
identifier
- Polar Device ID or BT address- Returns:
Single object listing service names and corresponding paths or error
-
getRestApiDescription
abstract Single<PolarDeviceRestApiServiceDescription> getRestApiDescription(String identifier, String path)
Get details related to particular REST API.
- Parameters:
identifier
- Polar Device ID or BT addresspath
- 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 addressnotification
- 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 addressmapper
- 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
-
-
-
-