UNPKG

xiot-core-spec-ts

Version:
19 lines (18 loc) 853 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DevicePropertyChangedCodec = void 0; const DevicePropertyChanged_1 = require("../../../typedef/notice/device/impl/DevicePropertyChanged"); const PropertyOperationCodec_1 = require("../../operation/PropertyOperationCodec"); class DevicePropertyChangedCodec { static encode(x) { return { property: PropertyOperationCodec_1.PropertyOperationCodec.Notify.encodeObject(x.property), timestamp: x.timestamp }; } static decode(o) { const property = PropertyOperationCodec_1.PropertyOperationCodec.Notify.decodeObject(o.property); return new DevicePropertyChanged_1.DevicePropertyChanged(o.timestamp || new Date().getTime(), property); } } exports.DevicePropertyChangedCodec = DevicePropertyChangedCodec;