You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
4.6 KiB
188 lines
4.6 KiB
// 开始、停止绘制
|
|
export type TaskState = {
|
|
messageType: "EVENT";
|
|
data:
|
|
| "START_RECORD_SIG"
|
|
| "END_RECORD_SIG"
|
|
| "FINISHED"
|
|
| "START_RECORD_LEFT"
|
|
| "FINISH_RECORD_RIGHT"
|
|
| "FINISH_RECORD"
|
|
| "FINISH_RECORD_LEFT"
|
|
| "END_RECORD_SIG"
|
|
| "END_RECORD"
|
|
| "START_RECORD_RIGHT"
|
|
| "WRONG_SIDE"
|
|
| "WAITING_FOR_RECORD_THE_1ST_SIDE"
|
|
| "WAITING_FOR_RECORD_THE_2ND_SIDE"
|
|
// data: {
|
|
// event: "START_RECORD_SIG" | "END_RECORD_SIG" | "FINISHED" | "START_RECORD_LEFT" | "FINISH_RECORD_RIGHT" | "FINISH_RECORD" | "FINISH_RECORD_LEFT" | "END_RECORD_SIG" | "END_RECORD" | "START_RECORD_RIGHT";
|
|
// };
|
|
path: "/api/measurement-task/event";
|
|
};
|
|
|
|
// 连续上报坐标点
|
|
export type TrackRecordSig = {
|
|
messageType: "STATE";
|
|
data: {
|
|
x: number;
|
|
y: number;
|
|
};
|
|
path: "/api/measurement-task/point-report";
|
|
};
|
|
|
|
type Points = {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
|
|
type MeasureResult = {
|
|
outline1: Points[];
|
|
outline2: Points[];
|
|
}
|
|
|
|
// 测量结果
|
|
export type ResultRecordData = {
|
|
messageType: "EVENT";
|
|
// data: {
|
|
// outline1: Points[];
|
|
// outline2: Points[];
|
|
// };
|
|
data: []
|
|
path: "/api/measurement-task/measure-finished";
|
|
};
|
|
|
|
export const defaultContext: ContextMessage["data"] = {
|
|
loginFlag: true,
|
|
loginUser: {
|
|
id: 3, //数据主键id
|
|
account: "test001", //用户账户
|
|
nickname: "测试账户001", //用户昵称
|
|
userRole: "User", //用户角色,可用值:User,Admin,Dev
|
|
isBuiltInUser: false, //是否内置用户(内置用户不可删除)
|
|
},
|
|
};
|
|
|
|
// 上下文状态
|
|
export type ContextMessage = {
|
|
messageType: "DeviceContext";
|
|
data: {
|
|
loginFlag: Boolean;
|
|
loginUser: Partial<{
|
|
id: number;
|
|
account: string;
|
|
nickname: string;
|
|
password: string;
|
|
userRole: "Admin" | "User" | "Dev";
|
|
isBuiltInUser: boolean;
|
|
}>;
|
|
};
|
|
path: "/api/deviceContext";
|
|
};
|
|
|
|
export type loginUser = Partial<{
|
|
id: 3; //数据主键id
|
|
account: "test001"; //用户账户
|
|
nickname: "测试账户001"; //用户昵称
|
|
userRole: "User"; //用户角色,可用值:User,Admin,Dev
|
|
isBuiltInUser: false; //是否内置用户(内置用户不可删除)
|
|
}>;
|
|
|
|
export const taskStatusDescMap: { [k in MeasureState["data"]["taskStatus"]]: string } = {
|
|
IDLE: "空闲",
|
|
MEASURING: "测量中",
|
|
WAITING_FOR_MEASURING: "等待测量",
|
|
FINISHED: "测量完成",
|
|
START_RECORD_LEFT: "",
|
|
FINISH_RECORD_RIGHT: "",
|
|
FINISH_RECORD: "",
|
|
FINISH_RECORD_LEFT: "",
|
|
END_RECORD_SIG: "",
|
|
END_RECORD: "",
|
|
START_RECORD_RIGHT: "",
|
|
};
|
|
// 测量任务状态
|
|
export type MeasureState = {
|
|
messageType: "STATE";
|
|
data: {
|
|
taskStatus:
|
|
| "IDLE"
|
|
| "MEASURING"
|
|
| "WAITING_FOR_MEASURING"
|
|
| "FINISHED"
|
|
| "START_RECORD_LEFT"
|
|
| "FINISH_RECORD_RIGHT"
|
|
| "FINISH_RECORD"
|
|
| "FINISH_RECORD_LEFT"
|
|
| "END_RECORD_SIG"
|
|
| "END_RECORD"
|
|
| "START_RECORD_RIGHT";
|
|
measureSideCnt: 0 | 1 | 2; //已测量数量,0,1,2 最多两边(左边和右边)
|
|
isMeasuringLeftEnd: boolean; //测量左侧完成
|
|
isMeasuringRightEnd: boolean; //测量右侧完成
|
|
motionlessSigFlag: boolean; //滑轮质心是否静止
|
|
inStartMeasuringPos: boolean; //是否在允许开始测量的位置
|
|
isWrongSide: boolean; //测量方向是错误的
|
|
// profileRecordDescription: null; //用户填写的新测量信息
|
|
};
|
|
path: "/api/measurement-task/get-task-state";
|
|
};
|
|
|
|
export const defaultMeasureState = {
|
|
taskStatus: "IDLE",
|
|
measureSideCnt: 0, //已测量数量,0,1,2 最多两边(左边和右边)
|
|
isMeasuringLeftEnd: false, //测量左侧完成
|
|
isMeasuringRightEnd: false, //测量右侧完成
|
|
motionlessSigFlag: true, //滑轮质心是否静止
|
|
inStartMeasuringPos: true, //是否在允许开始测量的位置
|
|
};
|
|
|
|
export type ChannelMessage = {
|
|
messageType: "STATE";
|
|
data: {
|
|
isConnect: boolean;
|
|
connectPort: string;
|
|
sn: string;
|
|
descriptivePortName: string;
|
|
};
|
|
path: "/api/subdevice/uartchanel/get-channel-state";
|
|
};
|
|
|
|
export type DeviceStatus = {
|
|
messageType: "STATE";
|
|
data: {
|
|
isConnected: boolean; //是否链接
|
|
connectedType: "UART_CHANNEL" | "BLE_CHANNEL";
|
|
sn: string;
|
|
power: number; //电量
|
|
inclinatorX: number; //x轴倾斜
|
|
inclinatorY: number; //y轴倾斜
|
|
temperature: number; //温度
|
|
state: number;
|
|
flag: number
|
|
};
|
|
path: "/api/profiler-state/get-state";
|
|
};
|
|
|
|
|
|
export type ProgressStatus = {
|
|
messageType: "SYNC";
|
|
data: {
|
|
progress: number; //同步进度
|
|
message: string; //消息
|
|
success: boolean;//同步状态
|
|
};
|
|
path: "/get-task-progress";
|
|
};
|
|
|
|
export type bleStatus = {
|
|
messageType: "STATE";
|
|
data: {
|
|
name: string;
|
|
address: string;
|
|
connect: boolean;
|
|
};
|
|
path: "/api/ble/ble-list";
|
|
};
|
|
|
|
export type Datagram = TrackRecordSig | TaskState | ContextMessage | MeasureState | ChannelMessage | DeviceStatus | ProgressStatus | ResultRecordData;
|