All files / uacp AcknowledgeMessage.js

100% Statements 24/24
97.87% Branches 46/47
100% Functions 4/4
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37  56x 56x   56x 56x         2x 2x 2x 2x 2x     1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x     56x  
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Bucket_1 = __importDefault(require("../ua/Bucket"));
// https://reference.opcfoundation.org/v104/Core/docs/Part6/7.1.2/#7.1.2.4
class AcknowledgeMessage {
    constructor(options) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
        this.ProtocolVersion = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.ProtocolVersion, (_b !== null && _b !== void 0 ? _b : 0));
        this.ReceiveBufferSize = (_d = (_c = options) === null || _c === void 0 ? void 0 : _c.ReceiveBufferSize, (_d !== null && _d !== void 0 ? _d : 0));
        this.SendBufferSize = (_f = (_e = options) === null || _e === void 0 ? void 0 : _e.SendBufferSize, (_f !== null && _f !== void 0 ? _f : 0));
        this.MaxMessageSize = (_h = (_g = options) === null || _g === void 0 ? void 0 : _g.MaxMessageSize, (_h !== null && _h !== void 0 ? _h : 0));
        this.MaxChunkCount = (_k = (_j = options) === null || _j === void 0 ? void 0 : _j.MaxChunkCount, (_k !== null && _k !== void 0 ? _k : 0));
    }
    encode() {
        const bucket = new Bucket_1.default();
        bucket.writeUint32(this.ProtocolVersion);
        bucket.writeUint32(this.ReceiveBufferSize);
        bucket.writeUint32(this.SendBufferSize);
        bucket.writeUint32(this.MaxMessageSize);
        bucket.writeUint32(this.MaxChunkCount);
        return bucket.bytes;
    }
    decode(b, position) {
        const bucket = new Bucket_1.default(b, position);
        this.ProtocolVersion = bucket.readUint32();
        this.ReceiveBufferSize = bucket.readUint32();
        this.SendBufferSize = bucket.readUint32();
        this.MaxMessageSize = bucket.readUint32();
        this.MaxChunkCount = bucket.readUint32();
        return bucket.position;
    }
}
exports.default = AcknowledgeMessage;