-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
I made some types for this library. Not sure if they're 100% correct but hopefully they'll be useful.
declare module 'react-native-zebra-bluetooth-printer' {
export type ScanResult = {
found: string;
paired: string;
};
export type BluetoothDevice = {
address: string;
name: string;
state: 'not-connected' | 'connected';
};
export type PairedBluetoothDevice = {
address: string;
class: number;
name: string;
type: 'paired';
};
/**
* Checks the status of the bluetooth service of the device.
* @returns true if already enabled, false if not enabled.
*/
export function isEnabledBluetooth(): Promise<boolean>;
/**
* Android: Requests for bluetooth on/off permission on the android device.
*
* iOS: Resolves to nil.
* */
export function enableBluetooth(): Promise<undefined>;
/**
* Android: Disables bluetooth if bluetooth is switched on.
*
* iOS: Resolves to nil.
*/
export function disableBluetooth(): Promise<undefined>;
/**
* Scans for available nearby bluetooth devices for a specific period of time.
* @returns Android: JSON string; iOS: ScanResult object
*/
export function scanDevices(): Promise<ScanResult | string>;
/**
* Android: Returns already paired devices.
*
* iOS: Resolves to nil.
*/
export function pairedDevices(): Promise<PairedBluetoothDevice[]>;
/**
* Connects to a device using the given address
* @param address The address of the device
*/
export function connectDevice(address: string): Promise<undefined>;
/**
* Android only: Unpairs/disconnects a paired device.
* @param address The address of the device
*/
export function unpairDevice(address: string): Promise<undefined>;
/**
* iOS only: Sends the zpl to the paired printer
* @param zpl The zpl to send to the printer
*/
export function print(zpl: string): Promise<boolean>;
/**
* Android only: Sends the zpl to the device with the given address
* @param address The address of the printer
* @param zpl The zpl to send to the printer
*/
export function print(address: string, zpl: string): Promise<boolean>;
}andrepaulo-bit and dhodges47
Metadata
Metadata
Assignees
Labels
No labels