// 实例状态枚举
|
export enum InstanceStatus {
|
Stopped = 'Stopped',
|
Starting = 'Starting',
|
Running = 'Running',
|
Stopping = 'Stopping',
|
Error = 'Error'
|
}
|
|
// PLC 型号枚举
|
export enum SiemensPLCType {
|
S7200Smart = 'S7200Smart',
|
S71200 = 'S71200',
|
S71500 = 'S71500',
|
S7300 = 'S7300',
|
S7400 = 'S7400'
|
}
|
|
// 内存区域配置
|
export interface MemoryRegionConfig {
|
mRegionSize: number
|
dbBlockCount: number
|
dbBlockNumbers: number[]
|
dbBlockSize: number
|
iRegionSize: number
|
qRegionSize: number
|
tRegionCount: number
|
cRegionCount: number
|
}
|
|
// 实例配置
|
export interface InstanceConfig {
|
id: string
|
name: string
|
plcType: SiemensPLCType
|
port: number
|
activationKey: string
|
autoStart: boolean
|
protocolTemplateId: string
|
memoryConfig: MemoryRegionConfig
|
}
|
|
// 客户端连接信息
|
export interface ClientConnection {
|
endpoint: string
|
connectTime: string
|
lastActivityTime: string
|
}
|
|
// 实例状态
|
export interface InstanceState {
|
instanceId: string
|
name: string
|
plcType: string
|
port: number
|
status: InstanceStatus
|
clientCount: number
|
totalRequests: number
|
startTime: string | null
|
lastActivityTime: string | null
|
errorMessage: string | null
|
}
|
|
// 实例列表项
|
export interface InstanceListItem {
|
instanceId: string
|
name: string
|
plcType: string
|
port: number
|
status: string
|
clientCount: number
|
totalRequests: number
|
startTime: string | null
|
lastActivityTime: string | null
|
errorMessage: string | null
|
}
|
|
// 创建实例输入
|
export interface CreateInstanceInput {
|
id: string
|
name: string
|
plcType: SiemensPLCType
|
port: number
|
activationKey?: string
|
autoStart: boolean
|
mRegionSize: number
|
dbBlockCount: number
|
dbBlockNumbers: number[]
|
dbBlockSize: number
|
iRegionSize: number
|
qRegionSize: number
|
tRegionCount: number
|
cRegionCount: number
|
}
|
|
export type ProtocolDataType = 'Byte' | 'Int' | 'DInt' | 'String' | 'Bool'
|
export type ProtocolFieldDirection = 'WcsToPlc' | 'PlcToWcs' | 'Bidirectional'
|
|
export interface ProtocolFieldMapping {
|
fieldKey: string
|
dbNumber: number
|
offset: number
|
bit?: number
|
dataType: ProtocolDataType
|
length: number
|
direction: ProtocolFieldDirection
|
}
|
|
export interface ProtocolTemplate {
|
id: string
|
name: string
|
version: string
|
fields: ProtocolFieldMapping[]
|
}
|
|
export interface RobotClientStartRequest {
|
serverId: string
|
listenIp: string
|
listenPort: number
|
localPort: number
|
}
|
|
export interface RobotClientSendRequest {
|
serverId: string
|
clientId?: number | null
|
message: string
|
}
|
|
export interface RobotClientStatusItem {
|
clientId: number
|
remoteEndPoint: string | null
|
connected: boolean
|
connectedAt: string | null
|
lastReceivedMessage: string | null
|
lastError: string | null
|
lastReceivedAt: string | null
|
lastSentAt: string | null
|
}
|
|
export interface RobotServerReceivedMessageItem {
|
receivedAt: string
|
clientId: number
|
remoteEndPoint: string | null
|
message: string
|
}
|
|
export interface RobotServerSentMessageItem {
|
sentAt: string
|
clientId: number
|
remoteEndPoint: string | null
|
message: string
|
}
|
|
export interface RobotServerStatusItem {
|
serverId: string
|
running: boolean
|
listenIp: string
|
listenPort: number
|
localPort: number
|
connectedCount: number
|
clients: RobotClientStatusItem[]
|
receivedMessages: RobotServerReceivedMessageItem[]
|
sentMessages: RobotServerSentMessageItem[]
|
}
|
|
export interface RobotClientStatusResponse {
|
runningServerCount: number
|
servers: RobotServerStatusItem[]
|
}
|