motion-master-client 0.0.3 → 0.0.6

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.
Files changed (118) hide show
  1. package/README.md +123 -49
  2. package/package.json +21 -6
  3. package/src/{index.ts → index.d.ts} +23 -22
  4. package/src/index.js +27 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/cia402.d.ts +30 -0
  7. package/src/lib/cia402.js +112 -0
  8. package/src/lib/cia402.js.map +1 -0
  9. package/src/lib/device-log-line.d.ts +5 -0
  10. package/src/lib/device-log-line.js +3 -0
  11. package/src/lib/device-log-line.js.map +1 -0
  12. package/src/lib/{device-parameter.ts → device-parameter.d.ts} +56 -69
  13. package/src/lib/device-parameter.js +39 -0
  14. package/src/lib/device-parameter.js.map +1 -0
  15. package/src/lib/device.d.ts +8 -0
  16. package/src/lib/device.js +3 -0
  17. package/src/lib/device.js.map +1 -0
  18. package/src/lib/examples/get-firmware-version-for-all-devices.d.ts +1 -0
  19. package/src/lib/examples/get-firmware-version-for-all-devices.js +15 -0
  20. package/src/lib/examples/get-firmware-version-for-all-devices.js.map +1 -0
  21. package/src/lib/hardware-description.d.ts +37 -0
  22. package/src/lib/hardware-description.js +48 -0
  23. package/src/lib/hardware-description.js.map +1 -0
  24. package/src/lib/logger.d.ts +1 -0
  25. package/src/lib/logger.js +8 -0
  26. package/src/lib/logger.js.map +1 -0
  27. package/src/lib/monitoring-config.d.ts +6 -0
  28. package/src/lib/monitoring-config.js +3 -0
  29. package/src/lib/monitoring-config.js.map +1 -0
  30. package/src/lib/monitoring-entry.d.ts +9 -0
  31. package/src/lib/monitoring-entry.js +3 -0
  32. package/src/lib/monitoring-entry.js.map +1 -0
  33. package/src/lib/motion-master-client.d.ts +18 -0
  34. package/src/lib/motion-master-client.js +73 -0
  35. package/src/lib/motion-master-client.js.map +1 -0
  36. package/src/lib/motion-master-pub-sub-client.d.ts +16 -0
  37. package/src/lib/motion-master-pub-sub-client.js +68 -0
  38. package/src/lib/motion-master-pub-sub-client.js.map +1 -0
  39. package/src/lib/motion-master-pub-sub-socket.d.ts +28 -0
  40. package/src/lib/motion-master-pub-sub-socket.js +3 -0
  41. package/src/lib/motion-master-pub-sub-socket.js.map +1 -0
  42. package/src/lib/motion-master-pub-sub-web-socket.d.ts +13 -0
  43. package/src/lib/motion-master-pub-sub-web-socket.js +61 -0
  44. package/src/lib/motion-master-pub-sub-web-socket.js.map +1 -0
  45. package/src/lib/motion-master-pub-sub-worker-socket.d.ts +13 -0
  46. package/src/lib/motion-master-pub-sub-worker-socket.js +37 -0
  47. package/src/lib/motion-master-pub-sub-worker-socket.js.map +1 -0
  48. package/src/lib/motion-master-req-res-client.d.ts +956 -0
  49. package/src/lib/motion-master-req-res-client.js +1521 -0
  50. package/src/lib/motion-master-req-res-client.js.map +1 -0
  51. package/src/lib/motion-master-req-res-socket.d.ts +38 -0
  52. package/src/lib/motion-master-req-res-socket.js +3 -0
  53. package/src/lib/motion-master-req-res-socket.js.map +1 -0
  54. package/src/lib/motion-master-req-res-web-socket.d.ts +20 -0
  55. package/src/lib/motion-master-req-res-web-socket.js +100 -0
  56. package/src/lib/motion-master-req-res-web-socket.js.map +1 -0
  57. package/src/lib/motion-master-req-res-worker-socket.d.ts +15 -0
  58. package/src/lib/motion-master-req-res-worker-socket.js +53 -0
  59. package/src/lib/motion-master-req-res-worker-socket.js.map +1 -0
  60. package/src/lib/motion-master.proto.js +5 -3
  61. package/src/lib/operators.d.ts +21 -0
  62. package/src/lib/operators.js +71 -0
  63. package/src/lib/operators.js.map +1 -0
  64. package/src/lib/options.d.ts +34 -0
  65. package/src/lib/options.js +38 -0
  66. package/src/lib/options.js.map +1 -0
  67. package/src/lib/parameter.d.ts +65 -0
  68. package/src/lib/parameter.js +70 -0
  69. package/src/lib/parameter.js.map +1 -0
  70. package/src/lib/request-status-resolver.d.ts +4 -0
  71. package/src/lib/request-status-resolver.js +345 -0
  72. package/src/lib/request-status-resolver.js.map +1 -0
  73. package/src/lib/system-log-line.d.ts +8 -0
  74. package/src/lib/system-log-line.js +3 -0
  75. package/src/lib/system-log-line.js.map +1 -0
  76. package/src/lib/types.d.ts +50 -0
  77. package/src/lib/types.js +23 -0
  78. package/src/lib/types.js.map +1 -0
  79. package/src/lib/urls.d.ts +3 -0
  80. package/src/lib/urls.js +10 -0
  81. package/src/lib/urls.js.map +1 -0
  82. package/src/lib/util.d.ts +30 -0
  83. package/src/lib/util.js +279 -0
  84. package/src/lib/util.js.map +1 -0
  85. package/.babelrc +0 -3
  86. package/.eslintrc.json +0 -18
  87. package/jest.config.ts +0 -15
  88. package/motion-master.proto +0 -1822
  89. package/src/lib/device-log-line.ts +0 -5
  90. package/src/lib/device-parameter.spec.ts +0 -85
  91. package/src/lib/hardware-description.spec.ts +0 -223
  92. package/src/lib/hardware-description.ts +0 -79
  93. package/src/lib/logger.ts +0 -5
  94. package/src/lib/monitoring-config.ts +0 -6
  95. package/src/lib/monitoring-entry.ts +0 -11
  96. package/src/lib/motion-master-client.ts +0 -94
  97. package/src/lib/motion-master-pub-sub-client.ts +0 -94
  98. package/src/lib/motion-master-pub-sub-socket.ts +0 -33
  99. package/src/lib/motion-master-pub-sub-web-socket.ts +0 -71
  100. package/src/lib/motion-master-pub-sub-worker-socket.ts +0 -58
  101. package/src/lib/motion-master-req-res-client.spec.ts +0 -126
  102. package/src/lib/motion-master-req-res-client.ts +0 -1990
  103. package/src/lib/motion-master-req-res-socket.ts +0 -45
  104. package/src/lib/motion-master-req-res-web-socket.ts +0 -119
  105. package/src/lib/motion-master-req-res-worker-socket.ts +0 -63
  106. package/src/lib/operators.ts +0 -93
  107. package/src/lib/options.ts +0 -12
  108. package/src/lib/parameter.spec.ts +0 -81
  109. package/src/lib/parameter.ts +0 -119
  110. package/src/lib/request-status-resolver.ts +0 -380
  111. package/src/lib/system-log-line.ts +0 -8
  112. package/src/lib/types.ts +0 -58
  113. package/src/lib/urls.ts +0 -6
  114. package/src/lib/util.ts +0 -261
  115. package/tsconfig.json +0 -22
  116. package/tsconfig.lib.json +0 -10
  117. package/tsconfig.spec.json +0 -20
  118. package/typedoc.json +0 -10
