UNPKG

xiot-core-spec-ts

Version:
21 lines (20 loc) 790 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeviceChildrenAddedCodec = void 0; const DeviceChildrenAdded_1 = require("../../../typedef/notice/device/impl/DeviceChildrenAdded"); const DeviceCodec_1 = require("../../device/DeviceCodec"); class DeviceChildrenAddedCodec { static encode(x) { return { did: x.did, children: DeviceCodec_1.DeviceCodec.encodeArray(x.children), timestamp: x.timestamp }; } static decode(o) { const e = new DeviceChildrenAdded_1.DeviceChildrenAdded(o.timestamp || new Date().getTime(), o.did); e.children = DeviceCodec_1.DeviceCodec.decodeArray(o.children); return e; } } exports.DeviceChildrenAddedCodec = DeviceChildrenAddedCodec;