@syncbridge/serialport 0.4.17 → 0.4.19

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.
@@ -11,6 +11,7 @@ export declare class SerialClientComponent<TEvents extends SerialClientComponent
11
11
  protected _stopping?: boolean;
12
12
  values: SerialClientVariables;
13
13
  get connected(): boolean;
14
+ protected _init(): Promise<void>;
14
15
  protected _start(abortSignal: AbortSignal): Promise<void>;
15
16
  protected _stop(): Promise<void>;
16
17
  write(data: string | Buffer): void;
@@ -16,6 +16,18 @@ let SerialClientComponent = class SerialClientComponent extends IoClientBaseComp
16
16
  get connected() {
17
17
  return this._connectionManager?.connected ?? false;
18
18
  }
19
+ async _init() {
20
+ await super._init();
21
+ this.on('values-updated', async () => {
22
+ const isStopped = this.stopped;
23
+ await this._stop();
24
+ if (!isStopped) {
25
+ await this._start(new AbortController().signal).catch(err => {
26
+ this.setStatus(ServiceStatus.unhealthy, err.message);
27
+ });
28
+ }
29
+ });
30
+ }
19
31
  async _start(abortSignal) {
20
32
  await super._start(abortSignal);
21
33
  this._stopping = false;
@@ -13,6 +13,7 @@ __decorate([
13
13
  label: 'Reconnection strategy',
14
14
  enumValues: ['fibonacci', 'exponential'],
15
15
  default: 'fibonacci',
16
+ hotPlug: true,
16
17
  }),
17
18
  __metadata("design:type", String)
18
19
  ], SerialClientReconnectVariables.prototype, "strategy", void 0);
@@ -21,6 +22,7 @@ __decorate([
21
22
  label: 'Initial delay',
22
23
  description: 'Initial delay in milliseconds',
23
24
  default: 2000,
25
+ hotPlug: true,
24
26
  }),
25
27
  __metadata("design:type", Number)
26
28
  ], SerialClientReconnectVariables.prototype, "initialDelay", void 0);
@@ -29,6 +31,7 @@ __decorate([
29
31
  label: 'Maximum delay',
30
32
  description: 'Maximum delay in milliseconds',
31
33
  default: 10000,
34
+ hotPlug: true,
32
35
  }),
33
36
  __metadata("design:type", Number)
34
37
  ], SerialClientReconnectVariables.prototype, "maxDelay", void 0);
@@ -46,6 +49,7 @@ __decorate([
46
49
  .then(ports => ports.map(port => port.path))
47
50
  .catch(() => []),
48
51
  index: 100,
52
+ hotPlug: true,
49
53
  }),
50
54
  __metadata("design:type", String)
51
55
  ], SerialClientVariables.prototype, "port", void 0);
@@ -60,6 +64,7 @@ __decorate([
60
64
  default: 9600,
61
65
  required: true,
62
66
  index: 101,
67
+ hotPlug: true,
63
68
  }),
64
69
  __metadata("design:type", Number)
65
70
  ], SerialClientVariables.prototype, "baudRate", void 0);
@@ -71,6 +76,7 @@ __decorate([
71
76
  default: '8',
72
77
  required: true,
73
78
  index: 102,
79
+ hotPlug: true,
74
80
  }),
75
81
  __metadata("design:type", String)
76
82
  ], SerialClientVariables.prototype, "dataBits", void 0);
@@ -81,6 +87,7 @@ __decorate([
81
87
  enumValues: ['1', '1.5', '2'],
82
88
  default: '1',
83
89
  index: 103,
90
+ hotPlug: true,
84
91
  }),
85
92
  __metadata("design:type", String)
86
93
  ], SerialClientVariables.prototype, "stopBits", void 0);
@@ -91,6 +98,7 @@ __decorate([
91
98
  enumValues: ['none', 'even', 'mark', 'odd', 'space'],
92
99
  default: 'none',
93
100
  index: 104,
101
+ hotPlug: true,
94
102
  }),
95
103
  __metadata("design:type", String)
96
104
  ], SerialClientVariables.prototype, "parity", void 0);
@@ -100,6 +108,7 @@ __decorate([
100
108
  description: 'RTS/CTS flow control',
101
109
  default: false,
102
110
  index: 105,
111
+ hotPlug: true,
103
112
  }),
104
113
  __metadata("design:type", Boolean)
105
114
  ], SerialClientVariables.prototype, "rtscts", void 0);
@@ -109,6 +118,7 @@ __decorate([
109
118
  description: 'XON flow control',
110
119
  default: false,
111
120
  index: 106,
121
+ hotPlug: true,
112
122
  }),
113
123
  __metadata("design:type", Boolean)
114
124
  ], SerialClientVariables.prototype, "xon", void 0);
@@ -118,6 +128,7 @@ __decorate([
118
128
  description: 'XOFF flow control',
119
129
  default: false,
120
130
  index: 107,
131
+ hotPlug: true,
121
132
  }),
122
133
  __metadata("design:type", Boolean)
123
134
  ], SerialClientVariables.prototype, "xoff", void 0);
@@ -127,6 +138,7 @@ __decorate([
127
138
  description: 'XANY flow control',
128
139
  default: false,
129
140
  index: 108,
141
+ hotPlug: true,
130
142
  }),
131
143
  __metadata("design:type", Boolean)
132
144
  ], SerialClientVariables.prototype, "xany", void 0);
@@ -136,6 +148,7 @@ __decorate([
136
148
  description: 'Drop DTR on close if enabled',
137
149
  default: true,
138
150
  index: 109,
151
+ hotPlug: true,
139
152
  }),
140
153
  __metadata("design:type", Boolean)
141
154
  ], SerialClientVariables.prototype, "hupcl", void 0);
@@ -143,6 +156,7 @@ __decorate([
143
156
  DefineVariable({
144
157
  label: 'Reconnect Options',
145
158
  description: 'Connection timeout in milliseconds',
159
+ hotPlug: true,
146
160
  }),
147
161
  __metadata("design:type", SerialClientReconnectVariables)
148
162
  ], SerialClientVariables.prototype, "reconnect", void 0);
package/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '0.4.17';
1
+ export const version = '0.4.19';
2
2
  export const noOp = () => undefined;
3
3
  export const panatesAuthor = {
4
4
  name: 'Panates Technology AS',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncbridge/serialport",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "SyncBridge Serial Port connection component",
5
5
  "author": "Panates Inc",
6
6
  "license": "UNLICENSED",
@@ -14,8 +14,8 @@
14
14
  "serialport": "^13.0.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@syncbridge/common": "^0.5.11",
18
- "@syncbridge/builtins": "^0.4.17"
17
+ "@syncbridge/common": "^0.6.0",
18
+ "@syncbridge/builtins": "^0.4.19"
19
19
  },
20
20
  "exports": {
21
21
  ".": {