-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: start bringing common type declarations together
- Loading branch information
Showing
26 changed files
with
366 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export enum BinaryEncoding { | ||
UNSIGNED = 'unsigned', | ||
SIGNED = 'signed', | ||
Q1616 = 'q16.16', | ||
FLOAT = 'float' | ||
} | ||
|
||
export enum TextEncoding { | ||
UTF8 = 'utf8', | ||
UTF16LE = 'utf16le', | ||
ASCII = 'ascii', | ||
UCS2 = 'ucs2' | ||
} | ||
|
||
export interface CommonDecoderConfig { | ||
logfile: string; | ||
} | ||
|
||
export interface BasicDecoderConfig extends CommonDecoderConfig { | ||
port: number; | ||
} | ||
|
||
export interface ConsoleDecoderConfig extends BasicDecoderConfig { | ||
label: string; | ||
encoding: TextEncoding; | ||
timestamp: boolean; | ||
} | ||
|
||
export interface BinaryDecoderConfig extends BasicDecoderConfig { | ||
encoding: BinaryEncoding; | ||
scale: number; | ||
label: string; | ||
} | ||
|
||
export interface GraphDecoderConfig extends BasicDecoderConfig { | ||
encoding: BinaryEncoding; | ||
scale: number; | ||
graphId: string; | ||
} | ||
|
||
export interface AdvancedDecoderConfig { | ||
decoder: string; | ||
config: any; | ||
ports: number[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { SWOProfileConfig } from './swo'; | ||
|
||
export interface CommonGraphConfiguration { | ||
label: string; | ||
} | ||
|
||
export interface TimeseriesGraphConfiguration extends CommonGraphConfiguration { | ||
type: 'realtime'; | ||
minimum: number; | ||
maximum: number; | ||
timespan: number; | ||
plots: Array<{ | ||
graphId: string, | ||
label: string, | ||
color: string | ||
}>; | ||
} | ||
|
||
export interface XYGraphConfiguration extends CommonGraphConfiguration { | ||
type: 'x-y-plot'; | ||
xPort: number; | ||
yPort: number; | ||
xMinimum: number; | ||
xMaximum: number; | ||
yMinimum: number; | ||
yMaximum: number; | ||
initialX: number; | ||
initialY: number; | ||
timespan: number; | ||
xGraphId: string; | ||
yGraphId: string; | ||
} | ||
|
||
export type GraphConfiguration = TimeseriesGraphConfiguration | XYGraphConfiguration; | ||
|
||
export interface GrapherMessageBase { | ||
timestamp?: number; | ||
} | ||
|
||
export interface GrapherUnsupportedMessage extends GrapherMessageBase { | ||
type: ''; | ||
} | ||
|
||
export interface GrapherInitMessage extends GrapherMessageBase { | ||
type: 'init'; | ||
} | ||
|
||
export interface GrapherStatusMessage extends GrapherMessageBase { | ||
type: 'status'; | ||
status: 'stopped' | 'terminated' | 'continued'; | ||
} | ||
|
||
export interface GrapherDataMessage extends GrapherMessageBase { | ||
type: 'data'; | ||
id: string; | ||
data: number; | ||
} | ||
|
||
export type GrapherProgramStats = Array<[ string, number ]>; | ||
|
||
export interface GrapherProgramCounterMessage extends GrapherMessageBase { | ||
type: 'program-counter'; | ||
function: string; | ||
counter: number; | ||
} | ||
|
||
export interface GrapherConfigurationMessage extends GrapherMessageBase { | ||
type: 'configure'; | ||
graphs: [ GraphConfiguration ]; | ||
profile: SWOProfileConfig; | ||
status: 'stopped' | 'terminated' | 'continued'; | ||
} | ||
|
||
export type GrapherMessage = | ||
GrapherUnsupportedMessage | | ||
GrapherInitMessage | | ||
GrapherStatusMessage | | ||
GrapherDataMessage | | ||
GrapherProgramCounterMessage | | ||
GrapherConfigurationMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './decoder'; | ||
export * from './grapher'; | ||
export * from './rtt'; | ||
export * from './swo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { AdvancedDecoderConfig, BasicDecoderConfig, BinaryDecoderConfig, ConsoleDecoderConfig, GraphDecoderConfig } from './decoder'; | ||
|
||
export enum TerminalInputMode { | ||
COOKED = 'cooked', | ||
RAW = 'raw', | ||
RAWECHO = 'rawecho', | ||
DISABLED = 'disabled' | ||
} | ||
|
||
export interface RTTCommonDecoderOpts { | ||
noclear: boolean; // do not clear screen buffer on connect | ||
logfile: string; // log IO to file | ||
} | ||
|
||
export interface RTTBasicDecoderOpts extends RTTCommonDecoderOpts, BasicDecoderConfig { | ||
tcpPort: string; // [hostname:]port | ||
} | ||
|
||
export interface RTTCommonTerminalDecoderOpts extends RTTBasicDecoderOpts { | ||
label: string; // label for window | ||
prompt: string; // Prompt to use | ||
noprompt: boolean; // disable prompt | ||
inputmode: TerminalInputMode; | ||
} | ||
|
||
export interface RTTConsoleDecoderOpts extends RTTBasicDecoderOpts, RTTCommonTerminalDecoderOpts, ConsoleDecoderConfig { | ||
type: 'console'; | ||
} | ||
|
||
export interface RTTBinaryDecoderOpts extends RTTBasicDecoderOpts, RTTCommonTerminalDecoderOpts, BinaryDecoderConfig { | ||
type: 'binary'; | ||
} | ||
|
||
export type RTTTerminalDecoderOpts = RTTBinaryDecoderOpts | RTTConsoleDecoderOpts; | ||
|
||
export interface RTTGraphDecoderOpts extends RTTBasicDecoderOpts, GraphDecoderConfig { | ||
type: 'graph'; | ||
} | ||
|
||
export interface RTTAdvancedDecoderOpts extends RTTCommonDecoderOpts, AdvancedDecoderConfig { | ||
type: 'advanced'; | ||
tcpPorts: string[]; | ||
} | ||
|
||
export type RTTDecoderOpts = RTTConsoleDecoderOpts | RTTBinaryDecoderOpts | RTTGraphDecoderOpts | RTTAdvancedDecoderOpts; | ||
|
||
export interface RTTConfiguration { | ||
enabled: boolean; | ||
address: string; | ||
searchSize: number; | ||
searchId: string; | ||
clearSearch: boolean; | ||
polling_interval: number; | ||
rtt_start_retry: number; | ||
decoders: RTTDecoderOpts[]; | ||
} |
Oops, something went wrong.