├── .eslintignore
├── .eslintrc.json
├── .gitattributes
├── .github
└── workflows
│ ├── close-resolved-issues.yml
│ ├── need-attention-issues.yml
│ └── stale-issues.yml
├── .gitignore
├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── .vscodeignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── __mocks__
└── vscode.js
├── assets
└── modelRepository
│ ├── command.js
│ ├── image
│ ├── Arrow.svg
│ ├── Checkbox.svg
│ ├── CheckboxChecked.svg
│ ├── CheckboxHover.svg
│ ├── Clear.svg
│ ├── Copy.svg
│ ├── Create.svg
│ ├── Delete.svg
│ ├── Download.svg
│ ├── Error.svg
│ ├── Filter.svg
│ ├── Info.svg
│ ├── More.svg
│ ├── Publish.svg
│ ├── Radio.svg
│ ├── RadioChecked.svg
│ ├── RadioHover.svg
│ ├── Refresh.svg
│ ├── Search.svg
│ ├── Success.svg
│ └── Warning.svg
│ ├── index.html
│ ├── main.js
│ ├── style.css
│ └── vue.js
├── azure-pipelines.yml
├── devicedevex_dockerfiles
├── README.md
├── helper
│ ├── build-with-arg.sh
│ ├── config.sample.json
│ └── push-to-devicedevex.sh
├── internal
│ └── iot-device-cube-1.0.0
│ │ ├── alpine-arm64
│ │ ├── Dockerfile
│ │ └── Toolchain.cmake
│ │ ├── arduino-base-0.3.6-alpha.preview
│ │ └── Dockerfile
│ │ ├── ubuntu-arm64
│ │ ├── Dockerfile
│ │ └── Toolchain.cmake
│ │ └── ubuntu-cross-toolchain-arm32
│ │ └── Dockerfile
└── public
│ ├── iot-device-cube-1.0.0
│ ├── arduino-az3166-1.6.2
│ │ ├── Dockerfile
│ │ ├── arduino-cli.yaml
│ │ └── install_az3166.sh
│ ├── azure-c-app-20190411-ubuntu-arm64
│ │ ├── Dockerfile
│ │ └── compile_app.sh
│ ├── azure-c-app-20190705-ubuntu-arm32
│ │ ├── Dockerfile
│ │ └── compile_app.sh
│ ├── azure-c-sdk-20190411-alpine-arm64
│ │ └── Dockerfile
│ ├── azure-c-sdk-20190411-ubuntu-arm64
│ │ └── Dockerfile
│ ├── azure-c-sdk-20190411-ubuntu-x86
│ │ ├── Dockerfile
│ │ └── config.json
│ └── azure-c-sdk-20190705-cross-toolchain-arm32
│ │ ├── Dockerfile
│ │ └── Toolchain.cmake
│ ├── iot-device-cube-1.0.1
│ ├── azure-c-app-20190411-ubuntu-arm64
│ │ ├── Dockerfile
│ │ └── compile_app.sh
│ ├── azure-c-app-20190411-ubuntu-x86
│ │ ├── Dockerfile
│ │ ├── compile_app.sh
│ │ └── config.json
│ └── azure-c-app-20190705-ubuntu-arm32
│ │ ├── Dockerfile
│ │ └── compile_app.sh
│ ├── iot-device-cube-1.0.2
│ ├── README.md
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm32
│ │ ├── Dockerfile
│ │ └── Toolchain.cmake
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm64
│ │ └── Dockerfile
│ └── azure-c-sdk-public-preview-ubuntu-x86
│ │ └── Dockerfile
│ ├── iot-device-cube-1.0.3
│ ├── README.md
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm32
│ │ ├── Dockerfile
│ │ ├── Toolchain.cmake
│ │ └── arm-linux-custom.cmake
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm64
│ │ ├── Dockerfile
│ │ ├── Toolchain.cmake
│ │ └── aarch64-linux-custom.cmake
│ └── azure-c-sdk-public-preview-ubuntu-x86
│ │ └── Dockerfile
│ └── iot-device-cube-1.0.4
│ ├── README.md
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm32
│ ├── Dockerfile
│ ├── Toolchain.cmake
│ └── arm-linux-custom.cmake
│ ├── azure-c-sdk-public-preview-cross-toolchain-arm64
│ ├── Dockerfile
│ ├── Toolchain.cmake
│ └── aarch64-linux-custom.cmake
│ └── azure-c-sdk-public-preview-ubuntu-x86
│ └── Dockerfile
├── docs
├── create-iothub-device.md
├── embedded-linux
│ ├── README.md
│ ├── configure-external-cmake-project-as-embedded-linux-project.md
│ ├── embedded-linux-configure-project.md
│ ├── embedded-linux-customization.md
│ ├── embedded-linux-get-started.md
│ ├── embedded-linux-pnp.md
│ └── embedded-linux-setup.md
├── esp32
│ ├── README.md
│ ├── esp32-setup.md
│ ├── m5stack-email-receiver.md
│ └── media
│ │ ├── esp32-get-started
│ │ ├── change-board.png
│ │ ├── copy-connection-string.png
│ │ ├── esp32-device-uploaded.png
│ │ ├── esp32-install-sdk.jpg
│ │ └── install-workbench.png
│ │ ├── iot-workbench-cloud-deploy.png
│ │ ├── iot-workbench-cloud-provision-steps3.png
│ │ ├── iot-workbench-cloud-provision.png
│ │ ├── iot-workbench-device-settings.png
│ │ ├── iot-workbench-device-upload.png
│ │ ├── iot-workbench-examples-board.png
│ │ ├── iot-workbench-examples-cmd.png
│ │ ├── iot-workbench-examples.png
│ │ └── m5stack-email-receiver
│ │ ├── m5stack-email-display.jpg
│ │ ├── m5stack-email-receiver-function-config.png
│ │ ├── m5stack-email-receiver-gmail-trigger.png
│ │ └── open-example-m5stack-email-receiver.jpg
├── images
│ ├── author-pnp-dcm.png
│ ├── azure-account.png
│ ├── compile-success.png
│ ├── config-device.png
│ ├── conn-string.png
│ ├── container-project.png
│ ├── create-device.png
│ ├── dev-container-ready.png
│ ├── device-code.png
│ ├── device-name.png
│ ├── device-workbench.png
│ ├── example.gif
│ ├── external-project-in-remote.png
│ ├── iothub-d2c.png
│ ├── iothub-sample.png
│ ├── logo.png
│ ├── more-actions.png
│ ├── new.gif
│ ├── pnp-with-container-compile-success.png
│ ├── pnp-with-container-iothub-d2c.png
│ ├── pnp-with-container-result.jpg
│ ├── prepare-dev-container.png
│ ├── result.png
│ ├── run-app.png
│ ├── shared-drivers.png
│ └── upload-options.png
├── iot-devkit
│ ├── devkit-shakeshake.md
│ ├── devkit_door_monitor.md
│ └── media
│ │ ├── devkit-configuration-mode.png
│ │ ├── devkit-door-monitor
│ │ ├── capture-url.jpg
│ │ ├── iot-workbench-device-uploaded.png
│ │ ├── logic-app-sendgrid.JPG
│ │ ├── open-sample.png
│ │ ├── sendgrid-create-api-first.png
│ │ ├── sendgrid-create-api-second.png
│ │ ├── sendgrid-deploy.png
│ │ ├── sendgrid-manage.png
│ │ ├── test-door-closed.jpg
│ │ └── test-door-opened.jpg
│ │ ├── iot-devkit-shakeshake
│ │ ├── devkit-diagram.png
│ │ ├── devkit-result-1.png
│ │ ├── devkit-result-2.png
│ │ ├── devkit-result-3.png
│ │ ├── devkit-result-4.png
│ │ ├── devkit-result-5.png
│ │ ├── devkit-result-6.png
│ │ ├── iot-workbench-device-uploaded.png
│ │ ├── iot-workbench-example.png
│ │ └── update-twitter-token.jpg
│ │ ├── iot-workbench-cloud-deploy.png
│ │ ├── iot-workbench-cloud-provision-steps3.png
│ │ ├── iot-workbench-cloud-provision.png
│ │ ├── iot-workbench-connection-done.png
│ │ ├── iot-workbench-device-settings.png
│ │ ├── iot-workbench-device-string1.png
│ │ ├── iot-workbench-device-upload.png
│ │ ├── iot-workbench-examples-board.png
│ │ ├── iot-workbench-examples-cmd.png
│ │ └── iot-workbench-examples.png
├── pic
│ ├── azure_signin.png
│ ├── iot-workbench-cloud-provision.png
│ ├── iothub.png
│ ├── iothub_device.png
│ ├── openexisting.png
│ ├── provision_process.png
│ ├── resource_group.png
│ ├── sign_in_success.png
│ └── subscription.png
├── provision_azure_iothub.md
└── scripts
│ └── genImageListToDelete.sh
├── hooks
├── pre-commit
└── readme.md
├── jest.config.js
├── logo.png
├── package-lock.json
├── package.json
├── resources
├── pnp
│ ├── definitions
│ │ ├── constraint.json
│ │ ├── context.json
│ │ └── graph.json
│ └── templates
│ │ ├── emptySchema.json
│ │ ├── sample.capabilitymodel.json
│ │ └── sample.interface.json
└── templates
│ ├── arduino_task
│ ├── tasks.json
│ └── templatefiles.json
│ ├── arm7
│ ├── Dockerfile
│ ├── build.sh
│ ├── c_cpp_properties.json
│ ├── devcontainer.json
│ ├── install_packages.sh
│ ├── tasks.json
│ └── templatefiles.json
│ ├── arm8
│ ├── Dockerfile
│ ├── build.sh
│ ├── c_cpp_properties.json
│ ├── devcontainer.json
│ ├── install_packages.sh
│ ├── tasks.json
│ └── templatefiles.json
│ ├── boardlist.json
│ ├── codeGenOptions.json
│ ├── configDeviceOptions.json
│ ├── devkit
│ ├── c_cpp_properties_linux.json
│ ├── c_cpp_properties_macos.json
│ └── c_cpp_properties_win32.json
│ ├── devkit_azurefunctions
│ ├── .gitignore
│ ├── arduino.json
│ ├── device.ino
│ ├── settings.json
│ └── templatefiles.json
│ ├── devkit_device
│ ├── .gitignore
│ ├── arduino.json
│ ├── device.ino
│ ├── settings.json
│ └── templatefiles.json
│ ├── devkit_iothub
│ ├── .gitignore
│ ├── arduino.json
│ ├── device.ino
│ ├── settings.json
│ └── templatefiles.json
│ ├── embedded_linux
│ ├── CMakeLists.txt
│ ├── main.c
│ └── templatefiles.json
│ ├── esp32
│ ├── c_cpp_properties_linux.json
│ ├── c_cpp_properties_macos.json
│ └── c_cpp_properties_win32.json
│ ├── esp32_device
│ ├── arduino.json
│ ├── device.ino
│ ├── settings.json
│ └── templatefiles.json
│ ├── esp32_iothub
│ ├── arduino.json
│ ├── device.ino
│ ├── settings.json
│ └── templatefiles.json
│ ├── platformlist.json
│ ├── templates.json
│ └── x86
│ ├── Dockerfile
│ ├── build.sh
│ ├── c_cpp_properties.json
│ ├── devcontainer.json
│ ├── install_packages.sh
│ ├── tasks.json
│ └── templatefiles.json
├── scripts
├── mdLinkChecker
│ └── mdLinkChecker.ts
└── updateConfig.js
├── src
├── ArduinoPackageManager.ts
├── AzureOperator.ts
├── DeviceOperator.ts
├── DialogResponses.ts
├── DigitalTwin
│ ├── CodeGeneratorCore.ts
│ ├── DigitalTwinCodeGen
│ │ ├── AnsiCCodeGeneratorFactory.ts
│ │ ├── CodeGenUtility.ts
│ │ └── Interfaces
│ │ │ ├── AnsiCCodeGenerator.ts
│ │ │ ├── CodeGenerator.ts
│ │ │ └── CodeGeneratorFactory.ts
│ ├── DigitalTwinConstants.ts
│ ├── DigitalTwinUtility.ts
│ └── pnp
│ │ └── src
│ │ ├── api
│ │ └── apiProvider.ts
│ │ ├── common
│ │ ├── badRequestError.ts
│ │ ├── colorizedChannel.ts
│ │ ├── command.ts
│ │ ├── configuration.ts
│ │ ├── constants.ts
│ │ ├── credentialStore.ts
│ │ ├── processError.ts
│ │ ├── userCancelledError.ts
│ │ └── utility.ts
│ │ ├── deviceModel
│ │ └── deviceModelManager.ts
│ │ ├── intelliSense
│ │ ├── digitalTwinCompletionItemProvider.ts
│ │ ├── digitalTwinConstants.ts
│ │ ├── digitalTwinDiagnosticProvider.ts
│ │ ├── digitalTwinGraph.ts
│ │ ├── digitalTwinHoverProvider.ts
│ │ ├── intelliSenseUtility.ts
│ │ └── languageCode.ts
│ │ ├── modelRepository
│ │ ├── modelRepositoryClient.ts
│ │ ├── modelRepositoryConnection.ts
│ │ ├── modelRepositoryInterface.ts
│ │ └── modelRepositoryManager.ts
│ │ └── view
│ │ ├── ui.ts
│ │ └── uiConstants.ts
├── FileUtility.ts
├── IoTSettings.ts
├── Models
│ ├── AZ3166Device.ts
│ ├── Apis.ts
│ ├── ArduinoDeviceBase.ts
│ ├── AzureComponentConfig.ts
│ ├── AzureFunctions.ts
│ ├── AzureUtility.ts
│ ├── ContainerDeviceBase.ts
│ ├── Esp32Device.ts
│ ├── Interfaces
│ │ ├── Api.ts
│ │ ├── Board.ts
│ │ ├── CommandItem.ts
│ │ ├── Compilable.ts
│ │ ├── Component.ts
│ │ ├── Deployable.ts
│ │ ├── Device.ts
│ │ ├── ProjectHostType.ts
│ │ ├── ProjectTemplate.ts
│ │ ├── Provisionable.ts
│ │ ├── UI.ts
│ │ ├── Uploadable.ts
│ │ └── Workspace.ts
│ ├── IoTContainerizedProject.ts
│ ├── IoTHub.ts
│ ├── IoTHubDevice.ts
│ ├── IoTWorkbenchProjectBase.ts
│ ├── IoTWorkspaceProject.ts
│ ├── OTA.ts
│ ├── RaspberryPiDevice.ts
│ └── RemoteExtension.ts
├── ProjectEnvironmentConfiger.ts
├── WorkbenchExtension.ts
├── azure-account.api.d.ts
├── boardProvider.ts
├── common
│ ├── Commands.ts
│ └── Error
│ │ ├── OperationCanceledError.ts
│ │ ├── OperationFailedErrors
│ │ ├── ArgumentEmptyOrNullError.ts
│ │ ├── DependentExtensionNotFoundError.ts
│ │ ├── DigitalTwinNotInitializedError.ts
│ │ ├── DirectoryNotFoundError.ts
│ │ ├── FileNotFound.ts
│ │ ├── OperationFailedError.ts
│ │ ├── RemoteEnvNotSupportedError.ts
│ │ ├── ResourceNotFoundError.ts
│ │ └── WorkspaceNotOpenError.ts
│ │ ├── PnPErrors
│ │ └── PnPModelTypeInvalidError.ts
│ │ ├── SystemErrors
│ │ ├── AzureConfigNotFoundErrors.ts
│ │ ├── ProjectConfigNotFoundError.ts
│ │ ├── SystemError.ts
│ │ ├── SystemResourceNotFoundError.ts
│ │ ├── TypeNotSupportedError.ts
│ │ └── WorkspaceConfigNotFoundError.ts
│ │ └── exceptionHelper.ts
├── configHandler.ts
├── constants.ts
├── exampleExplorer.ts
├── extension.ts
├── getmac.d.ts
├── nsat.ts
├── projectInitializer.ts
├── telemetry.ts
├── usbDetector.ts
└── utils.ts
├── syntaxes
└── colorized.channel.tmLanguage
├── test
├── IoTSettings.test.ts
├── digitalTwin
│ ├── colorizedChannel.test.ts
│ ├── deviceModelManager.test.ts
│ ├── digitalTwinDiagnosticProvider.test.ts
│ ├── intelliSenseUtility.test.ts
│ ├── ui.test.ts
│ └── utility.test.ts
├── resources
│ ├── interface_v1.json
│ ├── invalid_context.json
│ └── invalid_type.json
└── testUtility.ts
├── tsconfig.json
├── views
├── example-aside-schema.json
├── example.html
├── example.js
├── fonts
│ └── Press-Start-2P-Regular.woff2
├── images
│ ├── feed.svg
│ ├── github.svg
│ ├── logo-black.png
│ ├── logo.svg
│ ├── no-avatar.svg
│ └── no-image.jpg
└── vue.js
└── webpack.config.js
/.eslintignore:
--------------------------------------------------------------------------------
1 | # don't ever lint node_modules
2 | node_modules
3 | # don't lint build output (make sure it's set to your correct build folder name)
4 | out
5 | views/
6 | assets/
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "parserOptions": {
4 | "ecmaVersion": 2018,
5 | "sourceType": "module"
6 | },
7 | "extends": [
8 | "plugin:@typescript-eslint/recommended",
9 | "prettier/@typescript-eslint",
10 | "plugin:prettier/recommended"
11 | ],
12 | "env": {
13 | "browser": true,
14 | "es6": true,
15 | "node": true,
16 | "mocha": true,
17 | "amd": true,
18 | "commonjs": true
19 | },
20 | "plugins": [
21 | "@typescript-eslint/eslint-plugin"
22 | ],
23 | "rules": {
24 | "prettier/prettier": ["error", {"printWidth": 120}],
25 | "max-len": ["error", {"code": 120, "ignorePattern": "^import\\s.+\\sfrom\\s.+;$", "ignoreStrings": true}],
26 | "no-unused-vars": "off",
27 | "@typescript-eslint/no-var-requires": "off",
28 | "@typescript-eslint/no-empty-function": ["error", { "allow": ["constructors"] }],
29 | "object-curly-spacing": ["error", "always"],
30 | "@typescript-eslint/explicit-function-return-type": "off"
31 | },
32 | "overrides": [
33 | {
34 | // enable the rule specifically for TypeScript files
35 | "files": ["*.ts", "*.tsx"],
36 | "rules": {
37 | "@typescript-eslint/explicit-function-return-type": ["error"]
38 | }
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | views/vue.js linguist-vendored
--------------------------------------------------------------------------------
/.github/workflows/close-resolved-issues.yml:
--------------------------------------------------------------------------------
1 | name: Close resolved issues
2 |
3 | on:
4 | schedule:
5 | - cron: "0 * * * *"
6 |
7 | jobs:
8 | stale:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: blackchoey/stale@releases/v1.2
14 | with:
15 | repo-token: ${{ secrets.GITHUB_TOKEN }}
16 | stale-issue-message: 'This issue has been resolved and it will be closed if no further activity occurs within 3 days. Thank you for your contributions.'
17 | stale-issue-label: 'pending close'
18 | days-before-stale: 7
19 | only-labels: 'resolved'
20 | last-updated-user-type: 'collaborator'
21 | days-before-close: 3
22 | operations-per-run: 150
23 |
--------------------------------------------------------------------------------
/.github/workflows/need-attention-issues.yml:
--------------------------------------------------------------------------------
1 | name: Pickup issues that needs attention
2 |
3 | on:
4 | schedule:
5 | - cron: "0 * * * *"
6 |
7 | jobs:
8 | stale:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: blackchoey/stale@releases/v1.2
14 | with:
15 | repo-token: ${{ secrets.GITHUB_TOKEN }}
16 | stale-issue-message: 'This issue has no recent activities, please take a look and provide updates for it.'
17 | stale-issue-label: 'need attention'
18 | days-before-stale: 3
19 | last-updated-user-type: 'non-collaborator'
20 | days-before-close: 999
21 | operations-per-run: 150
22 |
--------------------------------------------------------------------------------
/.github/workflows/stale-issues.yml:
--------------------------------------------------------------------------------
1 | name: Mark stale issues and close them
2 |
3 | on:
4 | schedule:
5 | - cron: "0 * * * *"
6 |
7 | jobs:
8 | stale:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: blackchoey/stale@releases/v1.2
14 | with:
15 | repo-token: ${{ secrets.GITHUB_TOKEN }}
16 | stale-issue-message: 'This issue has been automatically marked as stale because it has no recent activities. It will be closed if no further activity occurs within 3 days. Thank you for your contributions.'
17 | stale-issue-label: 'stale'
18 | days-before-stale: 7
19 | only-labels: 'need more info'
20 | last-updated-user-type: 'collaborator'
21 | days-before-close: 3
22 | operations-per-run: 150
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | node_modules
3 | dist
4 | .vscode-test/
5 | *.vsix
6 | .vscode/arduino.json
7 | .vscode/c_cpp_properties.json
8 | screenlog*
9 | cache/
10 | coverage/
11 | scripts/mdLinkChecker/*.js
12 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | {
3 | "version": "0.1.0",
4 | "configurations": [
5 | {
6 | "name": "Extension",
7 | "type": "extensionHost",
8 | "request": "launch",
9 | "runtimeExecutable": "${execPath}",
10 | "args": [
11 | "--extensionDevelopmentPath=${workspaceRoot}"
12 | ],
13 | "stopOnEntry": false,
14 | "sourceMaps": true,
15 | "outFiles": [
16 | "${workspaceRoot}/dist/**/*.js"
17 | ],
18 | "preLaunchTask": "npm: watch"
19 | },
20 | {
21 | "name": "Extension Tests",
22 | "type": "extensionHost",
23 | "request": "launch",
24 | "runtimeExecutable": "${execPath}",
25 | "args": [
26 | "${workspaceRoot}/test/resources/project1/project.code-workspace",
27 | "--extensionDevelopmentPath=${workspaceRoot}",
28 | "--extensionTestsPath=${workspaceRoot}/out/test"
29 | ],
30 | "stopOnEntry": false,
31 | "sourceMaps": true,
32 | "outFiles": [
33 | "${workspaceRoot}/out/test/**/*.js"
34 | ],
35 | "preLaunchTask": "npm: watch"
36 | },
37 | {
38 | "type": "node",
39 | "request": "launch",
40 | "name": "Unit Tests",
41 | "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
42 | "args": [
43 | "-i"
44 | ],
45 | "internalConsoleOptions": "openOnSessionStart",
46 | "outFiles": [
47 | "${workspaceRoot}/out/test/**/*.js"
48 | ]
49 | }
50 | ]
51 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "editor.tabSize": 2,
4 | "files.exclude": {
5 | "out": false // set this to true to hide the "out" folder with the compiled JS files
6 | },
7 | "search.exclude": {
8 | "out": true // set this to false to include "out" folder in search results
9 | },
10 | "editor.formatOnSave": true,
11 | "[javascript]": {
12 | "editor.formatOnSave": false,
13 | },
14 | "[javascriptreact]": {
15 | "editor.formatOnSave": false,
16 | },
17 | "[typescript]": {
18 | "editor.formatOnSave": false,
19 | },
20 | "[typescriptreact]": {
21 | "editor.formatOnSave": false,
22 | },
23 | "editor.codeActionsOnSave": {
24 | "source.fixAll.eslint": true
25 | }
26 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$tsc-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never"
13 | },
14 | "group": {
15 | "kind": "build",
16 | "isDefault": true
17 | }
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | .vscode-test
3 | # The following lines starting with '!' are the modules that are not webpack bundle friendly,
4 | # so make sure we pack it into extension package.
5 | !node_modules/keytar
6 | !node_modules/getmac
7 | !node_modules/editions
8 | !node_modules/errlop
9 | !node_modules/extract-opts
10 | !node_modules/typechecker
11 | !node_modules/eachr
12 | !node_modules/getos
13 | !node_modules/node-usb-native/lib/native
14 | !node_modules/usb-detection/build/Release/detection.node
15 | !node_modules/usb-detection/*.*
16 | !node_modules/eventemitter2
17 | !node_modules/bindings
18 | !node_modules/file-uri-to-path
19 | !node_modules/@serialport/bindings
20 | !node_modules/@serialport/binding-abstract
21 | !node_modules/@serialport/parser-readline
22 | !node_modules/@serialport/parser-delimiter
23 | !node_modules/debug
24 | !node_modules/ms
25 | node_modules
26 | # The following folders don't need to be in extension package.
27 | __mocks__
28 | src
29 | hooks
30 | test
31 | docs
32 | scripts
33 | devicedevex_dockerfiles
34 | # out folder is the temporary folder for compilation
35 | out
36 | # The following folder/files are for test
37 | coverage
38 | jest.config.js
39 | # Other files don't need to be in extension package
40 | .gitignore
41 | .eslintignore
42 | tsconfig.json
43 | webpack.config.js
44 | azure-pipelines.yml
45 | **/*.map
46 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/assets/modelRepository/command.js:
--------------------------------------------------------------------------------
1 | const callbackStack = [];
2 | const vscode = acquireVsCodeApi();
3 |
4 | function command(cmd, callback) {
5 | if (!cmd) {
6 | return;
7 | }
8 | const args = Array.from(arguments);
9 | if (typeof args[args.length - 1] === "function") {
10 | callback = args[args.length - 1];
11 | args.length = args.length - 1;
12 | } else {
13 | callback = undefined;
14 | }
15 | args.shift();
16 | const messageId = new Date().getTime() + Math.random();
17 |
18 | callbackStack.push({
19 | messageId,
20 | callback
21 | });
22 |
23 | vscode.postMessage({
24 | messageId,
25 | command: cmd,
26 | parameter: args
27 | });
28 | }
29 |
30 | window.addEventListener("message", event => {
31 | const message = event.data;
32 |
33 | for (let index = 0; index < callbackStack.length; index++) {
34 | const callbackItem = callbackStack[index];
35 | if (callbackItem.messageId === message.messageId) {
36 | if (callbackItem.callback) {
37 | callbackItem.callback(message.payload);
38 | }
39 | callbackStack.splice(index, 1);
40 | break;
41 | }
42 | }
43 | });
44 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Arrow.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Checkbox.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/CheckboxChecked.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/CheckboxHover.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
20 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Clear.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Copy.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Create.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Delete.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Download.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Error.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Filter.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Info.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/More.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Publish.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
27 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Radio.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/RadioChecked.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/RadioHover.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Refresh.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Search.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Success.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
--------------------------------------------------------------------------------
/assets/modelRepository/image/Warning.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/README.md:
--------------------------------------------------------------------------------
1 | # Dockerfiles of docker images in ACR/MCR
2 |
3 | ## For devkit
4 |
5 | naming convention:
6 |
7 | `[iot-device-cube]:[iot-device-cube-version]-arduino-[pkg]-[pkg-version]`
8 |
9 | * internal/iot-device-cube:1.0.0-arduino-base-0.3.6-alpha.preview
10 |
11 | * public/iot-device-cube:1.0.0-arduino-az3166-1.6.2
12 |
13 | ## For RPI
14 |
15 | naming convention:
16 |
17 | `[iot-device-cube]:[iot-device-cube-version]-azure-[language]-[sdk/app]-[azure-sdk-version]-[OS]-[platform]`
18 |
19 | * internal/iot-device-cube:1.0.0-ubuntu-arm64
20 | * internal/iot-device-cube:1.0.0-alpine-arm64
21 |
22 | * public/iot-device-cube:1.0.0-azure-c-sdk-20190411-ubuntu-arm64
23 | * public/iot-device-cube:1.0.0-azure-c-sdk-20190411-alpine-arm64
24 | * public/iot-device-cube:1.0.0-azure-c-app-20190411-ubuntu-arm64
25 |
26 |
27 | ## Change Logs
28 | * 1.0.0
29 | * 1.0.1
30 | Add extensible containerized experience.
31 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/helper/build-with-arg.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | if [[ $# -lt 2 ]]; then
5 | echo "Usage: $0 "
6 | exit 1
7 | fi
8 |
9 | configFile=$1
10 | dockerfile_path=$2
11 | image_name=`jq -r .image_name $configFile`
12 |
13 | keys=`jq -r '.arg | keys | .[]' $configFile`
14 | build_arg=`jq -r .arg $configFile`
15 |
16 | for k in $keys
17 | do
18 | value=`jq -r .$k <<< $build_arg`
19 | argJson+=" --build-arg ${k}=${value}"
20 | done
21 | docker build -t $image_name $dockerfile_path $argJson
22 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/helper/config.sample.json:
--------------------------------------------------------------------------------
1 | {
2 | "image_name": "ubuntu_sdk:latest",
3 | "dockerfile_path": ".",
4 | "arg": {
5 | "base_image": "ubuntu:18.04",
6 | "c_sdk_version": "2019-04-11"
7 | }
8 | }
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/helper/push-to-devicedevex.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 | check_docker=`docker -v`
4 | if [[ $? != 0 ]]; then
5 | echo "No docker found. Please install docker first."
6 | exit 1
7 | fi
8 |
9 | if [[ $# -lt 1 ]]; then
10 | echo "Usage: $0 "
11 | exit 1
12 | fi
13 | docker_image=$1
14 |
15 | # login in ACR
16 | ACR_domain=devicedevex.azurecr.io
17 | ACR_user=devicedevex
18 | echo "### Login in to ACR: $ACR_domain"
19 | echo "### USER_name: $ACR_user"
20 | echo "### Please input the password for $ACR_user: "
21 | read ACR_password
22 | docker login $ACR_domain -u $ACR_user --password-stdin <<< $ACR_password
23 |
24 | # Push docker image to ACR
25 | echo "### Do you need to tag domain prefix to the image?[Y/N]"
26 | read tagImage
27 | new_docker_image=''
28 | if [[ $tagImage == 'Y' || $tagImage == 'y' ]]; then
29 | echo "### public or internal or non? [p/i/n]"
30 | read Visibility
31 | if [[ $Visibility == 'p' || $Visibility == 'P' ]]; then
32 | new_docker_image="$ACR_domain/public/$docker_image"
33 | elif [[ $Visibility == 'i' || $Visibility == 'I' ]]; then
34 | new_docker_image="$ACR_domain/internal/$docker_image"
35 | else
36 | new_docker_image="$ACR_domain/$docker_image"
37 | fi
38 | elif [[ $tagImage == 'N' || $tagImage == 'n' ]]; then
39 | new_docker_image=$docker_image
40 | else
41 | echo "WRONG INPUT!!"
42 | exit 1
43 | fi
44 |
45 | echo "Push docker image $new_docker_image to $ACR_domain..."
46 | docker tag $docker_image $new_docker_image
47 | docker push $new_docker_image
48 | docker rmi $docker_image
49 | docker rmi $new_docker_image
50 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/internal/iot-device-cube-1.0.0/alpine-arm64/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-alpine-arm64
2 | FROM frolvlad/alpine-glibc
3 |
4 | # Download toolchain
5 | RUN mkdir -p /usr/xcc
6 | WORKDIR /usr/xcc
7 | RUN wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz && \
8 | tar xf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz && \
9 | mv gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu aarch64-linux-gnu && \
10 | rm gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
11 |
12 | # Set ENV
13 | ENV CROSS_TRIPLE=aarch64-linux-gnu \
14 | XCC_PREFIX=/usr/xcc/
15 |
16 | ENV CROSS_ROOT ${XCC_PREFIX}/${CROSS_TRIPLE}
17 | ENV QEMU_LD_PREFIX "${CROSS_ROOT}/${CROSS_TRIPLE}/libc"
18 |
19 | ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \
20 | AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \
21 | CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \
22 | CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \
23 | CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ \
24 | LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld \
25 | FC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gfortran \
26 | NM=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-nm \
27 | RANLIB=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ranlib \
28 | LDFLAGS="-L${QEMU_LD_PREFIX}/usr/lib" \
29 | LIBS="-lssl -lcrypto -ldl -lpthread"
30 |
31 | COPY Toolchain.cmake ${CROSS_ROOT}/
32 | ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake
33 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/internal/iot-device-cube-1.0.0/alpine-arm64/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 | set(CMAKE_SYSTEM_PROCESSOR aarch64)
4 |
5 | set(cross_triple "aarch64-linux-gnu")
6 | set(cross_root /usr/xcc/${cross_triple})
7 |
8 | set(CMAKE_C_COMPILER $ENV{CC})
9 | set(CMAKE_CXX_COMPILER $ENV{CXX})
10 | set(CMAKE_Fortran_COMPILER $ENV{FC})
11 |
12 | set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/")
13 |
14 | set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${cross_triple})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 | set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/libc)
19 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/internal/iot-device-cube-1.0.0/arduino-base-0.3.6-alpha.preview/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-arduino-base-0.3.6-alpha.preview
2 | FROM ubuntu:18.04
3 |
4 | ARG arduino_cli_url=https://github.com/arduino/arduino-cli/releases/download/0.3.6-alpha.preview/arduino-cli-0.3.6-alpha.preview-linux64.tar.bz2
5 | ARG go_url=https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
6 |
7 | RUN mkdir /work
8 | WORKDIR /work
9 |
10 | # Install arduino-cli and go compiler
11 | RUN apt-get update && \
12 | apt-get install -y --no-install-recommends ca-certificates wget git unzip && \
13 | wget ${arduino_cli_url} && \
14 | tar -jxvf arduino-cli-* && \
15 | rm -r arduino-cli-*.tar.bz2 && \
16 | mv arduino-cli-* arduino-cli && \
17 | mv arduino-cli /usr/bin && \
18 | wget ${go_url} && \
19 | tar -C /usr/local -xzf go*.tar.gz && \
20 | rm go*.tar.gz && \
21 | apt-get clean && \
22 | rm -rf /var/lib/apt/lists/*
23 |
24 | ENV PATH=$PATH:/usr/local/go/bin
25 |
26 | # Download arduino-cli sdk
27 | RUN go get -u github.com/arduino/arduino-cli
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/internal/iot-device-cube-1.0.0/ubuntu-arm64/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 | set(CMAKE_SYSTEM_PROCESSOR $ENV{CMAKE_SYSTEM_PROCESSOR})
4 |
5 | set(cross_triple $ENV{CROSS_TRIPLE})
6 | set(cross_root /usr/xcc/${cross_triple})
7 |
8 | set(CMAKE_C_COMPILER $ENV{CC})
9 | set(CMAKE_CXX_COMPILER $ENV{CXX})
10 | set(CMAKE_Fortran_COMPILER $ENV{FC})
11 |
12 | set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/")
13 |
14 | set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${cross_triple})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 | set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/libc)
19 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/internal/iot-device-cube-1.0.0/ubuntu-cross-toolchain-arm32/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-ubuntu-cross-toolchain-arm32
2 | # Usage example:
3 | # docker build -t devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-ubuntu-cross-toolchain-arm32 .
4 | FROM ubuntu:18.04
5 | ARG linaro_package_uri=https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf.tar.xz
6 | ARG linaro_package_name=gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf
7 | ARG target_cross_triple=arm-linux-gnueabihf
8 |
9 | RUN mkdir -p /usr/xcc
10 | WORKDIR /usr/xcc
11 |
12 | # Prepare Linaro toolchain
13 | RUN apt-get update && \
14 | apt-get install -y --no-install-recommends wget ca-certificates xz-utils && \
15 | wget ${linaro_package_uri} && \
16 | tar -xf ${linaro_package_name}.tar.xz && \
17 | mv ${linaro_package_name} ${target_cross_triple} && \
18 | rm ${linaro_package_name}.tar.xz && \
19 | apt-get remove -y wget ca-certificates xz-utils && \
20 | apt-get clean && \
21 | rm -rf /var/lib/apt/lists/*
22 |
23 | # Set ENV
24 | ENV CROSS_TRIPLE=${target_cross_triple}
25 | ENV XCC_PREFIX=/usr/xcc
26 |
27 | ENV CROSS_ROOT=${XCC_PREFIX}/${CROSS_TRIPLE}
28 | ENV LIBC_PREFIX="${CROSS_ROOT}/${CROSS_TRIPLE}/libc"
29 |
30 | ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as
31 | ENV AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar
32 | ENV CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc
33 | ENV CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp
34 | ENV CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++
35 | ENV LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld
36 | ENV FC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gfortran
37 | ENV NM=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-nm
38 |
39 | ENV RANLIB=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ranlib
40 | ENV LDFLAGS="-L${LIBC_PREFIX}/usr/lib"
41 | ENV LIBS="-lssl -lcrypto -ldl -lpthread"
42 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/arduino-az3166-1.6.2/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.0-arduino-az3166-1.6.2
2 | FROM devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-arduino-base-0.3.6-alpha.preview
3 |
4 | ARG AZ3166_version=1.6.2
5 |
6 | # Use root as the user
7 | USER root
8 | ENV USER root
9 |
10 | # Add aditional Url to download AZ3166 package
11 | COPY arduino-cli.yaml /
12 | COPY install_az3166.sh /work
13 |
14 | # Install AZ3166
15 | RUN /work/install_az3166.sh ${AZ3166_version}
16 |
17 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/arduino-az3166-1.6.2/arduino-cli.yaml:
--------------------------------------------------------------------------------
1 | board_manager:
2 | additional_urls:
3 | - https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/arduino-az3166-1.6.2/install_az3166.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # set -x
3 |
4 | # By default install latest AZ3166 version: 1.6.2
5 | AZ3166_version=1.6.2
6 |
7 | install_AZ3166() {
8 | # Check arduino-cli
9 | arduino-cli -h
10 | if [[ $? != 0 ]]; then
11 | echo "## ERROR: arduino-cli is not correctly installed."
12 | exit 0
13 | fi
14 |
15 | if [[ $# == 0 ]]; then
16 | version=1.6.2
17 | else
18 | version=$1
19 | fi
20 |
21 | # Install AZ3166 package
22 | arduino-cli core list | grep -q AZ3166
23 | if [ $? != 0 ]; then
24 | echo "## AZ3166 has not been installed. Installing AZ3166..."
25 |
26 | echo "## arduino-cli config"
27 | arduino-cli config dump
28 |
29 | echo "## Update core index..."
30 | arduino-cli core update-index
31 |
32 | echo "## Install AZ3166 package"
33 | arduino-cli core install AZ3166:stm32f4@${version} --debug
34 |
35 | arduino-cli core list
36 | fi
37 | }
38 |
39 |
40 | if [[ $# == 0 ]]; then
41 | echo "## No argument is provided to the script."
42 | echo "Usage: $0 "
43 | else
44 | AZ3166_version=$1
45 | echo "## AZ3166 package version: ${AZ3166_version}"
46 | install_AZ3166 ${AZ3166_version}
47 | fi
48 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-app-20190411-ubuntu-arm64/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.0-azure-c-app-20190411-ubuntu-arm64
2 | ARG base_image_tag=1.0.0-azure-c-sdk-20190411-ubuntu-arm64
3 | FROM devicedevex.azurecr.io/public/iot-device-cube:${base_image_tag}
4 |
5 | COPY compile_app.sh /work/
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-app-20190411-ubuntu-arm64/compile_app.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | if [[ $# == 0 ]]; then
5 | echo "Usage: $0 "
6 | exit 1
7 | else
8 | srcFileFolder=$1
9 | iot_application_code_path="/work/azure-iot-sdk-c/iot_application"
10 | if [[ ! -d "${iot_application_code_path}" ]]; then
11 | mkdir ${iot_application_code_path}
12 | fi
13 | cp -rf ${srcFileFolder}/* ${iot_application_code_path}
14 | fi
15 |
16 | # Configure CMakeLists.txt on first compilation time
17 | iot_application_cmake_path="/work/azure-iot-sdk-c/cmake/iot_application"
18 | if [[ ! -d "${iot_application_cmake_path}" ]]; then
19 | echo "add_subdirectory(iot_application)" >> /work/azure-iot-sdk-c/CMakeLists.txt
20 | fi
21 |
22 | # Compile device code with azure-c-sdk
23 | cd /work/azure-iot-sdk-c/cmake && \
24 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${QEMU_LD_PREFIX}/usr .. -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON && \
25 | cmake --build .
26 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-app-20190705-ubuntu-arm32/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.0-azure-c-app-20190705-ubuntu-arm32
2 | ARG base_image_tag=1.0.0-azure-c-sdk-20190705-cross-toolchain-arm32
3 | FROM devicedevex.azurecr.io/public/iot-device-cube:${base_image_tag}
4 |
5 | COPY compile_app.sh /work/
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-app-20190705-ubuntu-arm32/compile_app.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | if [[ $# == 0 ]]; then
5 | echo "Usage: $0 "
6 | exit 1
7 | else
8 | srcFileFolder=$1
9 | iot_application_code_path="/work/azure-iot-sdk-c/iot_application"
10 | if [[ ! -d "${iot_application_code_path}" ]]; then
11 | mkdir ${iot_application_code_path}
12 | fi
13 | cp -rf ${srcFileFolder}/* ${iot_application_code_path}
14 | fi
15 |
16 | # Configure CMakeLists.txt on first compilation time
17 | iot_application_cmake_path="/work/azure-iot-sdk-c/cmake/iot_application"
18 | if [[ ! -d "${iot_application_cmake_path}" ]]; then
19 | echo "add_subdirectory(iot_application)" >> /work/azure-iot-sdk-c/CMakeLists.txt
20 | fi
21 |
22 | # Compile device code with azure-c-sdk
23 | cd /work/azure-iot-sdk-c/cmake && \
24 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${LIBC_PREFIX}/usr -Dhsm_type_symm_key:BOOL=ON -Duse_amqp:BOOL=OFF -Dbuild_service_client:BOOL=OFF .. && \
25 | cmake --build .
26 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-sdk-20190411-alpine-arm64/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.0-azure-c-sdk-20190411-alpine-arm64
2 | FROM devicedevex.azurecr.io/internal/iot-device-cube:1.0.0-alpine-arm64
3 |
4 | RUN mkdir /work
5 | WORKDIR /work
6 |
7 | RUN apk add --no-cache perl make cmake git && \
8 | wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz && \
9 | tar -xvf openssl-1.0.2o.tar.gz && \
10 | cd openssl-1.0.2o && \
11 | ./Configure linux-generic32 shared --prefix=${QEMU_LD_PREFIX}/usr --openssldir=${QEMU_LD_PREFIX}/usr && \
12 | make && \
13 | make install && \
14 | rm /work/openssl-1.0.2o.tar.gz && \
15 | rm -rf /work/openssl-1.0.2o && \
16 | cd .. && \
17 | wget http://curl.haxx.se/download/curl-7.60.0.tar.gz && \
18 | tar -xvf curl-7.60.0.tar.gz && \
19 | cd curl-7.60.0 && \
20 | ./configure --with-sysroot=${QEMU_LD_PREFIX} --prefix=${QEMU_LD_PREFIX}/usr --target=${CROSS_TRIPLE} --with-ssl --with-zlib --host=${CROSS_TRIPLE} --build=x86_64-pc-linux-uclibc && \
21 | make && \
22 | make install && \
23 | rm /work/curl-7.60.0.tar.gz && \
24 | rm -rf /work/curl-7.60.0 && \
25 | cd .. && \
26 | wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.32/util-linux-2.32-rc2.tar.gz && \
27 | tar -xvf util-linux-2.32-rc2.tar.gz && \
28 | cd util-linux-2.32-rc2 && \
29 | ./configure --prefix=${QEMU_LD_PREFIX}/usr --with-sysroot=${QEMU_LD_PREFIX} --target=${CROSS_TRIPLE} --host=${CROSS_TRIPLE} --disable-all-programs --disable-bash-completion --enable-libuuid && \
30 | make && \
31 | make install && \
32 | rm /work/util-linux-2.32-rc2.tar.gz && \
33 | rm -rf /work/util-linux-2.32-rc2 && \
34 | cd .. && \
35 | git clone --single-branch --branch 2019-04-11 --recursive https://github.com/azure/azure-iot-sdk-c.git && \
36 | cd azure-iot-sdk-c && \
37 | mkdir cmake && \
38 | cd cmake && \
39 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} .. && \
40 | make && \
41 | apk del perl git
42 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-sdk-20190411-ubuntu-x86/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG base_image=ubuntu:18.04
2 | FROM ${base_image}
3 | ARG c_sdk_repo=github.com/Azure/azure-iot-sdk-c-pnp
4 | ARG c_sdk_version=public-preview-utopia
5 | ARG github_username=default-username
6 | ARG github_token=default-token
7 |
8 | RUN apt-get update && \
9 | apt-get install -y git cmake build-essential curl libcurl4-openssl-dev libssl-dev uuid-dev
10 |
11 | RUN mkdir /work && \
12 | chown -R 1000:1000 /work
13 |
14 | # setup new user builder so that we don't run it all as root
15 | RUN groupadd -o -g $(stat -c "%g" /work) "builder" && \
16 | useradd -N -g $(stat -c "%g" /work) -m -o -u $(stat -c "%u" /work) -p builder "builder"
17 | USER builder
18 |
19 | WORKDIR /work
20 | RUN git clone https://${github_username}:${github_token}@${c_sdk_repo} --recursive -b ${c_sdk_version} azure-iot-sdk-c
21 | RUN cd azure-iot-sdk-c && \
22 | mkdir cmake && \
23 | cd cmake && \
24 | cmake -Dhsm_type_symm_key:BOOL=ON -Duse_amqp:BOOL=OFF -Dbuild_service_client:BOOL=OFF -Dbuild_provisioning_service_client:BOOL=OFF -Dskip_samples:BOOL=ON .. && \
25 | make
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-sdk-20190411-ubuntu-x86/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "image_name": "iot-device-cube:1.0.0-azure-c-sdk-20190411-ubuntu-x86",
3 | "arg": {
4 | "github_username": "[Your github username]",
5 | "github_token": "[Your github token]"
6 | }
7 | }
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.0/azure-c-sdk-20190705-cross-toolchain-arm32/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 |
4 | set(CMAKE_C_COMPILER ${CC})
5 | set(CMAKE_CXX_COMPILER ${CXX})
6 |
7 | set(CMAKE_FIND_ROOT_PATH ${CROSS_ROOT})
8 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
9 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
10 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
11 |
12 | set(CMAKE_SYSROOT ${CROSS_ROOT})
13 |
14 | SET(set_trusted_cert_in_samples true CACHE BOOL "Force use of TrustedCerts option" FORCE)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190411-ubuntu-arm64/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.1-azure-c-app-20190411-ubuntu-arm64
2 | ARG base_image_tag=1.0.0-azure-c-sdk-20190411-ubuntu-arm64
3 | FROM devicedevex.azurecr.io/public/iot-device-cube:${base_image_tag}
4 |
5 | RUN cp /work/azure-iot-sdk-c/CMakeLists.txt /work/azure-iot-sdk-c/default_CMakeLists.txt
6 | COPY compile_app.sh /work/
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190411-ubuntu-arm64/compile_app.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | application_name="iot_application"
5 | azure_c_sdk_directory="/work/azure-iot-sdk-c"
6 | cmake_directory="${azure_c_sdk_directory}/cmake"
7 | CMakeLists_file_path="${azure_c_sdk_directory}/CMakeLists.txt"
8 | CMakeLists_default_file_path="${azure_c_sdk_directory}/default_CMakeLists.txt"
9 | output_folder="/work/output"
10 |
11 | if [[ $# == 0 ]]; then
12 | echo "Usage: $0 [application name]"
13 | echo "default application name is ${application_name}"
14 | exit 1
15 | elif [[ $# -ge 2 ]]; then
16 | application_name=$2
17 | fi
18 |
19 | srcFileFolder=$1
20 | application_code_path="${azure_c_sdk_directory}/${application_name}"
21 | application_cmake_path="${cmake_directory}/${application_name}"
22 |
23 | # Copy code to azure-c-sdk directory
24 | rm -rf ${application_code_path}
25 | mkdir ${application_code_path}
26 | cp -rf ${srcFileFolder}/* ${application_code_path}
27 |
28 | # Refresh and configure CMakeLists.txt file
29 | cp ${CMakeLists_default_file_path} ${CMakeLists_file_path}
30 | echo "add_subdirectory(${application_name})" >> ${CMakeLists_file_path}
31 |
32 | # Compile device code with azure-c-sdk
33 | cd ${cmake_directory} && \
34 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${QEMU_LD_PREFIX}/usr .. -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON && \
35 | cmake --build .
36 |
37 | # Copy the compiled files to a fixed folder
38 | rm -rf ${output_folder}
39 | mkdir ${output_folder}
40 | if [[ -d "${application_cmake_path}" ]]; then
41 | cp -r ${application_cmake_path} ${output_folder}
42 | fi
43 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190411-ubuntu-x86/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.1-azure-c-app-20190411-ubuntu-x86
2 | ARG base_image_tag=1.0.0-azure-c-sdk-20190411-ubuntu-x86
3 | FROM devicedevex.azurecr.io/public/iot-device-cube:${base_image_tag}
4 |
5 | RUN cp /work/azure-iot-sdk-c/CMakeLists.txt /work/azure-iot-sdk-c/default_CMakeLists.txt
6 | COPY compile_app.sh /work/
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190411-ubuntu-x86/compile_app.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | application_name="iot_application"
5 | azure_c_sdk_directory="/work/azure-iot-sdk-c"
6 | cmake_directory="${azure_c_sdk_directory}/cmake"
7 | CMakeLists_file_path="${azure_c_sdk_directory}/CMakeLists.txt"
8 | CMakeLists_default_file_path="${azure_c_sdk_directory}/default_CMakeLists.txt"
9 | output_folder="/work/output"
10 |
11 | if [[ $# == 0 ]]; then
12 | echo "Usage: $0 [application name]"
13 | echo "default application name is ${application_name}"
14 | exit 1
15 | elif [[ $# -ge 2 ]]; then
16 | application_name=$2
17 | fi
18 |
19 | srcFileFolder=$1
20 | application_code_path="${azure_c_sdk_directory}/${application_name}"
21 | application_cmake_path="${cmake_directory}/${application_name}"
22 |
23 | # Copy code to azure-c-sdk directory
24 | rm -rf ${application_code_path}
25 | mkdir ${application_code_path}
26 | cp -rf ${srcFileFolder}/* ${application_code_path}
27 |
28 | # Refresh and configure CMakeLists.txt file
29 | cp ${CMakeLists_default_file_path} ${CMakeLists_file_path}
30 | echo "add_subdirectory(${application_name})" >> ${CMakeLists_file_path}
31 |
32 | # Compile device code with azure-c-sdk
33 | cd ${cmake_directory} && \
34 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${QEMU_LD_PREFIX}/usr .. -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON && \
35 | cmake --build .
36 |
37 | # Copy the compiled files to a fixed folder
38 | rm -rf ${output_folder}
39 | mkdir ${output_folder}
40 | if [[ -d "${application_cmake_path}" ]]; then
41 | cp -r ${application_cmake_path} ${output_folder}
42 | fi
43 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190411-ubuntu-x86/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "image_name": "iot-device-cube:1.0.1-azure-c-app-20190411-ubuntu-x86",
3 | "arg": {
4 | "base_image_tag": "1.0.0-azure-c-sdk-20190411-ubuntu-x86"
5 | }
6 | }
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190705-ubuntu-arm32/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.1-azure-c-app-20190705-ubuntu-arm32
2 | ARG base_image_tag=1.0.0-azure-c-sdk-20190705-cross-toolchain-arm32
3 | FROM devicedevex.azurecr.io/public/iot-device-cube:${base_image_tag}
4 |
5 | RUN cp /work/azure-iot-sdk-c/CMakeLists.txt /work/azure-iot-sdk-c/default_CMakeLists.txt
6 | COPY compile_app.sh /work/
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.1/azure-c-app-20190705-ubuntu-arm32/compile_app.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | application_name="iot_application"
5 | azure_c_sdk_directory="/work/azure-iot-sdk-c"
6 | cmake_directory="${azure_c_sdk_directory}/cmake"
7 | CMakeLists_file_path="${azure_c_sdk_directory}/CMakeLists.txt"
8 | CMakeLists_default_file_path="${azure_c_sdk_directory}/default_CMakeLists.txt"
9 | output_folder="/work/output"
10 |
11 | if [[ $# == 0 ]]; then
12 | echo "Usage: $0 [application name]"
13 | echo "default application name is ${application_name}"
14 | exit 1
15 | elif [[ $# -ge 2 ]]; then
16 | application_name=$2
17 | fi
18 |
19 | srcFileFolder=$1
20 | application_code_path="${azure_c_sdk_directory}/${application_name}"
21 | application_cmake_path="${cmake_directory}/${application_name}"
22 |
23 | # Copy code to azure-c-sdk directory
24 | rm -rf ${application_code_path}
25 | mkdir ${application_code_path}
26 | cp -rf ${srcFileFolder}/* ${application_code_path}
27 |
28 | # Refresh and configure CMakeLists.txt file
29 | cp ${CMakeLists_default_file_path} ${CMakeLists_file_path}
30 | echo "add_subdirectory(${application_name})" >> ${CMakeLists_file_path}
31 |
32 | # Compile device code with azure-c-sdk
33 | cd ${cmake_directory} && \
34 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${QEMU_LD_PREFIX}/usr .. -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON && \
35 | cmake --build .
36 |
37 | # Copy the compiled files to a fixed folder
38 | rm -rf ${output_folder}
39 | mkdir ${output_folder}
40 | if [[ -d "${application_cmake_path}" ]]; then
41 | cp -r ${application_cmake_path} ${output_folder}
42 | fi
43 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.2/README.md:
--------------------------------------------------------------------------------
1 | ## `iot-device-cube-1.0.2`
2 |
3 | This serial of docker images installs `https://github.com/Azure/azure-iot-sdk-c` repo, `public-preview` branch.
4 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.2/azure-c-sdk-public-preview-cross-toolchain-arm32/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 |
4 | set(CMAKE_C_COMPILER ${CC})
5 | set(CMAKE_CXX_COMPILER ${CXX})
6 |
7 | set(CMAKE_FIND_ROOT_PATH ${CROSS_ROOT})
8 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
9 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
10 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
11 |
12 | set(CMAKE_SYSROOT ${CROSS_ROOT})
13 |
14 | SET(set_trusted_cert_in_samples true CACHE BOOL "Force use of TrustedCerts option" FORCE)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.2/azure-c-sdk-public-preview-ubuntu-x86/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.2-azure-c-sdk-public-preview-ubuntu-x86
2 | ARG base_image=ubuntu:18.04
3 | FROM ${base_image}
4 | ARG c_sdk_branch=public-preview
5 |
6 | RUN apt-get update && \
7 | apt-get install -y git cmake build-essential curl libcurl4-openssl-dev libssl-dev uuid-dev
8 |
9 | RUN mkdir /work && \
10 | chown -R 1000:1000 /work
11 |
12 | # setup new user builder so that we don't run it all as root
13 | RUN groupadd -o -g $(stat -c "%g" /work) "builder" && \
14 | useradd -N -g $(stat -c "%g" /work) -m -o -u $(stat -c "%u" /work) -p builder "builder"
15 | USER builder
16 |
17 | WORKDIR /work
18 | RUN git clone --single-branch --branch ${c_sdk_branch} --recursive https://github.com/azure/azure-iot-sdk-c.git && \
19 | cd azure-iot-sdk-c && \
20 | mkdir cmake && \
21 | cd cmake && \
22 | cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON .. && \
23 | make
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/README.md:
--------------------------------------------------------------------------------
1 | ## `iot-device-cube-1.0.3`
2 |
3 | This serial of docker images installs Azure IoT C SDK using vcpkg.
4 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/azure-c-sdk-public-preview-cross-toolchain-arm32/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 |
4 | set(CMAKE_C_COMPILER ${CC})
5 | set(CMAKE_CXX_COMPILER ${CXX})
6 |
7 | set(CMAKE_FIND_ROOT_PATH ${CROSS_ROOT})
8 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
9 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
10 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
11 |
12 | set(CMAKE_SYSROOT ${CROSS_ROOT})
13 |
14 | SET(set_trusted_cert_in_samples true CACHE BOOL "Force use of TrustedCerts option" FORCE)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/azure-c-sdk-public-preview-cross-toolchain-arm32/arm-linux-custom.cmake:
--------------------------------------------------------------------------------
1 | set(VCPKG_TARGET_ARCHITECTURE arm)
2 | set(VCPKG_CRT_LINKAGE dynamic)
3 | set(VCPKG_LIBRARY_LINKAGE static)
4 |
5 | set(VCPKG_CMAKE_SYSTEM_NAME Linux)
6 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /work/vcpkg/scripts/toolchains/Toolchain.cmake)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/azure-c-sdk-public-preview-cross-toolchain-arm64/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 | set(CMAKE_SYSTEM_PROCESSOR aarch64)
4 |
5 | set(cross_triple "aarch64-linux-gnu")
6 | set(cross_root /usr/xcc/${cross_triple})
7 |
8 | set(CMAKE_C_COMPILER $ENV{CC})
9 | set(CMAKE_CXX_COMPILER $ENV{CXX})
10 | set(CMAKE_Fortran_COMPILER $ENV{FC})
11 |
12 | set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/")
13 |
14 | set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${cross_triple})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 | set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/libc)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/azure-c-sdk-public-preview-cross-toolchain-arm64/aarch64-linux-custom.cmake:
--------------------------------------------------------------------------------
1 | set(VCPKG_TARGET_ARCHITECTURE arm64)
2 | set(VCPKG_CRT_LINKAGE dynamic)
3 | set(VCPKG_LIBRARY_LINKAGE static)
4 |
5 | set(VCPKG_CMAKE_SYSTEM_NAME Linux)
6 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /work/vcpkg/scripts/toolchains/Toolchain.cmake)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.3/azure-c-sdk-public-preview-ubuntu-x86/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.3-azure-c-sdk-public-preview-ubuntu-x86
2 | FROM ubuntu:18.04
3 |
4 | WORKDIR /work
5 |
6 | RUN apt-get update && \
7 | apt-get install -y git cmake build-essential libcurl4-openssl-dev libssl-dev uuid-dev curl unzip tar && \
8 | git clone https://github.com/microsoft/vcpkg && \
9 | cd vcpkg && \
10 | ./bootstrap-vcpkg.sh && \
11 | ./vcpkg install azure-iot-sdk-c[public-preview,use_prov_client] && \
12 | apt-get remove -y git unzip && \
13 | apt-get clean && \
14 | rm -rf /var/lib/apt/lists/*
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/README.md:
--------------------------------------------------------------------------------
1 | ## `iot-device-cube-1.0.4`
2 |
3 | This serial of docker images installs latest (2019-11-22) Azure IoT C SDK with vcpkg.
4 |
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/azure-c-sdk-public-preview-cross-toolchain-arm32/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 |
4 | set(CMAKE_C_COMPILER ${CC})
5 | set(CMAKE_CXX_COMPILER ${CXX})
6 |
7 | set(CMAKE_FIND_ROOT_PATH ${CROSS_ROOT})
8 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
9 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
10 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
11 |
12 | set(CMAKE_SYSROOT ${CROSS_ROOT})
13 |
14 | SET(set_trusted_cert_in_samples true CACHE BOOL "Force use of TrustedCerts option" FORCE)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/azure-c-sdk-public-preview-cross-toolchain-arm32/arm-linux-custom.cmake:
--------------------------------------------------------------------------------
1 | set(VCPKG_TARGET_ARCHITECTURE arm)
2 | set(VCPKG_CRT_LINKAGE dynamic)
3 | set(VCPKG_LIBRARY_LINKAGE static)
4 |
5 | set(VCPKG_CMAKE_SYSTEM_NAME Linux)
6 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /work/vcpkg/scripts/toolchains/Toolchain.cmake)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/azure-c-sdk-public-preview-cross-toolchain-arm64/Toolchain.cmake:
--------------------------------------------------------------------------------
1 | # set(CMAKE_SYSTEM_NAME Linux)
2 | set(CMAKE_SYSTEM_VERSION 1)
3 | set(CMAKE_SYSTEM_PROCESSOR aarch64)
4 |
5 | set(cross_triple "aarch64-linux-gnu")
6 | set(cross_root /usr/xcc/${cross_triple})
7 |
8 | set(CMAKE_C_COMPILER $ENV{CC})
9 | set(CMAKE_CXX_COMPILER $ENV{CXX})
10 | set(CMAKE_Fortran_COMPILER $ENV{FC})
11 |
12 | set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/")
13 |
14 | set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${cross_triple})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
18 | set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/libc)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/azure-c-sdk-public-preview-cross-toolchain-arm64/aarch64-linux-custom.cmake:
--------------------------------------------------------------------------------
1 | set(VCPKG_TARGET_ARCHITECTURE arm64)
2 | set(VCPKG_CRT_LINKAGE dynamic)
3 | set(VCPKG_LIBRARY_LINKAGE static)
4 |
5 | set(VCPKG_CMAKE_SYSTEM_NAME Linux)
6 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /work/vcpkg/scripts/toolchains/Toolchain.cmake)
--------------------------------------------------------------------------------
/devicedevex_dockerfiles/public/iot-device-cube-1.0.4/azure-c-sdk-public-preview-ubuntu-x86/Dockerfile:
--------------------------------------------------------------------------------
1 | # devicedevex.azurecr.io/public/iot-device-cube:1.0.4-azure-c-sdk-public-preview-ubuntu-x86
2 | FROM ubuntu:18.04
3 |
4 | WORKDIR /work
5 |
6 | RUN apt-get update && \
7 | apt-get install -y git cmake build-essential libcurl4-openssl-dev libssl-dev uuid-dev curl unzip tar && \
8 | git clone https://github.com/microsoft/vcpkg && \
9 | cd vcpkg && \
10 | ./bootstrap-vcpkg.sh && \
11 | ./vcpkg install azure-iot-sdk-c[public-preview,use_prov_client] && \
12 | apt-get remove -y git unzip && \
13 | apt-get clean && \
14 | rm -rf /var/lib/apt/lists/*
--------------------------------------------------------------------------------
/docs/create-iothub-device.md:
--------------------------------------------------------------------------------
1 | # Create Azure IoT Hub Device
2 |
3 | Follow these steps to use Azure IoT Hub Toolkit in VS Code to create an IoT Hub device and restrieve its connection string.
4 |
5 | ## Prerequisite
6 |
7 | - An active Azure subscription. [Activate a free 30-day trial Microsoft Azure account](https://azureinfo.microsoft.com/us-freetrial.html).
8 | - [Azure Iot Hub Toolkit extension](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit). If you have the Azure IoT Device Workbench installed, you are good to go.
9 |
10 | ## Steps
11 |
12 | 1. In VS Code, press `F1`, type and select **Azure: Sign In**.
13 |
14 | 2. Once you signed in, you can see your Azure account at the status bar.
15 |
16 |
17 | 3. If you don't have Azure IoT Hub created before, Press `F1`, type and select **Azure IoT Hub: Create IoT Hub**. Follow the step by step wizard to finish creating new IoT Hub.
18 |
19 | 4. Otherwise, use command **Azure IoT Hub: Select IoT Hub** to select the one either you have already or just created.
20 |
21 | 5. On the sidebar, in **AZURE IOT HUB** section, click More Actions button and select **Create Device** to create a new IoT Hub device.
22 |
23 |
24 |
25 |
26 | 6. Enter the device ID and press enter.
27 | 
28 |
29 | 7. You will see the device in the "Devices" list. Right click on it and select **Copy Device Connection String**. Note it down.
30 |
31 |
--------------------------------------------------------------------------------
/docs/embedded-linux/README.md:
--------------------------------------------------------------------------------
1 | # Embedded Linux
2 |
--------------------------------------------------------------------------------
/docs/embedded-linux/configure-external-cmake-project-as-embedded-linux-project.md:
--------------------------------------------------------------------------------
1 | # Configure an External CMake Project as Embedded Linux Project
2 |
3 | You can now configure an external CMake project to be an Embedded Linux IoT Project, which you can develop leveraging the container toolchain: `armv7`, `arm64` or `x86`. It is convenient for cross-compilation or simulation.
4 |
5 | ## Configure an External CMake Project to be an Embedded Linux Project
6 |
7 | 1. Open your external CMake project folder, which is supposed to have `CMakeLists.txt` file under the root directory.
8 |
9 | 2. Open command palette and select "**Azure IoT Device Workbench: Configure Project for Device Development Environment...**"
10 |
11 | 3. Select **Embedded Linux (Preview)** as platform type.
12 |
13 | 4. Select **Azure IoT Device C SDK for x86 Linux** as your toolchain container for your device platform. (Select **Azure IoT Device C SDK for armv7 Linux** or **Azure IoT Device C SDK for arm64 Linux** if you would like to cross-compile your application.) Later the built application will be able to be executed in x86 Linux machine.
14 |
15 | 5. Select **Yes** to open the configured project in remote container.
16 |
17 | > The first time you use a container, it takes around 1 to 3 minutes to download and prepare the dev container. Click the details link on the notification for the progress:
18 | 
19 |
20 | 6. Once it's done, you are in container toolchain development environment. You can execute "**Azure IoT Device Workbench: Compile Device Code**" and "**Azure IoT Device Workbench: Upload Device Code**" to develop your application with Azure IoT C SDK and container toolchain pre-installed.
21 |
22 | 
23 |
--------------------------------------------------------------------------------
/docs/embedded-linux/embedded-linux-configure-project.md:
--------------------------------------------------------------------------------
1 | # Configure an External CMake Project as Embedded Linux Project
2 |
3 | You can now configure an external CMake project to be an Embedded Linux IoT Project, which you can develop leveraging the container toolchain: `armv7`, `arm64` or `x86`. It is convenient for cross-compilation or simulation.
4 |
5 | ## Configure an External CMake Project to be an Embedded Linux Project
6 |
7 | 1. Open your external CMake project folder, which is supposed to have `CMakeLists.txt` file under the root directory.
8 |
9 | 1. Open command palette and select "**Azure IoT Device Workbench: Configure Project for Device Development Environment...**"
10 |
11 | 1. Select **Embedded_Linux (Preview)** as platform type.
12 |
13 | 1. Select **Azure IoT Device C SDK for x86 Linux** as your toolchain container for your device platform. (Select **Azure IoT Device C SDK for armv7 Linux** or **Azure IoT Device C SDK for arm64 Linux** if you would like to cross-compile your application.) Later the built application will be able to be executed in x86 Linux machine.
14 |
15 | 1. Select **No** to open the configured project in remote container.
16 |
17 | > The first time you use a container, it takes around 1 to 3 minutes to download and prepare the dev container. Click the details link on the notification for the progress:
18 | 
19 |
20 | 1. Once it's done, you are in container toolchain development environment. You can execute "**Azure IoT Device Workbench: Compile Device Code**" and "**Azure IoT Device Workbench: Upload Device Code**" to develop your application with Azure IoT C SDK and container toolchain pre-installed.
21 |
22 | 
--------------------------------------------------------------------------------
/docs/embedded-linux/embedded-linux-customization.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/embedded-linux/embedded-linux-customization.md
--------------------------------------------------------------------------------
/docs/embedded-linux/embedded-linux-setup.md:
--------------------------------------------------------------------------------
1 | # Embedded Linux Setup
2 |
3 | If you are developing on embedded Linux for [ARM Cortex-A series](https://developer.arm.com/ip-products/processors/cortex-a) devices, you need to install and configure Docker in order to use a container as a compiling environment. [VS Code Remote](https://aka.ms/vscode-remote) is the technology that enables this experience.
4 |
5 | ## System Requirements
6 |
7 | - Windows: Docker Desktop 2.0+ on Windows 10 Pro/Enterprise. (Docker Toolbox is not supported.)
8 | - macOS: Docker Desktop 2.0+.
9 | - Linux: Docker CE/EE 18.06+ and Docker Compose 1.21+. (The Ubuntu snap package is not supported.)
10 |
11 | ## Install Docker
12 |
13 | Install and configure Docker for your operating system
14 |
15 | ### Windows / macOS
16 |
17 | 1. Install Docker Desktop for [Windows](https://docs.docker.com/docker-for-windows/install/) / [macOS](https://docs.docker.com/docker-for-mac/install/).
18 |
19 | 1. Right-click on the Docker taskbar item and update **Settings / Preferences > Shared Drives / File Sharing** to enable C drives in a container. If you run into trouble, see Docker Desktop for Windows tips on avoiding common problems with sharing.
20 |
21 |
22 |
23 | ### Linux
24 |
25 | 1. Follow the official install instructions for Docker CE/EE for your distribution. If you are using Docker Compose, follow the Docker Compose directions as well.
26 |
27 | 2. Add your user to the docker group by using a terminal to run:
28 | ```bash
29 | sudo usermod -aG docker $USER
30 | ```
31 |
32 | 3. Sign out and back in again so your changes take effect.
33 |
34 | 4. Check if Docker on your Linux use proper DNS. If output looks like below, there is a problem resolving DNS. Check FAQ: [Docker Setup on Linux](https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/) to fix the problem first.
35 |
36 | ```bash
37 | $ docker run busybox nslookup google.com
38 |
39 | Server: 8.8.8.8
40 | Address 1: 8.8.8.8
41 | nslookup: can't resolve 'google.com'
42 | ```
--------------------------------------------------------------------------------
/docs/esp32/README.md:
--------------------------------------------------------------------------------
1 | # ESP32 Arduino
2 |
--------------------------------------------------------------------------------
/docs/esp32/media/esp32-get-started/change-board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/esp32-get-started/change-board.png
--------------------------------------------------------------------------------
/docs/esp32/media/esp32-get-started/copy-connection-string.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/esp32-get-started/copy-connection-string.png
--------------------------------------------------------------------------------
/docs/esp32/media/esp32-get-started/esp32-device-uploaded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/esp32-get-started/esp32-device-uploaded.png
--------------------------------------------------------------------------------
/docs/esp32/media/esp32-get-started/esp32-install-sdk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/esp32-get-started/esp32-install-sdk.jpg
--------------------------------------------------------------------------------
/docs/esp32/media/esp32-get-started/install-workbench.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/esp32-get-started/install-workbench.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-cloud-deploy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-cloud-deploy.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-cloud-provision-steps3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-cloud-provision-steps3.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-cloud-provision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-cloud-provision.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-device-settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-device-settings.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-device-upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-device-upload.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-examples-board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-examples-board.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-examples-cmd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-examples-cmd.png
--------------------------------------------------------------------------------
/docs/esp32/media/iot-workbench-examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/iot-workbench-examples.png
--------------------------------------------------------------------------------
/docs/esp32/media/m5stack-email-receiver/m5stack-email-display.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/m5stack-email-receiver/m5stack-email-display.jpg
--------------------------------------------------------------------------------
/docs/esp32/media/m5stack-email-receiver/m5stack-email-receiver-function-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/m5stack-email-receiver/m5stack-email-receiver-function-config.png
--------------------------------------------------------------------------------
/docs/esp32/media/m5stack-email-receiver/m5stack-email-receiver-gmail-trigger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/m5stack-email-receiver/m5stack-email-receiver-gmail-trigger.png
--------------------------------------------------------------------------------
/docs/esp32/media/m5stack-email-receiver/open-example-m5stack-email-receiver.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/esp32/media/m5stack-email-receiver/open-example-m5stack-email-receiver.jpg
--------------------------------------------------------------------------------
/docs/images/author-pnp-dcm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/author-pnp-dcm.png
--------------------------------------------------------------------------------
/docs/images/azure-account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/azure-account.png
--------------------------------------------------------------------------------
/docs/images/compile-success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/compile-success.png
--------------------------------------------------------------------------------
/docs/images/config-device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/config-device.png
--------------------------------------------------------------------------------
/docs/images/conn-string.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/conn-string.png
--------------------------------------------------------------------------------
/docs/images/container-project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/container-project.png
--------------------------------------------------------------------------------
/docs/images/create-device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/create-device.png
--------------------------------------------------------------------------------
/docs/images/dev-container-ready.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/dev-container-ready.png
--------------------------------------------------------------------------------
/docs/images/device-code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/device-code.png
--------------------------------------------------------------------------------
/docs/images/device-name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/device-name.png
--------------------------------------------------------------------------------
/docs/images/device-workbench.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/device-workbench.png
--------------------------------------------------------------------------------
/docs/images/example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/example.gif
--------------------------------------------------------------------------------
/docs/images/external-project-in-remote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/external-project-in-remote.png
--------------------------------------------------------------------------------
/docs/images/iothub-d2c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/iothub-d2c.png
--------------------------------------------------------------------------------
/docs/images/iothub-sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/iothub-sample.png
--------------------------------------------------------------------------------
/docs/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/logo.png
--------------------------------------------------------------------------------
/docs/images/more-actions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/more-actions.png
--------------------------------------------------------------------------------
/docs/images/new.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/new.gif
--------------------------------------------------------------------------------
/docs/images/pnp-with-container-compile-success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/pnp-with-container-compile-success.png
--------------------------------------------------------------------------------
/docs/images/pnp-with-container-iothub-d2c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/pnp-with-container-iothub-d2c.png
--------------------------------------------------------------------------------
/docs/images/pnp-with-container-result.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/pnp-with-container-result.jpg
--------------------------------------------------------------------------------
/docs/images/prepare-dev-container.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/prepare-dev-container.png
--------------------------------------------------------------------------------
/docs/images/result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/result.png
--------------------------------------------------------------------------------
/docs/images/run-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/run-app.png
--------------------------------------------------------------------------------
/docs/images/shared-drivers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/shared-drivers.png
--------------------------------------------------------------------------------
/docs/images/upload-options.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/images/upload-options.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-configuration-mode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-configuration-mode.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/capture-url.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/capture-url.jpg
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/iot-workbench-device-uploaded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/iot-workbench-device-uploaded.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/logic-app-sendgrid.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/logic-app-sendgrid.JPG
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/open-sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/open-sample.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/sendgrid-create-api-first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/sendgrid-create-api-first.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/sendgrid-create-api-second.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/sendgrid-create-api-second.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/sendgrid-deploy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/sendgrid-deploy.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/sendgrid-manage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/sendgrid-manage.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/test-door-closed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/test-door-closed.jpg
--------------------------------------------------------------------------------
/docs/iot-devkit/media/devkit-door-monitor/test-door-opened.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/devkit-door-monitor/test-door-opened.jpg
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-diagram.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-1.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-2.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-3.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-4.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-5.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/devkit-result-6.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/iot-workbench-device-uploaded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/iot-workbench-device-uploaded.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/iot-workbench-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/iot-workbench-example.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-devkit-shakeshake/update-twitter-token.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-devkit-shakeshake/update-twitter-token.jpg
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-cloud-deploy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-cloud-deploy.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-cloud-provision-steps3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-cloud-provision-steps3.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-cloud-provision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-cloud-provision.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-connection-done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-connection-done.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-device-settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-device-settings.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-device-string1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-device-string1.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-device-upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-device-upload.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-examples-board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-examples-board.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-examples-cmd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-examples-cmd.png
--------------------------------------------------------------------------------
/docs/iot-devkit/media/iot-workbench-examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/iot-devkit/media/iot-workbench-examples.png
--------------------------------------------------------------------------------
/docs/pic/azure_signin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/azure_signin.png
--------------------------------------------------------------------------------
/docs/pic/iot-workbench-cloud-provision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/iot-workbench-cloud-provision.png
--------------------------------------------------------------------------------
/docs/pic/iothub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/iothub.png
--------------------------------------------------------------------------------
/docs/pic/iothub_device.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/iothub_device.png
--------------------------------------------------------------------------------
/docs/pic/openexisting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/openexisting.png
--------------------------------------------------------------------------------
/docs/pic/provision_process.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/provision_process.png
--------------------------------------------------------------------------------
/docs/pic/resource_group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/resource_group.png
--------------------------------------------------------------------------------
/docs/pic/sign_in_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/sign_in_success.png
--------------------------------------------------------------------------------
/docs/pic/subscription.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/docs/pic/subscription.png
--------------------------------------------------------------------------------
/docs/scripts/genImageListToDelete.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | #set -x
4 | LOG=./fulllog # log to audit
5 |
6 | patternInFile() {
7 | # example:./a/b/xxx.png
8 | PATTERN=$1
9 | FILE=$2
10 |
11 | RES=`grep $PATTERN ./$FILE`
12 |
13 | if [ -n "$RES" ];then
14 | return 1 # true
15 | else
16 | return 0 # false
17 | fi
18 | }
19 |
20 | shouldIBeDeleted() {
21 | #IMAGE_PATTERN="$1"
22 | #MDS_DIR="$2" # suppose mds are under this dir without sub dirs.
23 |
24 | echo "" >> $LOG
25 | echo "$1 <- " >> $LOG
26 |
27 | CNT=0
28 |
29 | for MD in `ls ./$2 | grep md$`
30 | do
31 | MD_FILE=./$2/$MD
32 | patternInFile "$1" $MD_FILE
33 | DELTA=$?
34 | if [ "$DELTA" = "1" ];then
35 | echo " $MD_FILE" >> $LOG
36 | fi
37 | (( CNT += DELTA ))
38 | done
39 |
40 | if [ "$CNT" = "0" ];then
41 | # should be deleted.
42 | # no md files depend on this image.
43 | return 1 # yes to delete.
44 | else
45 | return 0 # not to delete.
46 | fi
47 | }
48 |
49 | DELETE_LIST=./todelete
50 |
51 | splitForLast() {
52 | # Usage: split "string" "delimiter"
53 | IFS=$'\n' read -d "" -ra arr <<< "$1"
54 | printf '%s\n' "${arr[@]}"
55 | }
56 |
57 | walkDirGenDeleteList() {
58 | #IMAGE_DIR=$1
59 | #MD_DIR=$2
60 |
61 | # code refer to: https://github.com/dylanaraps/pure-bash-bible
62 | shopt -s globstar
63 | for IMG in ./$1/**/*
64 | do
65 | if [ -f "$IMG" ];then
66 | # regular file, expect to be of image type.
67 | # here we got the full path of image: $IMG
68 | # trim to get last image file name: $FNAME.
69 | IFS=$'/' read -d "" -ra ARR <<< "$IMG"
70 | FNAME=${ARR[-2]}/${ARR[-1]}
71 | shouldIBeDeleted $FNAME $2
72 | if [ "$?" = "1" ];then
73 | echo $IMG >> ./$DELETE_LIST # collect files to be deleted.
74 | fi
75 | fi
76 | done
77 | shopt -u globstar
78 | }
79 |
80 | >$LOG
81 | >$DELETE_LIST
82 |
83 | walkDirGenDeleteList ../esp32/media ../esp32
84 | #walkDirGenDeleteList ../iot-devkit/media ../iot-devkit
85 |
--------------------------------------------------------------------------------
/hooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "Checking TypeScript style..."
4 | if [[ $(gts check) ]]; then
5 | echo "Trying auto fix style issues..."
6 | gts fix
7 | if [[ $(gts check) ]]; then
8 | echo "You have style issues that cannot be fixed automatically, please fix it manually first before commit."
9 | exit 1
10 | else
11 | git add -u
12 | fi
13 | fi
--------------------------------------------------------------------------------
/hooks/readme.md:
--------------------------------------------------------------------------------
1 | Move all files under this folder to `.git/hooks` or symlink them in `.git/hooks` to make hooks work.
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | moduleFileExtensions: ["ts", "js"],
3 | transform: {
4 | "\\.ts$": "ts-jest"
5 | },
6 | globals: {
7 | "ts-jest": {
8 | tsConfig: "tsconfig.json"
9 | }
10 | },
11 | testMatch: ["**/test/**/*.test.ts"],
12 | testPathIgnorePatterns: ["/node_modules/"]
13 | };
14 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/logo.png
--------------------------------------------------------------------------------
/resources/pnp/definitions/constraint.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": {
3 | "v1": "http://azureiot.com/v1/contexts/IoTModel.json"
4 | },
5 | "@id": {
6 | "minLength": 1,
7 | "maxLength": 256,
8 | "pattern": "^urn(:[a-zA-Z_][a-zA-Z0-9_]*){2,}:[0-9]+$"
9 | },
10 | "comment": {
11 | "minLength": 1,
12 | "maxLength": 512
13 | },
14 | "description": {
15 | "minLength": 1,
16 | "maxLength": 512
17 | },
18 | "displayName": {
19 | "minLength": 1,
20 | "maxLength": 64
21 | },
22 | "enumValues": {
23 | "minItems": 1
24 | },
25 | "fields": {
26 | "minItems": 1
27 | },
28 | "name": {
29 | "minLength": 1,
30 | "maxLength": 64,
31 | "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
32 | },
33 | "displayUnit": {
34 | "minLength": 1,
35 | "maxLength": 64
36 | },
37 | "contents": {
38 | "minItems": 1,
39 | "maxItems": 300
40 | },
41 | "schemas": {
42 | "minItems": 1
43 | },
44 | "implements": {
45 | "minItems": 1,
46 | "maxItems": 30
47 | },
48 | "Interface": {
49 | "required": ["@id", "@type", "@context"]
50 | },
51 | "Telemetry": {
52 | "required": ["@type", "name", "schema"]
53 | },
54 | "Property": {
55 | "required": ["@type", "name", "schema"]
56 | },
57 | "Command": {
58 | "required": ["@type", "name"]
59 | },
60 | "Array": {
61 | "required": ["@type", "elementSchema"]
62 | },
63 | "Enum": {
64 | "required": ["@type", "enumValues", "valueSchema"]
65 | },
66 | "EnumValue": {
67 | "required": ["name", "enumValue"]
68 | },
69 | "Map": {
70 | "required": ["@type", "mapKey", "mapValue"]
71 | },
72 | "MapKey": {
73 | "required": ["name", "schema"]
74 | },
75 | "MapValue": {
76 | "required": ["name", "schema"]
77 | },
78 | "Object": {
79 | "required": ["@type", "fields"]
80 | },
81 | "SchemaField": {
82 | "required": ["name", "schema"]
83 | },
84 | "CapabilityModel": {
85 | "required": ["@id", "@type", "@context", "implements"]
86 | },
87 | "InterfaceInstance": {
88 | "required": ["name", "schema"]
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/resources/pnp/templates/emptySchema.json:
--------------------------------------------------------------------------------
1 | {
2 | "anyOf": [
3 | { "type": "object" },
4 | { "type": "array" },
5 | { "type": "string" },
6 | { "type": "number" },
7 | { "type": "boolean" },
8 | { "type": "null" }
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/resources/pnp/templates/sample.capabilitymodel.json:
--------------------------------------------------------------------------------
1 | {
2 | "@id": "{DigitalTwinIdentifier}",
3 | "@type": "CapabilityModel",
4 | "displayName": "mycapabilitymodel",
5 | "implements": [
6 | {
7 | "schema": "urn:azureiot:DeviceManagement:DeviceInformation:1",
8 | "name": "deviceInfo"
9 | }
10 | ],
11 | "@context": "http://azureiot.com/v1/contexts/IoTModel.json"
12 | }
13 |
--------------------------------------------------------------------------------
/resources/pnp/templates/sample.interface.json:
--------------------------------------------------------------------------------
1 | {
2 | "@id": "{DigitalTwinIdentifier}",
3 | "@type": "Interface",
4 | "displayName": "myinterface",
5 | "contents": [
6 | {
7 | "@type": "Property",
8 | "displayName": "Device Name",
9 | "description": "The name of the device.",
10 | "name": "name",
11 | "schema": "string",
12 | "writable": false
13 | },
14 | {
15 | "@type": "Property",
16 | "name": "fanSpeed",
17 | "displayName": "Fan Speed",
18 | "writable": true,
19 | "schema": "double"
20 | },
21 | {
22 | "@type": "Telemetry",
23 | "comment": "This shows an event that contains a single value (temperature).",
24 | "name": "temperature",
25 | "schema": "double"
26 | },
27 | {
28 | "@type": "Telemetry",
29 | "name": "magnetometer",
30 | "displayName": "Magnetometer",
31 | "comment": "This shows a complex telemetry that contains a magnetometer reading.",
32 | "schema": {
33 | "@type": "Object",
34 | "fields": [
35 | {
36 | "name": "x",
37 | "schema": "integer"
38 | },
39 | {
40 | "name": "y",
41 | "schema": "integer"
42 | },
43 | {
44 | "name": "z",
45 | "schema": "integer"
46 | }
47 | ]
48 | }
49 | },
50 | {
51 | "@type": "Command",
52 | "description": "This command will begin blinking the LED for given time interval.",
53 | "name": "blink",
54 | "commandType": "synchronous",
55 | "request": {
56 | "name": "interval",
57 | "schema": "long"
58 | },
59 | "response": {
60 | "name": "blinkResponse",
61 | "schema": {
62 | "@type": "Object",
63 | "fields": [
64 | {
65 | "name": "description",
66 | "schema": "string"
67 | }
68 | ]
69 | }
70 | }
71 | }
72 | ],
73 | "@context": "http://azureiot.com/v1/contexts/IoTModel.json"
74 | }
75 |
--------------------------------------------------------------------------------
/resources/templates/arduino_task/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "Arduino Compile",
8 | "type": "shell",
9 | "command": "echo ${input:arduinoCompile}"
10 | },
11 | {
12 | "label": "Arduino Upload",
13 | "type": "shell",
14 | "command": "echo ${input:arduinoUpload}"
15 | }
16 | ],
17 | "inputs": [
18 | {
19 | "id": "arduinoCompile",
20 | "type": "command",
21 | "command": "arduino.verify"
22 | },
23 | {
24 | "id": "arduinoUpload",
25 | "type": "command",
26 | "command": "arduino.upload"
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/resources/templates/arduino_task/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "tasks.json",
5 | "sourcePath" : "",
6 | "targetPath" : ".vscode/"
7 | }
8 | ]
9 | }
--------------------------------------------------------------------------------
/resources/templates/arm7/Dockerfile:
--------------------------------------------------------------------------------
1 | # Find more details about base image in https://github.com/microsoft/vscode-iot-workbench/tree/master/devicedevex_dockerfiles/public
2 | FROM mcr.microsoft.com/iot-device-cube:1.0.4-azure-c-sdk-public-preview-cross-toolchain-arm32
3 |
4 | # Install external libs
5 | COPY install_packages.sh /work
6 | RUN chmod +x /work/install_packages.sh && /work/install_packages.sh
--------------------------------------------------------------------------------
/resources/templates/arm7/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | rm -rf cmake
5 | mkdir cmake
6 | cd cmake
7 | cmake .. -DCMAKE_TOOLCHAIN_FILE=/work/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm-linux-custom -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON
8 | cmake --build .
--------------------------------------------------------------------------------
/resources/templates/arm7/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${CROSS_ROOT}/**",
7 | "/work/vcpkg/installed/arm-linux-custom/include/**",
8 | "/work/vcpkg/installed/arm-linux-custom/include/azureiot/**",
9 | "${workspaceFolder}/**"
10 | ],
11 | "defines": [],
12 | "cStandard": "c11",
13 | "cppStandard": "c++17",
14 | "intelliSenseMode": "gcc-x64",
15 | "compilerPath": "${CC}"
16 | }
17 | ],
18 | "version": 4
19 | }
20 |
--------------------------------------------------------------------------------
/resources/templates/arm7/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Azure IoT Device C SDK for armv7 Linux",
3 | "dockerFile": "Dockerfile",
4 | "extensions": [
5 | "ms-vscode.cpptools",
6 | "twxs.cmake",
7 | "vsciot-vscode.vscode-iot-workbench"
8 | ]
9 | }
--------------------------------------------------------------------------------
/resources/templates/arm7/install_packages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Add script to install external libs in this file.
4 | # If you haven't built the project container, run command "Remote-Containers: Reopen in container" to open the project in your customized docker image.
5 | # If you change Dockerfile or this script after your project container has been built, run command "Remote-Containers: Rebuild Container" to rebuild the docker image and apply your customization settings.
6 | # (Notice that the command "Remote-Containers: Rebuild Container" only appears when the project is in remote side.)
7 |
8 | # Samples:
9 | # apt-get update && apt-get upgrade
10 | # apt-get install -y git
11 |
--------------------------------------------------------------------------------
/resources/templates/arm7/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "default compile script",
8 | "type": "shell",
9 | "command": "bash ./build.sh . ${project_name}",
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | }
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/resources/templates/arm7/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "devcontainer.json",
5 | "sourcePath" : ".",
6 | "targetPath" : "./.devcontainer"
7 | },
8 | {
9 | "fileName": "Dockerfile",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.devcontainer"
12 | },
13 | {
14 | "fileName": "install_packages.sh",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.devcontainer"
17 | },
18 | {
19 | "fileName": "tasks.json",
20 | "sourcePath" : ".",
21 | "targetPath" : "./.vscode"
22 | },
23 | {
24 | "fileName": "c_cpp_properties.json",
25 | "sourcePath" : ".",
26 | "targetPath" : "./.vscode"
27 | },
28 | {
29 | "fileName": "build.sh",
30 | "sourcePath" : ".",
31 | "targetPath" : "."
32 | }
33 | ]
34 | }
--------------------------------------------------------------------------------
/resources/templates/arm8/Dockerfile:
--------------------------------------------------------------------------------
1 | # Find more details about base image in https://github.com/microsoft/vscode-iot-workbench/tree/master/devicedevex_dockerfiles/public
2 | FROM mcr.microsoft.com/iot-device-cube:1.0.4-azure-c-sdk-public-preview-cross-toolchain-arm64
3 |
4 | # Install external libs
5 | COPY install_packages.sh /work
6 | RUN chmod +x /work/install_packages.sh && /work/install_packages.sh
--------------------------------------------------------------------------------
/resources/templates/arm8/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | rm -rf cmake
5 | mkdir cmake
6 | cd cmake
7 | cmake .. -DCMAKE_TOOLCHAIN_FILE=/work/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=aarch64-linux-custom -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON
8 | cmake --build .
--------------------------------------------------------------------------------
/resources/templates/arm8/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${CROSS_ROOT}/**",
7 | "/work/vcpkg/installed/aarch64-linux-custom/include/**",
8 | "/work/vcpkg/installed/aarch64-linux-custom/include/azureiot/**",
9 | "${workspaceFolder}/**"
10 | ],
11 | "defines": [],
12 | "cStandard": "c11",
13 | "cppStandard": "c++17",
14 | "intelliSenseMode": "gcc-x64",
15 | "compilerPath": "${CC}"
16 | }
17 | ],
18 | "version": 4
19 | }
20 |
--------------------------------------------------------------------------------
/resources/templates/arm8/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Azure IoT Device C SDK for arm64 Linux",
3 | "dockerFile": "Dockerfile",
4 | "extensions": [
5 | "ms-vscode.cpptools",
6 | "twxs.cmake",
7 | "vsciot-vscode.vscode-iot-workbench"
8 | ]
9 | }
--------------------------------------------------------------------------------
/resources/templates/arm8/install_packages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Add script to install external libs in this file.
4 | # If you haven't built the project container, run command "Remote-Containers: Reopen in container" to open the project in your customized docker image.
5 | # If you change Dockerfile or this script after your project container has been built, run command "Remote-Containers: Rebuild Container" to rebuild the docker image and apply your customization settings.
6 | # (Notice that the command "Remote-Containers: Rebuild Container" only appears when the project is in remote side.)
7 |
8 | # Samples:
9 | # apt-get update && apt-get upgrade
10 | # apt-get install -y git
--------------------------------------------------------------------------------
/resources/templates/arm8/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "default compile script",
8 | "type": "shell",
9 | "command": "bash ./build.sh . ${project_name}",
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | }
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/resources/templates/arm8/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "devcontainer.json",
5 | "sourcePath" : ".",
6 | "targetPath" : "./.devcontainer"
7 | },
8 | {
9 | "fileName": "Dockerfile",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.devcontainer"
12 | },
13 | {
14 | "fileName": "install_packages.sh",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.devcontainer"
17 | },
18 | {
19 | "fileName": "tasks.json",
20 | "sourcePath" : ".",
21 | "targetPath" : "./.vscode"
22 | },
23 | {
24 | "fileName": "c_cpp_properties.json",
25 | "sourcePath" : ".",
26 | "targetPath" : "./.vscode"
27 | },
28 | {
29 | "fileName": "build.sh",
30 | "sourcePath" : ".",
31 | "targetPath" : "."
32 | }
33 | ]
34 | }
--------------------------------------------------------------------------------
/resources/templates/boardlist.json:
--------------------------------------------------------------------------------
1 | {
2 | "boards": [
3 | {
4 | "name": "MXChip IoT DevKit",
5 | "id": "devkit",
6 | "detailInfo": "MXChip - Microsoft Azure IoT Developer Kit",
7 | "defaultBaudRate": 115200,
8 | "vendorId": "0483",
9 | "productId": "374b",
10 | "exampleUrl": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/gallery/workbench-example-devkit-v3.json",
11 | "examplePageName": "MXChip IoT DevKit",
12 | "helpUrl": "https://aka.ms/iot-devkit",
13 | "installation": {
14 | "additionalUrl": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/master/package_azureboard_index.json",
15 | "packageName": "AZ3166",
16 | "architecture": "stm32f4"
17 | },
18 | "projectHostType": "workspace"
19 | },
20 | {
21 | "name": "Generic ESP32 boards",
22 | "id": "esp32",
23 | "detailInfo": "ESP32",
24 | "defaultBaudRate": 115200,
25 | "vendorId": "10c4",
26 | "productId": "ea60",
27 | "exampleUrl": "https://raw.githubusercontent.com/VSChina/azureiotdevkit_tools/gallery/workbench-example-esp32-v2.json",
28 | "examplePageName": "Espressif ESP32",
29 | "helpUrl": "https://github.com/espressif/arduino-esp32",
30 | "installation": {
31 | "additionalUrl": "https://dl.espressif.com/dl/package_esp32_index.json",
32 | "packageName": "esp32",
33 | "architecture": "esp32"
34 | },
35 | "projectHostType": "workspace"
36 | },
37 | {
38 | "name": "Raspberry Pi",
39 | "id": "raspberrypi",
40 | "detailInfo": "Raspberry Pi",
41 | "helpUrl": "https://www.raspberrypi.org/",
42 | "projectHostType": "container"
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/resources/templates/codeGenOptions.json:
--------------------------------------------------------------------------------
1 | {
2 | "connectionTypes": [
3 | {
4 | "type": "ConnectionString",
5 | "name": "Via IoT Hub device connection string",
6 | "detail": "To connect to Azure IoT Hub directly"
7 | },
8 | {
9 | "type": "DpsSasKey",
10 | "name": "Via DPS (Device Provisioning Service) symmetric key",
11 | "detail": "To connect to Azure IoT Hub, Azure IoT Central or Azure IoT Certification Service"
12 | }
13 | ],
14 | "projectTemplates": [
15 | {
16 | "language": "ANSI C",
17 | "type": "CMakeWindows",
18 | "name": "CMake Project on Windows",
19 | "detail": "Generate CMake project can be built with MSVC on Windows.",
20 | "enabled": true
21 | },
22 | {
23 | "language": "ANSI C",
24 | "type": "CMakeLinux",
25 | "name": "CMake Project on Linux",
26 | "detail": "Generate CMake project can be built with GCC on Linux.",
27 | "enabled": true
28 | },
29 | {
30 | "language": "ANSI C",
31 | "type": "IoTDevKit",
32 | "name": "MXChip IoT DevKit Project",
33 | "detail": "Generate Arduino project for MXChip IoT DevKit.",
34 | "enabled" : true
35 | },
36 | {
37 | "language": "ANSI C",
38 | "type": "VisualStudio",
39 | "name": "Visual Studio Project",
40 | "detail": "Generate ANSI C code as Visual Studio (.vcxproj) project.",
41 | "enabled": false
42 | }
43 | ],
44 | "deviceSdkReferenceTypes": [
45 | {
46 | "type": "SourceCode",
47 | "name": "Via Source Code",
48 | "detail": "Include Azure IoT Device SDK as Source Code."
49 | },
50 | {
51 | "type": "Vcpkg",
52 | "name": "Via Vcpkg",
53 | "detail": "Include Azure IoT Device SDK as Vcpkg."
54 | }
55 | ]
56 | }
--------------------------------------------------------------------------------
/resources/templates/configDeviceOptions.json:
--------------------------------------------------------------------------------
1 | {
2 | "configSelectionItems": [
3 | {
4 | "label": "Config Device Connection String",
5 | "detail": "Config IoT Hub Device Connection String"
6 | },
7 | {
8 | "label": "Config DPS Unique Device Secret (UDS)",
9 | "detail": "Config DPS Unique Device Secret (UDS) for X.509 certificates attestation"
10 | },
11 | {
12 | "label": "Config DPS credentials",
13 | "detail": "Config DPS credentials for Symmetric Key attestation"
14 | },
15 | {
16 | "label": "Generate CRC for OTA",
17 | "detail": "Generate Cyclic Redundancy Check(CRC) code for OTA Update"
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/resources/templates/devkit/c_cpp_properties_linux.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "{ROOTPATH}/.arduino15/packages/AZ3166/tools/**",
11 | "{ROOTPATH}/.arduino15/packages/AZ3166/hardware/stm32f4/{VERSION}/**"
12 | ],
13 | "forcedInclude": [
14 | "{ROOTPATH}/.arduino15/packages/AZ3166/hardware/stm32f4/{VERSION}/cores/arduino/Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "gnu++17",
19 | "compilerPath": "{ROOTPATH}/.arduino15/packages/AZ3166/tools/arm-none-eabi-gcc/5_4-2016q3/bin/arm-none-eabi-g++"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/resources/templates/devkit/c_cpp_properties_macos.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Mac",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "~/Library/Arduino15/packages/AZ3166/tools/**",
11 | "~/Library/Arduino15/packages/AZ3166/hardware/stm32f4/{VERSION}/**"
12 | ],
13 | "forcedInclude": [
14 | "~/Library/Arduino15/packages/AZ3166/hardware/stm32f4/{VERSION}/cores/arduino/Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "gnu++17",
19 | "compilerPath": "~/Library/Arduino15/packages/AZ3166/tools/arm-none-eabi-gcc/5_4-2016q3/bin/arm-none-eabi-g++"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/resources/templates/devkit/c_cpp_properties_win32.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Win32",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "{ROOTPATH}\\Arduino15\\packages\\AZ3166\\tools\\**",
11 | "{ROOTPATH}\\Arduino15\\packages\\AZ3166\\hardware\\stm32f4\\{VERSION}\\**"
12 | ],
13 | "forcedInclude": [
14 | "{ROOTPATH}\\Arduino15\\packages\\AZ3166\\hardware\\stm32f4\\{VERSION}\\cores\\arduino\\Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "gnu++17",
19 | "compilerPath": "{ROOTPATH}\\Arduino15\\packages\\AZ3166\\tools\\arm-none-eabi-gcc\\5_4-2016q3\\bin\\arm-none-eabi-g++"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_azurefunctions/.gitignore:
--------------------------------------------------------------------------------
1 | # Build folder
2 | .build/
3 |
4 | # VS Code files
5 | c_cpp_properties.json
6 |
7 | #IoT Hub Info
8 | azureconfig.json
--------------------------------------------------------------------------------
/resources/templates/devkit_azurefunctions/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "board": "AZ3166:stm32f4:MXCHIP_AZ3166",
3 | "sketch": "device.ino",
4 | "configuration": "upload_method=OpenOCDMethod",
5 | "output": "./.build"
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_azurefunctions/device.ino:
--------------------------------------------------------------------------------
1 | #include "AZ3166WiFi.h"
2 | #include "DevKitMQTTClient.h"
3 |
4 | static bool hasWifi = false;
5 | static bool hasIoTHub = false;
6 |
7 | void setup() {
8 | // put your setup code here, to run once:
9 | if (WiFi.begin() == WL_CONNECTED)
10 | {
11 | hasWifi = true;
12 | Screen.print(1, "Running...");
13 |
14 | if (!DevKitMQTTClient_Init())
15 | {
16 | hasIoTHub = false;
17 | return;
18 | }
19 | hasIoTHub = true;
20 | }
21 | else
22 | {
23 | hasWifi = false;
24 | Screen.print(1, "No Wi-Fi");
25 | }
26 | }
27 |
28 | void loop() {
29 | // put your main code here, to run repeatedly:
30 | if (hasIoTHub && hasWifi)
31 | {
32 | char buff[128];
33 |
34 | // replace the following line with your data sent to Azure IoTHub
35 | snprintf(buff, 128, "{\"topic\":\"iot\"}");
36 |
37 | if (DevKitMQTTClient_SendEvent(buff))
38 | {
39 | Screen.print(1, "Sending...");
40 | }
41 | else
42 | {
43 | Screen.print(1, "Failure...");
44 | }
45 | delay(2000);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/resources/templates/devkit_azurefunctions/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | ".build": true,
4 | ".iotworkbenchproject": true
5 | }
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_azurefunctions/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "device.ino",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "arduino.json",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.vscode"
12 | },
13 | {
14 | "fileName": "settings.json",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.vscode"
17 | },
18 | {
19 | "fileName": ".gitignore",
20 | "sourcePath" : ".",
21 | "targetPath" : "../."
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_device/.gitignore:
--------------------------------------------------------------------------------
1 | # Build folder
2 | .build/
3 |
4 | # VS Code files
5 | c_cpp_properties.json
6 |
7 | #IoT Hub Info
8 | azureconfig.json
--------------------------------------------------------------------------------
/resources/templates/devkit_device/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "board": "AZ3166:stm32f4:MXCHIP_AZ3166",
3 | "sketch": "device.ino",
4 | "configuration": "upload_method=OpenOCDMethod",
5 | "output": "./.build"
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_device/device.ino:
--------------------------------------------------------------------------------
1 | void setup() {
2 | // put your setup code here, to run once:
3 |
4 | }
5 |
6 | void loop() {
7 | // put your main code here, to run repeatedly:
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/resources/templates/devkit_device/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | ".build": true,
4 | ".iotworkbenchproject": true
5 | }
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_device/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "device.ino",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "arduino.json",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.vscode"
12 | },
13 | {
14 | "fileName": "settings.json",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.vscode"
17 | },
18 | {
19 | "fileName": ".gitignore",
20 | "sourcePath" : ".",
21 | "targetPath" : "../."
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_iothub/.gitignore:
--------------------------------------------------------------------------------
1 | # Build folder
2 | .build/
3 |
4 | # VS Code files
5 | c_cpp_properties.json
6 |
7 | #IoT Hub Info
8 | azureconfig.json
--------------------------------------------------------------------------------
/resources/templates/devkit_iothub/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "board": "AZ3166:stm32f4:MXCHIP_AZ3166",
3 | "sketch": "device.ino",
4 | "configuration": "upload_method=OpenOCDMethod",
5 | "output": "./.build"
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_iothub/device.ino:
--------------------------------------------------------------------------------
1 | #include "AZ3166WiFi.h"
2 | #include "DevKitMQTTClient.h"
3 |
4 | static bool hasWifi = false;
5 | static bool hasIoTHub = false;
6 |
7 | void setup() {
8 | // put your setup code here, to run once:
9 | if (WiFi.begin() == WL_CONNECTED)
10 | {
11 | hasWifi = true;
12 | Screen.print(1, "Running...");
13 |
14 | if (!DevKitMQTTClient_Init())
15 | {
16 | hasIoTHub = false;
17 | return;
18 | }
19 | hasIoTHub = true;
20 | }
21 | else
22 | {
23 | hasWifi = false;
24 | Screen.print(1, "No Wi-Fi");
25 | }
26 | }
27 |
28 | void loop() {
29 | // put your main code here, to run repeatedly:
30 | if (hasIoTHub && hasWifi)
31 | {
32 | char buff[128];
33 |
34 | // replace the following line with your data sent to Azure IoTHub
35 | snprintf(buff, 128, "{\"topic\":\"iot\"}");
36 |
37 | if (DevKitMQTTClient_SendEvent(buff))
38 | {
39 | Screen.print(1, "Sending...");
40 | }
41 | else
42 | {
43 | Screen.print(1, "Failure...");
44 | }
45 | delay(2000);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/resources/templates/devkit_iothub/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | ".build": true,
4 | ".iotworkbenchproject": true
5 | }
6 | }
--------------------------------------------------------------------------------
/resources/templates/devkit_iothub/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "device.ino",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "arduino.json",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.vscode"
12 | },
13 | {
14 | "fileName": "settings.json",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.vscode"
17 | },
18 | {
19 | "fileName": ".gitignore",
20 | "sourcePath" : ".",
21 | "targetPath" : "../."
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/resources/templates/embedded_linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.11)
2 |
3 | # The demonstration uses C99 but it could just as easily be a C++ application
4 | set(CMAKE_C_FLAGS "--std=c99 ${CMAKE_C_FLAGS}")
5 |
6 | set(iothub_c_files
7 | main.c
8 | )
9 |
10 | # Set up the include and library paths
11 | include_directories(.)
12 |
13 | add_executable({project_name} ${iothub_c_files})
14 |
15 | # Find azure_iot_sdks Vcpkg package
16 | find_package(azure_iot_sdks REQUIRED)
17 | find_package(ZLIB REQUIRED)
18 | find_package(OpenSSL REQUIRED)
19 | find_library(CURL NAMES curl-d curl)
20 |
21 | # List the libraries required by the link step
22 | target_link_libraries({project_name}
23 | parson
24 | iothub_client_mqtt_transport
25 | iothub_client
26 | digitaltwin_client
27 | prov_auth_client
28 | aziotsharedutil
29 | umqtt
30 | uuid
31 | ${CURL}
32 | pthread
33 | ssl
34 | crypto
35 | m
36 | ZLIB::ZLIB
37 | )
--------------------------------------------------------------------------------
/resources/templates/embedded_linux/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "CMakeLists.txt",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "main.c",
10 | "sourcePath" : ".",
11 | "targetPath" : "."
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/resources/templates/esp32/c_cpp_properties_linux.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "{ROOTPATH}/.arduino15/packages/esp32/tools/**",
11 | "{ROOTPATH}/.arduino15/packages/esp32/hardware/esp32/{VERSION}/**"
12 | ],
13 | "forcedInclude": [
14 | "{ROOTPATH}/.arduino15/packages/esp32/hardware/esp32/{VERSION}/cores/arduino/Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "c++17",
19 | "compilerPath": "{ROOTPATH}/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-gcc"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/resources/templates/esp32/c_cpp_properties_macos.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Mac",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "~/Library/Arduino15/packages/esp32/tools/**",
11 | "~/Library/Arduino15/packages/esp32/hardware/esp32/{VERSION}/**"
12 | ],
13 | "forcedInclude": [
14 | "~/Library/Arduino15/packages/esp32/hardware/esp32/{VERSION}/cores/esp32/Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "c++17",
19 | "compilerPath": "~/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/xtensa-esp32-elf-gcc"
20 |
21 | }
22 | ],
23 | "version": 4
24 | }
--------------------------------------------------------------------------------
/resources/templates/esp32/c_cpp_properties_win32.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Win32",
5 | "defines": [
6 | "ARDUINO=10800"
7 | ],
8 | "includePath": [
9 | "${workspaceFolder}",
10 | "{ROOTPATH}\\Arduino15\\packages\\esp32\\tools\\**",
11 | "{ROOTPATH}\\Arduino15\\packages\\esp32\\hardware\\esp32\\{VERSION}\\**"
12 | ],
13 | "forcedInclude": [
14 | "{ROOTPATH}\\Arduino15\\packages\\esp32\\hardware\\esp32\\{VERSION}\\cores\\esp32\\Arduino.h"
15 | ],
16 | "intelliSenseMode": "clang-x64",
17 | "cStandard": "c11",
18 | "cppStandard": "c++17",
19 | "compilerPath": "{ROOTPATH}\\Arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\1.22.0-80-g6c4433a-5.2.0\\bin\\xtensa-esp32-elf-gcc"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_device/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "board": "esp32:esp32:m5stack-core-esp32",
3 | "sketch": "device.ino",
4 | "configuration": "FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none",
5 | "output": "./.build"
6 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_device/device.ino:
--------------------------------------------------------------------------------
1 | void setup() {
2 | // put your setup code here, to run once:
3 |
4 | }
5 |
6 | void loop() {
7 | // put your main code here, to run repeatedly:
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/resources/templates/esp32_device/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | ".build": true,
4 | ".iotworkbenchproject": true
5 | }
6 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_device/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "device.ino",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "arduino.json",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.vscode"
12 | },
13 | {
14 | "fileName": "settings.json",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.vscode"
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_iothub/arduino.json:
--------------------------------------------------------------------------------
1 | {
2 | "board": "esp32:esp32:m5stack-core-esp32",
3 | "sketch": "device.ino",
4 | "configuration": "FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=none",
5 | "output": "./.build"
6 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_iothub/device.ino:
--------------------------------------------------------------------------------
1 | /**
2 | * A simple Azure IoT example for sending telemetry.
3 | */
4 |
5 | #include
6 | #include "Esp32MQTTClient.h"
7 |
8 | // Please input the SSID and password of WiFi
9 | const char* ssid = "";
10 | const char* password = "";
11 |
12 | /*String containing Hostname, Device Id & Device Key in the format: */
13 | /* "HostName=;DeviceId=;SharedAccessKey=" */
14 | /* "HostName=;DeviceId=;SharedAccessSignature=" */
15 | static const char* connectionString = "";
16 |
17 | static bool hasIoTHub = false;
18 |
19 | void setup() {
20 | Serial.begin(115200);
21 | Serial.println("Starting connecting WiFi.");
22 | delay(10);
23 | WiFi.begin(ssid, password);
24 | while (WiFi.status() != WL_CONNECTED) {
25 | delay(500);
26 | Serial.print(".");
27 | }
28 | Serial.println("WiFi connected");
29 | Serial.println("IP address: ");
30 | Serial.println(WiFi.localIP());
31 |
32 | if (!Esp32MQTTClient_Init((const uint8_t*)connectionString))
33 | {
34 | hasIoTHub = false;
35 | Serial.println("Initializing IoT hub failed.");
36 | return;
37 | }
38 | hasIoTHub = true;
39 | }
40 |
41 | void loop() {
42 | Serial.println("start sending events.");
43 | if (hasIoTHub)
44 | {
45 | char buff[128];
46 |
47 | // replace the following line with your data sent to Azure IoTHub
48 | snprintf(buff, 128, "{\"topic\":\"iot\"}");
49 |
50 | if (Esp32MQTTClient_SendEvent(buff))
51 | {
52 | Serial.println("Sending data succeed");
53 | }
54 | else
55 | {
56 | Serial.println("Failure...");
57 | }
58 | delay(5000);
59 | }
60 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_iothub/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | ".build": true,
4 | ".iotworkbenchproject": true
5 | }
6 | }
--------------------------------------------------------------------------------
/resources/templates/esp32_iothub/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "device.ino",
5 | "sourcePath" : ".",
6 | "targetPath" : "."
7 | },
8 | {
9 | "fileName": "arduino.json",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.vscode"
12 | },
13 | {
14 | "fileName": "settings.json",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.vscode"
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/resources/templates/platformlist.json:
--------------------------------------------------------------------------------
1 | {
2 | "platforms": [
3 | {
4 | "name": "Arduino",
5 | "id": "arduino",
6 | "description" : "Project based on Arduino Platform."
7 | },
8 | {
9 | "name": "Embedded Linux (Preview)",
10 | "id": "linux",
11 | "description": "Project based on Linux Platform."
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/resources/templates/x86/Dockerfile:
--------------------------------------------------------------------------------
1 | # Find more details about base image in https://github.com/microsoft/vscode-iot-workbench/tree/master/devicedevex_dockerfiles/public
2 | FROM mcr.microsoft.com/iot-device-cube:1.0.4-azure-c-sdk-public-preview-ubuntu-x86
3 |
4 | # Install external libs
5 | COPY install_packages.sh /work
6 | RUN chmod +x /work/install_packages.sh && /work/install_packages.sh
--------------------------------------------------------------------------------
/resources/templates/x86/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | rm -rf cmake
5 | mkdir cmake
6 | cd cmake
7 | cmake .. -DCMAKE_TOOLCHAIN_FILE=/work/vcpkg/scripts/buildsystems/vcpkg.cmake -Duse_prov_client=ON -Dhsm_type_symm_key:BOOL=ON
8 | cmake --build .
--------------------------------------------------------------------------------
/resources/templates/x86/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${CROSS_ROOT}/**",
7 | "/work/vcpkg/installed/x64-linux/include/**",
8 | "/work/vcpkg/installed/x64-linux/include/azureiot/**",
9 | "${workspaceFolder}/**"
10 | ],
11 | "defines": [],
12 | "cStandard": "c11",
13 | "cppStandard": "c++17",
14 | "intelliSenseMode": "gcc-x64"
15 | }
16 | ],
17 | "version": 4
18 | }
19 |
--------------------------------------------------------------------------------
/resources/templates/x86/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Azure IoT Device C SDK for x86 Linux",
3 | "dockerFile": "Dockerfile",
4 | "extensions": [
5 | "ms-vscode.cpptools",
6 | "twxs.cmake",
7 | "vsciot-vscode.vscode-iot-workbench"
8 | ]
9 | }
--------------------------------------------------------------------------------
/resources/templates/x86/install_packages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Add script to install external libs in this file.
4 | # If you haven't built the project container, run command "Remote-Containers: Reopen in container" to open the project in your customized docker image.
5 | # If you change Dockerfile or this script after your project container has been built, run command "Remote-Containers: Rebuild Container" to rebuild the docker image and apply your customization settings.
6 | # (Notice that the command "Remote-Containers: Rebuild Container" only appears when the project is in remote side.)
7 |
8 | # Samples:
9 | # apt-get update && apt-get upgrade
10 | # apt-get install -y git
11 |
--------------------------------------------------------------------------------
/resources/templates/x86/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "default compile script",
8 | "type": "shell",
9 | "command": "bash ./build.sh . ${project_name}",
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | }
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/resources/templates/x86/templatefiles.json:
--------------------------------------------------------------------------------
1 | {
2 | "templateFiles": [
3 | {
4 | "fileName": "devcontainer.json",
5 | "sourcePath" : ".",
6 | "targetPath" : "./.devcontainer"
7 | },
8 | {
9 | "fileName": "Dockerfile",
10 | "sourcePath" : ".",
11 | "targetPath" : "./.devcontainer"
12 | },
13 | {
14 | "fileName": "install_packages.sh",
15 | "sourcePath" : ".",
16 | "targetPath" : "./.devcontainer"
17 | },
18 | {
19 | "fileName": "tasks.json",
20 | "sourcePath" : ".",
21 | "targetPath" : "./.vscode"
22 | },
23 | {
24 | "fileName": "c_cpp_properties.json",
25 | "sourcePath" : ".",
26 | "targetPath" : "./.vscode"
27 | },
28 | {
29 | "fileName": "build.sh",
30 | "sourcePath" : ".",
31 | "targetPath" : "."
32 | }
33 | ]
34 | }
--------------------------------------------------------------------------------
/src/AzureOperator.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | import * as vscode from "vscode";
4 | import { TelemetryContext } from "./telemetry";
5 | import { constructAndLoadIoTProject } from "./utils";
6 | import { RemoteExtension } from "./Models/RemoteExtension";
7 |
8 | export class AzureOperator {
9 | async provision(
10 | context: vscode.ExtensionContext,
11 | channel: vscode.OutputChannel,
12 | telemetryContext: TelemetryContext
13 | ): Promise {
14 | const iotProject = await constructAndLoadIoTProject(context, channel, telemetryContext);
15 | if (!iotProject) {
16 | return;
17 | }
18 | const status = await iotProject.provision();
19 | if (status) {
20 | vscode.window.showInformationMessage("Azure provision succeeded.");
21 | }
22 | }
23 |
24 | async deploy(
25 | context: vscode.ExtensionContext,
26 | channel: vscode.OutputChannel,
27 | telemetryContext: TelemetryContext
28 | ): Promise {
29 | // Azure deploy command can be executed only in local environment
30 | RemoteExtension.ensureLocalBeforeRunCommand("deploy azure project", context);
31 |
32 | const iotProject = await constructAndLoadIoTProject(context, channel, telemetryContext);
33 | if (iotProject) {
34 | await iotProject.deploy();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/DeviceOperator.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | // The module 'vscode' contains the VS Code extensibility API
5 | // Import the module and reference it with the alias vscode in your code below
6 | import * as vscode from "vscode";
7 |
8 | import { TelemetryContext } from "./telemetry";
9 | import { constructAndLoadIoTProject } from "./utils";
10 |
11 | export class DeviceOperator {
12 | async compile(
13 | context: vscode.ExtensionContext,
14 | channel: vscode.OutputChannel,
15 | telemetryContext: TelemetryContext
16 | ): Promise {
17 | const iotProject = await constructAndLoadIoTProject(context, channel, telemetryContext);
18 | if (!iotProject) {
19 | return;
20 | }
21 | await iotProject.compile();
22 | }
23 |
24 | async upload(
25 | context: vscode.ExtensionContext,
26 | channel: vscode.OutputChannel,
27 | telemetryContext: TelemetryContext
28 | ): Promise {
29 | const iotProject = await constructAndLoadIoTProject(context, channel, telemetryContext);
30 | if (!iotProject) {
31 | return;
32 | }
33 | await iotProject.upload();
34 | }
35 |
36 | async configDeviceSettings(
37 | context: vscode.ExtensionContext,
38 | channel: vscode.OutputChannel,
39 | telemetryContext: TelemetryContext
40 | ): Promise {
41 | const iotProject = await constructAndLoadIoTProject(context, channel, telemetryContext);
42 | if (!iotProject) {
43 | return;
44 | }
45 | await iotProject.configDeviceSettings();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/DialogResponses.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import { MessageItem } from "vscode";
5 |
6 | export class DialogResponses {
7 | static skipForNow: MessageItem = { title: "Skip for now" };
8 | static all: MessageItem = { title: "All" };
9 | static yes: MessageItem = { title: "Yes" };
10 | static no: MessageItem = { title: "No" };
11 | static cancel: MessageItem = { title: "Cancel", isCloseAffordance: true };
12 | }
13 |
--------------------------------------------------------------------------------
/src/DigitalTwin/DigitalTwinCodeGen/AnsiCCodeGeneratorFactory.ts:
--------------------------------------------------------------------------------
1 | import * as vscode from "vscode";
2 |
3 | import { TelemetryContext } from "../../telemetry";
4 | import { AnsiCCodeGenerator } from "./Interfaces/AnsiCCodeGenerator";
5 | import { CodeGenerator, CodeGenLanguage } from "./Interfaces/CodeGenerator";
6 | import { CodeGeneratorFactory } from "./Interfaces/CodeGeneratorFactory";
7 |
8 | export class AnsiCCodeGeneratorFactory implements CodeGeneratorFactory {
9 | constructor(
10 | private context: vscode.ExtensionContext,
11 | private channel: vscode.OutputChannel,
12 | private telemetryContext: TelemetryContext
13 | ) {}
14 | createCodeGeneratorImpl(language: string): CodeGenerator | null {
15 | if (language === CodeGenLanguage.ANSIC.toString()) {
16 | return new AnsiCCodeGenerator(this.context, this.channel, this.telemetryContext);
17 | } else {
18 | return null;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/DigitalTwin/DigitalTwinCodeGen/CodeGenUtility.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as utils from "../../utils";
5 | import * as vscode from "vscode";
6 | import { CodeGenExecutionItem } from "./Interfaces/CodeGenerator";
7 |
8 | export class CodeGenUtility {
9 | static printCodeGenConfig(codeGenExecutionItem: CodeGenExecutionItem, channel: vscode.OutputChannel): void {
10 | utils.channelShowAndAppendLine(
11 | channel,
12 | `Device capability model file: ${codeGenExecutionItem.capabilityModelFilePath}`
13 | );
14 | utils.channelShowAndAppendLine(channel, `Project name: ${codeGenExecutionItem.projectName}`);
15 | utils.channelShowAndAppendLine(channel, `Language: ${codeGenExecutionItem.languageLabel}`);
16 | utils.channelShowAndAppendLine(channel, `Device connection type: ${codeGenExecutionItem.deviceConnectionType}`);
17 | utils.channelShowAndAppendLine(channel, `Project type: ${codeGenExecutionItem.codeGenProjectType}`);
18 | utils.channelShowAndAppendLine(
19 | channel,
20 | `Device SDK reference type: ${codeGenExecutionItem.deviceSdkReferenceType}`
21 | );
22 | utils.channelShowAndAppendLine(channel, `Project output directory: ${codeGenExecutionItem.outputDirectory}`);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/DigitalTwin/DigitalTwinCodeGen/Interfaces/CodeGenerator.ts:
--------------------------------------------------------------------------------
1 | export enum CodeGenLanguage {
2 | ANSIC = "ANSI C"
3 | }
4 |
5 | export enum DeviceConnectionType {
6 | ConnectionString = "ConnectionString",
7 | DpsSasKey = "DpsSasKey",
8 | IoTCX509 = "IoTCX509"
9 | }
10 |
11 | export enum CodeGenProjectType {
12 | CMakeWindows = "CMake_Windows",
13 | CMakeLinux = "CMake_Linux",
14 | VisualStudio = "VisualStudio",
15 | IoTDevKit = "IoTDevKit"
16 | }
17 |
18 | export enum DeviceSdkReferenceType {
19 | Vcpkg = "Vcpkg",
20 | SourceCode = "SourceCode",
21 | DevKitSDK = "DevKitSDK"
22 | }
23 |
24 | export enum CodeGenPlatform {
25 | Windows = "Windows",
26 | Linux = "Linux",
27 | MacOS = "MacOS"
28 | }
29 |
30 | export interface CodeGenExecutionItem {
31 | outputDirectory: string;
32 | capabilityModelFilePath: string;
33 | interfaceDirecoty: string;
34 | projectName: string;
35 | languageLabel: string;
36 | codeGenProjectType: CodeGenProjectType;
37 | deviceSdkReferenceType: DeviceSdkReferenceType;
38 | deviceConnectionType: DeviceConnectionType;
39 | }
40 |
41 | export interface CodeGenerator {
42 | generateCode(codegenInfo: CodeGenExecutionItem): Promise;
43 | }
44 |
--------------------------------------------------------------------------------
/src/DigitalTwin/DigitalTwinCodeGen/Interfaces/CodeGeneratorFactory.ts:
--------------------------------------------------------------------------------
1 | import { CodeGenerator, CodeGenProjectType, DeviceConnectionType, DeviceSdkReferenceType } from "./CodeGenerator";
2 |
3 | export interface CodeGeneratorFactory {
4 | createCodeGeneratorImpl(
5 | projectType: CodeGenProjectType,
6 | sdkReferenceType: DeviceSdkReferenceType,
7 | connectionType: DeviceConnectionType
8 | ): CodeGenerator | null;
9 | }
10 |
--------------------------------------------------------------------------------
/src/DigitalTwin/DigitalTwinConstants.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export class DigitalTwinConstants {
5 | static readonly dtPrefix = "[IoT Plug and Play]";
6 | static readonly codeGenCli = "IoT Plug and Play CodeGen CLI";
7 | static readonly codeGenCliFolder = "iotpnp-codegen";
8 | static readonly codeGenCliApp = "dtcodegen";
9 | static readonly codegenProjectNameRegex = new RegExp("^[a-zA-Z_][-a-zA-Z0-9_]*$");
10 | static readonly codegenProjectNameRegexDescription =
11 | "alphanumeric, underscore and dash character, and cannot start with number and dash character";
12 | static readonly codeGenProjectTypeSeperator = "-";
13 | static readonly cmakeListsFileName = "CMakeLists.txt";
14 | static readonly codeGenConfigFileName = ".codeGenConfigs";
15 | }
16 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/api/apiProvider.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import { ModelType } from "../deviceModel/deviceModelManager";
5 | import { ModelRepositoryManager } from "../modelRepository/modelRepositoryManager";
6 | import { UI } from "../view/ui";
7 | import { UIConstants } from "../view/uiConstants";
8 |
9 | /**
10 | * Api provider for extension integration
11 | */
12 | export class ApiProvider {
13 | constructor(private readonly modelRepositoryManager: ModelRepositoryManager) {}
14 |
15 | /**
16 | * select capability model
17 | */
18 | async selectCapabilityModel(): Promise {
19 | return await UI.selectOneModelFile(UIConstants.SELECT_CAPABILITY_MODEL_LABEL, ModelType.CapabilityModel);
20 | }
21 |
22 | /**
23 | * download dependent interface of capability model
24 | * @param folder folder to download interface
25 | * @param capabilityModelFile capability model file path
26 | */
27 | async downloadDependentInterface(folder: string, capabilityModelFile: string): Promise {
28 | await this.modelRepositoryManager.downloadDependentInterface(folder, capabilityModelFile);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/badRequestError.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | /**
5 | * Error for user bad request
6 | */
7 | export class BadRequestError extends Error {
8 | constructor(message: string) {
9 | super(`Bad request: ${message}`);
10 | this.name = "BadRequestError";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/command.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | /**
5 | * Command type
6 | */
7 | export enum Command {
8 | CreateInterface = "azure-digital-twins.createInterface",
9 | CreateCapabilityModel = "azure-digital-twins.createCapabilityModel",
10 | OpenRepository = "azure-digital-twins.openRepository",
11 | SignOutRepository = "azure-digital-twins.signOutRepository",
12 | SearchInterface = "azure-digital-twins.searchInterface",
13 | SearchCapabilityModel = "azure-digital-twins.searchCapabilityModel",
14 | SubmitFiles = "azure-digital-twins.submitFiles",
15 | DeleteModels = "azure-digital-twins.deleteModels",
16 | DownloadModels = "azure-digital-twins.downloadModels",
17 | OpenFile = "azure-digital-twins.openFile"
18 | }
19 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/configuration.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import * as vscode from "vscode";
5 | import { Constants } from "./constants";
6 |
7 | /**
8 | * Extension configuration, stored as name/value pair
9 | */
10 | export class Configuration {
11 | /**
12 | * get configuration property by name
13 | * @param name property name
14 | */
15 | static getProperty(name: string): T | undefined {
16 | return Configuration.instance.get(name);
17 | }
18 |
19 | /**
20 | * set global property
21 | * @param name property name
22 | * @param value property value
23 | */
24 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
25 | static async setGlobalProperty(name: string, value: any): Promise {
26 | await Configuration.instance.update(name, value, true);
27 | }
28 |
29 | /**
30 | * set workspace property
31 | * @param name property name
32 | * @param value property value
33 | */
34 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
35 | static async setWorkspaceProperty(name: string, value: any): Promise {
36 | await Configuration.instance.update(name, value, false);
37 | }
38 |
39 | private static readonly instance: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(
40 | Constants.EXTENSION_NAME
41 | );
42 | private constructor() {}
43 | }
44 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/credentialStore.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import * as keytar from "keytar";
5 | import { Constants } from "./constants";
6 |
7 | /**
8 | * Credential store for user secret information, stored as name/value pair
9 | */
10 | export class CredentialStore {
11 | /**
12 | * get credential value
13 | * @param name credential name
14 | */
15 | static async get(name: string): Promise {
16 | return keytar.getPassword(Constants.EXTENSION_NAME, name);
17 | }
18 |
19 | /**
20 | * set credential
21 | * @param name credential name
22 | * @param value credential value
23 | */
24 | static async set(name: string, value: string): Promise {
25 | await keytar.setPassword(Constants.EXTENSION_NAME, name, value);
26 | }
27 |
28 | /**
29 | * delete credential
30 | * @param name credential name
31 | */
32 | static async delete(name: string): Promise {
33 | return keytar.deletePassword(Constants.EXTENSION_NAME, name);
34 | }
35 |
36 | private constructor() {}
37 | }
38 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/processError.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import { ColorizedChannel } from "./colorizedChannel";
5 |
6 | /**
7 | * Error for processing failure
8 | */
9 | export class ProcessError extends Error {
10 | constructor(operation: string, error: Error, readonly component: string) {
11 | super(ColorizedChannel.formatMessage(operation, error));
12 | this.name = "ProcessError";
13 | if (Error.captureStackTrace) {
14 | Error.captureStackTrace(this, ProcessError);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/common/userCancelledError.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | /**
5 | * Error for user cancel operation
6 | */
7 | export class UserCancelledError extends Error {
8 | constructor(operation?: string) {
9 | const message = operation ? ` [${operation}]` : "";
10 | super("User cancelled the operation" + message);
11 | this.name = "UserCancelledError";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/modelRepository/modelRepositoryInterface.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | /**
5 | * Meta model type
6 | */
7 | export enum MetaModelType {
8 | None = "none",
9 | Interface = "interface",
10 | CapabilityModel = "capabilityModel"
11 | }
12 |
13 | /**
14 | * Localized data
15 | */
16 | export interface LocalizedData {
17 | locale: string;
18 | value: string;
19 | }
20 |
21 | /**
22 | * DigitalTwin base class
23 | */
24 | export interface DigitalTwinModelBase {
25 | contents?: string;
26 | comment?: string;
27 | description?: string;
28 | displayName?: LocalizedData[];
29 | urnId: string;
30 | modelName: string;
31 | version: number;
32 | type: string;
33 | etag: string;
34 | publisherId: string;
35 | publisherName: string;
36 | createdOn: string;
37 | updatedOn: string;
38 | }
39 |
40 | /**
41 | * Search options
42 | */
43 | export interface SearchOptions {
44 | searchKeyword: string;
45 | modelFilterType: MetaModelType;
46 | continuationToken: string | null;
47 | pageSize?: number;
48 | }
49 |
50 | /**
51 | * Result of search API
52 | */
53 | export interface SearchResult {
54 | continuationToken?: string;
55 | results: DigitalTwinModelBase[];
56 | }
57 |
58 | /**
59 | * Result of get API
60 | */
61 | export interface GetResult {
62 | etag: string;
63 | modelId: string;
64 | content: { [key: string]: string };
65 | }
66 |
--------------------------------------------------------------------------------
/src/DigitalTwin/pnp/src/view/uiConstants.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | /**
5 | * Constants for UI
6 | */
7 | export class UIConstants {
8 | static readonly SELECT_ROOT_FOLDER_LABEL = "Select folder";
9 | static readonly INPUT_MODEL_NAME_LABEL = "Input device model name";
10 | static readonly BROWSE_LABEL = "Browse...";
11 | static readonly SELECT_REPOSITORY_LABEL = "Select model repository";
12 | static readonly SELECT_MODELS_LABEL = "Select device models";
13 | static readonly SELECT_CAPABILITY_MODEL_LABEL = "Select a capability model";
14 | static readonly INPUT_REPOSITORY_CONNECTION_STRING_LABEL = "Input company repository connection string";
15 | static readonly SAVE_FILE_CHANGE_LABEL = "Save file change";
16 | static readonly MODEL_REPOSITORY_TITLE = "IoT Plug and Play Model Repository";
17 | static readonly MODEL_FILE_GLOB = "**/*.json";
18 | static readonly REPOSITORY_CONNECTION_STRING_TEMPLATE =
19 | "HostName=;RepositoryId=;" +
20 | "SharedAccessKeyName=;SharedAccessKey=";
21 | static readonly MODELS_NOT_FOUND_MSG =
22 | "No device model is found in current workspace. Please open the folder that contains models and try again";
23 | static readonly ASK_TO_SAVE_MSG = "The following files contain unsaved changes, do you want to save them?";
24 | static readonly ASK_TO_OVERWRITE_MSG = "do you want to overwrite it?";
25 | }
26 |
--------------------------------------------------------------------------------
/src/Models/Apis.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as vscode from "vscode";
5 |
6 | import { AzureAccountCommands, VscodeCommands } from "../common/Commands";
7 | import { DependentExtensionNotFoundError } from "../common/Error/OperationFailedErrors/DependentExtensionNotFoundError";
8 | import { ExtensionName, ExtensionNameIdMap } from "./Interfaces/Api";
9 |
10 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 | export function getExtension(name: ExtensionName): any {
12 | const extensionId = ExtensionNameIdMap.get(name);
13 | if (extensionId) {
14 | const extension = vscode.extensions.getExtension(extensionId);
15 | if (extension) {
16 | switch (name) {
17 | case ExtensionName.AzureAccount:
18 | case ExtensionName.Toolkit:
19 | return extension.exports ? extension.exports : undefined;
20 | default:
21 | return extension;
22 | }
23 | }
24 | }
25 | return undefined;
26 | }
27 |
28 | export async function checkAzureLogin(): Promise {
29 | const azureAccount = getExtension(ExtensionName.AzureAccount);
30 | if (!azureAccount) {
31 | throw new DependentExtensionNotFoundError("check Azure Login", ExtensionName.AzureAccount);
32 | }
33 |
34 | // Sign in Azure
35 | if (azureAccount.status !== "LoggedIn") {
36 | await vscode.commands.executeCommand(AzureAccountCommands.Login);
37 | }
38 |
39 | return true;
40 | }
41 |
42 | export async function checkExtensionAvailable(extensionName: ExtensionName): Promise {
43 | if (!getExtension(extensionName)) {
44 | const choice = await vscode.window.showInformationMessage(
45 | `${extensionName} extension is required for the current project. Do you want to install it from marketplace?`,
46 | "Yes",
47 | "No"
48 | );
49 | if (choice === "Yes") {
50 | vscode.commands.executeCommand(
51 | VscodeCommands.VscodeOpen,
52 | vscode.Uri.parse(("vscode:extension/" + ExtensionNameIdMap.get(extensionName)) as string)
53 | );
54 | }
55 | return false;
56 | }
57 |
58 | return true;
59 | }
60 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Api.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export enum ExtensionName {
5 | Toolkit = "Azure IoT Hub Toolkit",
6 | AzureAccount = "Azure Account",
7 | Remote = "Remote Development",
8 | AzureFunctions = "Azure Functions",
9 | Arduino = "Arduino"
10 | }
11 |
12 | export const ExtensionNameIdMap: Map = new Map([
13 | [ExtensionName.Toolkit, "vsciot-vscode.azure-iot-toolkit"],
14 | [ExtensionName.AzureAccount, "ms-vscode.azure-account"],
15 | [ExtensionName.Remote, "ms-vscode-remote.vscode-remote-extensionpack"],
16 | [ExtensionName.AzureFunctions, "ms-azuretools.vscode-azurefunctions"],
17 | [ExtensionName.Arduino, "vsciot-vscode.vscode-arduino"]
18 | ]);
19 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Board.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as vscode from "vscode";
5 |
6 | export interface BoardInstallation {
7 | additionalUrl: string;
8 | packageName: string;
9 | architecture: string;
10 | }
11 |
12 | export interface Board {
13 | name: string;
14 | id: string;
15 | detailInfo: string;
16 | defaultBaudRate?: number;
17 | vendorId?: string;
18 | productId?: string;
19 | exampleUrl?: string;
20 | examplePageName?: string;
21 | helpUrl?: string;
22 | installation?: BoardInstallation;
23 | }
24 |
25 | export interface BoardQuickPickItem extends vscode.QuickPickItem, Board {}
26 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/CommandItem.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as vscode from "vscode";
5 |
6 | export interface CommandItem extends vscode.QuickPickItem {
7 | /**
8 | * Click action of the menu item
9 | */
10 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 | click?: (...args: any[]) => any;
12 | /**
13 | * Submenu of the menu item
14 | */
15 | children?: CommandItem[];
16 | /**
17 | * Show the menu item when only the
18 | * workspace configuration contains
19 | * the specific field.
20 | */
21 | only?: string | string[];
22 | /**
23 | * Show the menu item when only the
24 | * deviceId of current workspace is in
25 | * variable 'deviceIds'
26 | */
27 | deviceIds?: string[];
28 | }
29 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Compilable.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export interface Compilable {
5 | compile(): Promise;
6 | }
7 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Component.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export enum ComponentType {
5 | Device = "Device",
6 | IoTHub = "IoTHub",
7 | AzureFunctions = "AzureFunctions",
8 | IoTHubDevice = "IoTHubDevice"
9 | }
10 |
11 | export interface Component {
12 | name: string;
13 | id: string;
14 | load(): Promise;
15 | create(): Promise;
16 | checkPrerequisites(operation: string): Promise;
17 | getComponentType(): ComponentType;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Deployable.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export interface Deployable {
5 | deploy(): Promise;
6 | }
7 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Device.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import { ScaffoldType } from "../../constants";
5 |
6 | import { Compilable } from "./Compilable";
7 | import { Component } from "./Component";
8 | import { Uploadable } from "./Uploadable";
9 |
10 | export enum DeviceType {
11 | MXChipAZ3166 = 1,
12 | Esp32 = 2,
13 | RaspberryPi = 3
14 | }
15 |
16 | export interface Device extends Component, Compilable, Uploadable {
17 | getDeviceType(): DeviceType;
18 | configDeviceSettings(): Promise;
19 | configDeviceEnvironment(deviceRootPath: string, scaffoldType: ScaffoldType): Promise;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/ProjectHostType.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export enum ProjectHostType {
5 | Unknown = "Unknown",
6 | Workspace = "Workspace",
7 | Container = "Container"
8 | }
9 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/ProjectTemplate.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export enum ProjectTemplateType {
5 | Basic = "Basic",
6 | IotHub = "IotHub",
7 | AzureFunctions = "AzureFunctions"
8 | }
9 |
10 | export interface TemplateFileInfo {
11 | fileName: string;
12 | sourcePath: string;
13 | targetPath: string;
14 | fileContent?: string;
15 | overwrite?: boolean;
16 | }
17 |
18 | export interface TemplatesType {
19 | templates: ProjectTemplate[];
20 | }
21 | export interface ProjectTemplate {
22 | platform: string;
23 | name: string;
24 | detail: string;
25 | description: string;
26 | path: string;
27 | boardId: string;
28 | type: string;
29 | tag: string;
30 | connectionType: string;
31 | }
32 |
33 | export interface PnpDeviceConnection {
34 | name: string;
35 | type: string;
36 | detail: string;
37 | }
38 |
39 | export interface CodeGenProjectTemplate {
40 | language: string;
41 | name: string;
42 | supportedPlatforms: string[];
43 | type: string;
44 | detail: string;
45 | enabled: boolean;
46 | }
47 |
48 | export interface DeviceSdkReference {
49 | type: string;
50 | name: string;
51 | detail: string;
52 | }
53 |
54 | export interface Platform {
55 | name: string;
56 | id: string;
57 | description: string;
58 | }
59 |
60 | export interface DeviceConfig {
61 | id: string;
62 | label: string;
63 | detail: string;
64 | }
65 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Provisionable.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | import { ScaffoldType } from "../../constants";
4 | import { ComponentInfo, DependencyConfig } from "../AzureComponentConfig";
5 |
6 | export interface Provisionable {
7 | dependencies: DependencyConfig[];
8 | provision(): Promise;
9 | updateConfigSettings(type: ScaffoldType, componentInfo?: ComponentInfo): void;
10 | }
11 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/UI.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import { QuickPickItem } from "vscode";
5 |
6 | export interface PickWithData extends QuickPickItem {
7 | data: T;
8 | }
9 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Uploadable.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export interface Uploadable {
5 | upload(): Promise;
6 | }
7 |
--------------------------------------------------------------------------------
/src/Models/Interfaces/Workspace.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | export interface Workspace {
5 | folders: Array<{ path: string }>;
6 | settings: { [key: string]: string };
7 | }
8 |
--------------------------------------------------------------------------------
/src/Models/OTA.ts:
--------------------------------------------------------------------------------
1 | import { crc16xmodem } from "crc";
2 | import * as fs from "fs-plus";
3 |
4 | export class OTA {
5 | static generateCrc(
6 | filePath: string
7 | ): {
8 | crc: string;
9 | size: number;
10 | } {
11 | const data = fs.readFileSync(filePath);
12 | const size = fs.statSync(filePath).size;
13 | const crc = crc16xmodem(data).toString(16);
14 | return { crc, size };
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Models/RemoteExtension.ts:
--------------------------------------------------------------------------------
1 | import * as vscode from "vscode";
2 | import { ExtensionName } from "./Interfaces/Api";
3 | import { WorkbenchExtension } from "../WorkbenchExtension";
4 | import { RemoteEnvNotSupportedError } from "../common/Error/OperationFailedErrors/RemoteEnvNotSupportedError";
5 | import { OperationFailedError } from "../common/Error/OperationFailedErrors/OperationFailedError";
6 | import { checkExtensionAvailable } from "./Apis";
7 | import { DependentExtensionNotFoundError } from "../common/Error/OperationFailedErrors/DependentExtensionNotFoundError";
8 |
9 | export class RemoteExtension {
10 | static isRemote(context: vscode.ExtensionContext): boolean {
11 | const extension = WorkbenchExtension.getExtension(context);
12 | if (!extension) {
13 | throw new OperationFailedError("check whether is remote", "Failed to get workbench extension", "");
14 | }
15 | return extension.extensionKind === vscode.ExtensionKind.Workspace;
16 | }
17 |
18 | /**
19 | * Check whether remote extension is installed in VS Code.
20 | * If not, ask user to install it from marketplace.
21 | * @returns true - remote extension is installed.
22 | * @returns false - remote extension is not installed.
23 | */
24 | static async isAvailable(): Promise {
25 | return await checkExtensionAvailable(ExtensionName.Remote);
26 | }
27 |
28 | static async checkRemoteExtension(operation: string): Promise {
29 | const res = await RemoteExtension.isAvailable();
30 | if (!res) {
31 | throw new DependentExtensionNotFoundError(operation, ExtensionName.Remote);
32 | }
33 | }
34 |
35 | /**
36 | * Ensure we are not in remote environment before running a command.
37 | * If in remote environment, throw error.
38 | */
39 | static ensureLocalBeforeRunCommand(operation: string, context: vscode.ExtensionContext): void {
40 | if (RemoteExtension.isRemote(context)) {
41 | throw new RemoteEnvNotSupportedError(operation);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/WorkbenchExtension.ts:
--------------------------------------------------------------------------------
1 | import * as vscode from "vscode";
2 | import * as fs from "fs";
3 |
4 | export class WorkbenchExtension {
5 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
6 | private static extension: vscode.Extension | undefined;
7 |
8 | static getExtension(
9 | context: vscode.ExtensionContext
10 | ): // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 | vscode.Extension | undefined {
12 | if (!WorkbenchExtension.extension) {
13 | const extensionId = WorkbenchExtension.getExtensionId(context);
14 | WorkbenchExtension.extension = vscode.extensions.getExtension(extensionId);
15 | }
16 | return WorkbenchExtension.extension;
17 | }
18 |
19 | private static getExtensionId(context: vscode.ExtensionContext): string {
20 | // Get extensionId from package.json
21 | const packageJsonPath = context.asAbsolutePath("./package.json");
22 | const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
23 | const extensionId = packageJson.publisher + "." + packageJson.name;
24 | return extensionId;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/azure-account.api.d.ts:
--------------------------------------------------------------------------------
1 | /*---------------------------------------------------------------------------------------------
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | * Licensed under the MIT License. See License.txt in the project root for license information.
4 | *--------------------------------------------------------------------------------------------*/
5 |
6 | import { Event } from "vscode";
7 | import { ServiceClientCredentials } from "ms-rest";
8 | import { AzureEnvironment } from "ms-rest-azure";
9 | import { SubscriptionModels } from "azure-arm-resource";
10 |
11 | export type AzureLoginStatus = "Initializing" | "LoggingIn" | "LoggedIn" | "LoggedOut";
12 |
13 | export interface AzureAccount {
14 | readonly status: AzureLoginStatus;
15 | readonly onStatusChanged: Event;
16 | readonly waitForLogin: () => Promise;
17 | readonly sessions: AzureSession[];
18 | readonly onSessionsChanged: Event;
19 | readonly filters: AzureResourceFilter[];
20 | readonly onFiltersChanged: Event;
21 | }
22 |
23 | export interface AzureSession {
24 | readonly environment: AzureEnvironment;
25 | readonly userId: string;
26 | readonly tenantId: string;
27 | readonly credentials: ServiceClientCredentials;
28 | }
29 |
30 | export interface AzureResourceFilter {
31 | readonly session: AzureSession;
32 | readonly subscription: SubscriptionModels.Subscription;
33 | }
34 |
35 | export interface Credentials {
36 | readSecret(service: string, account: string): Thenable;
37 | writeSecret(service: string, account: string, secret: string): Thenable;
38 | deleteSecret(service: string, account: string): Thenable;
39 | }
40 |
--------------------------------------------------------------------------------
/src/boardProvider.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import { FileNames } from "./constants";
5 | import { Board } from "./Models/Interfaces/Board";
6 | import * as path from "path";
7 | import * as fs from "fs-extra";
8 |
9 | interface BoardList {
10 | boards: Board[];
11 | }
12 |
13 | export interface BoardOption {
14 | name?: string;
15 | id?: string;
16 | platform?: string;
17 | defaultBaudRate?: number;
18 | vendorId?: string | number;
19 | productId?: string | number;
20 | }
21 |
22 | export class BoardProvider {
23 | private boardFolderPath: string;
24 | constructor(boardFolderPath: string) {
25 | this.boardFolderPath = boardFolderPath;
26 | }
27 |
28 | get list(): Board[] {
29 | const boardList = path.join(this.boardFolderPath, FileNames.boardListFileName);
30 | const data = fs.readFileSync(boardList, "utf8");
31 | const boardsJson: BoardList = JSON.parse(data);
32 | return boardsJson.boards;
33 | }
34 |
35 | find(option: BoardOption): Board | undefined {
36 | const list = this.list;
37 | return list.find(board => {
38 | for (const key of Object.keys(option)) {
39 | const boardProperty = Object.getOwnPropertyDescriptor(board, key);
40 | const optionProperty = Object.getOwnPropertyDescriptor(option, key);
41 |
42 | if (!optionProperty) {
43 | continue;
44 | }
45 |
46 | if (!boardProperty) {
47 | return false;
48 | }
49 |
50 | if (key === "vendorId" || key === "productId") {
51 | const optionId =
52 | typeof optionProperty.value === "number" ? optionProperty.value : Number(`0x${optionProperty.value}`);
53 | const boardId = Number(`0x${boardProperty.value}`);
54 | if (optionId !== boardId) {
55 | return false;
56 | }
57 | } else if (optionProperty.value !== boardProperty.value) {
58 | return false;
59 | }
60 | }
61 | return true;
62 | });
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/common/Commands.ts:
--------------------------------------------------------------------------------
1 | export enum WorkbenchCommands {
2 | // workbench commands
3 | InitializeProject = "iotworkbench.initializeProject",
4 | ConfigureProjectEnvironment = "iotworkbench.configureProjectEnvironment",
5 | Examples = "iotworkbench.examples",
6 | Help = "iotworkbench.help",
7 | Workbench = "iotworkbench.workbench",
8 | DeviceCompile = "iotworkbench.deviceCompile",
9 | DeviceUpload = "iotworkbench.deviceUpload",
10 | AzureProvision = "iotworkbench.azureProvision",
11 | AzureDeploy = "iotworkbench.azureDeploy",
12 | ConfigureDevice = "iotworkbench.configureDevice",
13 | IotPnPGenerateCode = "iotworkbench.iotPnPGenerateCode",
14 |
15 | // Workbench internal commands
16 | ExampleInitialize = "iotworkbench.exampleInitialize",
17 | SendTelemetry = "iotworkbench.sendTelemetry",
18 | OpenUri = "iotworkbench.openUri",
19 | HttpRequest = "iotworkbench.httpRequest"
20 | }
21 |
22 | export enum VscodeCommands {
23 | // vscode commands
24 | VscodeOpen = "vscode.open",
25 | VscodeOpenFolder = "vscode.openFolder"
26 | }
27 |
28 | export enum RemoteContainersCommands {
29 | // remote-containers commands
30 | ReopenInContainer = "remote-containers.reopenInContainer",
31 | OpenFolder = "remote-containers.openFolder"
32 | }
33 |
34 | export enum ArduinoCommands {
35 | // arduino commands
36 | InstallBoard = "arduino.installBoard",
37 | CloseSerialMonitor = "arduino.closeSerialMonitor"
38 | }
39 |
40 | export enum AzureAccountCommands {
41 | Login = "azure-account.login"
42 | }
43 |
44 | export enum AzureFunctionsCommands {
45 | CreateNewProject = "azureFunctions.createNewProject",
46 | CreateFunctionApp = "azureFunctions.createFunctionApp",
47 | Deploy = "azureFunctions.deploy"
48 | }
49 |
50 | export enum IoTCubeCommands {
51 | OpenLocally = "iotcube.openLocally"
52 | }
53 |
--------------------------------------------------------------------------------
/src/common/Error/OperationCanceledError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Used when user cancel operation.
3 | */
4 | export class OperationCanceledError extends Error {
5 | /**
6 | * Construct operation canceled error.
7 | * @param errorMessage failure reason
8 | */
9 | constructor(errorMessage: string) {
10 | super(`Operation cancelled: ${errorMessage}`);
11 | this.name = "CancelOperationError";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/ArgumentEmptyOrNullError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "./OperationFailedError";
2 |
3 | /**
4 | * Used when argument is empty or null.
5 | */
6 | export class ArgumentEmptyOrNullError extends OperationFailedError {
7 | /**
8 | * Construct a argument empty or null error.
9 | * @param operation the failed operation
10 | * @param argument the empty or null argument name
11 | * @param suggestedOperation suggested operation for user to handle the failure
12 | */
13 | constructor(operation: string, argument: string, suggestedOperation?: string) {
14 | super(operation, `Argument ${argument} is empty or null.`, suggestedOperation || "");
15 | this.name = "ArgumentEmptyOrNullError";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/DependentExtensionNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { ExtensionName } from "../../../Models/Interfaces/Api";
2 | import { OperationFailedError } from "./OperationFailedError";
3 |
4 | /**
5 | * Used when dependent extension is not installed.
6 | * Ask user to install depedent extension first.
7 | */
8 | export class DependentExtensionNotFoundError extends OperationFailedError {
9 | /**
10 | * Construct a depedent extension not found error.
11 | * @param extension name of the depedent extension that's not found
12 | */
13 | constructor(operation: string, extension: ExtensionName) {
14 | super(operation, `Dependent extension ${extension} is not found.`, "Please install it from Marketplace.");
15 | this.name = "DependentExtensionNotFound";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/DigitalTwinNotInitializedError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "./OperationFailedError";
2 |
3 | /**
4 | * Used when Azure Digital Twin instance is not initialized.
5 | */
6 | export class DigitalTwinNotInitializedError extends OperationFailedError {
7 | /**
8 | * Construct a digital twin not initialized error.
9 | */
10 | constructor(operation: string) {
11 | super(operation, "Azure Digital Twin extension is not initialized.", "Please initialize the extension first.");
12 | this.name = "DigitalTwinNotInitializedError";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/DirectoryNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { ResourceNotFoundError } from "./ResourceNotFoundError";
2 |
3 | /**
4 | * Used when directory not found.
5 | */
6 | export class DirectoryNotFoundError extends ResourceNotFoundError {
7 | /**
8 | * Construct a directory not found error.
9 | * @param operation the failed operation
10 | * @param directory The missing directory
11 | * @param suggestedOperation Recommended operation for user.
12 | */
13 | constructor(operation: string, directory: string, suggestedOperation: string) {
14 | super(operation, `${directory}`, suggestedOperation);
15 | this.name = "DirectoryNotFoundError";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/FileNotFound.ts:
--------------------------------------------------------------------------------
1 | import { ResourceNotFoundError } from "./ResourceNotFoundError";
2 |
3 | /**
4 | * Used when file not found.
5 | */
6 | export class FileNotFoundError extends ResourceNotFoundError {
7 | /**
8 | * Construct a file not found error.
9 | * @param operation the failed operation
10 | * @param file The missing file
11 | * @param suggestedOperation Recommended operation for user.
12 | */
13 | constructor(operation: string, file: string, suggestedOperation: string) {
14 | super(operation, `${file}`, suggestedOperation);
15 | this.name = "FileNotFoundError";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/OperationFailedError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Used when one operation failed.
3 | */
4 | export class OperationFailedError extends Error {
5 | /**
6 | * Construct operation failed error.
7 | * @param operation the failed operation
8 | * @param errorMessage failure reason
9 | * @param suggestedOperation recommended method for user to handle the failure
10 | */
11 | constructor(operation: string, errorMessage: string, suggestedOperation: string) {
12 | super(`Failed to ${operation}. ${errorMessage} ${suggestedOperation}`);
13 | this.name = "OperationFailedError";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/RemoteEnvNotSupportedError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "./OperationFailedError";
2 |
3 | /**
4 | * Used when user tries to execute an operation that is not supported to run in remote environment.
5 | * Ask user to open window locally and try the command again.
6 | */
7 | export class RemoteEnvNotSupportedError extends OperationFailedError {
8 | /**
9 | * Construct a remote environemt not supported error.
10 | * @param suggestedOperation message of the recommended operation for user
11 | */
12 | constructor(operation: string) {
13 | const suggestedOperation = "Open a new window and run this command again";
14 | super(operation, `The operation is not supported to be run in remote environment.`, suggestedOperation);
15 | this.name = "RemoteEnvNotSupportedError";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/ResourceNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "./OperationFailedError";
2 |
3 | /**
4 | * Used when the needed resource (file, directory, etc) is not found.
5 | * e.g. File does not exists
6 | */
7 | export class ResourceNotFoundError extends OperationFailedError {
8 | /**
9 | * Construct a resource not found error.
10 | * @param resource The name of the missing resource
11 | * @param suggestedOperation Recommended operation for user.
12 | */
13 | constructor(operation: string, resource: string, suggestedOperation: string) {
14 | super(operation, `Unable to find ${resource}.`, suggestedOperation);
15 | this.name = "ResourceNotFoundError";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/common/Error/OperationFailedErrors/WorkspaceNotOpenError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "./OperationFailedError";
2 |
3 | /**
4 | * Used when no folder is open in VS Code. Ask user to open a folder first.
5 | */
6 | export class WorkspaceNotOpenError extends OperationFailedError {
7 | /**
8 | * Construct a workspace not open error.
9 | * @param operation the failed operation
10 | */
11 | constructor(operation: string) {
12 | super(operation, "You have not yet opened a folder in Visual Studio Code.", "Please select a folder first.");
13 | this.name = "WorkspaceNotOpenError";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/common/Error/PnPErrors/PnPModelTypeInvalidError.ts:
--------------------------------------------------------------------------------
1 | import { OperationFailedError } from "../OperationFailedErrors/OperationFailedError";
2 | import { ModelType } from "../../../DigitalTwin/pnp/src/deviceModel/deviceModelManager";
3 |
4 | export class PnPModelTypeInvalidError extends OperationFailedError {
5 | constructor(operation: string, type: ModelType) {
6 | super(operation, `Invalid model type: ${type}`, "");
7 | this.name = "PnPModelTypeInvalidError";
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/AzureConfigNotFoundErrors.ts:
--------------------------------------------------------------------------------
1 | import { SystemError } from "./SystemError";
2 |
3 | /**
4 | * Used when fail to get configuration value using key from workspace settings.
5 | */
6 | export class AzureConfigNotFoundError extends SystemError {
7 | /**
8 | * Construct a config not found error.
9 | * @param errorMsg Error Message
10 | */
11 | constructor(errorMsg: string) {
12 | super(`Failed to get Azure configuration ${errorMsg}.`);
13 | this.name = "AzureConfigNotFoundError";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/ProjectConfigNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { SystemError } from "./SystemError";
2 |
3 | /**
4 | * Used when fail to get configuration value using key from project configuration file.
5 | */
6 | export class ProjectConfigNotFoundError extends SystemError {
7 | /**
8 | * Construct a project config not found error.
9 | * @param configKey configuration key
10 | */
11 | constructor(configKey: string, projectConfigurationFile: string) {
12 | super(`Failed to get configuration value of key ${configKey} \
13 | from project configuration file ${projectConfigurationFile}.`);
14 | this.name = "ProjectConfigNotFoundError";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/SystemError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Used when the program hits system error.
3 | * This kind of error has less to do with user operation than bad program system implementation.
4 | */
5 | export class SystemError extends Error {
6 | /**
7 | * Construct system error.
8 | * @param errorMessage failure reason
9 | */
10 | constructor(errorMessage: string) {
11 | super(`System Error: ${errorMessage}}`);
12 | this.name = "SystemError";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/SystemResourceNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { SystemError } from "./SystemError";
2 |
3 | /**
4 | * Used when try to get items from system resource file with searching key but failed.
5 | */
6 | export class SystemResourceNotFoundError extends SystemError {
7 | /**
8 | * Construct a system resource not found error.
9 | * @param targetResource name of target resource wanted from system template resource
10 | * @param searchingKey searching key used to search target resource
11 | * @param systemResource name of system resource
12 | */
13 | constructor(targetResource: string, searchingKey: string, systemResource: string) {
14 | super(`Unable to find available ${targetResource} using ${searchingKey} \
15 | from system resource ${systemResource}.`);
16 | this.name = "SystemResourceNotFoundError";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/TypeNotSupportedError.ts:
--------------------------------------------------------------------------------
1 | import { SystemError } from "./SystemError";
2 |
3 | /**
4 | * Used when type is not implemented in current system.
5 | */
6 | export class TypeNotSupportedError extends SystemError {
7 | /**
8 | * Construct a type not supported error
9 | * @param typeName the name of the unsupported type
10 | * @param typeValue the value of the unsupported type
11 | */
12 | constructor(typeName: string, typeValue: string) {
13 | super(`Unsupported ${typeName}: ${typeValue}`);
14 | this.name = "TypeNotSupportedError";
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/common/Error/SystemErrors/WorkspaceConfigNotFoundError.ts:
--------------------------------------------------------------------------------
1 | import { SystemError } from "./SystemError";
2 |
3 | /**
4 | * Used when fail to get configuration value using key from workspace settings.
5 | */
6 | export class WorkspaceConfigNotFoundError extends SystemError {
7 | /**
8 | * Construct a config not found error.
9 | * @param configKey configuration key
10 | */
11 | constructor(configKey: string) {
12 | super(`Failed to get workspace configuration value of key ${configKey}.`);
13 | this.name = "WorkspaceConfigNotFoundError";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/common/Error/exceptionHelper.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as vscode from "vscode";
5 | import * as utils from "../../utils";
6 |
7 | export class ExceptionHelper {
8 | static logError(channel: vscode.OutputChannel | undefined, error: Error, popupErrorMsg: string): void;
9 | static logError(channel: vscode.OutputChannel | undefined, errorMsg: string, popupErrorMsg: string): void;
10 | static logError(channel: vscode.OutputChannel | undefined, error: Error, isPopupErrorMsg: boolean): void;
11 | static logError(channel: vscode.OutputChannel | undefined, errorMsg: string, isPopupErrorMsg: boolean): void;
12 | static logError(
13 | channel: vscode.OutputChannel | undefined,
14 | errorValue: string | Error,
15 | popupValue: string | boolean
16 | ): void {
17 | let _error: Error;
18 | let _message: string;
19 |
20 | if (typeof errorValue === "string") {
21 | _error = new Error(errorValue);
22 | _message = errorValue;
23 | } else {
24 | _error = errorValue;
25 | _message = errorValue.message;
26 | }
27 |
28 | if (popupValue === true) {
29 | vscode.window.showErrorMessage(_message);
30 | } else if (typeof popupValue === "string") {
31 | vscode.window.showErrorMessage(popupValue);
32 | }
33 |
34 | if (channel) {
35 | let errorMessage: string;
36 | if (_error.message) {
37 | errorMessage = _error.message;
38 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
39 | } else if ((_error as any).body && (_error as any).body.message) {
40 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
41 | errorMessage = (_error as any).body.message;
42 | } else {
43 | errorMessage = _error.toString();
44 | }
45 |
46 | utils.channelShowAndAppendLine(channel, errorMessage);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/configHandler.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | import * as vscode from "vscode";
5 | import { ArgumentEmptyOrNullError } from "./common/Error/OperationFailedErrors/ArgumentEmptyOrNullError";
6 |
7 | export class ConfigHandler {
8 | static async update(key: string, value: {}, target = vscode.ConfigurationTarget.Workspace): Promise {
9 | if (!key) {
10 | throw new ArgumentEmptyOrNullError("update workspace configuration", "key");
11 | }
12 |
13 | return await vscode.workspace.getConfiguration("IoTWorkbench").update(key, value, target);
14 | }
15 |
16 | static get(key: string): T | undefined {
17 | if (!key) {
18 | throw new ArgumentEmptyOrNullError("get workspace configuration value of key", "key");
19 | }
20 |
21 | return vscode.workspace.getConfiguration("IoTWorkbench").get(key);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/getmac.d.ts:
--------------------------------------------------------------------------------
1 | // reference code from https://github.com/0815fox/DefinitelyTyped
2 |
3 | declare module "getmac" {
4 | function getMac(opts: (err: Error, macAddress: string) => void): void;
5 | function isMac(macAddress: string): boolean;
6 | }
7 |
--------------------------------------------------------------------------------
/syntaxes/colorized.channel.tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | colorizedChannel
7 | scopeName
8 | text.channel.colorized
9 | patterns
10 |
11 |
12 | name
13 | channel.colorized.info
14 | match
15 | (\[Start\]|\[Done\])(.*)
16 | captures
17 |
18 | 0
19 |
20 | name
21 | token.info-token
22 |
23 |
24 |
25 |
26 | name
27 | channel.colorized.warn
28 | match
29 | (\[Warn\])(.+)
30 | captures
31 |
32 | 0
33 |
34 | name
35 | token.warn-token
36 |
37 |
38 |
39 |
40 | name
41 | channel.colorized.error
42 | match
43 | (\[Error\])(.+)
44 | captures
45 |
46 | 0
47 |
48 | name
49 | token.error-token
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/test/digitalTwin/digitalTwinDiagnosticProvider.test.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import { DigitalTwinDiagnosticProvider } from "../../src/DigitalTwin/pnp/src/intelliSense/digitalTwinDiagnosticProvider";
5 | import { IntelliSenseUtility } from "../../src/DigitalTwin/pnp/src/intelliSense/intelliSenseUtility";
6 | import { TestCase, TestUtility } from "../testUtility";
7 | import { Diagnostic } from "vscode";
8 |
9 | const vscode = require("../../__mocks__/vscode");
10 |
11 | describe("DigitalTwin diagnostic provider", () => {
12 | const context = vscode.ExtensionContext;
13 | const document = vscode.TextDocument;
14 | const collection = vscode.DiagnosticCollection;
15 | const provider = new DigitalTwinDiagnosticProvider();
16 |
17 | let results: string[];
18 | collection.set = jest.fn((_uri, diagnostics: Diagnostic[]) => {
19 | results = diagnostics.map(e => e.message);
20 | });
21 |
22 | beforeAll(() => {
23 | return IntelliSenseUtility.initGraph(context);
24 | });
25 |
26 | test("invalid @context value", async () => {
27 | const testCase: TestCase = await TestUtility.readTestCase("invalid_context.json");
28 | document.getText = jest.fn().mockReturnValueOnce(testCase.input);
29 | provider.updateDiagnostics(document, collection);
30 | expect(collection.delete).toHaveBeenCalled();
31 | });
32 |
33 | test("invalid @type value", async () => {
34 | const testCase: TestCase = await TestUtility.readTestCase("invalid_type.json");
35 | document.getText = jest.fn().mockReturnValueOnce(testCase.input);
36 | provider.updateDiagnostics(document, collection);
37 | expect(results).toHaveLength(testCase.output.length);
38 | expect(results).toEqual(testCase.output);
39 | });
40 |
41 | test("Interface of DTDL v1", async () => {
42 | const testCase: TestCase = await TestUtility.readTestCase("interface_v1.json");
43 | document.getText = jest.fn().mockReturnValueOnce(testCase.input);
44 | provider.updateDiagnostics(document, collection);
45 | expect(results).toHaveLength(testCase.output.length);
46 | expect(results).toEqual(testCase.output);
47 | });
48 | });
49 |
--------------------------------------------------------------------------------
/test/digitalTwin/intelliSenseUtility.test.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import { IntelliSenseUtility } from "../../src/DigitalTwin/pnp/src/intelliSense/intelliSenseUtility";
5 |
6 | const vscode = require("../../__mocks__/vscode");
7 |
8 | describe("IntelliSense utility", () => {
9 | const context = vscode.ExtensionContext;
10 |
11 | beforeAll(() => {
12 | return IntelliSenseUtility.initGraph(context);
13 | });
14 |
15 | test("parse DigitalTwin model with normal JSON file", () => {
16 | const text = `{ "@type": "Interface" }`;
17 | expect(IntelliSenseUtility.parseDigitalTwinModel(text)).toBeUndefined();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/test/resources/invalid_context.json:
--------------------------------------------------------------------------------
1 | {
2 | "input": {
3 | "@id": "{DigitalTwinIdentifier}",
4 | "@type": "CapabilityModel",
5 | "displayName": "mycapabilitymodel",
6 | "implements": [
7 | {
8 | "schema": "urn:azureiot:DeviceManagement:DeviceInformation:1",
9 | "name": "deviceInfo"
10 | }
11 | ],
12 | "@context": "http://azureiot.com/v1/contexts/invalid.json"
13 | },
14 | "output": []
15 | }
16 |
--------------------------------------------------------------------------------
/test/resources/invalid_type.json:
--------------------------------------------------------------------------------
1 | {
2 | "input": {
3 | "@id": "{DigitalTwinIdentifier}",
4 | "@type": "Invalid",
5 | "displayName": "mycapabilitymodel",
6 | "implements": [
7 | {
8 | "schema": "urn:azureiot:DeviceManagement:DeviceInformation:1",
9 | "name": "deviceInfo"
10 | }
11 | ],
12 | "@context": "http://azureiot.com/v1/contexts/IoTModel.json"
13 | },
14 | "output": ["Invalid type. Valid types:\nInterface\nCapabilityModel"]
15 | }
16 |
--------------------------------------------------------------------------------
/test/testUtility.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | import * as path from "path";
5 | import { Utility } from "../src/DigitalTwin/pnp/src/common/utility";
6 |
7 | export interface TestCase {
8 | input: string;
9 | output: string[];
10 | }
11 |
12 | export class TestUtility {
13 | private static readonly TEST_CASE_FOLDER = "test/resources";
14 |
15 | static async readTestCase(fileName: string): Promise {
16 | const filePath: string = path.join(TestUtility.TEST_CASE_FOLDER, fileName);
17 | const content = await Utility.getJsonContent(filePath);
18 | const input: string = JSON.stringify(content["input"]);
19 | const output = content["output"] as string[];
20 | return { input, output };
21 | }
22 |
23 | private constructor() {}
24 | }
25 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "moduleResolution": "node",
4 | "module": "commonjs",
5 | "target": "es6",
6 | "outDir": "out",
7 | "lib": [
8 | "es6",
9 | "es2017"
10 | ],
11 | "sourceMap": true,
12 | "rootDir": ".",
13 | "noUnusedLocals": false,
14 | "noUnusedParameters": true,
15 | "strict": true // Enable several strict checks
16 | },
17 | "include": [
18 | "src/*.ts",
19 | "src/**/*.ts",
20 | "test/*.ts",
21 | "test/**/*.ts"
22 | ],
23 | "exclude": [
24 | "node_modules",
25 | ".vscode-test"
26 | ]
27 | }
--------------------------------------------------------------------------------
/views/example-aside-schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "oneOf": [
3 | {
4 | "type": "links",
5 | "title": "string|null",
6 | "items": [
7 | {
8 | "text": "string",
9 | "url": "string"
10 | }
11 | ]
12 | },
13 | {
14 | "type": "table",
15 | "title": "string|null",
16 | "rows": [
17 | [
18 | {
19 | "text": "string",
20 | "url": "string|null"
21 | }
22 | ]
23 | ]
24 | },
25 | {
26 | "type": "text",
27 | "title": "string|null",
28 | "text": "string"
29 | },
30 | {
31 | "type": "image",
32 | "title": "string|null",
33 | "src": "string",
34 | "url": "string|null"
35 | },
36 | {
37 | "type": "badge",
38 | "title": "string|null",
39 | "items": [
40 | {
41 | "icon": "string",
42 | "text": "string",
43 | "url": "string|null"
44 | }
45 | ]
46 | },
47 | {
48 | "type": "feed",
49 | "url": "string"
50 | }
51 | ]
52 | }
--------------------------------------------------------------------------------
/views/fonts/Press-Start-2P-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/views/fonts/Press-Start-2P-Regular.woff2
--------------------------------------------------------------------------------
/views/images/feed.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/views/images/github.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/views/images/logo-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/views/images/logo-black.png
--------------------------------------------------------------------------------
/views/images/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/views/images/no-avatar.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
--------------------------------------------------------------------------------
/views/images/no-image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/vscode-iot-workbench/5b555fa15cd97627a9f75cda5721dd4d844b5d6f/views/images/no-image.jpg
--------------------------------------------------------------------------------