var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { defineTapPropertyExtension, Tap } from '@iotize/tap';
import { DEFAULT_KEEP_ALIVE_PERIOD_MS, KeepAliveEngine } from '@iotize/tap/keep-alive';
const ɵ0 = (context) => {
    return new KeepAliveEngine(context.tap, {
        period: DEFAULT_KEEP_ALIVE_PERIOD_MS
    });
};
export const _TAP_EXTENSION_KEEP_ALIVE_ = defineTapPropertyExtension('keepAlive', ɵ0);
/**
 * @deprecated use keepAlive property instead
 * @param this
 */
export function getKeepAliveEngine() {
    return this.keepAlive;
}
Tap.prototype.getKeepAliveEngine = getKeepAliveEngine;
export function setupKeepAliveFromConfig() {
    return __awaiter(this, void 0, void 0, function* () {
        const periodInSeconds = (yield this.service.interface.getHostInactivityPeriod()).body();
        this.keepAlive.period = periodInSeconds * 1000;
        this.keepAlive.start();
    });
}
Tap.prototype.setupKeepAliveFromConfig = setupKeepAliveFromConfig;
export { ɵ0 };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2VlcC1hbGl2ZS1leHQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW90aXplL3RhcC9leHQva2VlcC1hbGl2ZS8iLCJzb3VyY2VzIjpbImxpYi9rZWVwLWFsaXZlLWV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsR0FBRyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQzlELE9BQU8sRUFBR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