motion-master-client 0.0.55 → 0.0.56
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/.babelrc +3 -0
- package/.eslintrc.json +18 -0
- package/README.md +123 -123
- package/jest.config.ts +16 -0
- package/motion-master.proto +1861 -0
- package/package.json +6 -21
- package/project.json +45 -0
- package/src/{index.d.ts → index.ts} +26 -26
- package/src/lib/cia402.spec.ts +77 -0
- package/src/lib/cia402.ts +414 -0
- package/src/lib/config-file.spec.ts +114 -0
- package/src/lib/config-file.ts +63 -0
- package/src/lib/device-log-line.ts +5 -0
- package/src/lib/device-parameter.spec.ts +85 -0
- package/src/lib/device-parameter.ts +79 -0
- package/src/lib/device.ts +10 -0
- package/src/lib/hardware-description.spec.ts +253 -0
- package/src/lib/hardware-description.ts +129 -0
- package/src/lib/logger.ts +5 -0
- package/src/lib/monitoring-config.ts +6 -0
- package/src/lib/{monitoring-entry.d.ts → monitoring-entry.ts} +10 -9
- package/src/lib/motion-master-client.ts +266 -0
- package/src/lib/motion-master-pub-sub-client.ts +100 -0
- package/src/lib/motion-master-pub-sub-socket.ts +46 -0
- package/src/lib/motion-master-pub-sub-web-socket.ts +77 -0
- package/src/lib/motion-master-pub-sub-worker-socket.ts +57 -0
- package/src/lib/motion-master-req-res-client.spec.ts +740 -0
- package/src/lib/motion-master-req-res-client.ts +2211 -0
- package/src/lib/motion-master-req-res-socket.ts +68 -0
- package/src/lib/motion-master-req-res-web-socket.ts +123 -0
- package/src/lib/motion-master-req-res-worker-socket.ts +89 -0
- package/src/lib/motion-master.proto.d.ts +5183 -5083
- package/src/lib/motion-master.proto.js +53218 -52284
- package/src/lib/operators.ts +108 -0
- package/src/lib/options.ts +12 -0
- package/src/lib/parameter.spec.ts +160 -0
- package/src/lib/parameter.ts +170 -0
- package/src/lib/product-id-range.ts +8 -0
- package/src/lib/request-status-resolver.ts +403 -0
- package/src/lib/system-log-line.ts +9 -0
- package/src/lib/{types.d.ts → types.ts} +141 -209
- package/src/lib/urls.ts +6 -0
- package/src/lib/util.ts +332 -0
- package/src/lib/web-socket-connection-close-codes.ts +85 -0
- package/tsconfig.json +23 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +20 -0
- package/typedoc.json +10 -0
- package/src/index.js +0 -30
- package/src/index.js.map +0 -1
- package/src/lib/cia402.d.ts +0 -182
- package/src/lib/cia402.js +0 -392
- package/src/lib/cia402.js.map +0 -1
- package/src/lib/config-file.d.ts +0 -13
- package/src/lib/config-file.js +0 -50
- package/src/lib/config-file.js.map +0 -1
- package/src/lib/device-log-line.d.ts +0 -5
- package/src/lib/device-log-line.js +0 -3
- package/src/lib/device-log-line.js.map +0 -1
- package/src/lib/device-parameter.d.ts +0 -56
- package/src/lib/device-parameter.js +0 -39
- package/src/lib/device-parameter.js.map +0 -1
- package/src/lib/device.d.ts +0 -9
- package/src/lib/device.js +0 -3
- package/src/lib/device.js.map +0 -1
- package/src/lib/hardware-description.d.ts +0 -41
- package/src/lib/hardware-description.js +0 -94
- package/src/lib/hardware-description.js.map +0 -1
- package/src/lib/logger.d.ts +0 -1
- package/src/lib/logger.js +0 -8
- package/src/lib/logger.js.map +0 -1
- package/src/lib/monitoring-config.d.ts +0 -6
- package/src/lib/monitoring-config.js +0 -3
- package/src/lib/monitoring-config.js.map +0 -1
- package/src/lib/monitoring-entry.js +0 -3
- package/src/lib/monitoring-entry.js.map +0 -1
- package/src/lib/motion-master-client.d.ts +0 -56
- package/src/lib/motion-master-client.js +0 -167
- package/src/lib/motion-master-client.js.map +0 -1
- package/src/lib/motion-master-pub-sub-client.d.ts +0 -17
- package/src/lib/motion-master-pub-sub-client.js +0 -73
- package/src/lib/motion-master-pub-sub-client.js.map +0 -1
- package/src/lib/motion-master-pub-sub-socket.d.ts +0 -42
- package/src/lib/motion-master-pub-sub-socket.js +0 -3
- package/src/lib/motion-master-pub-sub-socket.js.map +0 -1
- package/src/lib/motion-master-pub-sub-web-socket.d.ts +0 -18
- package/src/lib/motion-master-pub-sub-web-socket.js +0 -66
- package/src/lib/motion-master-pub-sub-web-socket.js.map +0 -1
- package/src/lib/motion-master-pub-sub-worker-socket.d.ts +0 -18
- package/src/lib/motion-master-pub-sub-worker-socket.js +0 -48
- package/src/lib/motion-master-pub-sub-worker-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-client.d.ts +0 -947
- package/src/lib/motion-master-req-res-client.js +0 -1735
- package/src/lib/motion-master-req-res-client.js.map +0 -1
- package/src/lib/motion-master-req-res-socket.d.ts +0 -60
- package/src/lib/motion-master-req-res-socket.js +0 -3
- package/src/lib/motion-master-req-res-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-web-socket.d.ts +0 -28
- package/src/lib/motion-master-req-res-web-socket.js +0 -98
- package/src/lib/motion-master-req-res-web-socket.js.map +0 -1
- package/src/lib/motion-master-req-res-worker-socket.d.ts +0 -24
- package/src/lib/motion-master-req-res-worker-socket.js +0 -72
- package/src/lib/motion-master-req-res-worker-socket.js.map +0 -1
- package/src/lib/operators.d.ts +0 -20
- package/src/lib/operators.js +0 -84
- package/src/lib/operators.js.map +0 -1
- package/src/lib/options.d.ts +0 -10
- package/src/lib/options.js +0 -14
- package/src/lib/options.js.map +0 -1
- package/src/lib/parameter.d.ts +0 -72
- package/src/lib/parameter.js +0 -119
- package/src/lib/parameter.js.map +0 -1
- package/src/lib/product-id-range.d.ts +0 -7
- package/src/lib/product-id-range.js +0 -12
- package/src/lib/product-id-range.js.map +0 -1
- package/src/lib/request-status-resolver.d.ts +0 -4
- package/src/lib/request-status-resolver.js +0 -345
- package/src/lib/request-status-resolver.js.map +0 -1
- package/src/lib/system-log-line.d.ts +0 -9
- package/src/lib/system-log-line.js +0 -3
- package/src/lib/system-log-line.js.map +0 -1
- package/src/lib/types.js +0 -29
- package/src/lib/types.js.map +0 -1
- package/src/lib/urls.d.ts +0 -3
- package/src/lib/urls.js +0 -10
- package/src/lib/urls.js.map +0 -1
- package/src/lib/util.d.ts +0 -42
- package/src/lib/util.js +0 -327
- package/src/lib/util.js.map +0 -1
- package/src/lib/web-socket-connection-close-codes.d.ts +0 -8
- package/src/lib/web-socket-connection-close-codes.js +0 -89
- package/src/lib/web-socket-connection-close-codes.js.map +0 -1
package/.babelrc
ADDED
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["../../.eslintrc.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
+
"rules": {}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.js", "*.jsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/README.md
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
# Motion Master Client
|
|
2
|
-
|
|
3
|
-
Motion Master Client is a library and CLI program written in [TypeScript](https://www.typescriptlang.org). It is used for communicating with Motion Master process over [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) connections by exchanging [Protocol Buffers](https://developers.google.com/protocol-buffers) serialized messages.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install motion-master-client
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
const reqResSocket = new MotionMasterReqResWebSocket();
|
|
15
|
-
const pubSubSocket = new MotionMasterPubSubWebSocket();
|
|
16
|
-
|
|
17
|
-
const client = new MotionMasterClient(reqResSocket, pubSubSocket);
|
|
18
|
-
|
|
19
|
-
const clientId = v4();
|
|
20
|
-
reqResSocket.open(`ws://oblac-drives-7dc95497.local:63524?clientId=${clientId}`);
|
|
21
|
-
pubSubSocket.open(`ws://oblac-drives-7dc95497.local:63525?clientId=${clientId}`);
|
|
22
|
-
|
|
23
|
-
client.request.getDeviceInfo().subscribe(console.log);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Class Diagrams
|
|
27
|
-
|
|
28
|
-
```mermaid
|
|
29
|
-
---
|
|
30
|
-
title: Client & socket classes
|
|
31
|
-
---
|
|
32
|
-
classDiagram
|
|
33
|
-
class MotionMasterClient {
|
|
34
|
-
+MotionMasterReqResClient request
|
|
35
|
-
+MotionMasterPubSubClient monitor
|
|
36
|
-
+startMonitoring()
|
|
37
|
-
+stopMonitoring()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
class MotionMasterReqResClient {
|
|
41
|
-
+MotionMasterReqResSocket socket
|
|
42
|
-
note "Has all the request methods\ncorresponding to the proto file."
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
class MotionMasterReqResSocket
|
|
46
|
-
<<interface>> MotionMasterReqResSocket
|
|
47
|
-
MotionMasterReqResSocket: +BehaviorSubject~boolean~ opened\$
|
|
48
|
-
MotionMasterReqResSocket: +BehaviorSubject~boolean~ alive\$
|
|
49
|
-
MotionMasterReqResSocket: +Observable~MotionMasterMessage~ message\$
|
|
50
|
-
MotionMasterReqResSocket: +open(string url, number pingSystemInterval?, number systemAliveTimeout?)
|
|
51
|
-
MotionMasterReqResSocket: +close()
|
|
52
|
-
MotionMasterReqResSocket: +send(MotionMasterMessage message)
|
|
53
|
-
|
|
54
|
-
class MotionMasterReqResWebSocket {
|
|
55
|
-
note "Keeps the connection alive by\nsending the ping system messages\nin regular intervals."
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class MotionMasterReqResWorkerSocket {
|
|
59
|
-
+Worker worker
|
|
60
|
-
note "Passes messages between\nthe UI and worker thread."
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
class MotionMasterPubSubClient {
|
|
64
|
-
+MotionMasterPubSubSocket socket
|
|
65
|
-
+Subject<[string, MotionMasterMessage[]]> data\$
|
|
66
|
-
+Observable~MotionMasterMessage~ notification\$
|
|
67
|
-
+Observable~MotionMasterMessage~ systemEvent\$
|
|
68
|
-
+Observable~MotionMasterMessage~ deviceEvent\$
|
|
69
|
-
+subscribe(MonitoringConfig config)
|
|
70
|
-
+unsubscribe(string messageId)
|
|
71
|
-
+unsubscribeAll()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
class MotionMasterPubSubSocket
|
|
75
|
-
<<interface>> MotionMasterPubSubSocket
|
|
76
|
-
MotionMasterPubSubSocket: +BehaviorSubject~boolean~ opened\$
|
|
77
|
-
MotionMasterPubSubSocket: +Observable<[string, MotionMasterMessage]> data\$
|
|
78
|
-
MotionMasterPubSubSocket: +open(string url)
|
|
79
|
-
MotionMasterPubSubSocket: +close()
|
|
80
|
-
|
|
81
|
-
class MotionMasterPubSubWebSocket {
|
|
82
|
-
note "Deserializes incoming data into\na tuple of topic and message."
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class MotionMasterPubSubWorkerSocket {
|
|
86
|
-
+Worker worker
|
|
87
|
-
note "Passes messages between\nthe UI and worker thread."
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
MotionMasterClient *-- MotionMasterReqResClient
|
|
91
|
-
MotionMasterClient *-- MotionMasterPubSubClient
|
|
92
|
-
|
|
93
|
-
MotionMasterReqResClient *-- MotionMasterReqResSocket
|
|
94
|
-
MotionMasterReqResWebSocket <|-- MotionMasterReqResSocket
|
|
95
|
-
MotionMasterReqResWorkerSocket <|-- MotionMasterReqResSocket
|
|
96
|
-
|
|
97
|
-
MotionMasterPubSubClient *-- MotionMasterPubSubSocket
|
|
98
|
-
MotionMasterPubSubWebSocket <|-- MotionMasterPubSubSocket
|
|
99
|
-
MotionMasterPubSubWorkerSocket <|-- MotionMasterPubSubSocket
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Communication
|
|
103
|
-
|
|
104
|
-
### Protocols
|
|
105
|
-
|
|
106
|
-
### Message Exchange
|
|
107
|
-
|
|
108
|
-
## Running unit tests
|
|
109
|
-
|
|
110
|
-
## Features
|
|
111
|
-
|
|
112
|
-
## Goals
|
|
113
|
-
|
|
114
|
-
Run `nx test motion-master-client` to execute the unit tests via [Jest](https://jestjs.io).
|
|
115
|
-
|
|
116
|
-
https://github.com/protocolbuffers/protobuf/issues/2497#issuecomment-267422550
|
|
117
|
-
|
|
118
|
-
explain status progress completed error
|
|
119
|
-
request timeout
|
|
120
|
-
ping mechanism
|
|
121
|
-
reactive and async api
|
|
122
|
-
two sockets
|
|
123
|
-
matching request id (message id with response)
|
|
1
|
+
# Motion Master Client
|
|
2
|
+
|
|
3
|
+
Motion Master Client is a library and CLI program written in [TypeScript](https://www.typescriptlang.org). It is used for communicating with Motion Master process over [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) connections by exchanging [Protocol Buffers](https://developers.google.com/protocol-buffers) serialized messages.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install motion-master-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const reqResSocket = new MotionMasterReqResWebSocket();
|
|
15
|
+
const pubSubSocket = new MotionMasterPubSubWebSocket();
|
|
16
|
+
|
|
17
|
+
const client = new MotionMasterClient(reqResSocket, pubSubSocket);
|
|
18
|
+
|
|
19
|
+
const clientId = v4();
|
|
20
|
+
reqResSocket.open(`ws://oblac-drives-7dc95497.local:63524?clientId=${clientId}`);
|
|
21
|
+
pubSubSocket.open(`ws://oblac-drives-7dc95497.local:63525?clientId=${clientId}`);
|
|
22
|
+
|
|
23
|
+
client.request.getDeviceInfo().subscribe(console.log);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Class Diagrams
|
|
27
|
+
|
|
28
|
+
```mermaid
|
|
29
|
+
---
|
|
30
|
+
title: Client & socket classes
|
|
31
|
+
---
|
|
32
|
+
classDiagram
|
|
33
|
+
class MotionMasterClient {
|
|
34
|
+
+MotionMasterReqResClient request
|
|
35
|
+
+MotionMasterPubSubClient monitor
|
|
36
|
+
+startMonitoring()
|
|
37
|
+
+stopMonitoring()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class MotionMasterReqResClient {
|
|
41
|
+
+MotionMasterReqResSocket socket
|
|
42
|
+
note "Has all the request methods\ncorresponding to the proto file."
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class MotionMasterReqResSocket
|
|
46
|
+
<<interface>> MotionMasterReqResSocket
|
|
47
|
+
MotionMasterReqResSocket: +BehaviorSubject~boolean~ opened\$
|
|
48
|
+
MotionMasterReqResSocket: +BehaviorSubject~boolean~ alive\$
|
|
49
|
+
MotionMasterReqResSocket: +Observable~MotionMasterMessage~ message\$
|
|
50
|
+
MotionMasterReqResSocket: +open(string url, number pingSystemInterval?, number systemAliveTimeout?)
|
|
51
|
+
MotionMasterReqResSocket: +close()
|
|
52
|
+
MotionMasterReqResSocket: +send(MotionMasterMessage message)
|
|
53
|
+
|
|
54
|
+
class MotionMasterReqResWebSocket {
|
|
55
|
+
note "Keeps the connection alive by\nsending the ping system messages\nin regular intervals."
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class MotionMasterReqResWorkerSocket {
|
|
59
|
+
+Worker worker
|
|
60
|
+
note "Passes messages between\nthe UI and worker thread."
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class MotionMasterPubSubClient {
|
|
64
|
+
+MotionMasterPubSubSocket socket
|
|
65
|
+
+Subject<[string, MotionMasterMessage[]]> data\$
|
|
66
|
+
+Observable~MotionMasterMessage~ notification\$
|
|
67
|
+
+Observable~MotionMasterMessage~ systemEvent\$
|
|
68
|
+
+Observable~MotionMasterMessage~ deviceEvent\$
|
|
69
|
+
+subscribe(MonitoringConfig config)
|
|
70
|
+
+unsubscribe(string messageId)
|
|
71
|
+
+unsubscribeAll()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class MotionMasterPubSubSocket
|
|
75
|
+
<<interface>> MotionMasterPubSubSocket
|
|
76
|
+
MotionMasterPubSubSocket: +BehaviorSubject~boolean~ opened\$
|
|
77
|
+
MotionMasterPubSubSocket: +Observable<[string, MotionMasterMessage]> data\$
|
|
78
|
+
MotionMasterPubSubSocket: +open(string url)
|
|
79
|
+
MotionMasterPubSubSocket: +close()
|
|
80
|
+
|
|
81
|
+
class MotionMasterPubSubWebSocket {
|
|
82
|
+
note "Deserializes incoming data into\na tuple of topic and message."
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class MotionMasterPubSubWorkerSocket {
|
|
86
|
+
+Worker worker
|
|
87
|
+
note "Passes messages between\nthe UI and worker thread."
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
MotionMasterClient *-- MotionMasterReqResClient
|
|
91
|
+
MotionMasterClient *-- MotionMasterPubSubClient
|
|
92
|
+
|
|
93
|
+
MotionMasterReqResClient *-- MotionMasterReqResSocket
|
|
94
|
+
MotionMasterReqResWebSocket <|-- MotionMasterReqResSocket
|
|
95
|
+
MotionMasterReqResWorkerSocket <|-- MotionMasterReqResSocket
|
|
96
|
+
|
|
97
|
+
MotionMasterPubSubClient *-- MotionMasterPubSubSocket
|
|
98
|
+
MotionMasterPubSubWebSocket <|-- MotionMasterPubSubSocket
|
|
99
|
+
MotionMasterPubSubWorkerSocket <|-- MotionMasterPubSubSocket
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Communication
|
|
103
|
+
|
|
104
|
+
### Protocols
|
|
105
|
+
|
|
106
|
+
### Message Exchange
|
|
107
|
+
|
|
108
|
+
## Running unit tests
|
|
109
|
+
|
|
110
|
+
## Features
|
|
111
|
+
|
|
112
|
+
## Goals
|
|
113
|
+
|
|
114
|
+
Run `nx test motion-master-client` to execute the unit tests via [Jest](https://jestjs.io).
|
|
115
|
+
|
|
116
|
+
https://github.com/protocolbuffers/protobuf/issues/2497#issuecomment-267422550
|
|
117
|
+
|
|
118
|
+
explain status progress completed error
|
|
119
|
+
request timeout
|
|
120
|
+
ping mechanism
|
|
121
|
+
reactive and async api
|
|
122
|
+
two sockets
|
|
123
|
+
matching request id (message id with response)
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: 'motion-master-client',
|
|
4
|
+
preset: '../../jest.preset.js',
|
|
5
|
+
globals: {},
|
|
6
|
+
transform: {
|
|
7
|
+
'^.+\\.[tj]sx?$': [
|
|
8
|
+
'ts-jest',
|
|
9
|
+
{
|
|
10
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
15
|
+
coverageDirectory: '../../coverage/libs/motion-master-client',
|
|
16
|
+
};
|