/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ChannelType, ImplementationError } from "#general";
class BlenoPeripheralInterface {
  constructor(blenoServer) {
    this.blenoServer = blenoServer;
  }
  onData(listener) {
    this.blenoServer.setMatterMessageListener(listener);
    return {
      close: async () => await this.close()
    };
  }
  openChannel() {
    throw new ImplementationError("Outbound connections are not supported on peripheral interfaces");
  }
  async close() {
    await this.blenoServer.close();
  }
  supports(type, address) {
    if (type === ChannelType.BLE) {
      return true;
    }
    if (address === void 0) {
      return true;
    }
    return this.blenoServer.clientAddress === address;
  }
  advertise(advertiseData, additionalAdvertisementData, interval) {
    return this.blenoServer.advertise(advertiseData, additionalAdvertisementData, interval);
  }
  stopAdvertising() {
    return this.blenoServer.stopAdvertising();
  }
}
export {
  BlenoPeripheralInterface
};
//# sourceMappingURL=BlenoPeripheralInterface.js.map
