UNPKG

1.55 kBTypeScriptView Raw
1import { MacAddress } from "../../types";
2/**
3 * IdentifierCache is a model class that manages a system of associating HAP "Accessory IDs" and "Instance IDs"
4 * with other values that don't usually change. HomeKit Clients use Accessory/Instance IDs as a primary key of
5 * sorts, so the IDs need to remain "stable". For instance, if you create a HomeKit "Scene" called "Leaving Home"
6 * that sets your Alarm System's "Target Alarm State" Characteristic to "Arm Away", that Scene will store whatever
7 * "Instance ID" it was given for the "Target Alarm State" Characteristic. If the ID changes later on this server,
8 * the scene will stop working.
9 * @group Model
10 */
11export declare class IdentifierCache {
12 username: MacAddress;
13 _cache: Record<string, number>;
14 _usedCache: Record<string, number> | null;
15 _savedCacheHash: string;
16 constructor(username: MacAddress);
17 startTrackingUsage(): void;
18 stopTrackingUsageAndExpireUnused(): void;
19 getCache(key: string): number;
20 setCache(key: string, value: number): number;
21 getAID(accessoryUUID: string): number;
22 getIID(accessoryUUID: string, serviceUUID: string, serviceSubtype?: string, characteristicUUID?: string): number;
23 getNextAID(): number;
24 getNextIID(accessoryUUID: string): number;
25 save(): void;
26 /**
27 * Persisting to File System
28 */
29 static persistKey(username: MacAddress): string;
30 static load(username: MacAddress): IdentifierCache | null;
31 static remove(username: MacAddress): void;
32}
33//# sourceMappingURL=IdentifierCache.d.ts.map
\No newline at end of file