@ray-js/lamp-schedule-core 1.0.4-beta-3 → 1.0.4-beta-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,13 +18,13 @@ class CycleTimerParser {
18
18
  }))();
19
19
  parser(dpValue) {
20
20
  try {
21
- ScheduleLogger.debug(`CycleTimerParser dpValue: ${dpValue}`);
21
+ ScheduleLogger.debug(`dpParser ===> CycleTimerParser dpValue: ${dpValue}`);
22
22
  if (!dpValue) {
23
- ScheduleLogger.warn(`无法解析数据, 请检查数据是否合规1【${CYCLE_TIMING}】: ${dpValue}`);
23
+ ScheduleLogger.warn(`dpParser ===> 无法解析数据, 请检查数据是否合规1【${CYCLE_TIMING}】: ${dpValue}`);
24
24
  return this.defaultValue;
25
25
  }
26
26
  if (dpValue.length <= 4 || (dpValue.length - 4) % 32 !== 0) {
27
- ScheduleLogger.warn(`节点数量不匹配, 请检查数据是否合规【${CYCLE_TIMING}】: ${dpValue}`);
27
+ ScheduleLogger.warn(`dpParser ===> 节点数量不匹配, 请检查数据是否合规【${CYCLE_TIMING}】: ${dpValue}`);
28
28
  return {
29
29
  version: 0,
30
30
  length: LENGTH,
@@ -92,6 +92,7 @@ class CycleTimerParser {
92
92
  }
93
93
  }
94
94
  formatter(data) {
95
+ ScheduleLogger.debug('dpParser ===> CycleTimerParser formatter data: ', data);
95
96
  const {
96
97
  version,
97
98
  nodes
@@ -19,9 +19,9 @@ class RandomTimerParser {
19
19
  };
20
20
  parser(dpValue) {
21
21
  try {
22
- ScheduleLogger.debug(`RandomTimerParser dpValue: ${dpValue}`);
22
+ ScheduleLogger.debug(`dpParser ===> RandomTimerParser dpValue: ${dpValue}`);
23
23
  if (!dpValue) {
24
- ScheduleLogger.warn(`无法解析数据, 请检查数据是否合规1【${RANDOM_TIMING}】: ${dpValue}`);
24
+ ScheduleLogger.warn(`dpParser ===> 无法解析数据, 请检查数据是否合规1【${RANDOM_TIMING}】: ${dpValue}`);
25
25
  return {
26
26
  version: 0,
27
27
  length: LENGTH,
@@ -32,7 +32,7 @@ class RandomTimerParser {
32
32
  const version = step().value;
33
33
  const length = step().value;
34
34
  if (!dpValue || (dpValue.length - 4) % 24 !== 0) {
35
- console.log('decodeRandomTask 数据有问题,无法解析');
35
+ console.log('dpParser ===> decodeRandomTask 数据有问题,无法解析');
36
36
  // 返回默认值
37
37
  return this.defaultValue;
38
38
  }
@@ -84,11 +84,12 @@ class RandomTimerParser {
84
84
  nodes
85
85
  };
86
86
  } catch (error) {
87
- ScheduleLogger.error('RandomTimerParser parser error', error);
87
+ ScheduleLogger.error('dpParser ===> RandomTimerParser parser error', error);
88
88
  return this.defaultValue;
89
89
  }
90
90
  }
91
91
  formatter(data) {
92
+ ScheduleLogger.debug('dpParser ===> RandomTimerParser formatter data: ', data);
92
93
  try {
93
94
  const {
94
95
  version,
@@ -128,7 +129,7 @@ class RandomTimerParser {
128
129
  }).join('');
129
130
  return `${versionStr}${lengthStr}${nodesStr}`;
130
131
  } catch (error) {
131
- ScheduleLogger.error('RandomTimerParser formatter error', error);
132
+ ScheduleLogger.error('dpParser ===> RandomTimerParser formatter error', error);
132
133
  return '';
133
134
  }
134
135
  }
@@ -50,7 +50,7 @@ export class RtcTimerFormatter {
50
50
  parser() {
51
51
  let val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
52
52
  if (!val) {
53
- ScheduleLogger.warn('RtcTimerFormatter parser,value is empty, return defaultValue', this.defaultValue);
53
+ ScheduleLogger.warn('dpParser ===> RtcTimerFormatter parser,value is empty, return defaultValue', this.defaultValue);
54
54
  return this.defaultValue;
55
55
  }
56
56
  try {
@@ -66,7 +66,7 @@ export class RtcTimerFormatter {
66
66
 
67
67
  if (length !== 4 && length !== powerLen && length !== brightLightLen && length !== colourLightLen && length !== mixLightLen) {
68
68
  // 数据位数不定, 可能是14位或18位22位26位, 删除定时指令为4位
69
- ScheduleLogger.warn('RtcTimerFormatter parser fail:', RTC_TIMER, '=>', val);
69
+ ScheduleLogger.warn('dpParser ===> RtcTimerFormatter parser fail:', RTC_TIMER, '=>', val);
70
70
  return this.defaultValue;
71
71
  }
72
72
  const step = generateDpStrStep(val);
@@ -178,7 +178,7 @@ export class RtcTimerFormatter {
178
178
  status
179
179
  };
180
180
  } catch (err) {
181
- ScheduleLogger.error('RtcTimerFormatter parser fail:', RTC_TIMER, '=>', val, err);
181
+ ScheduleLogger.error('dpParser ===> RtcTimerFormatter parser fail:', RTC_TIMER, '=>', val, err);
182
182
  return this.defaultValue;
183
183
  }
184
184
  }
@@ -202,7 +202,7 @@ export class RtcTimerFormatter {
202
202
  time,
203
203
  dps
204
204
  } = data;
205
- ScheduleLogger.debug('rtcTimer formatter data:', data);
205
+ ScheduleLogger.debug('dpParser ===> rtcTimer formatter data:', data);
206
206
  if (loops) {
207
207
  const _dps = {};
208
208
  Object.keys(dps).forEach(key => {
@@ -289,18 +289,18 @@ export class RtcTimerFormatter {
289
289
  dpDataStr = `${powerStr}`;
290
290
  }
291
291
  const _res = `${idStr}${typeStr}${repeatStr}${startTimeTypeStr}${startTimeStr}${dpDataStr}`;
292
- ScheduleLogger.debug('rtcTimer formatter dpStr1:', dpDataStr);
293
- ScheduleLogger.debug('rtcTimer formatter dpStr2:', _res);
292
+ ScheduleLogger.debug('dpParser ===> rtcTimer formatter dpStr1:', dpDataStr);
293
+ ScheduleLogger.debug('dpParser ===> rtcTimer formatter dpStr2:', _res);
294
294
  return _res;
295
295
  }
296
296
  const statusStr = status ? '1' : '0';
297
297
  const timerIdStr = padStart(Number(timerId).toString(2), 7, '0');
298
298
  const idStr = this.to16(parseInt(`${statusStr}${timerIdStr}`, 2), 2);
299
299
  const _res = `${idStr}00`;
300
- ScheduleLogger.debug('rtcTimer remove formatter2 data:', _res);
300
+ ScheduleLogger.debug('dpParser ===> rtcTimer remove formatter2 data:', _res);
301
301
  return _res;
302
302
  } catch (error) {
303
- ScheduleLogger.error('rtcTimer formatter error', error);
303
+ ScheduleLogger.error('dpParser ===> rtcTimer formatter error', error);
304
304
  return '';
305
305
  }
306
306
  }
@@ -18,13 +18,13 @@ export class Sleep {
18
18
  };
19
19
  parser(dpStr) {
20
20
  try {
21
- scheduleLogger.debug('Sleep parser dpStr: ', dpStr);
21
+ scheduleLogger.debug('dpParser ===> Sleep parser dpStr: ', dpStr);
22
22
  if (!dpStr) {
23
23
  return this.defaultValue;
24
24
  }
25
25
  const dpLength = dpStr.length;
26
26
  if (!dpLength || (dpLength - 4) % 22 !== 0) {
27
- scheduleLogger.error('数据有问题,无法解析');
27
+ scheduleLogger.error('dpParser ===> 数据有问题,无法解析');
28
28
  return this.defaultValue;
29
29
  }
30
30
  const step = generateDpStrStep(dpStr);
@@ -73,7 +73,7 @@ export class Sleep {
73
73
  nodes
74
74
  };
75
75
  } catch (error) {
76
- scheduleLogger.error('Sleep parser error', error);
76
+ scheduleLogger.error('dpParser ===> Sleep parser error', error);
77
77
  return this.defaultValue;
78
78
  }
79
79
  }
@@ -81,7 +81,7 @@ export class Sleep {
81
81
  try {
82
82
  var _data$nodes, _data$nodes2;
83
83
  const result = [numToHexString(data.version), numToHexString((_data$nodes = data.nodes) === null || _data$nodes === void 0 ? void 0 : _data$nodes.length)];
84
- scheduleLogger.debug('sleep formatter data', data);
84
+ scheduleLogger.debug('dpParser ===> sleep formatter data', data);
85
85
  data === null || data === void 0 || (_data$nodes2 = data.nodes) === null || _data$nodes2 === void 0 || _data$nodes2.forEach(node => {
86
86
  // 拆分色相值为百位和十个位
87
87
  const hueHundreds = Math.floor(node.hue / 100);
@@ -106,7 +106,7 @@ export class Sleep {
106
106
  });
107
107
  return result.join('');
108
108
  } catch (error) {
109
- scheduleLogger.error('sleep formatter error', error);
109
+ scheduleLogger.error('dpParser ===> sleep formatter error', error);
110
110
  return '';
111
111
  }
112
112
  }
@@ -32,7 +32,7 @@ export class TimerReportFormatter {
32
32
  });
33
33
  return arr;
34
34
  } catch (error) {
35
- ScheduleLogger.error('TimerReportFormatter parser error', error);
35
+ ScheduleLogger.error('dpParser ===> TimerReportFormatter parser error', error);
36
36
  return this.defaultValue;
37
37
  }
38
38
  }
@@ -47,7 +47,7 @@ export class TimerReportFormatter {
47
47
  return hexStr;
48
48
  }).join('');
49
49
  } catch (error) {
50
- ScheduleLogger.error('TimerReportFormatter formatter error', error);
50
+ ScheduleLogger.error('dpParser ===> TimerReportFormatter formatter error', error);
51
51
  return '';
52
52
  }
53
53
  }
@@ -17,7 +17,7 @@ export class WakeUp {
17
17
  nodes: []
18
18
  };
19
19
  parser(dpStr) {
20
- scheduleLogger.debug('WakeUp parser dpStr: ', dpStr);
20
+ scheduleLogger.debug('dpParser ===> WakeUp parser dpStr: ', dpStr);
21
21
  if (!dpStr) {
22
22
  return this.defaultValue;
23
23
  }
@@ -28,7 +28,7 @@ export class WakeUp {
28
28
  let number = step(2).value;
29
29
  const nodeLen = (_dpStr$slice = dpStr.slice(4)) === null || _dpStr$slice === void 0 ? void 0 : _dpStr$slice.length;
30
30
  if (nodeLen % 24 !== 0) {
31
- scheduleLogger.error('wakeup dpStr error nodeLen:', nodeLen);
31
+ scheduleLogger.error('dpParser ===> wakeup dpStr error nodeLen:', nodeLen);
32
32
  }
33
33
  const nodes = [];
34
34
  number = Math.min(number, 4);
@@ -75,7 +75,7 @@ export class WakeUp {
75
75
  nodes
76
76
  };
77
77
  } catch (error) {
78
- scheduleLogger.error('wakeup parser error', error);
78
+ scheduleLogger.error('dpParser ===> wakeup parser error', error);
79
79
  return this.defaultValue;
80
80
  }
81
81
  }
@@ -83,7 +83,7 @@ export class WakeUp {
83
83
  try {
84
84
  var _data$nodes, _data$nodes2;
85
85
  const result = [numToHexString(data.version), numToHexString((_data$nodes = data.nodes) === null || _data$nodes === void 0 ? void 0 : _data$nodes.length)];
86
- scheduleLogger.debug('wakeup formatter data', data);
86
+ scheduleLogger.debug('dpParser ===> wakeup formatter data', data);
87
87
  data === null || data === void 0 || (_data$nodes2 = data.nodes) === null || _data$nodes2 === void 0 || _data$nodes2.forEach(node => {
88
88
  // 拆分色相值为百位和十个位
89
89
  const hueHundreds = Math.floor(node.hue / 100);
@@ -108,7 +108,7 @@ export class WakeUp {
108
108
  });
109
109
  return result.join('');
110
110
  } catch (error) {
111
- scheduleLogger.error('wakeup formatter error', error);
111
+ scheduleLogger.error('dpParser ===> wakeup formatter error', error);
112
112
  return '';
113
113
  }
114
114
  }
@@ -10,6 +10,7 @@ const onGroupDpDataChangeEventMock = jest.fn();
10
10
  const offDpDataChangeMock = jest.fn();
11
11
  const offGroupDpDataChangeEventMock = jest.fn();
12
12
  const getDeviceInfoMock = jest.fn();
13
+ const getGroupInfoMock = jest.fn();
13
14
  const getTimerListWithFlushMock = jest.fn();
14
15
  const initDpStateMock = jest.fn();
15
16
  jest.mock('../../context/timer/context', () => ({
@@ -48,8 +49,8 @@ jest.mock('@ray-js/ray', () => ({
48
49
  getDeviceInfo: function () {
49
50
  return getDeviceInfoMock(...arguments);
50
51
  },
51
- getGroupDpsInfos: function () {
52
- return getGroupDpsInfosMock(...arguments);
52
+ getGroupInfo: function () {
53
+ return getGroupInfoMock(...arguments);
53
54
  },
54
55
  registerDeviceListListener: function () {
55
56
  return registerDeviceListListenerMock(...arguments);
@@ -121,8 +122,15 @@ describe('useCommonSupport suite', () => {
121
122
  }
122
123
  });
123
124
  });
124
- getGroupDpsInfosMock.mockResolvedValue({
125
- 1: true
125
+ getGroupInfoMock.mockImplementation(_ref4 => {
126
+ let {
127
+ success
128
+ } = _ref4;
129
+ return success === null || success === void 0 ? void 0 : success({
130
+ dps: {
131
+ 1: true
132
+ }
133
+ });
126
134
  });
127
135
  });
128
136
  it('initializes device support and sets ready state', async () => {
@@ -5,7 +5,7 @@ import "core-js/modules/esnext.iterator.every.js";
5
5
  import "core-js/modules/esnext.iterator.for-each.js";
6
6
  import "core-js/modules/esnext.iterator.some.js";
7
7
  import { useEffect, useMemo, useRef, useState } from 'react';
8
- import { getDeviceInfo, getGroupDpsInfos, onDpDataChange, onGroupDpDataChangeEvent, registerDeviceListListener, registerGroupChange, offDpDataChange, offGroupDpDataChangeEvent } from '@ray-js/ray';
8
+ import { getDeviceInfo, getGroupInfo, onDpDataChange, onGroupDpDataChangeEvent, registerDeviceListListener, registerGroupChange, offDpDataChange, offGroupDpDataChangeEvent } from '@ray-js/ray';
9
9
  import { Support } from '../utils/ScheduleSupport';
10
10
  import { useTimerContext } from '../context/timer/context';
11
11
  import { scheduleLogger, scheduleLogger as ScheduleLogger } from '../utils/ScheduleLogger';
@@ -161,23 +161,29 @@ export const useScheduleInit = props => {
161
161
  const promiseList = Promise.all([initStorage(props.devId, props.groupId), support.init()]);
162
162
  promiseList.then(() => {
163
163
  if (props.groupId) {
164
- // 获取群组 dp 数据
165
- getGroupDpsInfos(props.groupId).then(res => {
166
- scheduleLogger.debug('getGroupDpsInfos res', res);
167
- res && Object.keys(res).length && initDpState(res);
168
- supportIns = {
169
- isReady: true,
170
- support
171
- };
172
- emitter.emit('initDone');
173
- _isInit = true;
174
- ScheduleLogger.debug('useSupport: support init success', true);
175
- setScheduleState({
176
- isReady: true
177
- });
178
- }).catch(err => {
179
- scheduleLogger.error('Failed to get group info groupId:', props.groupId);
180
- scheduleLogger.error('Failed to get group info err:', err);
164
+ getGroupInfo({
165
+ groupId: props.groupId,
166
+ success: res => {
167
+ const dpMap = {};
168
+ Object.keys(res.dps).forEach(dpId => {
169
+ const dpCode = getDpCodeByDpId(dpId);
170
+ dpMap[dpCode] = res.dps[dpId];
171
+ });
172
+ dpMap && Object.keys(dpMap).length && initDpState(dpMap);
173
+ supportIns = {
174
+ isReady: true,
175
+ support
176
+ };
177
+ emitter.emit('initDone');
178
+ _isInit = true;
179
+ ScheduleLogger.debug('useSupport: support init success', true);
180
+ setScheduleState({
181
+ isReady: true
182
+ });
183
+ },
184
+ fail: err => {
185
+ scheduleLogger.error('Failed to get group info groupId:', props.groupId, err);
186
+ }
181
187
  });
182
188
  } else {
183
189
  // 获取单设备 dp 数据
@@ -18,7 +18,7 @@ var ELevelColor = /*#__PURE__*/function (ELevelColor) {
18
18
  return ELevelColor;
19
19
  }(ELevelColor || {});
20
20
  export class ScheduleLogger {
21
- logLevel = (() => LogLevel.DEBUG)();
21
+ logLevel = (() => LogLevel.WARN)();
22
22
  logPrefix = (() => LOG_PREFIX)();
23
23
  setLogLevel(level) {
24
24
  this.logLevel = level;
@@ -68,5 +68,4 @@ export class ScheduleLogger {
68
68
  console.error(...this.formatMessage(LogLevel.ERROR, message, data));
69
69
  }
70
70
  }
71
- export const scheduleLogger = new ScheduleLogger();
72
- scheduleLogger.setLogLevel(LogLevel.WARN);
71
+ export const scheduleLogger = new ScheduleLogger();
@@ -1,6 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "core-js/modules/esnext.iterator.constructor.js";
3
- import "core-js/modules/esnext.iterator.every.js";
4
3
  import "core-js/modules/esnext.iterator.find.js";
5
4
  import "core-js/modules/esnext.iterator.for-each.js";
6
5
  /* eslint-disable no-bitwise */
@@ -96,24 +95,42 @@ export class Support {
96
95
  return new Promise((resolve, reject) => {
97
96
  getGroupInfo({
98
97
  groupId,
99
- success: res => {
100
- var _res$deviceList;
101
- this.groupDevInfo = res;
98
+ success: groupRes => {
99
+ this.groupDevInfo = groupRes;
102
100
  ScheduleLogger.debug('getGroupInfo groupId: ', groupId);
103
- ScheduleLogger.debug('getGroupInfo success1: ', res);
104
- setScheduleCache(DEV_INFO_KEY, res);
105
- // 群组中为空
106
- groupId && (devIdOrGroupIdCache === null || devIdOrGroupIdCache === void 0 ? void 0 : devIdOrGroupIdCache.set('', groupId));
107
- const dpMap = {};
108
- Object.keys(res.dps).forEach(dpId => {
109
- const dpCode = getDpCodeByDpId(dpId);
110
- dpCode && setDpState(dpCode, res.dps[dpId]);
101
+ ScheduleLogger.debug('getGroupInfo success1: ', groupRes);
102
+ const {
103
+ deviceList = []
104
+ } = groupRes;
105
+ const firstDevice = deviceList === null || deviceList === void 0 ? void 0 : deviceList[0];
106
+ getDeviceInfo({
107
+ deviceId: firstDevice === null || firstDevice === void 0 ? void 0 : firstDevice.devId,
108
+ success: deviceInfoRes => {
109
+ var _res$deviceList;
110
+ // 从 deviceInfoRes 中筛选出 groupRes 中不存在的数据,合并到 res
111
+ const filteredDeviceInfo = {};
112
+ const _deviceInfo = _objectSpread(_objectSpread({}, groupRes), deviceInfoRes);
113
+ Object.keys(_deviceInfo).forEach(key => {
114
+ if (!(key in groupRes)) {
115
+ filteredDeviceInfo[key] = deviceInfoRes[key];
116
+ }
117
+ });
118
+ const res = _objectSpread(_objectSpread({}, groupRes), filteredDeviceInfo);
119
+ setScheduleCache(DEV_INFO_KEY, res);
120
+ // 群组中为空
121
+ groupId && (devIdOrGroupIdCache === null || devIdOrGroupIdCache === void 0 ? void 0 : devIdOrGroupIdCache.set('', groupId));
122
+ const dpMap = {};
123
+ Object.keys(res.dps).forEach(dpId => {
124
+ const dpCode = getDpCodeByDpId(dpId);
125
+ dpCode && setDpState(dpCode, res.dps[dpId]);
126
+ });
127
+ Object.keys(dpMap).length && initDpState(dpMap);
128
+ const deviceSchema = (_res$deviceList = res.deviceList) === null || _res$deviceList === void 0 || (_res$deviceList = _res$deviceList[0]) === null || _res$deviceList === void 0 ? void 0 : _res$deviceList.schema;
129
+ // 融合 deviceSchema 和 groupSchema 数据,优先使用 groupSchema
130
+ res.schema = [...(res.schema || []), ...(deviceSchema || [])];
131
+ resolve(true);
132
+ }
111
133
  });
112
- Object.keys(dpMap).length && initDpState(dpMap);
113
- const deviceSchema = (_res$deviceList = res.deviceList) === null || _res$deviceList === void 0 || (_res$deviceList = _res$deviceList[0]) === null || _res$deviceList === void 0 ? void 0 : _res$deviceList.schema;
114
- // 融合 deviceSchema 和 groupSchema 数据,优先使用 groupSchema
115
- res.schema = [...(res.schema || []), ...(deviceSchema || [])];
116
- resolve(true);
117
134
  },
118
135
  fail: err => {
119
136
  this.groupDevInfo = {};
@@ -213,31 +230,27 @@ export class Support {
213
230
  /**
214
231
  * @description 判断是否支持云端定时
215
232
  */
216
- isSupportCloudTimer = devInfo => {
217
- var _this$devInfo2;
218
- this.devInfo = devInfo !== null && devInfo !== void 0 ? devInfo : this.getCachedDevInfo();
219
- if (!this.devInfo) {
220
- return false;
221
- }
222
- // 群组设备需要从设备列表里面判断所有设备都支持定时才会显示
223
- if (this.devInfo.groupId) {
233
+ isSupportCloudTimer = (() => {
234
+ var _this = this;
235
+ return function () {
224
236
  var _this$devInfo;
225
- // @ts-ignore
226
- const deviceList = (_this$devInfo = this.devInfo) === null || _this$devInfo === void 0 ? void 0 : _this$devInfo.deviceList;
227
- if (!Array.isArray(deviceList) || deviceList.length === 0) return false;
228
- const isAllDeviceHasTimer = deviceList.every(d => {
229
- var _d$panelConfig;
230
- const timer = d === null || d === void 0 || (_d$panelConfig = d.panelConfig) === null || _d$panelConfig === void 0 || (_d$panelConfig = _d$panelConfig.bic) === null || _d$panelConfig === void 0 ? void 0 : _d$panelConfig.find(i => i.code === 'timer');
231
- if (!timer) {
232
- !this.isIniting && ScheduleLogger.info('isSupportCloudTimer: ', `${d.devId} 不支持云定时`);
233
- return false;
237
+ let devInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
238
+ // this.getCachedDevInfo() 中将 devInfo 不存在的数据合并到 this.devInfo
239
+ const cachedDevInfo = _this.getCachedDevInfo();
240
+ const filteredDevInfo = {};
241
+ const _devInfo = _objectSpread(_objectSpread({}, cachedDevInfo), devInfo);
242
+ Object.keys(_devInfo).forEach(key => {
243
+ if (!(key in cachedDevInfo)) {
244
+ filteredDevInfo[key] = devInfo[key];
234
245
  }
235
- return timer.selected;
236
246
  });
237
- return isAllDeviceHasTimer;
238
- }
239
- return ((_this$devInfo2 = this.devInfo) === null || _this$devInfo2 === void 0 || (_this$devInfo2 = _this$devInfo2.panelConfig) === null || _this$devInfo2 === void 0 || (_this$devInfo2 = _this$devInfo2.bic) === null || _this$devInfo2 === void 0 ? void 0 : _this$devInfo2.find(i => i.code === 'timer' && i.selected)) !== undefined;
240
- };
247
+ _this.devInfo = _objectSpread(_objectSpread({}, cachedDevInfo), filteredDevInfo);
248
+ if (!_this.devInfo) {
249
+ return false;
250
+ }
251
+ return ((_this$devInfo = _this.devInfo) === null || _this$devInfo === void 0 || (_this$devInfo = _this$devInfo.panelConfig) === null || _this$devInfo === void 0 || (_this$devInfo = _this$devInfo.bic) === null || _this$devInfo === void 0 ? void 0 : _this$devInfo.find(i => i.code === 'timer' && i.selected)) !== undefined;
252
+ };
253
+ })();
241
254
  supportDp = (dpCode, devInfo) => {
242
255
  this.devInfo = devInfo !== null && devInfo !== void 0 ? devInfo : this.getCachedDevInfo();
243
256
  if (!this.devInfo) {
@@ -267,7 +280,7 @@ export class Support {
267
280
  * @return {boolean} - 如果dpCode支持则返回true,否则返回false。
268
281
  */
269
282
  isSupportDp = (() => {
270
- var _this = this;
283
+ var _this2 = this;
271
284
  return function (dpCode) {
272
285
  let isForce = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
273
286
  let devInfo = arguments.length > 2 ? arguments[2] : undefined;
@@ -276,11 +289,11 @@ export class Support {
276
289
  return cache[dpCode];
277
290
  }
278
291
  }
279
- if (!_this.isInit) {
292
+ if (!_this2.isInit) {
280
293
  return false;
281
294
  }
282
295
  // 是否存在相关dp
283
- const isDpSupport = _this.supportDp(dpCode, devInfo);
296
+ const isDpSupport = _this2.supportDp(dpCode, devInfo);
284
297
  cache[dpCode] = isDpSupport;
285
298
  return isDpSupport;
286
299
  };
@@ -352,7 +365,7 @@ export class Support {
352
365
  * @returns {boolean} - 是否是 Matter 设备
353
366
  */
354
367
  isMatterDevice(devInfo, isMatter) {
355
- var _this$devInfo3;
368
+ var _this$devInfo2;
356
369
  if (isMatter !== undefined) {
357
370
  return isMatter;
358
371
  }
@@ -360,30 +373,30 @@ export class Support {
360
373
  return !!devInfo.isMatter;
361
374
  }
362
375
  this.devInfo = this.getCachedDevInfo();
363
- return !!((_this$devInfo3 = this.devInfo) !== null && _this$devInfo3 !== void 0 && _this$devInfo3.isMatter);
376
+ return !!((_this$devInfo2 = this.devInfo) !== null && _this$devInfo2 !== void 0 && _this$devInfo2.isMatter);
364
377
  }
365
378
 
366
379
  /**
367
380
  * @description 是否是 涂鸦 Matter 设备
368
381
  */
369
382
  isTuyaMatterDevice(devInfo) {
370
- var _this$devInfo4, _this$devInfo5;
383
+ var _this$devInfo3, _this$devInfo4;
371
384
  if (devInfo) {
372
385
  return !!(devInfo !== null && devInfo !== void 0 && devInfo.isMatter && !(devInfo !== null && devInfo !== void 0 && devInfo.isTripartiteMatter));
373
386
  }
374
387
  this.devInfo = this.getCachedDevInfo();
375
- return !!((_this$devInfo4 = this.devInfo) !== null && _this$devInfo4 !== void 0 && _this$devInfo4.isMatter && !((_this$devInfo5 = this.devInfo) !== null && _this$devInfo5 !== void 0 && _this$devInfo5.isTripartiteMatter));
388
+ return !!((_this$devInfo3 = this.devInfo) !== null && _this$devInfo3 !== void 0 && _this$devInfo3.isMatter && !((_this$devInfo4 = this.devInfo) !== null && _this$devInfo4 !== void 0 && _this$devInfo4.isTripartiteMatter));
376
389
  }
377
390
 
378
391
  /**
379
392
  * @description 是否是 三方 Matter 设备
380
393
  */
381
394
  isTripartiteMatter(devInfo) {
382
- var _this$devInfo6;
395
+ var _this$devInfo5;
383
396
  if (devInfo) {
384
397
  return !!devInfo.isTripartiteMatter;
385
398
  }
386
399
  this.devInfo = this.getCachedDevInfo();
387
- return !!((_this$devInfo6 = this.devInfo) !== null && _this$devInfo6 !== void 0 && _this$devInfo6.isTripartiteMatter);
400
+ return !!((_this$devInfo5 = this.devInfo) !== null && _this$devInfo5 !== void 0 && _this$devInfo5.isTripartiteMatter);
388
401
  }
389
402
  }
@@ -1,7 +1,8 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import "core-js/modules/esnext.iterator.constructor.js";
2
3
  import "core-js/modules/esnext.iterator.for-each.js";
3
4
  import { scheduleLogger } from './ScheduleLogger';
4
- const __dpState = {};
5
+ let __dpState = {};
5
6
  export const getDpState = dpCode => {
6
7
  scheduleLogger.debug('getDpState', dpCode, __dpState);
7
8
  return __dpState[dpCode];
@@ -22,6 +23,6 @@ export const getAllDpState = () => {
22
23
  };
23
24
  export const initDpState = function () {
24
25
  let dpState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
- Object.assign(__dpState, dpState);
26
+ __dpState = _objectSpread(_objectSpread({}, __dpState), dpState);
26
27
  scheduleLogger.debug('initDpState', __dpState);
27
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.4-beta-3",
3
+ "version": "1.0.4-beta-5",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [