{"version":3,"sources":["../src/profiles/battery.ts"],"names":["BatteryProfile","BaseProfile","dv","readUint8","callback"],"mappings":"0EA8BO,IAAMA,EAAN,cAA6BC,CAAY,CAAzC,WAAA,EAAA,CAAA,KAAA,CAAA,GAAA,SAAA,CAAA,CACL,KAAmB,OAAA,CAAU,kBAAA,CAG7B,MAAM,SAAA,EAA6B,CACjC,IAAMC,CAAAA,CAAK,MAAM,IAAA,CAAK,IAAA,CAAK,eAAe,CAAA,CAC1C,OAAOC,CAAAA,CAAUD,CAAE,CACrB,CAGA,aAAA,CAAcE,EAA+C,CAC3D,OAAO,KAAK,SAAA,CAAU,eAAA,CAAkBF,CAAAA,EAAO,CAC7CE,EAASD,CAAAA,CAAUD,CAAE,CAAC,EACxB,CAAC,CACH,CACF","file":"chunk-XI3VH4LR.mjs","sourcesContent":["import { readUint8 } from '../dataview-helpers';\nimport { BaseProfile } from './base';\n\n/**\n * BLE Battery Service profile (UUID 0x180F).\n *\n * Reads and subscribes to the Battery Level characteristic (0x2A19),\n * which reports the current charge level as a percentage (0--100).\n *\n * @example\n * ```ts\n * import { BatteryProfile } from '@beacio/core/profiles';\n *\n * const battery = new BatteryProfile(device);\n * await battery.connect();\n *\n * // One-shot read\n * const level = await battery.readLevel();\n * console.log(`Battery: ${level}%`);\n *\n * // Subscribe to level changes\n * const unsubscribe = battery.onLevelChange((level) => {\n *   console.log(`Battery changed: ${level}%`);\n * });\n *\n * // Clean up\n * unsubscribe();\n * battery.stop();\n * ```\n */\nexport class BatteryProfile extends BaseProfile {\n  protected readonly service = 'battery_service';\n\n  /** Read current battery level (0-100). */\n  async readLevel(): Promise<number> {\n    const dv = await this.read('battery_level');\n    return readUint8(dv);\n  }\n\n  /** Subscribe to battery level changes. Returns unsubscribe function. */\n  onLevelChange(callback: (level: number) => void): () => void {\n    return this.subscribe('battery_level', (dv) => {\n      callback(readUint8(dv));\n    });\n  }\n}\n"]}