@ledvance/group-ui-biz-bundle 1.0.45 → 1.0.47
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.
- package/package.json +1 -1
- package/src/modules/biorhythm/BiorhythmActions.ts +5 -13
- package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
- package/src/modules/biorhythm/BiorhythmPage.tsx +14 -38
- package/src/modules/biorhythm/Router.ts +34 -0
- package/src/modules/fixedTimeForPlug/Router.ts +25 -0
- package/src/modules/fixedTimingForLight/Router.ts +25 -0
- package/src/modules/flags/Router.ts +25 -0
- package/src/modules/mood_new/AddMoodPage.tsx +197 -0
- package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
- package/src/modules/mood_new/Interface.ts +219 -0
- package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
- package/src/modules/mood_new/MoodActions.ts +227 -0
- package/src/modules/mood_new/MoodInfo.ts +2151 -0
- package/src/modules/mood_new/MoodItem.tsx +148 -0
- package/src/modules/mood_new/MoodPage.tsx +374 -0
- package/src/modules/mood_new/MoodParse.ts +442 -0
- package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
- package/src/modules/mood_new/Router.ts +43 -0
- package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
- package/src/modules/music/Router.ts +16 -0
- package/src/modules/randomTimeForPlug/Router.ts +25 -0
- package/src/modules/randomTimingForLight/Router.ts +25 -0
- package/src/modules/remoteSwitch/Router.ts +16 -0
- package/src/modules/select/Router.ts +16 -0
- package/src/modules/switchGradient/Router.ts +16 -0
- package/src/modules/timeSchedule/Interface.ts +150 -0
- package/src/modules/timeSchedule/Router.ts +25 -0
- package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
- package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
- package/src/modules/timeSchedule/components/Summary.tsx +124 -0
- package/src/modules/timer/Router.ts +16 -0
- package/src/navigation/Routers.ts +1 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { hex2Int, spliceByStep } from '@ledvance/base/src/utils/common';
|
|
2
|
+
import { Utils } from '@tuya/tuya-panel-lamp-sdk';
|
|
3
|
+
import { MoodInfo, MoodNodeInfo } from './Interface';
|
|
4
|
+
import { getDefaultMood } from './MoodInfo';
|
|
5
|
+
const { nToHS, toFixed, sToN } = Utils;
|
|
6
|
+
|
|
7
|
+
// light source
|
|
8
|
+
export function dp2Obj(dp: string, isFan: boolean = false, isUVCFan?: boolean): MoodInfo {
|
|
9
|
+
if (!dp) return getDefaultMood();
|
|
10
|
+
let dpCopy = dp;
|
|
11
|
+
let fanEnable: undefined | boolean = undefined;
|
|
12
|
+
let fanSpeed: undefined | number = undefined;
|
|
13
|
+
let mode = 0;
|
|
14
|
+
let speed = 75;
|
|
15
|
+
const id = hex2Int(dpCopy.slice(0, 2));
|
|
16
|
+
dpCopy = dpCopy.slice(2);
|
|
17
|
+
if (isFan) {
|
|
18
|
+
fanEnable = hex2Int(dpCopy.slice(0, 2)) === 1;
|
|
19
|
+
dpCopy = dpCopy.slice(2);
|
|
20
|
+
fanSpeed = hex2Int(dpCopy.slice(0, 2));
|
|
21
|
+
dpCopy = dpCopy.slice(2);
|
|
22
|
+
}
|
|
23
|
+
const nodes: MoodNodeInfo[] = spliceByStep(dpCopy, 26).map(nodeHex => {
|
|
24
|
+
let hex = nodeHex;
|
|
25
|
+
speed = isUVCFan ? 101 - hex2Int(hex.slice(0, 2)) : hex2Int(hex.slice(0, 2));
|
|
26
|
+
hex = hex.slice(2);
|
|
27
|
+
speed = isUVCFan ? 101 - hex2Int(hex.slice(0, 2)) : hex2Int(hex.slice(0, 2));
|
|
28
|
+
hex = hex.slice(2);
|
|
29
|
+
mode = hex2Int(hex.slice(0, 2));
|
|
30
|
+
hex = hex.slice(2);
|
|
31
|
+
const h = hex2Int(hex.slice(0, 4));
|
|
32
|
+
hex = hex.slice(4);
|
|
33
|
+
const s = Math.round(hex2Int(hex.slice(0, 4)) / 10);
|
|
34
|
+
hex = hex.slice(4);
|
|
35
|
+
const v = Math.round(hex2Int(hex.slice(0, 4)) / 10);
|
|
36
|
+
hex = hex.slice(4);
|
|
37
|
+
const brightness = Math.round(hex2Int(hex.slice(0, 4)) / 10);
|
|
38
|
+
hex = hex.slice(4);
|
|
39
|
+
const colorTemp = Math.round(hex2Int(hex.slice(0, 4)) / 10);
|
|
40
|
+
const isColorNode = h !== 0 || s !== 0 || v !== 0;
|
|
41
|
+
return {
|
|
42
|
+
h,
|
|
43
|
+
s,
|
|
44
|
+
v,
|
|
45
|
+
brightness,
|
|
46
|
+
colorTemp,
|
|
47
|
+
isColorNode,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
id,
|
|
52
|
+
version: 0,
|
|
53
|
+
mainLamp: {
|
|
54
|
+
mode,
|
|
55
|
+
speed,
|
|
56
|
+
fanEnable,
|
|
57
|
+
fanSpeed,
|
|
58
|
+
nodes,
|
|
59
|
+
enable: true,
|
|
60
|
+
},
|
|
61
|
+
secondaryLamp: {
|
|
62
|
+
mode: 0,
|
|
63
|
+
speed: 100,
|
|
64
|
+
nodes: [],
|
|
65
|
+
enable: true,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function obj2Dp(mood: MoodInfo, isFan: boolean = false, isUVCFan?: boolean): string {
|
|
71
|
+
const { mainLamp } = mood;
|
|
72
|
+
let fanEnableHex = '';
|
|
73
|
+
let fanSpeedHex = '';
|
|
74
|
+
const idHex = mood.id.toString(16).padStart(2, '0');
|
|
75
|
+
if (isFan) {
|
|
76
|
+
fanEnableHex = (mainLamp.fanEnable ? 1 : 0).toString(16).padStart(2, '0');
|
|
77
|
+
fanSpeedHex = (mainLamp.fanSpeed || 1).toString(16).padStart(2, '0');
|
|
78
|
+
}
|
|
79
|
+
const hex =
|
|
80
|
+
idHex +
|
|
81
|
+
fanEnableHex +
|
|
82
|
+
fanSpeedHex +
|
|
83
|
+
mainLamp.nodes
|
|
84
|
+
?.map(node => {
|
|
85
|
+
const switchingIntervalHex = (isUVCFan ? 101 - mainLamp.speed : mainLamp.speed)
|
|
86
|
+
.toString(16)
|
|
87
|
+
.padStart(2, '0');
|
|
88
|
+
const transitionTimeHex = (isUVCFan ? 101 - mainLamp.speed : mainLamp.speed)
|
|
89
|
+
.toString(16)
|
|
90
|
+
.padStart(2, '0');
|
|
91
|
+
const transitionModeHex = mainLamp.mode.toString(16).padStart(2, '0');
|
|
92
|
+
const hHex = node.h.toString(16).padStart(4, '0');
|
|
93
|
+
const sHex = (node.s * 10).toString(16).padStart(4, '0');
|
|
94
|
+
const vHex = (node.v * 10).toString(16).padStart(4, '0');
|
|
95
|
+
const brightnessHex = (node.brightness * 10).toString(16).padStart(4, '0');
|
|
96
|
+
const colorTempHex = (node.colorTemp * 10).toString(16).padStart(4, '0');
|
|
97
|
+
return (
|
|
98
|
+
switchingIntervalHex +
|
|
99
|
+
transitionTimeHex +
|
|
100
|
+
transitionModeHex +
|
|
101
|
+
hHex +
|
|
102
|
+
sHex +
|
|
103
|
+
vHex +
|
|
104
|
+
brightnessHex +
|
|
105
|
+
colorTempHex
|
|
106
|
+
);
|
|
107
|
+
})
|
|
108
|
+
.join('');
|
|
109
|
+
return hex;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// strip,string light
|
|
113
|
+
export function stripDp2Obj(dp: string, isStringLight: boolean = false): MoodInfo {
|
|
114
|
+
if (!dp) return getDefaultMood();
|
|
115
|
+
const version = hex2Int(dp.slice(0, 2));
|
|
116
|
+
const id = hex2Int(dp.slice(2, 4));
|
|
117
|
+
const mode = hex2Int(dp.slice(4, 6));
|
|
118
|
+
const intervalTime = hex2Int(dp.slice(6, 8));
|
|
119
|
+
const changeTime = hex2Int(dp.slice(8, 10));
|
|
120
|
+
const speed = intervalTime || changeTime;
|
|
121
|
+
const optionA = hex2Int(dp.slice(10, 12)).toString(2).padStart(8, '0');
|
|
122
|
+
const segmented = sToN(optionA.slice(0, 1), 2);
|
|
123
|
+
const loop = sToN(optionA.slice(1, 2), 2);
|
|
124
|
+
const excessive = sToN(optionA.slice(2, 3), 2);
|
|
125
|
+
const direction = sToN(optionA.slice(3, 4), 2);
|
|
126
|
+
const expand = sToN(optionA.slice(4, 6), 2);
|
|
127
|
+
const reserved1 = sToN(optionA.slice(6, 7), 2);
|
|
128
|
+
const reserved2 = sToN(optionA.slice(7, 8), 2);
|
|
129
|
+
// 这两个目前灯具用不上
|
|
130
|
+
// const optionB = toN(dp.slice(12, 14))
|
|
131
|
+
// const optionC = toN(dp.slice(14, 16))
|
|
132
|
+
let nodes = [] as MoodNodeInfo[];
|
|
133
|
+
if (isStringLight) {
|
|
134
|
+
nodes = spliceByStep(dp.slice(16, dp.length), 16).map(nodeHex => {
|
|
135
|
+
const v = hex2Int(nodeHex.slice(0, 2));
|
|
136
|
+
const h = hex2Int(nodeHex.slice(2, 6));
|
|
137
|
+
const s = hex2Int(nodeHex.slice(6, 8));
|
|
138
|
+
const brightness = hex2Int(nodeHex.slice(8, 12)) / 10;
|
|
139
|
+
const colorTemp = hex2Int(nodeHex.slice(12, 16)) / 10;
|
|
140
|
+
const isColorNode = v > 0 && brightness === 0;
|
|
141
|
+
return { h, s, v, brightness, colorTemp, isColorNode };
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
const bright = hex2Int(dp.slice(16, 18));
|
|
145
|
+
nodes = spliceByStep(dp.slice(18, dp.length), 6).map(nodeHex => {
|
|
146
|
+
const h = hex2Int(nodeHex.slice(0, 4));
|
|
147
|
+
const s = hex2Int(nodeHex.slice(4, 6));
|
|
148
|
+
const v = bright;
|
|
149
|
+
const brightness = 0;
|
|
150
|
+
const colorTemp = 0;
|
|
151
|
+
const isColorNode = true;
|
|
152
|
+
return { h, s, v, brightness, colorTemp, isColorNode };
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
version,
|
|
158
|
+
id,
|
|
159
|
+
mainLamp: {
|
|
160
|
+
mode,
|
|
161
|
+
speed,
|
|
162
|
+
direction,
|
|
163
|
+
segmented,
|
|
164
|
+
loop,
|
|
165
|
+
excessive,
|
|
166
|
+
expand,
|
|
167
|
+
reserved1,
|
|
168
|
+
reserved2,
|
|
169
|
+
nodes,
|
|
170
|
+
enable: true,
|
|
171
|
+
},
|
|
172
|
+
secondaryLamp: {
|
|
173
|
+
mode,
|
|
174
|
+
speed,
|
|
175
|
+
nodes: [],
|
|
176
|
+
enable: true,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function stripObj2Dp(mood: MoodInfo, isStringLight: boolean = false) {
|
|
182
|
+
const {
|
|
183
|
+
expand = 0,
|
|
184
|
+
reserved1 = 0,
|
|
185
|
+
reserved2 = 0,
|
|
186
|
+
// mixedIds = [],
|
|
187
|
+
segmented = 0,
|
|
188
|
+
loop = 0,
|
|
189
|
+
excessive = 0,
|
|
190
|
+
direction = 0,
|
|
191
|
+
mode,
|
|
192
|
+
speed,
|
|
193
|
+
nodes,
|
|
194
|
+
} = mood.mainLamp;
|
|
195
|
+
const versionHex = nToHS(mood.version);
|
|
196
|
+
const idHex = nToHS(mood.id);
|
|
197
|
+
const modeHex = nToHS(mode);
|
|
198
|
+
const intervalTimeHex = nToHS(speed);
|
|
199
|
+
const changeTimeHex = nToHS(speed);
|
|
200
|
+
const optionAHex = nToHS(
|
|
201
|
+
parseInt(
|
|
202
|
+
`${segmented}${loop}${excessive}${direction}${toFixed(
|
|
203
|
+
expand.toString(2),
|
|
204
|
+
2
|
|
205
|
+
)}${reserved1}${reserved2}`,
|
|
206
|
+
2
|
|
207
|
+
)
|
|
208
|
+
);
|
|
209
|
+
const optionBHex = nToHS(0);
|
|
210
|
+
const optionCHex = nToHS(0);
|
|
211
|
+
let nodeHex = '';
|
|
212
|
+
if (isStringLight) {
|
|
213
|
+
nodeHex = nodes
|
|
214
|
+
.map(node => {
|
|
215
|
+
return `${nToHS(node.v)}${nToHS(node.h, 4)}${nToHS(node.s)}${nToHS(
|
|
216
|
+
node.brightness * 10,
|
|
217
|
+
4
|
|
218
|
+
)}${nToHS(node.colorTemp * 10, 4)}`;
|
|
219
|
+
})
|
|
220
|
+
.join('');
|
|
221
|
+
} else {
|
|
222
|
+
const brightHex = nToHS(nodes[0].v);
|
|
223
|
+
nodeHex =
|
|
224
|
+
brightHex +
|
|
225
|
+
nodes
|
|
226
|
+
.map(node => {
|
|
227
|
+
return `${nToHS(node.h, 4)}${nToHS(node.s)}`;
|
|
228
|
+
})
|
|
229
|
+
.join('');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
versionHex +
|
|
234
|
+
idHex +
|
|
235
|
+
modeHex +
|
|
236
|
+
intervalTimeHex +
|
|
237
|
+
changeTimeHex +
|
|
238
|
+
optionAHex +
|
|
239
|
+
optionBHex +
|
|
240
|
+
optionCHex +
|
|
241
|
+
nodeHex
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// mix light
|
|
246
|
+
export function MixObj2Dp(mood: MoodInfo) {
|
|
247
|
+
const { mainLamp, secondaryLamp } = mood;
|
|
248
|
+
const versionHex = nToHS(mood.version);
|
|
249
|
+
const idHex = nToHS(mood.id);
|
|
250
|
+
const lamps = [mainLamp, secondaryLamp];
|
|
251
|
+
const lampsHex = lamps
|
|
252
|
+
.map(lamp => {
|
|
253
|
+
let lampHex = lamp.enable ? '01' : '00';
|
|
254
|
+
const nodes = lamp.nodes || [];
|
|
255
|
+
lampHex += nToHS(nodes.length || 0);
|
|
256
|
+
if (nodes.length === 0 || !lamp.enable) {
|
|
257
|
+
return lampHex;
|
|
258
|
+
}
|
|
259
|
+
lampHex += nToHS(lamp.type);
|
|
260
|
+
lampHex += nodes
|
|
261
|
+
.map(node => {
|
|
262
|
+
let nodeHex = '';
|
|
263
|
+
nodeHex += nToHS(lamp.speed);
|
|
264
|
+
nodeHex += nToHS(lamp.speed);
|
|
265
|
+
nodeHex += nToHS(lamp.mode);
|
|
266
|
+
switch (
|
|
267
|
+
lamp.type // 1:W 只有亮度,2:CW 亮度+色温,3:RGB HSV,4:RGBC HSV+色温,5:RGBCW HSV+色温+亮度
|
|
268
|
+
) {
|
|
269
|
+
case 1:
|
|
270
|
+
nodeHex += nToHS(node.brightness * 10, 4);
|
|
271
|
+
break;
|
|
272
|
+
case 2:
|
|
273
|
+
nodeHex += nToHS(node.brightness * 10, 4);
|
|
274
|
+
nodeHex += nToHS(node.colorTemp * 10, 4);
|
|
275
|
+
break;
|
|
276
|
+
case 3:
|
|
277
|
+
nodeHex += nToHS(node.h, 4);
|
|
278
|
+
nodeHex += nToHS(node.s * 10, 4);
|
|
279
|
+
nodeHex += nToHS(node.v * 10, 4);
|
|
280
|
+
break;
|
|
281
|
+
case 4:
|
|
282
|
+
nodeHex += nToHS(node.h, 4);
|
|
283
|
+
nodeHex += nToHS(node.s * 10, 4);
|
|
284
|
+
nodeHex += nToHS(node.v * 10, 4);
|
|
285
|
+
nodeHex += nToHS(node.colorTemp * 10, 4);
|
|
286
|
+
break;
|
|
287
|
+
case 5:
|
|
288
|
+
nodeHex += nToHS(node.h, 4);
|
|
289
|
+
nodeHex += nToHS(node.s * 10, 4);
|
|
290
|
+
nodeHex += nToHS(node.v * 10, 4);
|
|
291
|
+
nodeHex += nToHS(node.brightness * 10, 4);
|
|
292
|
+
nodeHex += nToHS(node.colorTemp * 10, 4);
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
return nodeHex;
|
|
296
|
+
})
|
|
297
|
+
.join('');
|
|
298
|
+
return lampHex;
|
|
299
|
+
})
|
|
300
|
+
.join('');
|
|
301
|
+
return versionHex + idHex + lampsHex;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function MixDp2Obj(dp: string): MoodInfo {
|
|
305
|
+
if (!dp) return getDefaultMood();
|
|
306
|
+
const result = { mainLamp: {}, secondaryLamp: {} } as MoodInfo;
|
|
307
|
+
result.version = sToN(dp.slice(0, 2));
|
|
308
|
+
result.id = sToN(dp.slice(2, 4));
|
|
309
|
+
const mainEnable = sToN(dp.slice(4, 6)) === 1;
|
|
310
|
+
const mainNum = sToN(dp.slice(6, 8));
|
|
311
|
+
let sliceDp = dp.slice(8);
|
|
312
|
+
result.mainLamp.enable = mainEnable;
|
|
313
|
+
result.mainLamp.nodes = [];
|
|
314
|
+
if (mainEnable && mainNum) {
|
|
315
|
+
result.mainLamp.type = sToN(sliceDp.slice(0, 2));
|
|
316
|
+
sliceDp = sliceDp.slice(2);
|
|
317
|
+
for (let i = 0; i < mainNum; i++) {
|
|
318
|
+
result.mainLamp.speed = sToN(sliceDp.slice(0, 2));
|
|
319
|
+
result.mainLamp.mode = sToN(sliceDp.slice(4, 6));
|
|
320
|
+
sliceDp = sliceDp.slice(6);
|
|
321
|
+
const node = {} as MoodNodeInfo;
|
|
322
|
+
switch (result.mainLamp.type) {
|
|
323
|
+
case 1:
|
|
324
|
+
node.brightness = sToN(sliceDp.slice(0, 4)) / 10;
|
|
325
|
+
node.isColorNode = false;
|
|
326
|
+
sliceDp = sliceDp.slice(4);
|
|
327
|
+
break;
|
|
328
|
+
case 2:
|
|
329
|
+
node.brightness = sToN(sliceDp.slice(0, 4)) / 10;
|
|
330
|
+
node.colorTemp = sToN(sliceDp.slice(4, 8)) / 10;
|
|
331
|
+
node.isColorNode = false;
|
|
332
|
+
sliceDp = sliceDp.slice(8);
|
|
333
|
+
break;
|
|
334
|
+
case 3:
|
|
335
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
336
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
337
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
338
|
+
node.isColorNode = true;
|
|
339
|
+
sliceDp = sliceDp.slice(12);
|
|
340
|
+
break;
|
|
341
|
+
case 4:
|
|
342
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
343
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
344
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
345
|
+
node.colorTemp = sToN(sliceDp.slice(12, 16)) / 10;
|
|
346
|
+
node.isColorNode = true;
|
|
347
|
+
sliceDp = sliceDp.slice(16);
|
|
348
|
+
break;
|
|
349
|
+
case 5:
|
|
350
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
351
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
352
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
353
|
+
node.brightness = sToN(sliceDp.slice(12, 16)) / 10;
|
|
354
|
+
node.colorTemp = sToN(sliceDp.slice(16, 20)) / 10;
|
|
355
|
+
node.isColorNode = true;
|
|
356
|
+
sliceDp = sliceDp.slice(20);
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
359
|
+
result.mainLamp.nodes.push(node);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const secondaryEnable = sToN(sliceDp.slice(0, 2)) === 1;
|
|
363
|
+
const secondaryNum = sToN(sliceDp.slice(2, 4));
|
|
364
|
+
result.secondaryLamp.enable = secondaryEnable;
|
|
365
|
+
result.secondaryLamp.nodes = [];
|
|
366
|
+
sliceDp = sliceDp.slice(4);
|
|
367
|
+
if (secondaryEnable && secondaryNum) {
|
|
368
|
+
result.secondaryLamp.type = sToN(sliceDp.slice(0, 2));
|
|
369
|
+
sliceDp = sliceDp.slice(2);
|
|
370
|
+
for (let i = 0; i < secondaryNum; i++) {
|
|
371
|
+
result.secondaryLamp.speed = sToN(sliceDp.slice(0, 2));
|
|
372
|
+
result.secondaryLamp.mode = sToN(sliceDp.slice(4, 6));
|
|
373
|
+
sliceDp = sliceDp.slice(6);
|
|
374
|
+
const node = {} as MoodNodeInfo;
|
|
375
|
+
switch (result.secondaryLamp.type) {
|
|
376
|
+
case 1:
|
|
377
|
+
node.brightness = sToN(sliceDp.slice(0, 4)) / 10;
|
|
378
|
+
node.isColorNode = true;
|
|
379
|
+
sliceDp = sliceDp.slice(4);
|
|
380
|
+
break;
|
|
381
|
+
case 2:
|
|
382
|
+
node.brightness = sToN(sliceDp.slice(0, 4)) / 10;
|
|
383
|
+
node.colorTemp = sToN(sliceDp.slice(4, 8)) / 10;
|
|
384
|
+
node.isColorNode = false;
|
|
385
|
+
sliceDp = sliceDp.slice(8);
|
|
386
|
+
break;
|
|
387
|
+
case 3:
|
|
388
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
389
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
390
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
391
|
+
node.isColorNode = true;
|
|
392
|
+
sliceDp = sliceDp.slice(12);
|
|
393
|
+
break;
|
|
394
|
+
case 4:
|
|
395
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
396
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
397
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
398
|
+
node.colorTemp = sToN(sliceDp.slice(12, 16)) / 10;
|
|
399
|
+
node.isColorNode = true;
|
|
400
|
+
sliceDp = sliceDp.slice(16);
|
|
401
|
+
break;
|
|
402
|
+
case 5:
|
|
403
|
+
node.h = sToN(sliceDp.slice(0, 4));
|
|
404
|
+
node.s = sToN(sliceDp.slice(4, 8)) / 10;
|
|
405
|
+
node.v = sToN(sliceDp.slice(8, 12)) / 10;
|
|
406
|
+
node.brightness = sToN(sliceDp.slice(12, 16)) / 10;
|
|
407
|
+
node.colorTemp = sToN(sliceDp.slice(16, 20)) / 10;
|
|
408
|
+
node.isColorNode = true;
|
|
409
|
+
sliceDp = sliceDp.slice(20);
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
result.secondaryLamp.nodes.push(node);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function MixCeilingDpObj(mainDp: string, secondaryDp: string): MoodInfo {
|
|
420
|
+
const mainLamp = dp2Obj(mainDp);
|
|
421
|
+
const secondaryLamp = secondaryDp ? stripDp2Obj(secondaryDp) : '';
|
|
422
|
+
return {
|
|
423
|
+
id: 0,
|
|
424
|
+
version: 0,
|
|
425
|
+
mainLamp: {
|
|
426
|
+
...mainLamp.mainLamp,
|
|
427
|
+
id: mainLamp.id,
|
|
428
|
+
version: mainLamp.version,
|
|
429
|
+
},
|
|
430
|
+
secondaryLamp: secondaryLamp
|
|
431
|
+
? {
|
|
432
|
+
...secondaryLamp.mainLamp,
|
|
433
|
+
version: secondaryLamp.version,
|
|
434
|
+
id: secondaryLamp.id
|
|
435
|
+
}
|
|
436
|
+
: {
|
|
437
|
+
mode: 0,
|
|
438
|
+
speed: 75,
|
|
439
|
+
nodes: [],
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Utils } from 'tuya-panel-kit';
|
|
3
|
+
import Card from '@ledvance/base/src/components/Card';
|
|
4
|
+
import { CellContent } from '@ledvance/base/src/components/Cell';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
7
|
+
import { MoodUIInfo } from './Interface';
|
|
8
|
+
import { MixMoodColorsLine } from './MoodItem';
|
|
9
|
+
|
|
10
|
+
const cx = Utils.RatioUtils.convertX;
|
|
11
|
+
|
|
12
|
+
interface RecommendMixMoodItemProps {
|
|
13
|
+
title: string;
|
|
14
|
+
isMix: boolean;
|
|
15
|
+
mood: MoodUIInfo;
|
|
16
|
+
onPress: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const RecommendMixMoodItem = (props: RecommendMixMoodItemProps) => {
|
|
20
|
+
const { mood, isMix } = props;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Card style={styles.root} onPress={props.onPress}>
|
|
24
|
+
<CellContent
|
|
25
|
+
title={props.title}
|
|
26
|
+
value={''}
|
|
27
|
+
style={styles.content}
|
|
28
|
+
titleStyle={styles.title}
|
|
29
|
+
iconStyle={{
|
|
30
|
+
color: '#000',
|
|
31
|
+
size: cx(16),
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
{!!(mood.mainLamp) && (
|
|
35
|
+
<>
|
|
36
|
+
<View style={styles.lineStyle}>
|
|
37
|
+
<MixMoodColorsLine mixSubLight={mood?.mainLamp} isMix={isMix} />
|
|
38
|
+
<Spacer height={cx(7)} />
|
|
39
|
+
{(isMix && !!mood.secondaryLamp.nodes.length) && <MixMoodColorsLine mixSubLight={mood.secondaryLamp} isMix={isMix} />}
|
|
40
|
+
</View>
|
|
41
|
+
<Spacer height={cx(24)} />
|
|
42
|
+
</>
|
|
43
|
+
)}
|
|
44
|
+
</Card>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const styles = StyleSheet.create({
|
|
49
|
+
root: {
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
marginHorizontal: cx(24),
|
|
53
|
+
},
|
|
54
|
+
content: {
|
|
55
|
+
height: cx(56),
|
|
56
|
+
display: 'flex',
|
|
57
|
+
marginHorizontal: cx(16),
|
|
58
|
+
},
|
|
59
|
+
title: {
|
|
60
|
+
color: '#000',
|
|
61
|
+
fontSize: cx(16),
|
|
62
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
63
|
+
},
|
|
64
|
+
lineStyle: {
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export default RecommendMixMoodItem;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import MoodPage from "./MoodPage";
|
|
3
|
+
import DynamicMoodEditorPage from "./DynamicMoodEditorPage";
|
|
4
|
+
import StaticMoodEditorPage from "./StaticMoodEditorPage";
|
|
5
|
+
import MixDynamicMoodEditorPage from "./MixDynamicMoodEditor";
|
|
6
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
7
|
+
|
|
8
|
+
const MoodPageRouters: NavigationRoute[] = [
|
|
9
|
+
{
|
|
10
|
+
name: ui_biz_routerKey.group_ui_biz_mood,
|
|
11
|
+
component: MoodPage,
|
|
12
|
+
options:{
|
|
13
|
+
hideTopbar: true,
|
|
14
|
+
showOfflineView: false,
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: ui_biz_routerKey.group_ui_biz_dynamic_mood_edit,
|
|
19
|
+
component: DynamicMoodEditorPage,
|
|
20
|
+
options:{
|
|
21
|
+
hideTopbar: true,
|
|
22
|
+
showOfflineView: false,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: ui_biz_routerKey.group_ui_biz_static_mood_edit,
|
|
27
|
+
component: StaticMoodEditorPage,
|
|
28
|
+
options:{
|
|
29
|
+
hideTopbar: true,
|
|
30
|
+
showOfflineView: false,
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: ui_biz_routerKey.group_ui_biz_dynamic_mix_mood_edit,
|
|
35
|
+
component: MixDynamicMoodEditorPage,
|
|
36
|
+
options:{
|
|
37
|
+
hideTopbar: true,
|
|
38
|
+
showOfflineView: false,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
export default MoodPageRouters
|