import Vnmf from '../../index' declare module '../../index' { namespace onBLEPeripheralConnectionStateChanged { /** The current outer device is connected or disconnected from the recovery function of the connection event */ type Callback = ( result: CallbackResult, ) => void interface CallbackResult { /** Bluetooth equipment id */ deviceId: string /** server of UUID */ serverId: string /** Connect the current state */ connected: string } } namespace createBLEPeripheralServer { interface Option { /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.BluetoothError { /** The service side of the peripheral equipment */ server: BLEPeripheralServer } } /** The service side of the peripheral equipment * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html */ interface BLEPeripheralServer { /** Add service * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html */ addService(option: BLEPeripheralServer.addService.Option): Promise /** Close the current server * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html */ close(option: BLEPeripheralServer.close.Option): Promise /** Cancel down the connected device request to read the characteristic value event of the current peripheral device * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html */ offCharacteristicReadRequest( /** Connected device requests to read the recovery function of the characteristic value event of the current peripheral device */ callback: BLEPeripheralServer.onCharacteristicReadRequest.Callback, ): void /** Cancellation of monitoring characteristics Subscription incident * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html */ offCharacteristicSubscribed( /** The callback function of the feature subscription event */ callback: BLEPeripheralServer.onCharacteristicSubscribed.Callback, ): void /** Cancel down to listen to the elimination characteristics subscription incident * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html */ offCharacteristicUnsubscribed( /** Cancel the callback function of the feature subscription event */ callback: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback, ): void /** Cancel down the connected device request to write the characteristic value event of the current peripheral device * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html */ offCharacteristicWriteRequest( /** The connected device requests the recovery function of the characteristic value event of the current peripheral device */ callback: BLEPeripheralServer.onCharacteristicWriteRequest.Callback, ): void /** Surveying the connected device request to read the characteristic value event of the current peripheral equipment * * You need to call immediately after receiving the message [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) Write back data ,Otherwise the host will not receive a response 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html */ onCharacteristicReadRequest( /** Connected device requests to read the recovery function of the characteristic value event of the current peripheral device */ callback: BLEPeripheralServer.onCharacteristicReadRequest.Callback, ): void /** Subscribe to listening characteristics ,only iOS support * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html */ onCharacteristicSubscribed( /** The callback function of the feature subscription event */ callback: BLEPeripheralServer.onCharacteristicSubscribed.Callback, ): void /** Supervision and canceling feature subscription event ,only iOS support * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html */ onCharacteristicUnsubscribed( /** Cancel the callback function of the feature subscription event */ callback: BLEPeripheralServer.onCharacteristicUnsubscribed.Callback, ): void /** Surveying the connected device request to write the characteristic value event of the current peripheral device * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html */ onCharacteristicWriteRequest( /** The connected device requests the recovery function of the characteristic value event of the current peripheral device */ callback: BLEPeripheralServer.onCharacteristicWriteRequest.Callback, ): void /** Removal service * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html */ removeService(option: BLEPeripheralServer.removeService.Option): Promise /** Start broadcasting local peripheral equipment * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html */ startAdvertising(option: BLEPeripheralServer.startAdvertising.Option): Promise /** Stop broadcasting * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html */ stopAdvertising(option: BLEPeripheralServer.stopAdvertising.Option): Promise /** Written dual data value of the specified feature ,And notify the connected host ,The characteristic value of the machine has changed ,This interface will process whether to go back to the bag or subscribe to the subscription * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html */ writeCharacteristicValue(option: BLEPeripheralServer.writeCharacteristicValue.Option): Promise } namespace BLEPeripheralServer { namespace addService { interface Option { /** describe service of Object */ service: service /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } interface service { /** Bluetooth service UUID */ uuid: string /** characteristics List */ characteristics: characteristic[] } interface characteristic { /** characteristic of UUID */ uuid: string /** Feature support operation */ properties: properties /** Feature permissions */ permission: characteristicPermission /** The binary value corresponding to the characteristic */ value: ArrayBuffer /** Description data */ descriptors: descriptor[] } /** Feature support operation */ interface properties { /** Write * @default false */ write?: boolean /** No reply * @default false */ writeNoResponse?: boolean /** read * @default false */ read?: boolean /** subscription * @default false */ notify?: boolean /** Backpack * @default false */ indicate?: boolean } /** Feature permissions */ interface characteristicPermission { /** Readable * @default false */ readable?: boolean /** Be written * @default false */ writeable?: boolean /** Encrypted reading request * @default false */ readEncryptionRequired?: boolean /** Encrypted request * @default false */ writeEncryptionRequired?: boolean } /** Description data */ interface descriptor { /** Descriptor of UUID */ uuid: string /** The permissions of the descriptor */ permission: descriptorPermission /** Description data */ value: ArrayBuffer } /** The permissions of the descriptor */ interface descriptorPermission { /** Write * @default false */ write?: boolean /** read * @default false */ read?: boolean } } namespace close { interface Option { /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } } namespace onCharacteristicReadRequest { /** Connected device requests to read the recovery function of the characteristic value event of the current peripheral device */ type Callback = ( result: CallbackResult, ) => void interface CallbackResult { /** Bluetooth characteristics corresponding to service UUID */ serviceId: string /** Bluetooth UUID */ characteristicId: string /** Unique identification code ,transfer [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) Use */ callbackId: number } } namespace onCharacteristicSubscribed { /** The callback function of the feature subscription event */ type Callback = ( result: CallbackResult, ) => void interface CallbackResult { /** Bluetooth characteristics corresponding to service UUID */ serviceId: string /** Bluetooth UUID */ characteristicId: string } } namespace onCharacteristicUnsubscribed { /** Cancel the callback function of the feature subscription event */ type Callback = ( result: CallbackResult, ) => void interface CallbackResult { /** Bluetooth characteristics corresponding to service UUID */ serviceId: string /** Bluetooth UUID */ characteristicId: string } } namespace onCharacteristicWriteRequest { /** The connected device requests the recovery function of the characteristic value event of the current peripheral device */ type Callback = ( result: CallbackResult, ) => void interface CallbackResult { /** Bluetooth characteristics corresponding to service UUID */ serviceId: string /** Bluetooth UUID */ characteristicId: string /** Unique identification code ,transfer [writeCharacteristicValue](/docs/apis/device/bluetooth-peripheral/BLEPeripheralServer#writecharacteristicvalue) Use */ callbackId: number /** Binary data value of request writing feature */ value: ArrayBuffer } } namespace removeService { interface Option { /** service of UUID */ serviceId: string /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } } namespace startAdvertising { interface Option { /** Broadcast custom parameter */ advertiseRequest: advertiseRequest /** Broadcast power * @default "medium" */ powerLevel?: keyof PowerLevel /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } /** Broadcast custom parameter */ interface advertiseRequest { /** Whether the current device is connected * @default true */ connectable?: boolean /** Broadcast deviceName Field ,By default, empty * @default "" */ deviceName?: string /** Service to broadcast UUID List 。use 16/32 Position UUID Please refer to the precautions 。 */ serviceUuids?: string[] /** Broadcast manufacturer information 。Only Android support ,iOS Unable to customize due to system restrictions 。 */ manufacturerData?: manufacturerData[] /** by beacon The parameters of the equipment form broadcast 。 */ beacon?: beacon } /** Broadcast manufacturer information 。Only Android support ,iOS Unable to customize due to system restrictions 。 */ interface manufacturerData { /** manufacturer ID,0x Sixteen in the beginning */ manufacturerId: string /** Manufacturer information */ manufacturerSpecificData?: ArrayBuffer } /** by beacon The parameters of the equipment form broadcast 。 */ interface beacon { /** Beacon Device broadcast UUID */ uuid: string /** Beacon Device ID */ major: number /** Beacon Equipment ID */ minor: number /** Used to judge distance equipment 1 Meter RSSI Small reference value */ measuredPower?: number } /** Broadcast power legal value */ interface PowerLevel { /** Low power */ low /** Moderate power */ medium /** High power */ high } } namespace stopAdvertising { interface Option { /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } } namespace writeCharacteristicValue { interface Option { /** Bluetooth characteristics corresponding to service UUID */ serviceId: string /** Bluetooth UUID */ characteristicId: string /** characteristic Corresponding binary value */ value: ArrayBuffer /** Do you need to notify the host value updated */ needNotify: boolean /** Optional ,Use when processing backpack */ callbackId?: number /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.BluetoothError) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.BluetoothError) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.BluetoothError) => void } } } interface VnmfStatic { /** Supervisor the current peripheral device is connected or disconnected to connect events * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html */ onBLEPeripheralConnectionStateChanged( /** Supervisor the current peripheral device is connected or disconnected to connect events */ callback: onBLEPeripheralConnectionStateChanged.Callback, ): void /** Cancel down the current peripheral device being connected or disconnected to connect events * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html */ offBLEPeripheralConnectionStateChanged( /** The current outer device is connected or disconnected from the recovery function of the connection event */ callback: onBLEPeripheralConnectionStateChanged.Callback, ): void /** Establish a server of local as a Bluetooth low -power peripheral equipment ,Can create multiple * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html */ createBLEPeripheralServer( option: createBLEPeripheralServer.Option, ): Promise } }