SimpleBLE Peripheral.

interface Peripheral {
    address: string;
    addressType: AddressType;
    connectable: boolean;
    connected: boolean;
    identifier: string;
    manufacturerData: Record<string, Uint8Array>;
    mtu: number;
    paired: boolean;
    rssi: number;
    services: Service[];
    txPower: number;
    connect(): boolean;
    disconnect(): boolean;
    indicate(service: string, characteristic: string, cb: ((data: Uint8Array) => void)): boolean;
    notify(service: string, characteristic: string, cb: ((data: Uint8Array) => void)): boolean;
    read(service: string, characteristic: string): Uint8Array;
    readDescriptor(service: string, characteristic: string, descriptor: string): Uint8Array;
    setCallbackOnConnected(cb: (() => void)): boolean;
    setCallbackOnDisconnected(cb: (() => void)): boolean;
    unpair(): boolean;
    unsubscribe(service: string, characteristic: string): boolean;
    writeCommand(service: string, characteristic: string, data: Uint8Array): boolean;
    writeDescriptor(service: string, characteristic: string, descriptor: string, data: Uint8Array): boolean;
    writeRequest(service: string, characteristic: string, data: Uint8Array): boolean;
}

Properties

address: string
addressType: AddressType
connectable: boolean
connected: boolean
identifier: string
manufacturerData: Record<string, Uint8Array>
mtu: number
paired: boolean
rssi: number
services: Service[]
txPower: number

Methods

  • Parameters

    • service: string
    • characteristic: string
    • cb: ((data: Uint8Array) => void)
        • (data): void
        • Parameters

          • data: Uint8Array

          Returns void

    Returns boolean

  • Parameters

    • service: string
    • characteristic: string
    • cb: ((data: Uint8Array) => void)
        • (data): void
        • Parameters

          • data: Uint8Array

          Returns void

    Returns boolean

  • Parameters

    • service: string
    • characteristic: string

    Returns Uint8Array

  • Parameters

    • service: string
    • characteristic: string
    • descriptor: string

    Returns Uint8Array

  • Parameters

    • service: string
    • characteristic: string

    Returns boolean

  • Parameters

    • service: string
    • characteristic: string
    • data: Uint8Array

    Returns boolean

  • Parameters

    • service: string
    • characteristic: string
    • descriptor: string
    • data: Uint8Array

    Returns boolean

  • Parameters

    • service: string
    • characteristic: string
    • data: Uint8Array

    Returns boolean