-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathEstablishConnection.tsx
More file actions
87 lines (82 loc) · 3.34 KB
/
Copy pathEstablishConnection.tsx
File metadata and controls
87 lines (82 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
*/
import React, { useEffect, useRef } from 'react';
import {
getPersistedNickname,
logger,
} from '@nordicsemiconductor/pc-nrfconnect-shared';
import qrImage from '../../../../../resources/cloud_qr.svg';
import { useAppDispatch, useAppSelector } from '../../../../app/store';
import { Back } from '../../../../common/Back';
import Main from '../../../../common/Main';
import { Next } from '../../../../common/Next';
import { reset } from '../../../device/deviceLib';
import { getSelectedDeviceUnsafely } from '../../../device/deviceSlice';
import { nextSubStep } from './cloudEvaluateSlice';
import { setDeviceName } from './device';
export default ({ vComIndex }: { vComIndex: number }) => {
const dispatch = useAppDispatch();
const device = useAppSelector(getSelectedDeviceUnsafely);
const btName = useRef<string>();
useEffect(() => {
const persistedName = getPersistedNickname(device.serialNumber);
if (persistedName && btName.current !== persistedName) {
setDeviceName(device, vComIndex, persistedName)
.then(() => {
reset(device);
btName.current = persistedName;
})
.catch(logger.error);
}
}, [device, vComIndex]);
return (
<Main>
<Main.Content
heading="Remote connection"
subHeading="Use your phone as a gateway"
>
<div className="tw-flex tw-flex-row tw-gap-3">
<div className="tw-flex tw-flex-shrink-0 tw-flex-col tw-items-center">
<img
src={qrImage}
alt="Remote connection QR code"
className="tw-h-32 tw-w-32"
/>
Scan to download
</div>
<div className="-tw-mt-1 tw-flex tw-flex-col tw-gap-2">
<p>
Establish a remote connection gateway for your{' '}
<b>nRF54L15 DK</b> using your mobile device as a
Bluetooth LE relay.
</p>
<ol className="tw-list-inside tw-list-decimal">
<li>
<b>Download</b> nRF Toolbox on your mobile
device (iOS or Android).
</li>
<li>
<b>Scan</b> for nearby devices and select your
nRF54L15 DK from the list.
</li>
<li>
<b>Connect</b> to your device.
</li>
<li>
After connecting the device in the app, click{' '}
<b>Continue</b> below.
</li>
</ol>
</div>
</div>
</Main.Content>
<Main.Footer>
<Back />
<Next onClick={() => dispatch(nextSubStep())} />
</Main.Footer>
</Main>
);
};