UNPKG

@iotize/ionic

Version:

Iotize specific building blocks on top of @ionic/angular.

68 lines (67 loc) 2.6 kB
import { Platform } from '@ionic/angular'; import { ReplaySubject } from 'rxjs'; import { CurrentDeviceService } from '../../current-device.service'; import { TapInfoRequestService } from '../../tap-info/tap-info-request.service'; import { TapConnectionStoreItem } from './definitions'; import * as i0 from "@angular/core"; export declare function filterByConnectionTypes(filteredConnectionTypes: string[] | undefined): (values: TapConnectionStoreItem[]) => TapConnectionStoreItem[]; export declare namespace TapConnectionStoreService { interface InstanceOptions { /** * localStore key path to store connections */ localStorageKey: string; /** * MQTT related options */ mqtt: { /** * For browser app, we must connect to MQTT broker through websocket * We can specify the port to in this case. * For mobile app we use the same port configured in the Tap */ webSocket?: { port: number; }; /** * MQTT broker username to user * If not provided it will use TAP username */ username?: string; /** * MQTT broker password to user * If not provided it will try to use TAP password (if not protected) */ password?: string; }; } } /** * TODO change implementation to not trigger NFC load * Use reactive programming instead */ export declare class TapConnectionStoreService { private tapService; private infoResolver; private platform; items: TapConnectionStoreItem[]; values: ReplaySubject<TapConnectionStoreItem[]>; config: TapConnectionStoreService.InstanceOptions; constructor(tapService: CurrentDeviceService, infoResolver: TapInfoRequestService, platform: Platform); set(items: TapConnectionStoreItem[] | undefined): void; remove(item: TapConnectionStoreItem): void; /** * Try to add or refresh current stored connection info * */ storeCurrentTapConnectionInfo(): Promise<boolean>; private _createMqttProtocolFromTapInfo; private _resolveConnectionProtocols; private _resolveConnectionProtocol; addOrRefresh(newItem: Pick<TapConnectionStoreItem, 'connection' | 'config'>): void; clear(): void; saveToStorage(): void; loadFromStorage(): void; static ɵfac: i0.ɵɵFactoryDeclaration<TapConnectionStoreService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<TapConnectionStoreService>; }