diff --git a/packages/transport-native-ble/src/api/bleApi.ts b/packages/transport-native-ble/src/api/bleApi.ts index ef16dc6e005..29419e02690 100644 --- a/packages/transport-native-ble/src/api/bleApi.ts +++ b/packages/transport-native-ble/src/api/bleApi.ts @@ -7,7 +7,7 @@ import { DEVICE_TYPE, } from '@trezor/transport/src/api/abstract'; import * as ERRORS from '@trezor/transport/src/errors'; -import { AsyncResultWithTypedError } from '@trezor/transport/src/types'; +import { AsyncResultWithTypedError, DescriptorApiLevel } from '@trezor/transport/src/types'; import { log } from '../logs'; import { nativeBleManager } from './nativeBleManager'; @@ -72,9 +72,15 @@ export class BleApi extends AbstractApi { private async devicesToDescriptors() { const devices = await nativeBleManager.getAllConnectedDevices(); - - // TODO: implement proper device type - return devices.map(d => ({ path: d.id, type: DEVICE_TYPE.TypeT2 })); + const descriptors: DescriptorApiLevel[] = devices.map( + d => + ({ + path: d.id, + type: DEVICE_TYPE.TypeT2, + }) as DescriptorApiLevel, + ); + + return descriptors; } public async read( path: string, diff --git a/packages/transport-native-ble/src/nativeTransportBLE.ts b/packages/transport-native-ble/src/nativeTransportBLE.ts index 23777ce242c..f3462779069 100644 --- a/packages/transport-native-ble/src/nativeTransportBLE.ts +++ b/packages/transport-native-ble/src/nativeTransportBLE.ts @@ -1,9 +1,4 @@ -import { - Transport as AbstractTransport, - AbstractApiTransport, - SessionsClient, - SessionsBackground, -} from '@trezor/transport'; +import { Transport as AbstractTransport, AbstractApiTransport } from '@trezor/transport'; import { BleApi } from './api/bleApi'; @@ -12,16 +7,6 @@ export class NativeTransportBLE extends AbstractApiTransport { constructor(params?: ConstructorParameters[0]) { const { messages, logger } = params || {}; - const sessionsBackground = new SessionsBackground(); - - const sessionsClient = new SessionsClient({ - requestFn: args => sessionsBackground.handleMessage(args), - registerBackgroundCallbacks: () => {}, - }); - - sessionsBackground.on('descriptors', descriptors => { - sessionsClient.emit('descriptors', descriptors); - }); super({ messages, @@ -29,7 +14,6 @@ export class NativeTransportBLE extends AbstractApiTransport { logger, }), logger, - sessionsClient, }); } }