import type { BLEConfig, ProtocolConfig, ImageConfig } from "./config.ts"; import { CMD_TYPE } from "../constants.ts"; import { PacketType } from "../packet-types.ts"; /** * Default BLE configuration for BeamBox devices * * Standard settings for connecting to the beambox e-Badge Pulse device. * TODO: Support other BeamBox models in the future. */ export const DEFAULT_BLE_CONFIG: BLEConfig = { deviceName: "beambox e-Badge Pulse", writeCharacteristicUUID: "000001f1-0000-1000-8000-00805f9b34fb", notifyCharacteristicUUID: "000001f2-0000-1000-8000-00805f9b34fb", scanTimeout: 10.0, }; /** * Default protocol configuration for data transmission * * Optimized timing and size values for reliable communication with the device. * * Values based on packet capture analysis: * - chunkSize: 0x1F0 (496 bytes) - max payload size observed * - imageInfoChunkSize: 0x14 (20 bytes) - size of `{"type":6,"number":1}` * - packetDelay: 0.1s - prevents overwhelming device buffer * - imageInfoDelay: 0.01s - gives device time to prepare * - packetAckTimeout: 2.0s - reasonable wait for response * - maxPacketCount: 20000 - seem to be the app limit * - maxPayloadSize: 2MB - seem to be the app limit */ export const DEFAULT_PROTOCOL_CONFIG: ProtocolConfig = { cmdType: CMD_TYPE, cmdSubtype: PacketType.IMAGE, chunkSize: 0x1f0, imageInfoChunkSize: 0x14, packetDelay: 0.1, imageInfoDelay: 0.01, packetAckTimeout: 2.0, maxPacketCount: 20000, maxPayloadSize: 2 * 1024 * 1024, }; /** * Default image processing configuration * * Standard settings for processing images for the BeamBox display. * * - defaultSize: [368, 368] - device native resolution for static images * - animationsSize: [360, 360] - frame resolution for animations (Type 5) * - jpegQuality: 80 - quality for static images (animations use 75) * - jpegOptimize: true - enable optimization for smaller files * - checkerboardSquares: 8 - for test pattern generation */ export const DEFAULT_IMAGE_CONFIG: ImageConfig = { defaultSize: [368, 368], animationsSize: [360, 360], jpegQuality: 80, jpegOptimize: true, checkerboardSquares: 8, };