All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arm.mbed.cloud.sdk.subscribe.model.DeviceStateObserver Maven / Gradle / Ivy

Go to download

The Pelion Cloud SDK (formerly known as Mbed Cloud SDK) provides a simplified interface to the Pelion Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.

There is a newer version: 2.5.0
Show newest version
package com.arm.mbed.cloud.sdk.subscribe.model;

import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.subscribe.AbstractObserver;
import com.arm.mbed.cloud.sdk.subscribe.SubscriptionManager;
import com.arm.mbed.cloud.sdk.subscribe.SubscriptionType;

import io.reactivex.Flowable;

@Preamble(description = "Device state observer")
public class DeviceStateObserver extends AbstractObserver {

    /**
     * Constructor.
     *
     * @param manager
     *            manager
     * @param id
     *            observer id
     * @param flow
     *            flow
     * @param filter
     *            filter
     */
    public DeviceStateObserver(SubscriptionManager manager, String id, Flowable flow,
            DeviceStateFilterOptions filter) {
        super(manager, id, flow, filter, true, null, null);
    }

    @Override
    protected boolean verifiesFilter(DeviceStateNotification notification) {
        if (filter == null) {
            return true;
        }
        return ((DeviceStateFilterOptions) filter).isVerified(notification);
    }

    @Override
    public SubscriptionType getSubscriptionType() {
        return SubscriptionType.DEVICE_STATE_CHANGE;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy