@adcops/autocore-react 3.1.1 → 3.3.5
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/additional-docs/react_performance_notes.md +94 -0
- package/dist/components/AutoCoreDevPanel.d.ts.map +1 -1
- package/dist/components/AutoCoreDevPanel.js +1 -1
- package/dist/components/FileList.d.ts.map +1 -1
- package/dist/components/FileList.js +1 -1
- package/dist/components/FileSelect.d.ts.map +1 -1
- package/dist/components/FileSelect.js +1 -1
- package/dist/core/AutoCoreTagContext.d.ts +59 -185
- package/dist/core/AutoCoreTagContext.d.ts.map +1 -1
- package/dist/core/AutoCoreTagContext.js +1 -1
- package/dist/core/AutoCoreTagTypes.d.ts +127 -6
- package/dist/core/AutoCoreTagTypes.d.ts.map +1 -1
- package/dist/core/CoreStreamTypes.d.ts +345 -0
- package/dist/core/CoreStreamTypes.d.ts.map +1 -0
- package/dist/core/CoreStreamTypes.js +1 -0
- package/dist/core/EventEmitterContext.d.ts +91 -473
- package/dist/core/EventEmitterContext.d.ts.map +1 -1
- package/dist/core/EventEmitterContext.js +1 -1
- package/dist/hooks/adsHooks.d.ts.map +1 -1
- package/dist/hooks/adsHooks.js +1 -1
- package/dist/hooks/commandHooks.d.ts +3 -3
- package/dist/hooks/commandHooks.d.ts.map +1 -1
- package/dist/hooks/commandHooks.js +1 -1
- package/dist/hooks/useAutoCoreTag.js +1 -1
- package/dist/hub/CommandMessage.d.ts +18 -9
- package/dist/hub/CommandMessage.d.ts.map +1 -1
- package/dist/hub/CommandMessage.js +1 -1
- package/dist/hub/DebugPanel.d.ts +31 -0
- package/dist/hub/DebugPanel.d.ts.map +1 -0
- package/dist/hub/DebugPanel.js +1 -0
- package/dist/hub/HubBase.d.ts +83 -129
- package/dist/hub/HubBase.d.ts.map +1 -1
- package/dist/hub/HubBase.js +1 -1
- package/dist/hub/HubSimulate.d.ts +41 -8
- package/dist/hub/HubSimulate.d.ts.map +1 -1
- package/dist/hub/HubSimulate.js +1 -1
- package/dist/hub/HubTauri.d.ts +24 -60
- package/dist/hub/HubTauri.d.ts.map +1 -1
- package/dist/hub/HubTauri.js +1 -1
- package/dist/hub/HubWebSocket.d.ts +33 -17
- package/dist/hub/HubWebSocket.d.ts.map +1 -1
- package/dist/hub/HubWebSocket.js +1 -1
- package/dist/hub/debug.d.ts +23 -0
- package/dist/hub/debug.d.ts.map +1 -0
- package/dist/hub/debug.js +1 -0
- package/dist/hub/index.d.ts +19 -4
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js +1 -1
- package/package.json +8 -4
- package/src/components/AutoCoreDevPanel.tsx +14 -11
- package/src/components/FileList.tsx +5 -4
- package/src/components/FileSelect.tsx +2 -1
- package/src/core/ActionMode.ts +1 -1
- package/src/core/AutoCoreTagContext.tsx +247 -330
- package/src/core/AutoCoreTagTypes.ts +236 -104
- package/src/core/CoreStreamTypes.ts +512 -0
- package/src/core/EventEmitterContext.tsx +182 -520
- package/src/core/IndicatorButtonState.ts +1 -1
- package/src/core/hoc.tsx +1 -1
- package/src/hooks/adsHooks.tsx +21 -22
- package/src/hooks/commandHooks.tsx +23 -19
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useAutoCoreTag.ts +2 -2
- package/src/hooks/useScaledValue.tsx +1 -1
- package/src/hub/CommandMessage.ts +71 -19
- package/src/hub/DebugPanel.ts +280 -0
- package/src/hub/HubBase.ts +147 -223
- package/src/hub/HubSimulate.ts +93 -24
- package/src/hub/HubTauri.ts +87 -96
- package/src/hub/HubWebSocket.ts +118 -140
- package/src/hub/debug.ts +211 -0
- package/src/hub/index.ts +49 -39
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -134
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1633
- package/docs/classes/components_CodeEditor.CodeEditor.html +0 -135
- package/docs/classes/components_Indicator.Indicator.html +0 -122
- package/docs/classes/components_IndicatorRect.IndicatorRect.html +0 -121
- package/docs/classes/components_JogPanel.JogPanel.html +0 -136
- package/docs/classes/components_Lamp.Lamp.html +0 -122
- package/docs/classes/components_OskDialog.OskDialog.html +0 -125
- package/docs/classes/components_TextInput.TextInput.html +0 -125
- package/docs/classes/components_ValueDisplay.ValueDisplay.html +0 -148
- package/docs/classes/components_ValueIndicator.ValueIndicator.html +0 -126
- package/docs/classes/core_ValueSimulator.ValueSimulator.html +0 -51
- package/docs/classes/hub_HubBase.HubBase.html +0 -106
- package/docs/classes/hub_HubSimulate.HubSimulate.html +0 -75
- package/docs/classes/hub_HubTauri.HubTauri.html +0 -93
- package/docs/classes/hub_HubWebSocket.HubWebSocket.html +0 -112
- package/docs/documents/core_AutoCoreTagContext.AutoCoreTagContext.html +0 -148
- package/docs/enums/components_JogPanel.JogDistanceAction.html +0 -5
- package/docs/enums/components_JogPanel.JogPanelAction.html +0 -18
- package/docs/enums/components_JogPanel.JogSpeedAction.html +0 -5
- package/docs/enums/core_ActionMode.ActionMode.html +0 -6
- package/docs/enums/core_IndicatorColor.IndicatorColor.html +0 -23
- package/docs/functions/assets.BlocklyLogo.html +0 -1
- package/docs/functions/assets.Distance.html +0 -1
- package/docs/functions/assets.JogLong.html +0 -1
- package/docs/functions/assets.JogMedium.html +0 -1
- package/docs/functions/assets.JogShort.html +0 -1
- package/docs/functions/assets.PythonLogo.html +0 -1
- package/docs/functions/assets.Rotation3D.html +0 -1
- package/docs/functions/assets.RotationCcw.html +0 -1
- package/docs/functions/assets.RotationCcwA.html +0 -1
- package/docs/functions/assets.RotationCcwB.html +0 -1
- package/docs/functions/assets.RotationCcwC.html +0 -1
- package/docs/functions/assets.RotationCw.html +0 -1
- package/docs/functions/assets.RotationCwA.html +0 -1
- package/docs/functions/assets.RotationCwB.html +0 -1
- package/docs/functions/assets.RotationCwC.html +0 -1
- package/docs/functions/assets.Run.html +0 -1
- package/docs/functions/assets.Speed.html +0 -1
- package/docs/functions/assets.SpeedFast.html +0 -1
- package/docs/functions/assets.SpeedMedium.html +0 -1
- package/docs/functions/assets.SpeedNone.html +0 -1
- package/docs/functions/assets.SpeedSlow.html +0 -1
- package/docs/functions/assets.Walk.html +0 -1
- package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +0 -6
- package/docs/functions/core_UniqueId.UniqueId.html +0 -9
- package/docs/functions/core_hoc.hocAddSubscription.html +0 -6
- package/docs/functions/hooks_adsHooks.useAdsRegisterSymbols.html +0 -16
- package/docs/functions/hooks_adsHooks.useAdsTapValue.html +0 -8
- package/docs/functions/hooks_adsHooks.useAdsWriteScaledValue.html +0 -18
- package/docs/functions/hooks_adsHooks.useAdsWriteValue.html +0 -9
- package/docs/functions/hooks_commandHooks.useRegisterSymbols.html +0 -16
- package/docs/functions/hooks_commandHooks.useTapValue.html +0 -10
- package/docs/functions/hooks_commandHooks.useWriteScaledValue.html +0 -18
- package/docs/functions/hooks_commandHooks.useWriteValue.html +0 -11
- package/docs/functions/hooks_useAutoCoreTag.ts.makeAutoCoreTagHooks.html +0 -12
- package/docs/functions/hooks_useScaledValue.useScaledValue.html +0 -18
- package/docs/functions/hub.createHub.html +0 -3
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -148
- package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +0 -654
- package/docs/interfaces/components_IndicatorRect.IndicatorRectProps.html +0 -37
- package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +0 -5
- package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +0 -644
- package/docs/interfaces/core_AutoCoreTagTypes.BaseContextValue.html +0 -12
- package/docs/interfaces/core_AutoCoreTagTypes.ScaleConfig.html +0 -13
- package/docs/interfaces/core_EventEmitterContext.Action.html +0 -8
- package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +0 -33
- package/docs/interfaces/core_EventEmitterContext.State.html +0 -8
- package/docs/interfaces/core_EventEmitterContext.Subscription.html +0 -6
- package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +0 -10
- package/docs/interfaces/core_PositionContext.IPositionContext.html +0 -17
- package/docs/interfaces/hub_CommandMessage.CommandMessage.html +0 -6
- package/docs/interfaces/hub_CommandMessage.CommandMessageResult.html +0 -4
- package/docs/modules/assets.html +0 -1
- package/docs/modules/assets_BlocklyLogo.html +0 -1
- package/docs/modules/assets_Distance.html +0 -1
- package/docs/modules/assets_JogLong.html +0 -1
- package/docs/modules/assets_JogMedium.html +0 -1
- package/docs/modules/assets_JogShort.html +0 -1
- package/docs/modules/assets_PythonLogo.html +0 -1
- package/docs/modules/assets_Rotation3D.html +0 -1
- package/docs/modules/assets_RotationCcw.html +0 -1
- package/docs/modules/assets_RotationCcwA.html +0 -1
- package/docs/modules/assets_RotationCcwB.html +0 -1
- package/docs/modules/assets_RotationCcwC.html +0 -1
- package/docs/modules/assets_RotationCw.html +0 -1
- package/docs/modules/assets_RotationCwA.html +0 -1
- package/docs/modules/assets_RotationCwB.html +0 -1
- package/docs/modules/assets_RotationCwC.html +0 -1
- package/docs/modules/assets_Run.html +0 -1
- package/docs/modules/assets_Speed.html +0 -1
- package/docs/modules/assets_SpeedFast.html +0 -1
- package/docs/modules/assets_SpeedMedium.html +0 -1
- package/docs/modules/assets_SpeedNone.html +0 -1
- package/docs/modules/assets_SpeedSlow.html +0 -1
- package/docs/modules/assets_Walk.html +0 -1
- package/docs/modules/components_AutoCoreDevPanel.html +0 -20
- package/docs/modules/components_BlocklyEditor.html +0 -1
- package/docs/modules/components_CodeEditor.html +0 -1
- package/docs/modules/components_FileList.html +0 -1
- package/docs/modules/components_FileSelect.html +0 -1
- package/docs/modules/components_FitText.html +0 -1
- package/docs/modules/components_Indicator.html +0 -1
- package/docs/modules/components_IndicatorButton.html +0 -1
- package/docs/modules/components_IndicatorRect.html +0 -1
- package/docs/modules/components_JogPanel.html +0 -1
- package/docs/modules/components_Lamp.html +0 -1
- package/docs/modules/components_Osk.html +0 -1
- package/docs/modules/components_OskDialog.html +0 -1
- package/docs/modules/components_ProgressBarWithValue.html +0 -1
- package/docs/modules/components_TextInput.html +0 -1
- package/docs/modules/components_ToggleGroup.html +0 -1
- package/docs/modules/components_ValueDisplay.html +0 -1
- package/docs/modules/components_ValueIndicator.html +0 -1
- package/docs/modules/components_ValueInput.html +0 -1
- package/docs/modules/core_ActionMode.html +0 -1
- package/docs/modules/core_AutoCoreTagContext.html +0 -11
- package/docs/modules/core_AutoCoreTagTypes.html +0 -1
- package/docs/modules/core_EventEmitterContext.html +0 -53
- package/docs/modules/core_IndicatorButtonState.html +0 -1
- package/docs/modules/core_IndicatorColor.html +0 -1
- package/docs/modules/core_MaskPatterns.html +0 -1
- package/docs/modules/core_NumerableTypes.html +0 -1
- package/docs/modules/core_PositionContext.html +0 -1
- package/docs/modules/core_UniqueId.html +0 -1
- package/docs/modules/core_ValueSimulator.html +0 -1
- package/docs/modules/core_hoc.html +0 -1
- package/docs/modules/hooks.html +0 -1
- package/docs/modules/hooks_adsHooks.html +0 -1
- package/docs/modules/hooks_commandHooks.html +0 -1
- package/docs/modules/hooks_useAutoCoreTag.ts.html +0 -52
- package/docs/modules/hooks_useScaledValue.html +0 -1
- package/docs/modules/hub.html +0 -1
- package/docs/modules/hub_CommandMessage.html +0 -1
- package/docs/modules/hub_HubBase.html +0 -1
- package/docs/modules/hub_HubSimulate.html +0 -1
- package/docs/modules/hub_HubTauri.html +0 -1
- package/docs/modules/hub_HubWebSocket.html +0 -1
- package/docs/modules.html +0 -23
- package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.ExtractByTag.html +0 -2
- package/docs/types/core_AutoCoreTagTypes.PrimitiveKind.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.TagConfig.html +0 -16
- package/docs/types/core_AutoCoreTagTypes.TagValueMap.html +0 -1
- package/docs/types/core_AutoCoreTagTypes.TagValueOf.html +0 -1
- package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +0 -3
- package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +0 -3
- package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +0 -3
- package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +0 -4
- package/docs/types/core_hoc.HocAddSubscriptionProps.html +0 -6
- package/docs/variables/components_AutoCoreDevPanel.AutoCoreDevPanel.html +0 -43
- package/docs/variables/components_BlocklyEditor.BlocklyEditor.html +0 -13
- package/docs/variables/components_BlocklyEditor.StandardToolbox.html +0 -1
- package/docs/variables/components_FileList.FileList.html +0 -23
- package/docs/variables/components_FileSelect.FileSelect.html +0 -1
- package/docs/variables/components_FitText.FitText.html +0 -4
- package/docs/variables/components_IndicatorButton.IndicatorButton.html +0 -1
- package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +0 -2
- package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +0 -2
- package/docs/variables/components_Osk.Osk.html +0 -1
- package/docs/variables/components_ProgressBarWithValue.ProgressBarWithValue.html +0 -1
- package/docs/variables/components_ToggleGroup.ToggleGroup.html +0 -1
- package/docs/variables/components_ValueInput.ValueInput.html +0 -4
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagContext.html +0 -1
- package/docs/variables/core_AutoCoreTagContext.AutoCoreTagProvider.html +0 -7
- package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +0 -64
- package/docs/variables/core_EventEmitterContext.EventEmitterProvider.html +0 -10
- package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +0 -14
- package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +0 -15
- package/docs/variables/core_PositionContext.DimensionsContext.html +0 -6
- package/docs/variables/hooks_useScaledValue.kMillimeters2Inches.html +0 -2
- package/docs/variables/hooks_useScaledValue.kNewtons2Pounds.html +0 -2
|
@@ -42,6 +42,107 @@ export type TagBinding<T> = Readonly<{
|
|
|
42
42
|
/** True while initial read/bootstrapping is in progress. */
|
|
43
43
|
isLoading: boolean;
|
|
44
44
|
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Options that control how subscription updates are delivered to the client.
|
|
47
|
+
*
|
|
48
|
+
* This implements the "hybrid" subscription model where:
|
|
49
|
+
* - **Project configuration** defines limits and defaults (e.g., minimum sampling rate)
|
|
50
|
+
* - **Client requests** can customize within those bounds
|
|
51
|
+
*
|
|
52
|
+
* ## Behavior
|
|
53
|
+
*
|
|
54
|
+
* - `undefined` values mean "use server default"
|
|
55
|
+
* - Client requests are clamped to server limits (can't request faster than hardware supports)
|
|
56
|
+
* - All filtering (deadband, on_change_only) is applied server-side before sending updates
|
|
57
|
+
*
|
|
58
|
+
* @example Basic rate limiting
|
|
59
|
+
* ```typescript
|
|
60
|
+
* {
|
|
61
|
+
* tagName: "fastSensor",
|
|
62
|
+
* domain: "MODBUS",
|
|
63
|
+
* symbolName: "sensor.temperature",
|
|
64
|
+
* valueType: "number",
|
|
65
|
+
* subscriptionOptions: {
|
|
66
|
+
* sampling_interval_ms: 500, // Limit to 2 updates/sec
|
|
67
|
+
* on_change_only: true // Only send when value changes
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example Deadband filtering for noisy signals
|
|
73
|
+
* ```typescript
|
|
74
|
+
* {
|
|
75
|
+
* tagName: "analogInput",
|
|
76
|
+
* domain: "MODBUS",
|
|
77
|
+
* symbolName: "ai.pressure",
|
|
78
|
+
* valueType: "number",
|
|
79
|
+
* subscriptionOptions: {
|
|
80
|
+
* deadband_percent: 1.0 // Ignore changes < 1% of full scale
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export interface SubscriptionOptions {
|
|
86
|
+
/**
|
|
87
|
+
* Minimum interval between updates in milliseconds.
|
|
88
|
+
*
|
|
89
|
+
* The server will not send updates faster than this rate, even if the
|
|
90
|
+
* underlying data changes more frequently. This helps prevent UI overload.
|
|
91
|
+
*
|
|
92
|
+
* - `undefined`: Use server default (typically from project configuration)
|
|
93
|
+
* - If client requests faster than hardware polling rate, gets clamped to hardware rate
|
|
94
|
+
*
|
|
95
|
+
* @example `{ sampling_interval_ms: 100 }` - Max 10 updates/second
|
|
96
|
+
*/
|
|
97
|
+
sampling_interval_ms?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Only send updates when the value changes (vs periodic heartbeat).
|
|
100
|
+
*
|
|
101
|
+
* When `true`, the server only sends updates when the value differs from
|
|
102
|
+
* the last sent value (after applying deadband filtering).
|
|
103
|
+
*
|
|
104
|
+
* When `false` or `undefined`, updates may be sent periodically even if unchanged.
|
|
105
|
+
*/
|
|
106
|
+
on_change_only?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Deadband as a percentage of full scale (0.0 to 100.0).
|
|
109
|
+
*
|
|
110
|
+
* Updates are suppressed unless the value changes by at least this
|
|
111
|
+
* percentage of the full scale range. This reduces network traffic
|
|
112
|
+
* for noisy signals.
|
|
113
|
+
*
|
|
114
|
+
* - `deadband_percent: 1.0` means ignore changes less than 1% of full scale
|
|
115
|
+
* - Takes precedence over `deadband_absolute` if both are set
|
|
116
|
+
*
|
|
117
|
+
* @example `{ deadband_percent: 2.5 }` - Ignore changes < 2.5% of range
|
|
118
|
+
*/
|
|
119
|
+
deadband_percent?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Deadband as an absolute value change threshold.
|
|
122
|
+
*
|
|
123
|
+
* Updates are suppressed unless the value changes by at least this
|
|
124
|
+
* absolute amount. Useful when you know the meaningful change threshold.
|
|
125
|
+
*
|
|
126
|
+
* - Only used if `deadband_percent` is not set
|
|
127
|
+
*
|
|
128
|
+
* @example `{ deadband_absolute: 5.0 }` - Ignore changes < 5 units
|
|
129
|
+
*/
|
|
130
|
+
deadband_absolute?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Queue size for buffering updates when the client is slow.
|
|
133
|
+
*
|
|
134
|
+
* If the client can't consume updates fast enough, this many updates
|
|
135
|
+
* are queued before older ones are discarded.
|
|
136
|
+
*
|
|
137
|
+
* - `undefined`: Use server default (typically 1 - latest value only)
|
|
138
|
+
* - Higher values useful for historical trending or burst handling
|
|
139
|
+
*/
|
|
140
|
+
queue_size?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Custom arguments specific for the specified domain.
|
|
143
|
+
*/
|
|
144
|
+
args?: Record<string, unknown>;
|
|
145
|
+
}
|
|
45
146
|
/**
|
|
46
147
|
* Configuration for a named scale group.
|
|
47
148
|
* Apply by setting `scale: "<name>"` on numeric tags.
|
|
@@ -85,16 +186,15 @@ export type TagCodec<TIn = unknown, TOut extends JsonValue = JsonValue> = {
|
|
|
85
186
|
export type TagConfig<K extends string = string, T extends PrimitiveKind = PrimitiveKind> = {
|
|
86
187
|
/** Local key used by UI/consumers (unique within your spec) */
|
|
87
188
|
tagName: K;
|
|
88
|
-
/** Domain
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
189
|
+
/** Fully-Qualified Domain Name - the complete topic path.
|
|
190
|
+
* Format: "domain.path.to.symbol" (e.g., "ads.plc1.gio.bControlPowerOk", "modbus.holding_registers.5")
|
|
191
|
+
* The first segment is the domain, used for routing to the appropriate servelet.
|
|
192
|
+
*/
|
|
193
|
+
fqdn: string;
|
|
92
194
|
/** Declared primitive kind for typing and DevPanel rendering */
|
|
93
195
|
valueType: T;
|
|
94
196
|
/** Optional initial **raw** value before first server update */
|
|
95
197
|
initialValue?: TagValueOf<T>;
|
|
96
|
-
/** Optional per-tag hook/config options (e.g., cycle time, debounce) */
|
|
97
|
-
options?: Record<string, unknown>;
|
|
98
198
|
/**
|
|
99
199
|
* Optional scale group for numeric tags.
|
|
100
200
|
* If present, provider will:
|
|
@@ -107,6 +207,27 @@ export type TagConfig<K extends string = string, T extends PrimitiveKind = Primi
|
|
|
107
207
|
* Only commonly used with `valueType: "json"`.
|
|
108
208
|
*/
|
|
109
209
|
codec?: TagCodec;
|
|
210
|
+
/**
|
|
211
|
+
* Optional subscription options to control how updates are delivered.
|
|
212
|
+
*
|
|
213
|
+
* These options implement the hybrid subscription model where you can
|
|
214
|
+
* configure rate limiting, deadband filtering, and other delivery options
|
|
215
|
+
* to prevent overwhelming the UI with high-frequency updates.
|
|
216
|
+
*
|
|
217
|
+
* @example Rate limit a fast-updating tag
|
|
218
|
+
* ```typescript
|
|
219
|
+
* {
|
|
220
|
+
* tagName: "position",
|
|
221
|
+
* subscriptionOptions: {
|
|
222
|
+
* sampling_interval_ms: 100, // Max 10 updates/sec
|
|
223
|
+
* on_change_only: true
|
|
224
|
+
* }
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @see SubscriptionOptions for all available options
|
|
229
|
+
*/
|
|
230
|
+
subscriptionOptions?: SubscriptionOptions;
|
|
110
231
|
};
|
|
111
232
|
/** Extract the tag config for a particular tag name `K` from a `Spec` */
|
|
112
233
|
export type ExtractByTag<Spec extends readonly TagConfig[], K> = Extract<Spec[number], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoCoreTagTypes.d.ts","sourceRoot":"","sources":["../../src/core/AutoCoreTagTypes.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,oDAAoD;AACpD,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"AutoCoreTagTypes.d.ts","sourceRoot":"","sources":["../../src/core/AutoCoreTagTypes.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,oDAAoD;AACpD,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,O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EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEpC;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzF"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/** Message type discriminator */
|
|
2
|
+
export type MessageType = "sdo" | "cyclic" | "system" | "rpc";
|
|
3
|
+
/**
|
|
4
|
+
* Address can be either a symbol name (FQDN) or CANopen-style index:subindex.
|
|
5
|
+
* Modules accept both formats and resolve internally.
|
|
6
|
+
*/
|
|
7
|
+
export type SymbolAddress = {
|
|
8
|
+
symbol: string;
|
|
9
|
+
} | {
|
|
10
|
+
index: number;
|
|
11
|
+
subindex: number;
|
|
12
|
+
};
|
|
13
|
+
/** Data types supported by the protocol */
|
|
14
|
+
export type DataType = "bool" | "i8" | "i16" | "i32" | "i64" | "u8" | "u16" | "u32" | "u64" | "f32" | "f64" | "string" | "bytes" | "json";
|
|
15
|
+
/** Access mode for symbols */
|
|
16
|
+
export type AccessMode = "ro" | "wo" | "rw";
|
|
17
|
+
/** Base structure for all CoreStream messages */
|
|
18
|
+
export interface CoreStreamMessage<T extends MessageType = MessageType> {
|
|
19
|
+
/** Message type discriminator */
|
|
20
|
+
type: T;
|
|
21
|
+
/** Command within the message type */
|
|
22
|
+
command: string;
|
|
23
|
+
/** Request ID for request/response matching (optional for push messages) */
|
|
24
|
+
request_id?: number;
|
|
25
|
+
/** Message payload (type-specific) */
|
|
26
|
+
payload: unknown;
|
|
27
|
+
}
|
|
28
|
+
export type SdoCommand = "upload_request" | "upload_response" | "download_request" | "download_response" | "abort";
|
|
29
|
+
/** SDO Upload Request - Read a value */
|
|
30
|
+
export interface SdoUploadRequest extends CoreStreamMessage<"sdo"> {
|
|
31
|
+
command: "upload_request";
|
|
32
|
+
request_id: number;
|
|
33
|
+
payload: SymbolAddress;
|
|
34
|
+
}
|
|
35
|
+
/** SDO Upload Response - Read result */
|
|
36
|
+
export interface SdoUploadResponse extends CoreStreamMessage<"sdo"> {
|
|
37
|
+
command: "upload_response";
|
|
38
|
+
request_id: number;
|
|
39
|
+
payload: {
|
|
40
|
+
/** The address that was read (echoed back) */
|
|
41
|
+
address: SymbolAddress;
|
|
42
|
+
/** The value read */
|
|
43
|
+
value: unknown;
|
|
44
|
+
/** Data type of the value */
|
|
45
|
+
datatype: DataType;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** SDO Download Request - Write a value */
|
|
49
|
+
export interface SdoDownloadRequest extends CoreStreamMessage<"sdo"> {
|
|
50
|
+
command: "download_request";
|
|
51
|
+
request_id: number;
|
|
52
|
+
payload: SymbolAddress & {
|
|
53
|
+
/** The value to write */
|
|
54
|
+
value: unknown;
|
|
55
|
+
/** Optional: data type hint */
|
|
56
|
+
datatype?: DataType;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** SDO Download Response - Write acknowledgment */
|
|
60
|
+
export interface SdoDownloadResponse extends CoreStreamMessage<"sdo"> {
|
|
61
|
+
command: "download_response";
|
|
62
|
+
request_id: number;
|
|
63
|
+
payload: {
|
|
64
|
+
/** The address that was written (echoed back) */
|
|
65
|
+
address: SymbolAddress;
|
|
66
|
+
/** Whether the write succeeded */
|
|
67
|
+
success: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** SDO Abort - Error response */
|
|
71
|
+
export interface SdoAbort extends CoreStreamMessage<"sdo"> {
|
|
72
|
+
command: "abort";
|
|
73
|
+
request_id: number;
|
|
74
|
+
payload: {
|
|
75
|
+
/** The address that caused the error */
|
|
76
|
+
address: SymbolAddress;
|
|
77
|
+
/** CANopen-style abort code */
|
|
78
|
+
abort_code: number;
|
|
79
|
+
/** Human-readable error message */
|
|
80
|
+
message: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Standard SDO abort codes (CANopen-compatible) */
|
|
84
|
+
export declare const SdoAbortCode: {
|
|
85
|
+
readonly TOGGLE_BIT_NOT_ALTERED: 84082688;
|
|
86
|
+
readonly SDO_PROTOCOL_TIMEOUT: 84148224;
|
|
87
|
+
readonly INVALID_COMMAND: 84148225;
|
|
88
|
+
readonly OUT_OF_MEMORY: 84148229;
|
|
89
|
+
readonly UNSUPPORTED_ACCESS: 100728832;
|
|
90
|
+
readonly WRITE_ONLY: 100728833;
|
|
91
|
+
readonly READ_ONLY: 100728834;
|
|
92
|
+
readonly OBJECT_NOT_EXIST: 100794368;
|
|
93
|
+
readonly SUBINDEX_NOT_EXIST: 101253137;
|
|
94
|
+
readonly GENERAL_ERROR: 134217728;
|
|
95
|
+
readonly DATA_TRANSFER_ERROR: 134217760;
|
|
96
|
+
readonly DATA_LENGTH_MISMATCH: 134217762;
|
|
97
|
+
};
|
|
98
|
+
export type SdoMessage = SdoUploadRequest | SdoUploadResponse | SdoDownloadRequest | SdoDownloadResponse | SdoAbort;
|
|
99
|
+
export type CyclicCommand = "subscribe" | "subscribe_ack" | "unsubscribe" | "unsubscribe_ack" | "data_update" | "data_update_batch";
|
|
100
|
+
/** Subscription options for cyclic updates */
|
|
101
|
+
export interface SubscriptionOptions {
|
|
102
|
+
/** Minimum interval between updates in milliseconds */
|
|
103
|
+
sampling_interval_ms?: number;
|
|
104
|
+
/** Only send updates when value changes */
|
|
105
|
+
on_change_only?: boolean;
|
|
106
|
+
/** Deadband as percentage of full scale (0-100) */
|
|
107
|
+
deadband_percent?: number;
|
|
108
|
+
/** Deadband as absolute value */
|
|
109
|
+
deadband_absolute?: number;
|
|
110
|
+
/** Queue size for buffering (default: 1 = latest only) */
|
|
111
|
+
queue_size?: number;
|
|
112
|
+
}
|
|
113
|
+
/** Subscribe to cyclic updates for a symbol */
|
|
114
|
+
export interface CyclicSubscribe extends CoreStreamMessage<"cyclic"> {
|
|
115
|
+
command: "subscribe";
|
|
116
|
+
request_id: number;
|
|
117
|
+
payload: SymbolAddress & {
|
|
118
|
+
/** Optional subscription options */
|
|
119
|
+
options?: SubscriptionOptions;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** Subscribe acknowledgment */
|
|
123
|
+
export interface CyclicSubscribeAck extends CoreStreamMessage<"cyclic"> {
|
|
124
|
+
command: "subscribe_ack";
|
|
125
|
+
request_id: number;
|
|
126
|
+
payload: {
|
|
127
|
+
/** The address subscribed to */
|
|
128
|
+
address: SymbolAddress;
|
|
129
|
+
/** Whether subscription succeeded */
|
|
130
|
+
success: boolean;
|
|
131
|
+
/** Error message if failed */
|
|
132
|
+
error?: string;
|
|
133
|
+
/** Effective options after server clamping */
|
|
134
|
+
effective_options?: SubscriptionOptions;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** Unsubscribe from cyclic updates */
|
|
138
|
+
export interface CyclicUnsubscribe extends CoreStreamMessage<"cyclic"> {
|
|
139
|
+
command: "unsubscribe";
|
|
140
|
+
request_id: number;
|
|
141
|
+
payload: SymbolAddress;
|
|
142
|
+
}
|
|
143
|
+
/** Unsubscribe acknowledgment */
|
|
144
|
+
export interface CyclicUnsubscribeAck extends CoreStreamMessage<"cyclic"> {
|
|
145
|
+
command: "unsubscribe_ack";
|
|
146
|
+
request_id: number;
|
|
147
|
+
payload: {
|
|
148
|
+
address: SymbolAddress;
|
|
149
|
+
success: boolean;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Single value update (pushed from server) */
|
|
153
|
+
export interface CyclicDataUpdate extends CoreStreamMessage<"cyclic"> {
|
|
154
|
+
command: "data_update";
|
|
155
|
+
payload: {
|
|
156
|
+
/** The symbol that changed */
|
|
157
|
+
symbol: string;
|
|
158
|
+
/** The new value */
|
|
159
|
+
value: unknown;
|
|
160
|
+
/** Server timestamp (nanoseconds since epoch, optional) */
|
|
161
|
+
timestamp_ns?: number;
|
|
162
|
+
/** Data type */
|
|
163
|
+
datatype?: DataType;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** Batch value update (multiple values in one message) */
|
|
167
|
+
export interface CyclicDataUpdateBatch extends CoreStreamMessage<"cyclic"> {
|
|
168
|
+
command: "data_update_batch";
|
|
169
|
+
payload: {
|
|
170
|
+
/** Array of updates */
|
|
171
|
+
updates: Array<{
|
|
172
|
+
symbol: string;
|
|
173
|
+
value: unknown;
|
|
174
|
+
timestamp_ns?: number;
|
|
175
|
+
datatype?: DataType;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export type CyclicMessage = CyclicSubscribe | CyclicSubscribeAck | CyclicUnsubscribe | CyclicUnsubscribeAck | CyclicDataUpdate | CyclicDataUpdateBatch;
|
|
180
|
+
export type SystemCommand = "announce" | "announce_ack" | "discovery" | "discovery_response" | "leaving" | "start" | "stop" | "health_request" | "health_response";
|
|
181
|
+
/** Symbol descriptor in module announcement */
|
|
182
|
+
export interface SymbolDescriptor {
|
|
183
|
+
/** Human-readable symbol name (FQDN within module) */
|
|
184
|
+
name: string;
|
|
185
|
+
/** CANopen-style index */
|
|
186
|
+
index: number;
|
|
187
|
+
/** CANopen-style subindex */
|
|
188
|
+
subindex: number;
|
|
189
|
+
/** Data type */
|
|
190
|
+
datatype: DataType;
|
|
191
|
+
/** Access mode */
|
|
192
|
+
access: AccessMode;
|
|
193
|
+
/** Optional description */
|
|
194
|
+
description?: string;
|
|
195
|
+
/** Optional unit (e.g., "mm", "Hz") */
|
|
196
|
+
unit?: string;
|
|
197
|
+
/** Optional min value (for validation) */
|
|
198
|
+
min?: number;
|
|
199
|
+
/** Optional max value (for validation) */
|
|
200
|
+
max?: number;
|
|
201
|
+
}
|
|
202
|
+
/** Module capabilities */
|
|
203
|
+
export interface ModuleCapabilities {
|
|
204
|
+
/** Supports SDO read */
|
|
205
|
+
sdo_read: boolean;
|
|
206
|
+
/** Supports SDO write */
|
|
207
|
+
sdo_write: boolean;
|
|
208
|
+
/** Supports cyclic subscriptions */
|
|
209
|
+
cyclic: boolean;
|
|
210
|
+
/** Supports batch operations */
|
|
211
|
+
batch: boolean;
|
|
212
|
+
/** Maximum symbols per batch */
|
|
213
|
+
max_batch_size?: number;
|
|
214
|
+
}
|
|
215
|
+
/** Module announces itself and its symbol catalog */
|
|
216
|
+
export interface SystemAnnounce extends CoreStreamMessage<"system"> {
|
|
217
|
+
command: "announce";
|
|
218
|
+
payload: {
|
|
219
|
+
/** Module name (used as FQDN prefix) */
|
|
220
|
+
module_name: string;
|
|
221
|
+
/** Module version */
|
|
222
|
+
version?: string;
|
|
223
|
+
/** Module capabilities */
|
|
224
|
+
capabilities: ModuleCapabilities;
|
|
225
|
+
/** Symbol catalog */
|
|
226
|
+
symbols: SymbolDescriptor[];
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** Announcement acknowledgment */
|
|
230
|
+
export interface SystemAnnounceAck extends CoreStreamMessage<"system"> {
|
|
231
|
+
command: "announce_ack";
|
|
232
|
+
payload: {
|
|
233
|
+
/** Whether announcement was accepted */
|
|
234
|
+
success: boolean;
|
|
235
|
+
/** Assigned module ID (if applicable) */
|
|
236
|
+
module_id?: number;
|
|
237
|
+
/** Error message if failed */
|
|
238
|
+
error?: string;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** Request list of all connected modules */
|
|
242
|
+
export interface SystemDiscovery extends CoreStreamMessage<"system"> {
|
|
243
|
+
command: "discovery";
|
|
244
|
+
request_id: number;
|
|
245
|
+
payload: Record<string, never>;
|
|
246
|
+
}
|
|
247
|
+
/** Discovery response with module list */
|
|
248
|
+
export interface SystemDiscoveryResponse extends CoreStreamMessage<"system"> {
|
|
249
|
+
command: "discovery_response";
|
|
250
|
+
request_id: number;
|
|
251
|
+
payload: {
|
|
252
|
+
modules: Array<{
|
|
253
|
+
module_name: string;
|
|
254
|
+
version?: string;
|
|
255
|
+
capabilities: ModuleCapabilities;
|
|
256
|
+
symbol_count: number;
|
|
257
|
+
state: "running" | "stopped" | "error";
|
|
258
|
+
}>;
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/** Module leaving notification */
|
|
262
|
+
export interface SystemLeaving extends CoreStreamMessage<"system"> {
|
|
263
|
+
command: "leaving";
|
|
264
|
+
payload: {
|
|
265
|
+
module_name: string;
|
|
266
|
+
reason?: string;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/** Health check request */
|
|
270
|
+
export interface SystemHealthRequest extends CoreStreamMessage<"system"> {
|
|
271
|
+
command: "health_request";
|
|
272
|
+
request_id: number;
|
|
273
|
+
payload: {
|
|
274
|
+
/** Optional: specific module to check */
|
|
275
|
+
module_name?: string;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/** Health check response */
|
|
279
|
+
export interface SystemHealthResponse extends CoreStreamMessage<"system"> {
|
|
280
|
+
command: "health_response";
|
|
281
|
+
request_id: number;
|
|
282
|
+
payload: {
|
|
283
|
+
healthy: boolean;
|
|
284
|
+
modules: Array<{
|
|
285
|
+
module_name: string;
|
|
286
|
+
state: "running" | "stopped" | "error";
|
|
287
|
+
uptime_secs?: number;
|
|
288
|
+
error?: string;
|
|
289
|
+
}>;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export type SystemMessage = SystemAnnounce | SystemAnnounceAck | SystemDiscovery | SystemDiscoveryResponse | SystemLeaving | SystemHealthRequest | SystemHealthResponse;
|
|
293
|
+
export type RpcCommand = "invoke" | "response";
|
|
294
|
+
/** RPC invoke request - call a function on a module */
|
|
295
|
+
export interface RpcInvoke extends CoreStreamMessage<"rpc"> {
|
|
296
|
+
command: "invoke";
|
|
297
|
+
request_id: number;
|
|
298
|
+
payload: {
|
|
299
|
+
/** Target module name */
|
|
300
|
+
module: string;
|
|
301
|
+
/** Method/function name */
|
|
302
|
+
method: string;
|
|
303
|
+
/** Arguments (JSON object) */
|
|
304
|
+
args?: Record<string, unknown>;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/** RPC response - function result */
|
|
308
|
+
export interface RpcResponse extends CoreStreamMessage<"rpc"> {
|
|
309
|
+
command: "response";
|
|
310
|
+
request_id: number;
|
|
311
|
+
payload: {
|
|
312
|
+
/** Whether the call succeeded */
|
|
313
|
+
success: boolean;
|
|
314
|
+
/** Return value (if success) */
|
|
315
|
+
data?: unknown;
|
|
316
|
+
/** Error message (if failed) */
|
|
317
|
+
error?: string;
|
|
318
|
+
/** Error code (if failed) */
|
|
319
|
+
error_code?: number;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
export type RpcMessage = RpcInvoke | RpcResponse;
|
|
323
|
+
export type AnyCoreSteamMessage = SdoMessage | CyclicMessage | SystemMessage | RpcMessage;
|
|
324
|
+
/** Type guard for SDO messages */
|
|
325
|
+
export declare function isSdoMessage(msg: CoreStreamMessage): msg is SdoMessage;
|
|
326
|
+
/** Type guard for Cyclic messages */
|
|
327
|
+
export declare function isCyclicMessage(msg: CoreStreamMessage): msg is CyclicMessage;
|
|
328
|
+
/** Type guard for System messages */
|
|
329
|
+
export declare function isSystemMessage(msg: CoreStreamMessage): msg is SystemMessage;
|
|
330
|
+
/** Type guard for RPC messages */
|
|
331
|
+
export declare function isRpcMessage(msg: CoreStreamMessage): msg is RpcMessage;
|
|
332
|
+
/** Check if an address uses symbol format */
|
|
333
|
+
export declare function isSymbolAddress(addr: SymbolAddress): addr is {
|
|
334
|
+
symbol: string;
|
|
335
|
+
};
|
|
336
|
+
/** Check if an address uses index:subindex format */
|
|
337
|
+
export declare function isIndexAddress(addr: SymbolAddress): addr is {
|
|
338
|
+
index: number;
|
|
339
|
+
subindex: number;
|
|
340
|
+
};
|
|
341
|
+
/** Convert address to string for display/logging */
|
|
342
|
+
export declare function addressToString(addr: SymbolAddress): string;
|
|
343
|
+
/** Parse an address string (either "vfd.frequency" or "0x2000:01") */
|
|
344
|
+
export declare function parseAddress(str: string): SymbolAddress;
|
|
345
|
+
//# sourceMappingURL=CoreStreamTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Co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UAAU,CAAC;AAMf,kCAAkC;AAClC,wBAAgB,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,IAAI,UAAU,CAEtE;AAED,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,IAAI,aAAa,CAE5E;AAED,qCAAqC;AACrC,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,IAAI,aAAa,CAE5E;AAED,kCAAkC;AAClC,wBAAgB,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,GAAG,IAAI,UAAU,CAEtE;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,IAAI;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAE/E;AAED,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAE/F;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAM3D;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAWvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SdoAbortCode={TOGGLE_BIT_NOT_ALTERED:84082688,SDO_PROTOCOL_TIMEOUT:84148224,INVALID_COMMAND:84148225,OUT_OF_MEMORY:84148229,UNSUPPORTED_ACCESS:100728832,WRITE_ONLY:100728833,READ_ONLY:100728834,OBJECT_NOT_EXIST:100794368,SUBINDEX_NOT_EXIST:101253137,GENERAL_ERROR:134217728,DATA_TRANSFER_ERROR:134217760,DATA_LENGTH_MISMATCH:134217762};export function isSdoMessage(e){return"sdo"===e.type}export function isCyclicMessage(e){return"cyclic"===e.type}export function isSystemMessage(e){return"system"===e.type}export function isRpcMessage(e){return"rpc"===e.type}export function isSymbolAddress(e){return"symbol"in e}export function isIndexAddress(e){return"index"in e&&"subindex"in e}export function addressToString(e){return isSymbolAddress(e)?e.symbol:`0x${e.index.toString(16).padStart(4,"0")}:${e.subindex.toString(16).padStart(2,"0")}`}export function parseAddress(e){const t=e.match(/^(?:0x)?([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,2})$/);return t?{index:parseInt(t[1],16),subindex:parseInt(t[2],16)}:{symbol:e}}
|