@flexem/fc-gui 3.0.0-alpha.113 → 3.0.0-alpha.115
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/bundles/@flexem/fc-gui.umd.js +130 -23
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +2 -2
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/communication/variable/variable-communicator.d.ts +1 -0
- package/communication/variable/variable-value.d.ts +3 -1
- package/communication/variable/variable-value.js +3 -1
- package/communication/variable/variable-value.metadata.json +1 -1
- package/elements/base/readable-element.js +4 -1
- package/elements/base/state-control-element.js +3 -0
- package/elements/historical-curve/historical-curve.element.d.ts +1 -0
- package/elements/historical-curve/historical-curve.element.js +28 -2
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/main-element.js +2 -1
- package/elements/per-view-variable-communicator.d.ts +1 -0
- package/elements/per-view-variable-communicator.js +3 -0
- package/elements/per-view-variable-communicator.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.js +2 -4
- package/elements/video/video-element.js +7 -1
- package/gui/gui-view.d.ts +2 -0
- package/gui/gui-view.js +54 -13
- package/gui/gui-view.metadata.json +1 -1
- package/package.json +1 -1
- package/remote/communication/variable/remote-variable-communicator.d.ts +3 -0
- package/remote/communication/variable/remote-variable-communicator.js +24 -0
- package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
- package/remote/communication/variable/remote-variable-protocol.d.ts +2 -0
|
@@ -6,6 +6,7 @@ export interface VariableCommunicator {
|
|
|
6
6
|
openVariables(variableNames: Array<string>, appId: string): Observable<Array<VariableValue>>;
|
|
7
7
|
write(variableName: string, value: any): Observable<VariableValue>;
|
|
8
8
|
writeWordByBit(variableName: string, index: number, value: number): Observable<VariableValue>;
|
|
9
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
9
10
|
subscribeVariableState(variableName: string): Observable<VariableState>;
|
|
10
11
|
subscribeVariableStates(variableNames: Array<string>): Observable<Array<VariableState>>;
|
|
11
12
|
subscribeUserDeviceAlarms(appId: string): any;
|
|
@@ -4,5 +4,7 @@ export declare class VariableValue {
|
|
|
4
4
|
state: VariableStateEnum;
|
|
5
5
|
value?: any;
|
|
6
6
|
readonly timeStamp?: string;
|
|
7
|
-
|
|
7
|
+
systemName?: string;
|
|
8
|
+
customStatus?: string;
|
|
9
|
+
constructor(variableName: string, state: VariableStateEnum, value?: any, timeStamp?: string, systemName?: string, customStatus?: string);
|
|
8
10
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export class VariableValue {
|
|
2
|
-
constructor(variableName, state, value, timeStamp) {
|
|
2
|
+
constructor(variableName, state, value, timeStamp, systemName, customStatus) {
|
|
3
3
|
this.variableName = variableName;
|
|
4
4
|
this.state = state;
|
|
5
5
|
this.value = value;
|
|
6
6
|
this.timeStamp = timeStamp;
|
|
7
|
+
this.systemName = systemName;
|
|
8
|
+
this.customStatus = customStatus;
|
|
7
9
|
}
|
|
8
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"VariableValue":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"./variable-state-enum","name":"VariableStateEnum","line":3,"character":68},{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"string"}]}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"VariableValue":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"./variable-state-enum","name":"VariableStateEnum","line":3,"character":68},{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}]}}}}]
|
|
@@ -73,7 +73,7 @@ export class ReadableElement extends ConditionalEnableElement {
|
|
|
73
73
|
}
|
|
74
74
|
reportValueChanged(value) {
|
|
75
75
|
forEach(this.elementStates, elementState => {
|
|
76
|
-
if (elementState.variableName === value.variableName) {
|
|
76
|
+
if (elementState.variableName === value.variableName || elementState.variableName === value.systemName) {
|
|
77
77
|
elementState.state = value.state;
|
|
78
78
|
this.changeStates();
|
|
79
79
|
}
|
|
@@ -83,5 +83,8 @@ export class ReadableElement extends ConditionalEnableElement {
|
|
|
83
83
|
|| value.variableName === this.maxVariableName) {
|
|
84
84
|
this.updateVariableValue(value.value, value.variableName);
|
|
85
85
|
}
|
|
86
|
+
if (value.systemName === '设备状态') {
|
|
87
|
+
this.updateVariableValue(value.customStatus, '设备状态');
|
|
88
|
+
}
|
|
86
89
|
}
|
|
87
90
|
}
|
|
@@ -139,6 +139,9 @@ export class StateControlElement extends ConditionalDynamicDisplayElement {
|
|
|
139
139
|
if (!this.currentRect.length) {
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
+
// 元件绑定设备状态时不需要在右上角显示状态
|
|
143
|
+
if (this.$element[0].dataset.model.includes('设备状态'))
|
|
144
|
+
return;
|
|
142
145
|
const document = this.$element[0].ownerDocument;
|
|
143
146
|
const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
144
147
|
if (imgObj) {
|
|
@@ -46,6 +46,7 @@ export declare class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
46
46
|
private updateQueryTimeRange;
|
|
47
47
|
private reRenderElement;
|
|
48
48
|
private renderElement;
|
|
49
|
+
setupTooltipAutoHide(chart: any): void;
|
|
49
50
|
private renderChart;
|
|
50
51
|
initPoint(): void;
|
|
51
52
|
private getLineChart;
|
|
@@ -152,6 +152,28 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
+
setupTooltipAutoHide(chart) {
|
|
156
|
+
const chartContainer = this.rootElement.select('.nv-focus').node();
|
|
157
|
+
if (!chartContainer || !chart)
|
|
158
|
+
return;
|
|
159
|
+
let timeoutId;
|
|
160
|
+
// 鼠标移入图表时显示 tooltip
|
|
161
|
+
chartContainer.addEventListener('mouseover', () => {
|
|
162
|
+
hideTooltipAfterDelay();
|
|
163
|
+
});
|
|
164
|
+
const clearTooltipTimeout = () => {
|
|
165
|
+
if (timeoutId) {
|
|
166
|
+
clearTimeout(timeoutId);
|
|
167
|
+
timeoutId = null;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const hideTooltipAfterDelay = () => {
|
|
171
|
+
clearTooltipTimeout();
|
|
172
|
+
timeoutId = setTimeout(() => {
|
|
173
|
+
chart.tooltip.hidden(true);
|
|
174
|
+
}, 2000); // 2秒延迟
|
|
175
|
+
};
|
|
176
|
+
}
|
|
155
177
|
renderChart(result) {
|
|
156
178
|
const chartWidth = this.model.displaySetting.size.width;
|
|
157
179
|
const chartHeight = this.model.displaySetting.size.height - this.displayOption.operationAreaHeight - this.displayOption.operationAreaMarginTop;
|
|
@@ -163,12 +185,16 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
163
185
|
});
|
|
164
186
|
this.data = data;
|
|
165
187
|
nv.addGraph(() => {
|
|
188
|
+
let chart;
|
|
166
189
|
if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
167
|
-
|
|
190
|
+
chart = this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
|
|
168
191
|
}
|
|
169
192
|
else {
|
|
170
|
-
|
|
193
|
+
chart = this.getLineChart(chartWidth, chartHeight, data);
|
|
171
194
|
}
|
|
195
|
+
// 设置 tooltip 自动隐藏逻辑
|
|
196
|
+
this.setupTooltipAutoHide(chart);
|
|
197
|
+
return chart;
|
|
172
198
|
});
|
|
173
199
|
}
|
|
174
200
|
initPoint() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":68,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":69,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":70,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":71,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":72,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":73,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"initKeyboardListener":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"initElementStatus":[{"__symbolic":"method"}],"updateElementStatus":[{"__symbolic":"method"}],"setStatusAsUnbound":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"setStatusAsLoadFailed":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":68,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":69,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":70,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":71,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":72,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":73,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"initKeyboardListener":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"setupTooltipAutoHide":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"initElementStatus":[{"__symbolic":"method"}],"updateElementStatus":[{"__symbolic":"method"}],"setStatusAsUnbound":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"setStatusAsLoadFailed":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
|
package/elements/main-element.js
CHANGED
|
@@ -262,7 +262,8 @@ export class MainElement {
|
|
|
262
262
|
each(values, value => {
|
|
263
263
|
each(this.elements, e => {
|
|
264
264
|
if (e instanceof ReadableElement) {
|
|
265
|
-
if (
|
|
265
|
+
if ((value.variableName && (e.readVariableName === value.variableName ||
|
|
266
|
+
e.minVariableName === value.variableName || e.maxVariableName === value.variableName)) || e.readVariableName === value.systemName) {
|
|
266
267
|
e.reportValueChanged(value);
|
|
267
268
|
}
|
|
268
269
|
}
|
|
@@ -12,6 +12,7 @@ export declare class PerViewVariableCommunicator implements VariableCommunicator
|
|
|
12
12
|
openVariables(variableNames: Array<string>, appId?: string): Observable<Array<VariableValue>>;
|
|
13
13
|
write(variableName: string, value: any): Observable<VariableValue>;
|
|
14
14
|
writeWordByBit(variableName: string, index: number, value: number): Observable<VariableValue>;
|
|
15
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
15
16
|
subscribeVariableState(variableName: string): Observable<VariableState>;
|
|
16
17
|
subscribeVariableStates(variableNames: string[]): Observable<Array<VariableState>>;
|
|
17
18
|
subscribeUserDeviceAlarms(appId?: string): Observable<VariableState[]>;
|
|
@@ -30,6 +30,9 @@ export class PerViewVariableCommunicator {
|
|
|
30
30
|
writeWordByBit(variableName, index, value) {
|
|
31
31
|
return this._rawVariableCommunicator.writeWordByBit(variableName, index, value);
|
|
32
32
|
}
|
|
33
|
+
requestVirtualDeviceState() {
|
|
34
|
+
return this._rawVariableCommunicator.requestVirtualDeviceState();
|
|
35
|
+
}
|
|
33
36
|
subscribeVariableState(variableName) {
|
|
34
37
|
return this.subscribeVariableStates([variableName]).pipe(map(values => values[0]));
|
|
35
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"PerViewVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":15,"character":38}]}],"openVariable":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeUserDeviceAlarms":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"PerViewVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":15,"character":38}]}],"openVariable":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"requestVirtualDeviceState":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeUserDeviceAlarms":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
|
@@ -72,9 +72,7 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
|
|
|
72
72
|
this.isWriteRestorationDownValue = true;
|
|
73
73
|
}, 1000);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
d3.event.preventDefault();
|
|
77
|
-
}
|
|
75
|
+
d3.event.preventDefault();
|
|
78
76
|
}
|
|
79
77
|
});
|
|
80
78
|
this.rootElement.on(this.isMobileMode && isMobile ? 'touchend' : 'mouseup', () => {
|
|
@@ -104,7 +102,7 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
|
|
|
104
102
|
this.isWriteRestorationDownValue = false;
|
|
105
103
|
if (!this.model.useIndicatorLight) {
|
|
106
104
|
this.switchToState(0);
|
|
107
|
-
if (d3.event
|
|
105
|
+
if (d3.event) {
|
|
108
106
|
d3.event.preventDefault();
|
|
109
107
|
}
|
|
110
108
|
}
|
|
@@ -93,7 +93,7 @@ export class VideoElement extends ConditionalDisplayElement {
|
|
|
93
93
|
playsInline webkit-playsinline `;
|
|
94
94
|
if (this.isMobileMode) {
|
|
95
95
|
if (isAndroid) {
|
|
96
|
-
videoHtml += '
|
|
96
|
+
videoHtml += ' muted></video>';
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
videoHtml += ' controls muted></video>';
|
|
@@ -115,6 +115,12 @@ export class VideoElement extends ConditionalDisplayElement {
|
|
|
115
115
|
}
|
|
116
116
|
try {
|
|
117
117
|
this.videoPlayer = new EZUIPlayer(videoId);
|
|
118
|
+
if (isAndroid) {
|
|
119
|
+
// 确保在 EZUIPlayer 初始化后才调用 play 方法
|
|
120
|
+
this.videoPlayer.on('canplay', () => {
|
|
121
|
+
this.videoPlayer.play();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
118
124
|
}
|
|
119
125
|
catch (err) {
|
|
120
126
|
console.log(err);
|
package/gui/gui-view.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare class GuiView implements PopupViewService {
|
|
|
21
21
|
private mainElement;
|
|
22
22
|
private muskElement;
|
|
23
23
|
private openVariableStatesSubscription;
|
|
24
|
+
private requestVirtualDeviceState;
|
|
25
|
+
private virtualDeviceStatesChanged;
|
|
24
26
|
private openVariablesSubscription;
|
|
25
27
|
private openedVariableNames;
|
|
26
28
|
private perViewVariableCommunicator;
|
package/gui/gui-view.js
CHANGED
|
@@ -72,22 +72,57 @@ export class GuiView {
|
|
|
72
72
|
this.openVariableStatesSubscription.unsubscribe();
|
|
73
73
|
}
|
|
74
74
|
this.openedVariableNames = this.mainElement.getVariableNames();
|
|
75
|
-
if (this.openedVariableNames.
|
|
76
|
-
|
|
75
|
+
if (this.openedVariableNames.indexOf('设备状态') !== -1) {
|
|
76
|
+
if (this.requestVirtualDeviceState) {
|
|
77
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
78
|
+
}
|
|
79
|
+
if (this.requestVirtualDeviceState) {
|
|
80
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
81
|
+
}
|
|
82
|
+
if (this.openedVariableNames.length === 1) {
|
|
83
|
+
this.normalOpenedVariableNames(['设备状态']);
|
|
84
|
+
this.requestVirtualDeviceState =
|
|
85
|
+
this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
|
|
86
|
+
complete: () => { }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.openVariableStatesSubscription =
|
|
91
|
+
this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
|
|
92
|
+
this.mainElement.reportVariableStates(states);
|
|
93
|
+
const normalVariableNames = [];
|
|
94
|
+
each(states, v => {
|
|
95
|
+
if (v.state === VariableStateEnum.Normal && normalVariableNames.indexOf(v.variableName) === -1) {
|
|
96
|
+
normalVariableNames.push(v.variableName);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
normalVariableNames.push('设备状态');
|
|
100
|
+
this.normalOpenedVariableNames(normalVariableNames);
|
|
101
|
+
this.requestVirtualDeviceState =
|
|
102
|
+
this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
|
|
103
|
+
complete: () => { }
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
77
107
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
108
|
+
else {
|
|
109
|
+
if (this.openedVariableNames.length === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.openVariableStatesSubscription =
|
|
113
|
+
this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
|
|
114
|
+
this.mainElement.reportVariableStates(states);
|
|
115
|
+
const normalVariableNames = [];
|
|
116
|
+
each(states, v => {
|
|
117
|
+
if (v.state === VariableStateEnum.Normal && normalVariableNames.indexOf(v.variableName) === -1) {
|
|
118
|
+
normalVariableNames.push(v.variableName);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
if (normalVariableNames.length > 0) {
|
|
122
|
+
this.normalOpenedVariableNames(normalVariableNames);
|
|
85
123
|
}
|
|
86
124
|
});
|
|
87
|
-
|
|
88
|
-
this.normalOpenedVariableNames(normalVariableNames);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
125
|
+
}
|
|
91
126
|
}
|
|
92
127
|
popView(viewIndex, hostContainerId, el) {
|
|
93
128
|
return this.context.configStore.viewStore.getViewConfig(viewIndex).pipe(map(view => {
|
|
@@ -181,6 +216,12 @@ export class GuiView {
|
|
|
181
216
|
if (this.openVariableStatesSubscription) {
|
|
182
217
|
this.openVariableStatesSubscription.unsubscribe();
|
|
183
218
|
}
|
|
219
|
+
if (this.requestVirtualDeviceState) {
|
|
220
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
221
|
+
}
|
|
222
|
+
if (this.virtualDeviceStatesChanged) {
|
|
223
|
+
this.virtualDeviceStatesChanged.unsubscribe();
|
|
224
|
+
}
|
|
184
225
|
if (this.openVariablesSubscription) {
|
|
185
226
|
this.openVariablesSubscription.unsubscribe();
|
|
186
227
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GuiView":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"GuiView":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":49,"character":43},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":50,"character":41},{"__symbolic":"reference","module":"./gui-context","name":"GuiContext","line":51,"character":34},{"__symbolic":"reference","name":"GuiView"}]}],"resize":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"loadElementState":[{"__symbolic":"method"}],"popView":[{"__symbolic":"method"}],"closeView":[{"__symbolic":"method"}],"moveView":[{"__symbolic":"method"}],"showMusk":[{"__symbolic":"method"}],"showShadow":[{"__symbolic":"method"}],"hideMusk":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"normalOpenedVariableNames":[{"__symbolic":"method"}]}}}}]
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
|
|
|
9
9
|
private appIdVariablesMap;
|
|
10
10
|
private connectedSubscription;
|
|
11
11
|
private variableValuesChangedSubscription;
|
|
12
|
+
private virtualDeviceStatesChangedSubscription;
|
|
12
13
|
private variablesToBeOpened;
|
|
13
14
|
private variablesToBeClosed;
|
|
14
15
|
private variableValueCache;
|
|
@@ -22,9 +23,11 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
|
|
|
22
23
|
constructor(remoteVariableProtocol: RemoteVariableProtocol, logger: LoggerService);
|
|
23
24
|
private doAlarmChanged;
|
|
24
25
|
private doVariableValuesChanged;
|
|
26
|
+
private doVirtualDeviceStatesChanged;
|
|
25
27
|
private doVariableStatesChanged;
|
|
26
28
|
subscribeVariableStates(variableNames: string[]): Observable<VariableState[]>;
|
|
27
29
|
subscribeVariableState(variableName: string): Observable<VariableState>;
|
|
30
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
28
31
|
openVariables(variableNames: string[], appId?: string): Observable<VariableValue[]>;
|
|
29
32
|
openVariable(variableName: string, appId?: string): Observable<VariableValue>;
|
|
30
33
|
write(variableName: string, value: any): Observable<VariableValue>;
|
|
@@ -24,6 +24,7 @@ export class RemoteVariableCommunicator {
|
|
|
24
24
|
});
|
|
25
25
|
this.doVariableStatesChanged();
|
|
26
26
|
this.doVariableValuesChanged();
|
|
27
|
+
this.doVirtualDeviceStatesChanged();
|
|
27
28
|
this.doAlarmChanged();
|
|
28
29
|
}
|
|
29
30
|
doAlarmChanged() {
|
|
@@ -54,6 +55,25 @@ export class RemoteVariableCommunicator {
|
|
|
54
55
|
});
|
|
55
56
|
});
|
|
56
57
|
}
|
|
58
|
+
doVirtualDeviceStatesChanged() {
|
|
59
|
+
if (this.virtualDeviceStatesChangedSubscription !== undefined) {
|
|
60
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
61
|
+
}
|
|
62
|
+
this.virtualDeviceStatesChangedSubscription =
|
|
63
|
+
this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
|
|
64
|
+
each(deviceStates, deviceState => {
|
|
65
|
+
const variableName = '设备状态';
|
|
66
|
+
this.variableValueCache.set(variableName, deviceState);
|
|
67
|
+
const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
|
|
68
|
+
if (this.observers.has(variableName)) {
|
|
69
|
+
each(this.observers.get(variableName), ob => {
|
|
70
|
+
// TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
|
|
71
|
+
ob.next([data]);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
57
77
|
doVariableStatesChanged() {
|
|
58
78
|
if (this.variableStatesChangedSubscription !== undefined) {
|
|
59
79
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
@@ -127,6 +147,9 @@ export class RemoteVariableCommunicator {
|
|
|
127
147
|
subscribeVariableState(variableName) {
|
|
128
148
|
return this.subscribeVariableStates([variableName]).pipe(map(values => values[0]));
|
|
129
149
|
}
|
|
150
|
+
requestVirtualDeviceState() {
|
|
151
|
+
return this.remoteVariableProtocol.requestVirtualDeviceState();
|
|
152
|
+
}
|
|
130
153
|
openVariables(variableNames, appId = '') {
|
|
131
154
|
return new Observable(observer => {
|
|
132
155
|
let variablesToStart = [];
|
|
@@ -229,6 +252,7 @@ export class RemoteVariableCommunicator {
|
|
|
229
252
|
this.connectedSubscription.unsubscribe();
|
|
230
253
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
231
254
|
this.variableValuesChangedSubscription.unsubscribe();
|
|
255
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
232
256
|
this.alarmChangedSubscription.unsubscribe();
|
|
233
257
|
if (this.logger && this.logger.isDebugEnabled()) {
|
|
234
258
|
this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":28,"character":57},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":28,"character":106}]}],"doAlarmChanged":[{"__symbolic":"method"}],"doVariableValuesChanged":[{"__symbolic":"method"}],"doVirtualDeviceStatesChanged":[{"__symbolic":"method"}],"doVariableStatesChanged":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"requestVirtualDeviceState":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"openVariable":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"subscribeUserDeviceAlarms":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
|
@@ -9,6 +9,8 @@ export interface RemoteVariableProtocol {
|
|
|
9
9
|
tryStopVariables(variableNames: string[], appId: string): Observable<void>;
|
|
10
10
|
writeVariable(variableName: string, value: any): Observable<void>;
|
|
11
11
|
writeVariableWordByBit(variableName: string, index: number, value: number): Observable<void>;
|
|
12
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
13
|
+
virtualDeviceStatesChanged: Observable<any>;
|
|
12
14
|
subscribeVariableStates(variableNames: string[]): Observable<void>;
|
|
13
15
|
unsubscribeVariableStates(variableNames: string[]): Observable<void>;
|
|
14
16
|
subscribeVirtualDeviceAlarms(appId: string): any;
|