@ray-js/lamp-schedule-core 1.0.1-beta-6 → 1.0.1-beta-8
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.
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
3
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
-
import { publishDps,
|
|
4
|
+
import { publishDps, publishGroupDps } from '@ray-js/ray';
|
|
4
5
|
import { scheduleLogger as ScheduleLogger } from '../utils/ScheduleLogger';
|
|
6
|
+
const DEFAULT_OPTIONS = {
|
|
7
|
+
mode: 2,
|
|
8
|
+
options: {},
|
|
9
|
+
pipelines: []
|
|
10
|
+
};
|
|
5
11
|
export const updateDeviceDp = (devId, groupId, dps) => {
|
|
6
12
|
if (Object.keys(dps).length === 0) {
|
|
7
13
|
ScheduleLogger.warn('updateDeviceDp', 'dps is empty');
|
|
@@ -12,30 +18,26 @@ export const updateDeviceDp = (devId, groupId, dps) => {
|
|
|
12
18
|
return;
|
|
13
19
|
}
|
|
14
20
|
if (groupId) {
|
|
15
|
-
|
|
21
|
+
publishGroupDps(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), {}, {
|
|
16
22
|
groupId,
|
|
17
|
-
|
|
23
|
+
dps,
|
|
18
24
|
success: () => {
|
|
19
|
-
ScheduleLogger.debug('
|
|
25
|
+
ScheduleLogger.debug('publishGroupDps dp success', dps);
|
|
20
26
|
},
|
|
21
27
|
fail: err => {
|
|
22
|
-
ScheduleLogger.error('
|
|
28
|
+
ScheduleLogger.error('publishGroupDps dp fail', err);
|
|
23
29
|
}
|
|
24
|
-
});
|
|
30
|
+
}));
|
|
25
31
|
return;
|
|
26
32
|
}
|
|
27
33
|
ScheduleLogger.debug('updateDeviceDp publishDps dps:', dps);
|
|
28
|
-
publishDps({
|
|
34
|
+
publishDps(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), {}, {
|
|
29
35
|
deviceId: devId,
|
|
30
|
-
dps,
|
|
31
|
-
mode: 2,
|
|
32
|
-
pipelines: [0, 1, 2, 3, 4, 5, 6],
|
|
33
|
-
options: {},
|
|
34
36
|
success: () => {
|
|
35
37
|
ScheduleLogger.debug('publishDps dp success', dps);
|
|
36
38
|
},
|
|
37
39
|
fail: err => {
|
|
38
40
|
ScheduleLogger.error('publishDps dp fail', err);
|
|
39
41
|
}
|
|
40
|
-
});
|
|
42
|
+
}));
|
|
41
43
|
};
|