package/README.md CHANGED
@@ -1,49 +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
- ## Communication
27
-
28
- ### Protocols
29
-
30
- ### Message Exchange
31
-
32
- ## Running unit tests
33
-
34
- ## Features
35
-
36
- ## Goals
37
-
38
- Run `nx test motion-master-client` to execute the unit tests via [Jest](https://jestjs.io).
39
-
40
- https://github.com/protocolbuffers/protobuf/issues/2497#issuecomment-267422550
41
-
42
- class diagram
43
-
44
- explain status progress completed error
45
- request timeout
46
- ping mechanism
47
- reactive and async api
48
- two sockets
49
- 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/package.json CHANGED
@@ -1,6 +1,21 @@
1
- {
2
- "name": "motion-master-client",
3
- "version": "0.0.3",
4
- "type": "module",
5
- "description": "A library and CLI program used for communicating with Motion Master."
6
- }
1
+ {
2
+ "name": "motion-master-client",
3
+ "version": "0.0.6",
4
+ "type": "commonjs",
5
+ "description": "A library and CLI program used for communicating with Motion Master.",
6
+ "dependencies": {
7
+ "fast-deep-equal": "^3.1.3",
8
+ "lodash": "^4.17.21",
9
+ "long": "5.2.1",
10
+ "protobufjs": "^7.1.2",
11
+ "roarr": "^7.14.1",
12
+ "rxjs": "~7.5.0",
13
+ "uuid": "^9.0.0",
14
+ "ws": "^8.12.1"
15
+ },
16
+ "peerDependencies": {
17
+ "tslib": "^2.4.0"
18
+ },
19
+ "main": "./src/index.js",
20
+ "types": "./src/index.d.ts"
21
+ }
@@ -1,22 +1,23 @@
1
- export * from './lib/device-log-line';
2
- export * from './lib/device-parameter';
3
- export * from './lib/hardware-description';
4
- export * from './lib/monitoring-config';
5
- export * from './lib/monitoring-entry';
6
- export * from './lib/motion-master-client';
7
- export * from './lib/motion-master-pub-sub-client';
8
- export * from './lib/motion-master-pub-sub-socket';
9
- export * from './lib/motion-master-pub-sub-web-socket';
10
- export * from './lib/motion-master-pub-sub-worker-socket';
11
- export * from './lib/motion-master-req-res-client';
12
- export * from './lib/motion-master-req-res-socket';
13
- export * from './lib/motion-master-req-res-web-socket';
14
- export * from './lib/motion-master-req-res-worker-socket';
15
- export * from './lib/operators';
16
- export * from './lib/options';
17
- export * from './lib/parameter';
18
- export * from './lib/request-status-resolver';
19
- export * from './lib/system-log-line';
20
- export * from './lib/types';
21
- export * from './lib/urls';
22
- export * from './lib/util';
1
+ export * from './lib/cia402';
2
+ export * from './lib/device-log-line';
3
+ export * from './lib/device-parameter';
4
+ export * from './lib/hardware-description';
5
+ export * from './lib/monitoring-config';
6
+ export * from './lib/monitoring-entry';
7
+ export * from './lib/motion-master-client';
8
+ export * from './lib/motion-master-pub-sub-client';
9
+ export * from './lib/motion-master-pub-sub-socket';
10
+ export * from './lib/motion-master-pub-sub-web-socket';
11
+ export * from './lib/motion-master-pub-sub-worker-socket';
12
+ export * from './lib/motion-master-req-res-client';
13
+ export * from './lib/motion-master-req-res-socket';
14
+ export * from './lib/motion-master-req-res-web-socket';
15
+ export * from './lib/motion-master-req-res-worker-socket';
16
+ export * from './lib/operators';
17
+ export * from './lib/options';
18
+ export * from './lib/parameter';
19
+ export * from './lib/request-status-resolver';
20
+ export * from './lib/system-log-line';
21
+ export * from './lib/types';
22
+ export * from './lib/urls';
23
+ export * from './lib/util';
package/src/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/cia402"), exports);
5
+ tslib_1.__exportStar(require("./lib/device-log-line"), exports);
6
+ tslib_1.__exportStar(require("./lib/device-parameter"), exports);
7
+ tslib_1.__exportStar(require("./lib/hardware-description"), exports);
8
+ tslib_1.__exportStar(require("./lib/monitoring-config"), exports);
9
+ tslib_1.__exportStar(require("./lib/monitoring-entry"), exports);
10
+ tslib_1.__exportStar(require("./lib/motion-master-client"), exports);
11
+ tslib_1.__exportStar(require("./lib/motion-master-pub-sub-client"), exports);
12
+ tslib_1.__exportStar(require("./lib/motion-master-pub-sub-socket"), exports);
13
+ tslib_1.__exportStar(require("./lib/motion-master-pub-sub-web-socket"), exports);
14
+ tslib_1.__exportStar(require("./lib/motion-master-pub-sub-worker-socket"), exports);
15
+ tslib_1.__exportStar(require("./lib/motion-master-req-res-client"), exports);
16
+ tslib_1.__exportStar(require("./lib/motion-master-req-res-socket"), exports);
17
+ tslib_1.__exportStar(require("./lib/motion-master-req-res-web-socket"), exports);
18
+ tslib_1.__exportStar(require("./lib/motion-master-req-res-worker-socket"), exports);
19
+ tslib_1.__exportStar(require("./lib/operators"), exports);
20
+ tslib_1.__exportStar(require("./lib/options"), exports);
21
+ tslib_1.__exportStar(require("./lib/parameter"), exports);
22
+ tslib_1.__exportStar(require("./lib/request-status-resolver"), exports);
23
+ tslib_1.__exportStar(require("./lib/system-log-line"), exports);
24
+ tslib_1.__exportStar(require("./lib/types"), exports);
25
+ tslib_1.__exportStar(require("./lib/urls"), exports);
26
+ tslib_1.__exportStar(require("./lib/util"), exports);
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,gEAAsC;AACtC,iEAAuC;AACvC,qEAA2C;AAC3C,kEAAwC;AACxC,iEAAuC;AACvC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,0DAAgC;AAChC,wDAA8B;AAC9B,0DAAgC;AAChC,wEAA8C;AAC9C,gEAAsC;AACtC,sDAA4B;AAC5B,qDAA2B;AAC3B,qDAA2B"}
@@ -0,0 +1,30 @@
1
+ export declare enum CiA402State {
2
+ NOT_READY_TO_SWITCH_ON = 0,
3
+ SWITCH_ON_DISABLED = 1,
4
+ READY_TO_SWITCH_ON = 2,
5
+ SWITCHED_ON = 3,
6
+ OPERATION_ENABLED = 4,
7
+ QUICK_STOP_ACTIVE = 5,
8
+ FAULT_REACTION_ACTIVE = 6,
9
+ FAULT = 7
10
+ }
11
+ export declare const cia402StateLabels: string[];
12
+ export declare const statuswordToCia402StateMap: Map<number, CiA402State>;
13
+ export declare function getCia402StateFromStatusword(statusword: number): CiA402State | undefined;
14
+ export declare function isInternalLimitActive(statusword: number): boolean;
15
+ export declare enum ModesOfOperation {
16
+ OPEN_LOOP_FIELD_MODE = -3,
17
+ DIAGNOSTICS_MODE = -2,
18
+ COGGING_COMPENSATION_RECORDING_MODE = -1,
19
+ NO_MODE_ASSIGNED = 0,
20
+ PROFILE_POSITION_MODE = 1,
21
+ PROFILE_VELOCITY_MODE = 3,
22
+ TORQUE_PROFILE_MODE = 4,
23
+ HOMING_MODE = 6,
24
+ CYCLIC_SYNC_POSITION_MODE = 8,
25
+ CYCLIC_SYNC_VELOCITY_MODE = 9,
26
+ CYCLIC_SYNC_TORQUE_MODE = 10
27
+ }
28
+ export declare const controlwordBits: string[];
29
+ export declare const statuswordBits: string[];
30
+ export declare const supportedDriveModesBits: string[];
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportedDriveModesBits = exports.statuswordBits = exports.controlwordBits = exports.ModesOfOperation = exports.isInternalLimitActive = exports.getCia402StateFromStatusword = exports.statuswordToCia402StateMap = exports.cia402StateLabels = exports.CiA402State = void 0;
4
+ var CiA402State;
5
+ (function (CiA402State) {
6
+ CiA402State[CiA402State["NOT_READY_TO_SWITCH_ON"] = 0] = "NOT_READY_TO_SWITCH_ON";
7
+ CiA402State[CiA402State["SWITCH_ON_DISABLED"] = 1] = "SWITCH_ON_DISABLED";
8
+ CiA402State[CiA402State["READY_TO_SWITCH_ON"] = 2] = "READY_TO_SWITCH_ON";
9
+ CiA402State[CiA402State["SWITCHED_ON"] = 3] = "SWITCHED_ON";
10
+ CiA402State[CiA402State["OPERATION_ENABLED"] = 4] = "OPERATION_ENABLED";
11
+ CiA402State[CiA402State["QUICK_STOP_ACTIVE"] = 5] = "QUICK_STOP_ACTIVE";
12
+ CiA402State[CiA402State["FAULT_REACTION_ACTIVE"] = 6] = "FAULT_REACTION_ACTIVE";
13
+ CiA402State[CiA402State["FAULT"] = 7] = "FAULT";
14
+ })(CiA402State = exports.CiA402State || (exports.CiA402State = {}));
15
+ exports.cia402StateLabels = [
16
+ 'NOT READY TO SWITCH ON',
17
+ 'SWITCH ON DISABLED',
18
+ 'READY TO SWITCH ON',
19
+ 'SWITCHED ON',
20
+ 'OPERATION ENABLED',
21
+ 'QUICK STOP ACTIVE',
22
+ 'FAULT REACTION ACTIVE',
23
+ 'FAULT',
24
+ ];
25
+ exports.statuswordToCia402StateMap = new Map([
26
+ [0b00000000, CiA402State.NOT_READY_TO_SWITCH_ON],
27
+ [0b01000000, CiA402State.SWITCH_ON_DISABLED],
28
+ [0b00100001, CiA402State.READY_TO_SWITCH_ON],
29
+ [0b00100011, CiA402State.SWITCHED_ON],
30
+ [0b00100111, CiA402State.OPERATION_ENABLED],
31
+ [0b00000111, CiA402State.QUICK_STOP_ACTIVE],
32
+ [0b00001111, CiA402State.FAULT_REACTION_ACTIVE],
33
+ [0b00001000, CiA402State.FAULT],
34
+ ]);
35
+ function getCia402StateFromStatusword(statusword) {
36
+ return exports.statuswordToCia402StateMap.get(statusword & 0b01101111)
37
+ || exports.statuswordToCia402StateMap.get(statusword & 0b01001111);
38
+ }
39
+ exports.getCia402StateFromStatusword = getCia402StateFromStatusword;
40
+ function isInternalLimitActive(statusword) {
41
+ return (0x800 & statusword) === 0x800;
42
+ }
43
+ exports.isInternalLimitActive = isInternalLimitActive;
44
+ var ModesOfOperation;
45
+ (function (ModesOfOperation) {
46
+ ModesOfOperation[ModesOfOperation["OPEN_LOOP_FIELD_MODE"] = -3] = "OPEN_LOOP_FIELD_MODE";
47
+ ModesOfOperation[ModesOfOperation["DIAGNOSTICS_MODE"] = -2] = "DIAGNOSTICS_MODE";
48
+ ModesOfOperation[ModesOfOperation["COGGING_COMPENSATION_RECORDING_MODE"] = -1] = "COGGING_COMPENSATION_RECORDING_MODE";
49
+ ModesOfOperation[ModesOfOperation["NO_MODE_ASSIGNED"] = 0] = "NO_MODE_ASSIGNED";
50
+ ModesOfOperation[ModesOfOperation["PROFILE_POSITION_MODE"] = 1] = "PROFILE_POSITION_MODE";
51
+ ModesOfOperation[ModesOfOperation["PROFILE_VELOCITY_MODE"] = 3] = "PROFILE_VELOCITY_MODE";
52
+ ModesOfOperation[ModesOfOperation["TORQUE_PROFILE_MODE"] = 4] = "TORQUE_PROFILE_MODE";
53
+ ModesOfOperation[ModesOfOperation["HOMING_MODE"] = 6] = "HOMING_MODE";
54
+ ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_POSITION_MODE"] = 8] = "CYCLIC_SYNC_POSITION_MODE";
55
+ ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_VELOCITY_MODE"] = 9] = "CYCLIC_SYNC_VELOCITY_MODE";
56
+ ModesOfOperation[ModesOfOperation["CYCLIC_SYNC_TORQUE_MODE"] = 10] = "CYCLIC_SYNC_TORQUE_MODE";
57
+ })(ModesOfOperation = exports.ModesOfOperation || (exports.ModesOfOperation = {}));
58
+ exports.controlwordBits = [
59
+ 'so = switch on',
60
+ 'ev = enable voltage',
61
+ 'qs = quick stop',
62
+ 'eo = enable operation',
63
+ 'oms = operation mode specific',
64
+ 'oms = operation mode specific',
65
+ 'oms = operation mode specific',
66
+ 'fr = fault reset',
67
+ 'h = halt',
68
+ 'oms = operation mode specific',
69
+ 'r = reserved',
70
+ 'ms = manufacturer-specific',
71
+ 'ms = manufacturer-specific',
72
+ 'ms = manufacturer-specific',
73
+ 'ms = manufacturer-specific',
74
+ 'ms = manufacturer-specific',
75
+ ];
76
+ exports.statuswordBits = [
77
+ 'rtso = ready to switch on',
78
+ 'so = switched on',
79
+ 'oe = operation enabled',
80
+ 'f = fault',
81
+ 've = voltage enabled',
82
+ 'qs = quick stop',
83
+ 'sod = switch on disabled',
84
+ 'w = warning',
85
+ 'ms = manufacturer-specific',
86
+ 'rm = remote',
87
+ 'tr = target reached',
88
+ 'ila = internal limit active',
89
+ 'oms = operation-mode-specific',
90
+ 'oms = operation-mode-specific',
91
+ 'ms = manufacturer-specific',
92
+ 'ms = manufacturer-specific',
93
+ ];
94
+ exports.supportedDriveModesBits = [
95
+ 'pp = profile position mode',
96
+ 'vl = velocity mode',
97
+ 'pv = profile velocity mode',
98
+ 'tq = torque mode',
99
+ 'r = reserved',
100
+ 'hm = homing mode',
101
+ 'ip = interpolated position mode',
102
+ 'csp = cyclic synchronous position mode',
103
+ 'csv = cyclic synchronous velocity mode',
104
+ 'cst = cyclic synchronous torque mode',
105
+ 'r = reserved',
106
+ 'r = reserved',
107
+ 'r = reserved',
108
+ 'r = reserved',
109
+ 'r = reserved',
110
+ 'r = reserved',
111
+ ];
112
+ //# sourceMappingURL=cia402.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cia402.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/cia402.ts"],"names":[],"mappings":";;;AAAA,IAAY,WASX;AATD,WAAY,WAAW;IACrB,iFAAsB,CAAA;IACtB,yEAAkB,CAAA;IAClB,yEAAkB,CAAA;IAClB,2DAAW,CAAA;IACX,uEAAiB,CAAA;IACjB,uEAAiB,CAAA;IACjB,+EAAqB,CAAA;IACrB,+CAAK,CAAA;AACP,CAAC,EATW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAStB;AAEY,QAAA,iBAAiB,GAAG;IAC/B,wBAAwB;IACxB,oBAAoB;IACpB,oBAAoB;IACpB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,uBAAuB;IACvB,OAAO;CACR,CAAC;AAEW,QAAA,0BAA0B,GAAG,IAAI,GAAG,CAAC;IAChD,CAAC,UAAU,EAAE,WAAW,CAAC,sBAAsB,CAAC;IAChD,CAAC,UAAU,EAAE,WAAW,CAAC,kBAAkB,CAAC;IAC5C,CAAC,UAAU,EAAE,WAAW,CAAC,kBAAkB,CAAC;IAC5C,CAAC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC;IACrC,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAC3C,CAAC,UAAU,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAC3C,CAAC,UAAU,EAAE,WAAW,CAAC,qBAAqB,CAAC;IAC/C,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC;CAChC,CAAC,CAAC;AAEH,SAAgB,4BAA4B,CAAC,UAAkB;IAC7D,OAAO,kCAA0B,CAAC,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;WACzD,kCAA0B,CAAC,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC;AAC/D,CAAC;AAHD,oEAGC;AAED,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,KAAK,CAAC;AACxC,CAAC;AAFD,sDAEC;AAED,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,wFAAyB,CAAA;IACzB,gFAAqB,CAAA;IACrB,sHAAwC,CAAA;IACxC,+EAAoB,CAAA;IACpB,yFAAyB,CAAA;IACzB,yFAAyB,CAAA;IACzB,qFAAuB,CAAA;IACvB,qEAAe,CAAA;IACf,iGAA6B,CAAA;IAC7B,iGAA6B,CAAA;IAC7B,8FAA4B,CAAA;AAC9B,CAAC,EAZW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAY3B;AAEY,QAAA,eAAe,GAAG;IAC7B,gBAAgB;IAChB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,kBAAkB;IAClB,UAAU;IACV,+BAA+B;IAC/B,cAAc;IACd,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,2BAA2B;IAC3B,kBAAkB;IAClB,wBAAwB;IACxB,WAAW;IACX,sBAAsB;IACtB,iBAAiB;IACjB,0BAA0B;IAC1B,aAAa;IACb,4BAA4B;IAC5B,aAAa;IACb,qBAAqB;IACrB,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,4BAA4B;IAC5B,4BAA4B;CAC7B,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACrC,4BAA4B;IAC5B,oBAAoB;IACpB,4BAA4B;IAC5B,kBAAkB;IAClB,cAAc;IACd,kBAAkB;IAClB,iCAAiC;IACjC,wCAAwC;IACxC,wCAAwC;IACxC,sCAAsC;IACtC,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;CACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface DeviceLogLine {
2
+ time: string;
3
+ level: string;
4
+ message: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=device-log-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-log-line.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device-log-line.ts"],"names":[],"mappings":""}
@@ -1,69 +1,56 @@
1
- import { makeParameterId, Parameter } from "./parameter";
2
-
3
- export interface DeviceParameter extends Parameter {
4
- id: string;
5
- }
6
-
7
- /**
8
- * Make device parameter id by providing a device serial number and tuple of index and subindex.
9
- *
10
- * @param serialNumber - device serial number from the hardware description file
11
- * @param tuple - an array of index and subindex
12
- * @throws {Error} if index or subindex are less than 0
13
- * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
14
- */
15
- export function makeDeviceParameterId(serialNumber: string, tuple: [(number | null | undefined), (number | null | undefined)]): string;
16
-
17
- /**
18
- * Make device parameter id by providing a device serial number and object which has index and subindex properties.
19
- *
20
- * @param serialNumber - device serial number from the hardware description file
21
- * @param parameter - an object with optional index and subindex properties
22
- * @throws {Error} if index or subindex are less than 0
23
- * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
24
- */
25
- export function makeDeviceParameterId(serialNumber: string, parameter: { index?: (number | null), subindex?: (number | null) }): string;
26
-
27
- /**
28
- * Make parameter id by providing a device serial number and index and subindex.
29
- *
30
- * @param serialNumber - device serial number from the hardware description file
31
- * @param index - from 0x0000 to 0xFFFF for objects defined in ESI and >0xFFFF for custom object
32
- * @param subindex - defaults to 0 if not provided
33
- * @throws {Error} if index or subindex are less than 0
34
- * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
35
- */
36
- export function makeDeviceParameterId(serialNumber: string, index?: (number | null), subindex?: (number | null)): string;
37
-
38
- export function makeDeviceParameterId(serialNumber: string, a?: (number | null) | { index?: (number | null), subindex?: (number | null) } | [(number | null | undefined), (number | null | undefined)], b?: (number | null)): string {
39
- const parameterId = makeParameterId(a, b);
40
- return `${parameterId}.${serialNumber}`;
41
- }
42
-
43
- /**
44
- * Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where:
45
- * - 0x2110 is object index in hexadecimal format
46
- * - 1A is subindex in hexadecimal format
47
- * - 8502-03-0001353-2115 is device serial number from hardware description file
48
- */
49
- export const deviceParameterIdRegExp = /^0x([0-9a-fA-F]{4,}):([0-9a-fA-F]{2})\.([\d-]+)$/;
50
-
51
- /**
52
- * Split device parameter id into parts.
53
- *
54
- * @param id - device parameter id like "0x2110:1A.8502-03-0001353-2115"
55
- * @returns tuple of device serial number, index, and subindex
56
- */
57
- export function splitDeviceParameterId(id: string): [string, number, number] {
58
- const match = id.match(deviceParameterIdRegExp);
59
-
60
- if (!match) {
61
- throw new Error(`Device parameter id "${id}" doesn't match the regular expression: ${deviceParameterIdRegExp}`);
62
- }
63
-
64
- return [
65
- match[3], // device serial number
66
- parseInt(match[1], 16), // index
67
- parseInt(match[2], 16), // subindex
68
- ];
69
- }
1
+ import { Parameter } from "./parameter";
2
+ export interface DeviceParameter extends Parameter {
3
+ id: string;
4
+ flags?: {
5
+ access?: 'ro' | 'rw' | 'wo';
6
+ category?: 'm' | 'o' | 'c';
7
+ pdoMapping?: 't' | 'r' | 'tr';
8
+ safetyMapping?: 'si' | 'so' | 'sio' | 'sp';
9
+ };
10
+ }
11
+ /**
12
+ * Make device parameter id by providing a device serial number and tuple of index and subindex.
13
+ *
14
+ * @param serialNumber - device serial number from the hardware description file
15
+ * @param tuple - an array of index and subindex
16
+ * @throws {Error} if index or subindex are less than 0
17
+ * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
18
+ */
19
+ export declare function makeDeviceParameterId(serialNumber: string, tuple: [(number | null | undefined), (number | null | undefined)]): string;
20
+ /**
21
+ * Make device parameter id by providing a device serial number and object which has index and subindex properties.
22
+ *
23
+ * @param serialNumber - device serial number from the hardware description file
24
+ * @param parameter - an object with optional index and subindex properties
25
+ * @throws {Error} if index or subindex are less than 0
26
+ * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
27
+ */
28
+ export declare function makeDeviceParameterId(serialNumber: string, parameter: {
29
+ index?: (number | null);
30
+ subindex?: (number | null);
31
+ }): string;
32
+ /**
33
+ * Make parameter id by providing a device serial number and index and subindex.
34
+ *
35
+ * @param serialNumber - device serial number from the hardware description file
36
+ * @param index - from 0x0000 to 0xFFFF for objects defined in ESI and >0xFFFF for custom object
37
+ * @param subindex - defaults to 0 if not provided
38
+ * @throws {Error} if index or subindex are less than 0
39
+ * @returns combined index and subindex in uppercase hexadecimal format, e.g. "0x60FE:02"
40
+ */
41
+ export declare function makeDeviceParameterId(serialNumber: string, index?: (number | null), subindex?: (number | null)): string;
42
+ /**
43
+ * Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where:
44
+ * - 0x2110 is object index in hexadecimal format
45
+ * - 1A is subindex in hexadecimal format
46
+ * - 8502-03-0001353-2115 is device serial number from hardware description file
47
+ */
48
+ export declare const deviceParameterIdRegExp: RegExp;
49
+ /**
50
+ * Split device parameter id into parts.
51
+ *
52
+ * @param id - device parameter id like "0x2110:1A.8502-03-0001353-2115"
53
+ * @returns tuple of device serial number, index, and subindex
54
+ */
55
+ export declare function splitDeviceParameterId(id: string): [string, number, number];
56
+ export declare function isDeviceParameterId(id: string): boolean;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDeviceParameterId = exports.splitDeviceParameterId = exports.deviceParameterIdRegExp = exports.makeDeviceParameterId = void 0;
4
+ const parameter_1 = require("./parameter");
5
+ function makeDeviceParameterId(serialNumber, a, b) {
6
+ const parameterId = (0, parameter_1.makeParameterId)(a, b);
7
+ return `${parameterId}.${serialNumber}`;
8
+ }
9
+ exports.makeDeviceParameterId = makeDeviceParameterId;
10
+ /**
11
+ * Example of device parameter id is "0x2110:1A.8502-03-0001353-2115" where:
12
+ * - 0x2110 is object index in hexadecimal format
13
+ * - 1A is subindex in hexadecimal format
14
+ * - 8502-03-0001353-2115 is device serial number from hardware description file
15
+ */
16
+ exports.deviceParameterIdRegExp = /^0x([0-9a-fA-F]{4,}):([0-9a-fA-F]{2})\.([\d-]+)$/;
17
+ /**
18
+ * Split device parameter id into parts.
19
+ *
20
+ * @param id - device parameter id like "0x2110:1A.8502-03-0001353-2115"
21
+ * @returns tuple of device serial number, index, and subindex
22
+ */
23
+ function splitDeviceParameterId(id) {
24
+ const match = id.match(exports.deviceParameterIdRegExp);
25
+ if (!match) {
26
+ throw new Error(`Device parameter id "${id}" doesn't match the regular expression: ${exports.deviceParameterIdRegExp}`);
27
+ }
28
+ return [
29
+ match[3],
30
+ parseInt(match[1], 16),
31
+ parseInt(match[2], 16), // subindex
32
+ ];
33
+ }
34
+ exports.splitDeviceParameterId = splitDeviceParameterId;
35
+ function isDeviceParameterId(id) {
36
+ return exports.deviceParameterIdRegExp.test(id);
37
+ }
38
+ exports.isDeviceParameterId = isDeviceParameterId;
39
+ //# sourceMappingURL=device-parameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-parameter.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device-parameter.ts"],"names":[],"mappings":";;;AAAA,2CAAyD;AA2CzD,SAAgB,qBAAqB,CAAC,YAAoB,EAAE,CAA0I,EAAE,CAAmB;IACzN,MAAM,WAAW,GAAG,IAAA,2BAAe,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1C,OAAO,GAAG,WAAW,IAAI,YAAY,EAAE,CAAC;AAC1C,CAAC;AAHD,sDAGC;AAED;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,kDAAkD,CAAC;AAE1F;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,EAAU;IAC/C,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,+BAAuB,CAAC,CAAC;IAEhD,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,2CAA2C,+BAAuB,EAAE,CAAC,CAAC;KACjH;IAED,OAAO;QACL,KAAK,CAAC,CAAC,CAAC;QACR,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,WAAW;KACpC,CAAC;AACJ,CAAC;AAZD,wDAYC;AAED,SAAgB,mBAAmB,CAAC,EAAU;IAC5C,OAAO,+BAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAFD,kDAEC"}
@@ -0,0 +1,8 @@
1
+ import { HardwareDescription } from "./hardware-description";
2
+ export interface Device {
3
+ deviceAddress: number;
4
+ type?: number;
5
+ position?: number;
6
+ alias?: number;
7
+ hardwareDescription?: HardwareDescription;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/device.ts"],"names":[],"mappings":""}