@iotize/ionic
Version:
Iotize specific building blocks on top of @ionic/angular.
74 lines (73 loc) • 2.85 kB
TypeScript
import { Tap } from '@iotize/tap';
import { EncryptionOptions } from '@iotize/tap/auth';
import { Observable, Subscriber } from 'rxjs';
import { CurrentDeviceService } from './current-device.service';
import { ProtocolMeta } from './extensions/protocol-info';
import { ProtocolFactoryService } from './protocol-factory.service';
import * as i0 from "@angular/core";
export declare const TAP_CONNECTION_OPTIONS_PROVIDER = "TapConnectionOptions";
export declare enum TapRegisterProtocolsMethod {
/**
* Only register altertive protocol when connecting with nfc using ndef
*/
NDEF_ONLY = "NDEF_ONLY",
/**
* Register alternative protocols using NDEF if present or service if not
*/
NDEF_OR_SERVICE = "NDEF_OR_SERVICE",
/**
* Register alternative protocols using service (even if ndef is available)
*/
SERVICE_ONLY = "SERVICE_ONLY"
}
export interface TapConnectionOptions {
/**
* Set to true if you want to automatically connect with a long range protocol when connecting with NFC
*/
switchProtocol?: boolean;
/**
* Configure register alternative protocol method when we are connection to the tap
* This will performs additional requests leading to a slower connection
*/
registerProtocolsMethod?: TapRegisterProtocolsMethod | false;
/**
* Set to true to refresh session state after connection
*/
refreshSessionState?: boolean;
/**
* True to perform NFC pairing on connection
*/
nfcPairing?: boolean;
/**
* Encryption keys for tap initialization
*/
encryption?: EncryptionOptions;
/**
* Start keep alive (if true or undefined)
* If false, keep alive is not started
* If true, it is started with default period
* If number > 0 this is the keep alive period to use in milliseconds
*/
keepAlive?: boolean | number;
}
export interface ConnectionEvent {
message: string;
tap: Tap;
}
/**
* User can the replace with its own service
*/
export declare class TapConnectionService {
private tapService;
private protocolFactory;
private tapFactory;
constructor(tapService: CurrentDeviceService, protocolFactory: ProtocolFactoryService);
/**
* Create a Tap connection Observable shared stream
*/
connect(meta: ProtocolMeta, config: TapConnectionOptions): Observable<ConnectionEvent>;
createConnectionObservable(protocolMeta: ProtocolMeta, config: TapConnectionOptions, emitter: Subscriber<ConnectionEvent>): Observable<Tap>;
registerAlternativeProtocols(registerAlternativeProtocolMethod: TapRegisterProtocolsMethod | false | undefined, initialProtocolMeta: ProtocolMeta): Promise<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<TapConnectionService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TapConnectionService>;
}