Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions src/common/steps/Develop/OpenVsCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import { openUrl, telemetry } from '@nordicsemiconductor/pc-nrfconnect-shared';

import logo from '../../../../resources/nrf_connect_for_vs_code.svg';
import { useAppDispatch, useAppSelector } from '../../../app/store';
import {
getChoiceUnsafely,
getSelectedDeviceUnsafely,
} from '../../../features/device/deviceSlice';
import { getChoiceUnsafely } from '../../../features/device/deviceSlice';
import { Back } from '../../Back';
import Main from '../../Main';
import { Next, Skip } from '../../Next';
Expand Down Expand Up @@ -46,7 +43,6 @@ export default ({ samples }: { samples: SampleWithRef[] }) => {
const isVsCodeInstalled = useAppSelector(getIsVsCodeInstalled);
const choice = useAppSelector(getChoiceUnsafely);

const device = useAppSelector(getSelectedDeviceUnsafely);
const sample = samples.find(s => s.ref === choice.name)?.sampleSource;

useEffect(
Expand Down Expand Up @@ -87,15 +83,22 @@ export default ({ samples }: { samples: SampleWithRef[] }) => {
<Next
label="Open VS Code with extension"
onClick={() => {
openUrl(
`vscode://nordic-semiconductor.nrf-connect-extension-pack/quickstart?${queryParamsString(
{
deviceSerial: device.serialNumber,
deviceType: device.devkit?.boardVersion,
sample,
},
)}`,
);
const deepLink =
'vscode://nordic-semiconductor.nrf-connect/';

if (choice.ncsAddon) {
openUrl(`${deepLink}${choice.ncsAddon}`);
} else {
openUrl(
`${deepLink}openSampleFromSDK?${queryParamsString(
{
sample,
sdkVersion: choice.sdk?.version,
sdkType: choice.sdk?.type,
},
)}`,
);
}

dispatch(setDevelopState(DevelopState.VS_CODE_OPENED));
telemetry.sendEvent('Opened VS Code');
Expand Down
10 changes: 10 additions & 0 deletions src/features/device/deviceSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ interface FirmwareNote {
content: string;
}

export enum SDKType {
nRFConnectSDK = 'nRF Connect SDK', // Must match the description on nrfutil SDK types.
nRFConnectSDKBareMetal = 'nRF Connect SDK Bare Metal', // Must match the description on nrfutil SDK types.
}

interface ChoiceInfo {
name: string;
description: string;
documentation: { label: string; href: string };
firmwareNote: FirmwareNote | undefined;
ncsAddon?: string;
sdk?: {
type: SDKType;
version: string;
};
}

interface BatchChoice extends ChoiceInfo {
Expand Down
2 changes: 2 additions & 0 deletions src/features/flows/nRF9151/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
ncsAddon:
'app=asset-tracker-template&branch=v1.5.3&manifest=&repo=https://github.com/nrfconnect/Asset-Tracker-Template',
programmingOptions: {
actions: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/features/flows/nRF9151SMA/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
ncsAddon:
'app=asset-tracker-template&branch=v1.5.3&manifest=&repo=https://github.com/nrfconnect/Asset-Tracker-Template',
programmingOptions: {
actions: [
{
Expand Down
6 changes: 5 additions & 1 deletion src/features/flows/nRF9160/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Info from '../../../common/steps/Info';
import Learn from '../../../common/steps/Learn';
import Program from '../../../common/steps/Program';
import Rename from '../../../common/steps/Rename';
import { type Choice } from '../../device/deviceSlice';
import { type Choice, SDKType } from '../../device/deviceSlice';
import SIM from './SIM';

const infoConfig = {
Expand Down Expand Up @@ -85,6 +85,10 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
sdk: {
type: SDKType.nRFConnectSDK,
version: '2.8.0',
},
programmingOptions: {
actions: [
{
Expand Down
8 changes: 7 additions & 1 deletion src/features/flows/nRF9161/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Info from '../../../common/steps/Info';
import Learn from '../../../common/steps/Learn';
import Program from '../../../common/steps/Program';
import Rename from '../../../common/steps/Rename';
import { type Choice } from '../../device/deviceSlice';
import { type Choice, SDKType } from '../../device/deviceSlice';
import CustomEvaluate from './Evaluate';
import SIM from './SIM';

Expand All @@ -37,6 +37,8 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
ncsAddon:
'app=asset-tracker-template&branch=v1.2.1&manifest=&repo=https://github.com/nrfconnect/Asset-Tracker-Template',
programmingOptions: {
actions: [
{
Expand Down Expand Up @@ -185,6 +187,10 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
sdk: {
type: SDKType.nRFConnectSDK,
version: '2.8.0',
},
programmingOptions: {
actions: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/features/flows/thingy91x/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ const programConfig = [
content:
'Modem Trace is enabled; the current consumption will be higher than usual.',
},
ncsAddon:
'app=asset-tracker-template&branch=v1.5.3&manifest=&repo=https://github.com/nrfconnect/Asset-Tracker-Template',
programmingOptions: {
actions: [
{
Expand Down