import { JDBus } from "./bus"; import { JDService } from "./service"; import { JDClient } from "./client"; export declare function escapeRoleName(role: string): string; /** * A binding from a name to a service * @category Roles */ export interface RoleBinding { role: string; serviceClass: number; preferredDeviceId?: string; preferredServiceIndex?: number; } export interface LiveRoleBinding extends RoleBinding { service?: JDService; } /** * A role manager * @category Roles */ export declare class RoleManager extends JDClient { private readonly _roles; /** * Gets the bus for this role */ readonly bus: JDBus; constructor(bus: JDBus, configuration?: RoleBinding[]); /** * Indicates if all roles are bound. */ get isBound(): boolean; /** * Gets the list of roles tracked by the manager */ roles(bound?: boolean): LiveRoleBinding[]; /** * Saves roles status * @returns */ saveRoles(): RoleBinding[]; private get hash(); /** * Updates the list of roles * @param newRoles */ updateRoles(newRoles: RoleBinding[]): void; /** * Resolves the service bound to a given role. * @param role * @returns */ service(role: string): JDService; /** * Updates or creates a new role * @param role name of the role * @param serviceClass desired service class * @param preferredDeviceId optional preferred device id * @returns */ updateRole(role: string, serviceClass: number, preferredDeviceId?: string, preferredServiceIndex?: number): void; private emitBoundEvents; private bindRole; private bindServices; private addServices; private removeServices; toString(): string; } /** * Tracks a set of roles * @param bus bus hosting the devices * @param bindings map of role names to device service pairs * @param onUpdate callback to run whenver role assignments change * @param options Additional options * @returns A unsubscribe callback to cleanup handlers * @category Roles */ export declare function startRoles>(bus: JDBus, bindings: TRoles, onUpdate: (roles: Record) => void, options?: { /** * Calls update even if not all role around bound */ incomplete?: boolean; }): () => void; //# sourceMappingURL=rolemanager.d.ts.map