You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Use any out-of-band mechanism to communicate the value of params to the peer device.
@@ -66,36 +66,36 @@ The app that _scans the QR code_ shall set its connection parameters:
66
66
// Use any out-of-band mechanism to get the value of params from the peer device.
67
67
// For example, you can use a QR code scanning library to get params.
68
68
69
-
BluetoothApi.setConnectionParameters(params);
69
+
IdpassSmartshare.setConnectionParameters(params);
70
70
```
71
71
72
72
Both apps create the connection:
73
73
74
74
```javascript
75
-
BluetoothApi.createConnection('dual', () => {
75
+
IdpassSmartshare.createConnection('dual', () => {
76
76
// A secure Bluetooth connection is created
77
-
// Anytime, either app may call BluetoothApi.send()
77
+
// Anytime, either app may call IdpassSmartshare.send()
78
78
});
79
79
```
80
80
81
81
Once the connection is created, either app can send a string message.
82
82
83
83
```javascript
84
-
BluetoothApi.send(message, () => {
84
+
IdpassSmartshare.send(message, () => {
85
85
// message sent
86
86
});
87
87
```
88
88
89
89
The app can intentionally destroy the connection.
90
90
91
91
```javascript
92
-
BluetoothApi.destroyConnection();
92
+
IdpassSmartshare.destroyConnection();
93
93
```
94
94
95
95
The app must handle _Nearby_ events in order to receive **messages**, to monitor transfer **status** of incoming/outgoing messages, or to monitor connection related **events**:
The above example snippets illustrated the use of the **dual** Bluetooth connection creation mode, wherein both devices will actively attempt to connect to each other and depending on who does it first, a connection is thereby created. The **dual** mode is a more robust mechanism to create a connection. However, an application may opt to configure one device as the `advertiser` and the other as the `discoverer`. For example, the first app that displays the QR code will advertise its presence and waits for a connection by:
0 commit comments