Files
buzzer_2/webpage/src/lib/protocol/constants.ts
2026-03-21 13:49:05 +01:00

68 lines
1.7 KiB
TypeScript

export const BLE = {
SERVICE_UUID: "e517d988-bab5-4574-8479-97c6cb115ca0",
RX_UUID: "e517d988-bab5-4574-8479-97c6cb115ca1",
TX_UUID: "e517d988-bab5-4574-8479-97c6cb115ca2"
};
export const FRAME = {
REQUEST: 0x00,
RESPONSE: 0x10,
ACK: 0x11,
ERROR: 0x12,
SUCCESS: 0x13,
FILE_START: 0x20,
FILE_CHUNK: 0x21,
FILE_END: 0x22,
LS_START: 0x40,
LS_ENTRY: 0x41,
LS_END: 0x42,
};
export const DATA = {
PROTO_INFO: 0x01,
DEVICE_INFO: 0x02,
FS_INFO: 0x03,
FW_INFO: 0x04,
FILE_GET: 0x20,
FILE_PUT: 0x21,
TAGS_GET: 0x22,
TAGS_PUT: 0x23,
LS: 0x40
};
export const FS_ENTRY_TYPE = {
FILE: 0x00,
DIR: 0x01,
}
export interface ZephyrError {
text: string;
zephyr: string;
}
export const ZEPHYR_ERRORS: Record<number, ZephyrError> = {
1: { text: "Fehlende Berechtigung", zephyr: "EPERM" },
2: { text: "Datei oder Verzeichnis nicht gefunden", zephyr: "ENOENT" },
5: { text: "Ein-/Ausgabefehler auf dem Flash", zephyr: "EIO" },
12: { text: "Nicht genügend Speicher frei", zephyr: "ENOMEM" },
16: { text: "Gerät oder Ressource belegt", zephyr: "EBUSY" },
22: { text: "Ungültiges Argument oder Parameter", zephyr: "EINVAL" },
24: { text: "Zu viele offene Dateien", zephyr: "EMFILE" },
28: { text: "Kein freier Speicherplatz mehr", zephyr: "ENOSPC" },
36: { text: "Dateiname oder Pfad zu lang", zephyr: "ENAMETOOLONG" },
88: { text: "Funktion im Buzzer nicht implementiert", zephyr: "ENOSYS" },
134: { text: "Operation nicht unterstützt", zephyr: "ENOTSUP" }
};
export const FW_STATUS = {
CONFIRMED: 0x00,
PENDING: 0x01,
TESTING: 0x02,
UNKNOWN: 0xFF,
}