UNPKG

xiot-core-spec-ts

Version:
28 lines (27 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventImageCodec = void 0; const Spec_1 = require("../../typedef/constant/Spec"); const EventImage_1 = require("../../typedef/image/EventImage"); const EventType_1 = require("../../typedef/definition/urn/EventType"); const DescriptionCodec_1 = require("../definition/DescriptionCodec"); const ArgumentImageCodec_1 = require("./ArgumentImageCodec"); class EventImageCodec { static decodeArray(array) { const list = []; if (array != null) { for (const o of array) { const iid = o[Spec_1.Spec.IID]; const type = new EventType_1.EventType(o[Spec_1.Spec.TYPE]); const description = DescriptionCodec_1.DescriptionCodec.decode(o[Spec_1.Spec.DESCRIPTION]); const a = ArgumentImageCodec_1.ArgumentImageCodec.decodeArray(o[Spec_1.Spec.ARGUMENTS]); // if (o[Spec.X_OPTIONAL] != null) { // type._optional = o[Spec.X_OPTIONAL]; // } list.push(new EventImage_1.EventImage(iid, type, description, a)); } } return list; } } exports.EventImageCodec = EventImageCodec;