- Complete Next.js 14 app with TypeScript and Tailwind CSS - ESP32 serial communication via API routes - Real-time UWB positioning visualization - Interactive 2D warehouse mapping with Canvas - Device connection interface with auto-detection - AT command parsing for UWBHelper library integration - Clean project structure with comprehensive documentation
67 lines
No EOL
1.3 KiB
TypeScript
67 lines
No EOL
1.3 KiB
TypeScript
// UWB Device Data Types (from ESP32 project context)
|
|
|
|
export interface DeviceData {
|
|
deviceId: number;
|
|
distance: number;
|
|
rssi: number;
|
|
lastUpdate: number;
|
|
active: boolean;
|
|
}
|
|
|
|
export interface AnchorPosition {
|
|
anchorId: number;
|
|
x: number;
|
|
y: number;
|
|
confidence: number;
|
|
valid: boolean;
|
|
}
|
|
|
|
export interface RangeResult {
|
|
tagId: number;
|
|
mask: number;
|
|
sequence: number;
|
|
ranges: number[]; // 8 elements
|
|
rssi: number[]; // 8 elements
|
|
anchorIds: number[]; // 8 elements
|
|
timer: number;
|
|
timerSys: number;
|
|
}
|
|
|
|
export interface TagPosition {
|
|
x: number;
|
|
y: number;
|
|
timestamp: number;
|
|
confidence: number;
|
|
}
|
|
|
|
// Configuration constants from ESP32 project
|
|
export const UWB_CONFIG = {
|
|
MAX_ANCHORS: 8,
|
|
UWB_TAG_COUNT: 64,
|
|
NETWORK_ID: 1234,
|
|
DEVICE_TIMEOUT: 5000,
|
|
BAUD_RATE: 115200,
|
|
DATA_RATE: 1, // 6.8Mbps
|
|
RANGE_FILTER: 1
|
|
} as const;
|
|
|
|
// Serial data parsing types
|
|
export interface SerialData {
|
|
type: 'range' | 'config' | 'status';
|
|
raw: string;
|
|
parsed?: RangeResult | DeviceData[];
|
|
timestamp: number;
|
|
}
|
|
|
|
// File upload types for offline analysis
|
|
export interface PositioningSession {
|
|
rawData: RangeResult[];
|
|
anchors: AnchorPosition[];
|
|
tagPath: TagPosition[];
|
|
sessionInfo: {
|
|
startTime: number;
|
|
endTime: number;
|
|
duration: number;
|
|
totalPoints: number;
|
|
};
|
|
} |