m2-inno-bedpressure/app/api/sensors/config/route.ts
2025-06-21 12:09:47 +07:00

52 lines
No EOL
1.9 KiB
TypeScript

import { NextResponse } from 'next/server';
// Sensor configuration that matches the API route
const SENSOR_CONFIG = [
// Head area
{ id: "head-1", x: 45, y: 15, zone: "head", label: "Head Left", pin: 2 },
{ id: "head-2", x: 55, y: 15, zone: "head", label: "Head Right", pin: 3 },
// Shoulder area
{ id: "shoulder-1", x: 35, y: 25, zone: "shoulders", label: "Left Shoulder", pin: 4 },
{ id: "shoulder-2", x: 65, y: 25, zone: "shoulders", label: "Right Shoulder", pin: 5 },
// Upper back
{ id: "back-1", x: 40, y: 35, zone: "back", label: "Upper Back Left", pin: 6 },
{ id: "back-2", x: 50, y: 35, zone: "back", label: "Upper Back Center", pin: 7 },
{ id: "back-3", x: 60, y: 35, zone: "back", label: "Upper Back Right", pin: 8 },
// Lower back/Hip area
{ id: "hip-1", x: 35, y: 50, zone: "hips", label: "Left Hip", pin: 9 },
{ id: "hip-2", x: 50, y: 50, zone: "hips", label: "Lower Back", pin: 10 },
{ id: "hip-3", x: 65, y: 50, zone: "hips", label: "Right Hip", pin: 11 },
// Thigh area
{ id: "thigh-1", x: 40, y: 65, zone: "legs", label: "Left Thigh", pin: 12 },
{ id: "thigh-2", x: 60, y: 65, zone: "legs", label: "Right Thigh", pin: 13 },
// Calf area (mock data)
{ id: "calf-1", x: 40, y: 75, zone: "legs", label: "Left Calf" },
{ id: "calf-2", x: 60, y: 75, zone: "legs", label: "Right Calf" },
// Feet (mock data)
{ id: "feet-1", x: 45, y: 85, zone: "feet", label: "Left Foot" },
{ id: "feet-2", x: 55, y: 85, zone: "feet", label: "Right Foot" },
];
export async function GET() {
try {
return NextResponse.json({
success: true,
sensors: SENSOR_CONFIG,
timestamp: new Date().toISOString()
});
} catch (error) {
console.error('Sensor config API error:', error);
return NextResponse.json({
success: false,
error: 'Failed to get sensor configuration',
sensors: [],
timestamp: new Date().toISOString()
}, { status: 500 });
}
}