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

com.arm.mbed.cloud.sdk.connect.subscription.AbstractSubscriptionAction 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.connect.subscription;

import com.arm.mbed.cloud.sdk.Connect;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.AbstractApi;
import com.arm.mbed.cloud.sdk.subscribe.model.FirstValue;
import com.arm.mbed.cloud.sdk.subscribe.store.SubscriptionAction;

@Preamble(description = "Generic definition of subscription action")
@Internal
public abstract class AbstractSubscriptionAction implements SubscriptionAction {

    protected final Connect api;
    protected FirstValue mode;

    /**
     * Constructor.
     *
     * @param api
     *            Connect API instance
     * @param mode
     *            mode
     */
    public AbstractSubscriptionAction(AbstractApi api, FirstValue mode) {
        super();
        this.api = (Connect) api;
        this.mode = mode;
    }

    /**
     * Sets the first value mode.
     *
     * @see FirstValue
     * @param mode
     *            the mode to set
     */
    @Override
    public void setMode(FirstValue mode) {
        this.mode = mode;
    }

    /**
     * Sets the first value mode.
     *
     * @see FirstValue
     * @param firstValueMode
     *            the mode to set
     */
    @Override
    public SubscriptionAction mode(FirstValue firstValueMode) {
        setMode(firstValueMode);
        return this;
    }

    /**
     * States whether a connection to the Cloud was set up or not.
     *
     * @return true if a cloud connection was set up. False otherwise.
     */
    public boolean hasCloudConnection() {
        return api != null;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#clone()
     */
    @Override
    public abstract SubscriptionAction clone();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy