(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@iotize/tap'), require('@iotize/tap/client/api'), require('@iotize/tap/client/impl'), require('@iotize/tap/service/core'), require('@iotize/tap/service/impl/single-packet')) :
    typeof define === 'function' && define.amd ? define('@iotize/tap/service/impl/data-log', ['exports', '@iotize/tap', '@iotize/tap/client/api', '@iotize/tap/client/impl', '@iotize/tap/service/core', '@iotize/tap/service/impl/single-packet'], factory) :
    (global = global || self, factory((global.iotize = global.iotize || {}, global.iotize.tap = global.iotize.tap || {}, global.iotize.tap.service = global.iotize.tap.service || {}, global.iotize.tap.service.impl = global.iotize.tap.service.impl || {}, global.iotize.tap.service.impl['data-log'] = {}), global.iotize.tap, global.iotize.tap.client.api, global.iotize.tap.client.impl, global.iotize.tap.service.core, global.iotize.tap.service.impl['single-packet']));
}(this, (function (exports, tap, api, impl, core, singlePacket) { 'use strict';

    /**
     *   Generated file. Do not edit
     */
    impl.TapStreamReader.prototype.readDataLogOption = function () {
        var model = {};
        this.forwardBits(6);
        model.security = this.readBoolean(1);
        model.qos = this.readBoolean(1);
        this.forwardBits(5);
        model.logOnChange = this.readBoolean(1);
        model.rollingMode = this.readBoolean(1);
        model.autorun = this.readBoolean(1);
        return model;
    };
    // TapStreamWriter.prototype.write(model: DataLogOption) : TapStreamWriter{
    //     return this.writeDataLogOption(model)
    // }
    impl.TapStreamWriter.prototype.writeDataLogOption = function (model) {
        this.forwardBits(6);
        this.writeBoolean(model.security, 1);
        this.writeBoolean(model.qos, 1);
        this.forwardBits(5);
        this.writeBoolean(model.logOnChange, 1);
        this.writeBoolean(model.rollingMode, 1);
        this.writeBoolean(model.autorun, 1);
        return this;
    };

    /**
     *   Generated file. Do not edit
     */
    var DataLogOptionConverter = /** @class */ (function () {
        function DataLogOptionConverter() {
        }
        DataLogOptionConverter.prototype.encode = function (model, stream) {
            if (stream === void 0) { stream = new impl.TapStreamWriter(); }
            stream.writeDataLogOption(model);
            return stream.toBytes;
        };
        DataLogOptionConverter.prototype.decode = function (data) {
            var stream = data instanceof impl.TapStreamReader ? data : impl.TapStreamReader.create(data);
            return stream.readDataLogOption();
        };
        return DataLogOptionConverter;
    }());

    /**
     *   Generated file. Do not edit
     */
    var dataLogOption = new DataLogOptionConverter();

    var serviceConverters = /*#__PURE__*/Object.freeze({
        __proto__: null,
        dataLogOption: dataLogOption
    });

    /**
     *   Generated file. Do not edit
     */
    var __assign = (this && this.__assign) || function () {
        __assign = Object.assign || function(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                    t[p] = s[p];
            }
            return t;
        };
        return __assign.apply(this, arguments);
    };
    var allConverters = __assign(__assign(__assign({}, core.converters), serviceConverters), singlePacket.singlePacketConverters);
    var SERVICE_CALLS = {
        getMaxPacketCount: {
            method: api.TapRequestFrame.MethodType.GET,
            pathAlias: "/data-log/max-packet-count",
            path: "/1024//23",
            responseBodyDecoder: allConverters.uint16
        },
        isRunning: {
            method: api.TapRequestFrame.MethodType.GET,
            pathAlias: "/data-log/run",
            path: "/1031//0",
            responseBodyDecoder: allConverters.boolean
        },
        run: {
            method: api.TapRequestFrame.MethodType.POST,
            pathAlias: "/data-log/run",
            path: "/1031//0"
        },
        stop: {
            method: api.TapRequestFrame.MethodType.POST,
            pathAlias: "/data-log/stop",
            path: "/1031//1"
        },
        getOptions: {
            method: api.TapRequestFrame.MethodType.GET,
            pathAlias: "/data-log/options",
            path: "/1031//2",
            responseBodyDecoder: allConverters.dataLogOption
        },
        putOptions: {
            method: api.TapRequestFrame.MethodType.PUT,
            pathAlias: "/data-log/options",
            path: "/1031//2",
            bodyEncoder: allConverters.dataLogOption
        },
        putCryptoKey: {
            method: api.TapRequestFrame.MethodType.PUT,
            pathAlias: "/data-log/crypto-key",
            path: "/1031//3"
        },
        flush: {
            method: api.TapRequestFrame.MethodType.POST,
            pathAlias: "/data-log/flush",
            path: "/1031//4"
        },
        getPacketCount: {
            method: api.TapRequestFrame.MethodType.GET,
            pathAlias: "/data-log/packet-count",
            path: "/1031//10",
            responseBodyDecoder: allConverters.uint16
        },
        dequeueOnePacket: {
            method: api.TapRequestFrame.MethodType.GET,
            pathAlias: "/data-log/dequeue-packet",
            path: "/1031//11",
            responseBodyDecoder: allConverters.singlePacket
        }
    };

    var __extends = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __assign$1 = (this && this.__assign) || function () {
        __assign$1 = Object.assign || function(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                    t[p] = s[p];
            }
            return t;
        };
        return __assign$1.apply(this, arguments);
    };
    var DataLogService = /** @class */ (function (_super) {
        __extends(DataLogService, _super);
        function DataLogService() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this.resources = SERVICE_CALLS;
            return _this;
        }
        /**
         * Get the maximum number of packet
         *
         * LWM2M path: /1024//23
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.getMaxPacketCount = function () {
            return this.serviceCallRunner.execute(this.getMaxPacketCountCall());
        };
        /**
         *
         *
         * LWM2M path: /1024//23
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.getMaxPacketCountCall = function () {
            var callOptions = __assign$1({}, this.resources.getMaxPacketCount);
            return callOptions;
        };
        /**
         * Returns true is data log acquisition is running
         *
         * LWM2M path: /1031//0
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.isRunning = function () {
            return this.serviceCallRunner.execute(this.isRunningCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//0
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.isRunningCall = function () {
            var callOptions = __assign$1({}, this.resources.isRunning);
            return callOptions;
        };
        /**
         * Run data-log acquisition
         *
         * LWM2M path: /1031//0
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.run = function () {
            return this.serviceCallRunner.execute(this.runCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//0
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.runCall = function () {
            var callOptions = __assign$1({}, this.resources.run);
            return callOptions;
        };
        /**
         * Stop data-log acquisition
         *
         * LWM2M path: /1031//1
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.stop = function () {
            return this.serviceCallRunner.execute(this.stopCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//1
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.stopCall = function () {
            var callOptions = __assign$1({}, this.resources.stop);
            return callOptions;
        };
        /**
         * Get data log options
         *
         * LWM2M path: /1031//2
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.getOptions = function () {
            return this.serviceCallRunner.execute(this.getOptionsCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//2
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.getOptionsCall = function () {
            var callOptions = __assign$1({}, this.resources.getOptions);
            return callOptions;
        };
        /**
         * Write data log option
         *
         * LWM2M path: /1031//2
         *
         * @tapVersion(">=")
         * @param value input
         * @return
         */
        DataLogService.prototype.putOptions = function (
        /*
         *
         */
        value) {
            return this.serviceCallRunner.execute(this.putOptionsCall(value));
        };
        /**
         *
         *
         * LWM2M path: /1031//2
         *
         * @tapVersion(">=")
         * @param value input
         * @return call options
         */
        DataLogService.prototype.putOptionsCall = function (
        /*
         *
         */
        value) {
            var callOptions = __assign$1({}, this.resources.putOptions);
            callOptions.body = value;
            return callOptions;
        };
        /**
         * Write data log crypto key
         *
         * LWM2M path: /1031//3
         *
         * @tapVersion(">=")
         * @param value input
         * @return
         */
        DataLogService.prototype.putCryptoKey = function (
        /*
         *
         */
        value) {
            return this.serviceCallRunner.execute(this.putCryptoKeyCall(value));
        };
        /**
         *
         *
         * LWM2M path: /1031//3
         *
         * @tapVersion(">=")
         * @param value input
         * @return call options
         */
        DataLogService.prototype.putCryptoKeyCall = function (
        /*
         *
         */
        value) {
            var callOptions = __assign$1({}, this.resources.putCryptoKey);
            callOptions.body = value;
            return callOptions;
        };
        /**
         * Flush data log packets
         *
         * LWM2M path: /1031//4
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.flush = function () {
            return this.serviceCallRunner.execute(this.flushCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//4
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.flushCall = function () {
            var callOptions = __assign$1({}, this.resources.flush);
            return callOptions;
        };
        /**
         * Get number of pending data-log packet
         *
         * LWM2M path: /1031//10
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.getPacketCount = function () {
            return this.serviceCallRunner.execute(this.getPacketCountCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//10
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.getPacketCountCall = function () {
            var callOptions = __assign$1({}, this.resources.getPacketCount);
            return callOptions;
        };
        /**
         * Dequeue one packet
         *
         * LWM2M path: /1031//11
         *
         * @tapVersion(">=")
         * @return
         */
        DataLogService.prototype.dequeueOnePacket = function () {
            return this.serviceCallRunner.execute(this.dequeueOnePacketCall());
        };
        /**
         *
         *
         * LWM2M path: /1031//11
         *
         * @tapVersion(">=")
         * @return call options
         */
        DataLogService.prototype.dequeueOnePacketCall = function () {
            var callOptions = __assign$1({}, this.resources.dequeueOnePacket);
            return callOptions;
        };
        return DataLogService;
    }(tap.AbstractService));

    var _TAP_SERVICE_EXTENSION_DATALOG_ = tap.extendServiceContainer("dataLog", DataLogService);

    exports.DATALOG_SERVICE_CALLS = SERVICE_CALLS;
    exports.DataLogOptionConverter = DataLogOptionConverter;
    exports.DataLogService = DataLogService;
    exports._TAP_SERVICE_EXTENSION_DATALOG_ = _TAP_SERVICE_EXTENSION_DATALOG_;
    exports.dataLogConverters = serviceConverters;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=iotize-tap-service-impl-data-log.umd.js.map
