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

com.microsoft.azure.sdk.iotcentral.device.callbacks.EventCallback Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
// Copyright (c) Luca Druda. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package com.microsoft.azure.sdk.iotcentral.device.callbacks;

import com.microsoft.azure.sdk.iot.device.IotHubEventCallback;
import com.microsoft.azure.sdk.iot.device.IotHubStatusCode;
import com.microsoft.azure.sdk.iotcentral.device.ILogger;

public class EventCallback implements IotHubEventCallback {

    private IoTCCallback callback;
    private ILogger logger;

    public EventCallback(IoTCCallback callback, ILogger logger) {
        this.callback = callback;
        this.logger = logger;
    }

    public void execute(IotHubStatusCode responseStatus, Object callbackContext) {
        if (this.callback != null) {
            if (!responseStatus.equals(IotHubStatusCode.OK)) {
                this.callback.Exec(responseStatus.toString());
            } else {
                this.callback.Exec(responseStatus.toString());
            }
        } else {
            this.logger.Log(responseStatus.toString());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy