@@ -39,6 +39,7 @@ import (
39
39
"github.com/BitBoxSwiss/bitbox-wallet-app/backend/config"
40
40
"github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/bitbox"
41
41
"github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/bitbox02"
42
+ "github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/bluetooth"
42
43
"github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/device"
43
44
deviceevent "github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/device/event"
44
45
"github.com/BitBoxSwiss/bitbox-wallet-app/backend/devices/usb"
@@ -176,6 +177,9 @@ type Environment interface {
176
177
// OnAuthSettingChanged is called when the authentication (screen lock) setting is changed.
177
178
// This is also called when the app launches with the current setting.
178
179
OnAuthSettingChanged (enabled bool )
180
+ // BluetoothConnect tries to connect to the peripheral by the given identifier.
181
+ // Use `backend.bluetooth.State()` to track failure.
182
+ BluetoothConnect (identifier string )
179
183
}
180
184
181
185
// Backend ties everything together and is the main starting point to use the BitBox wallet library.
@@ -194,6 +198,7 @@ type Backend struct {
194
198
devices map [string ]device.Interface
195
199
196
200
usbManager * usb.Manager
201
+ bluetooth * bluetooth.Bluetooth
197
202
198
203
accountsAndKeystoreLock locker.Locker
199
204
accounts AccountsList
@@ -265,7 +270,6 @@ func NewBackend(arguments *arguments.Arguments, environment Environment) (*Backe
265
270
coins : map [coinpkg.Code ]coinpkg.Coin {},
266
271
accounts : []accounts.Interface {},
267
272
aopp : AOPP {State : aoppStateInactive },
268
-
269
273
makeBtcAccount : func (config * accounts.AccountConfig , coin * btc.Coin , gapLimits * types.GapLimits , log * logrus.Entry ) accounts.Interface {
270
274
return btc .NewAccount (config , coin , gapLimits , log , hclient )
271
275
},
@@ -297,6 +301,9 @@ func NewBackend(arguments *arguments.Arguments, environment Environment) (*Backe
297
301
backend .banners = banners .NewBanners ()
298
302
backend .banners .Observe (backend .Notify )
299
303
304
+ backend .bluetooth = bluetooth .New (log )
305
+ backend .bluetooth .Observe (backend .Notify )
306
+
300
307
return backend , nil
301
308
}
302
309
@@ -1052,3 +1059,8 @@ func (backend *Backend) ExportLogs() error {
1052
1059
}
1053
1060
return nil
1054
1061
}
1062
+
1063
+ // Bluetooth returns the backend's bluetooth instance.
1064
+ func (backend * Backend ) Bluetooth () * bluetooth.Bluetooth {
1065
+ return backend .bluetooth
1066
+ }
0 commit comments