package org.iotivity.bridge.homeserver.handler.client;

import android.util.Log;

import org.iotivity.OCEventCallbackResult;
import org.iotivity.OCTriggerHandler;
import org.iotivity.bridge.homeserver.BridgeServerActivity;
import org.iotivity.bridge.homeserver.BridgeService;
import org.iotivity.bridge.homeserver.model.Light;
import org.iotivity.bridge.homeserver.utils.Utils;
import org.iotivity.oc.OcRemoteResource;
import org.iotivity.oc.OcUtils;

public class StopObserveTriggerHandler implements OCTriggerHandler {

    private static final String TAG = StopObserveTriggerHandler.class.getSimpleName();

    private OcRemoteResource resource ;

    public StopObserveTriggerHandler(OcRemoteResource resource) {
        this.resource = resource ;
    }

    @Override
    public OCEventCallbackResult handler() {

        Log.d(TAG, "Stop Observe by Trigger");
        OcUtils.stopObserve(resource.getUri(), Utils.getCoapsEndpoint(resource.getEndpoints()));

        return OCEventCallbackResult.OC_EVENT_DONE;
    }
}
