Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Injectable, NgZone } from '@angular/core';
import { Observable, Subscription, fromEventPattern } from 'rxjs';
import { takeWhile } from 'rxjs/operators';
import * as dialogs from '@nativescript/core/ui/dialogs';
import { Bluetooth, Peripheral, Service, Characteristic, ReadResult } from 'nativescript-bluetooth';
const bluetooth = new Bluetooth();
bluetooth.debug = true;
export interface IPeripheral extends Peripheral {
isConnected?: boolean;
}
export interface IService extends Service {
peripheralRef?: IPeripheral; // retain a reference to the parent peripheral
}
export interface ICharacteristic extends Characteristic {
serviceRef?: IService; // retain a reference to the parent service
isExpandedView?: boolean; // toggle for view component to show/hide the read/write/notify properties
isNotifying?: boolean;
readResult?: CharOpResult;
writeResult?: CharOpResult;
writeWithoutResponseResult?: CharOpResult;
notifyResult?: CharOpResult;