Add BI, update README and some refinement (#3)
* Add BI, update README and some refinement * Remove GitHub repo before open source
This commit is contained in:
Родитель
95da103e91
Коммит
7dd660d5fc
56
CHANGELOG.md
56
CHANGELOG.md
|
@ -1,54 +1,2 @@
|
|||
### 0.1.4 (2017-08-09)
|
||||
* Invoke Direct Method
|
||||
* Get/update Device Twin
|
||||
* Remove IoT Hub commands from editor context menu
|
||||
|
||||
### 0.1.3 (2017-06-28)
|
||||
* Make stringifying D2C messages optional
|
||||
|
||||
### 0.1.2 (2017-06-23)
|
||||
* Show different icon for connected devices
|
||||
|
||||
### 0.1.1 (2017-06-15)
|
||||
* Add 'Send/monitor C2D message' into context menu of Device Explorer
|
||||
|
||||
### 0.1.0 (2017-06-09)
|
||||
* Device Explorer
|
||||
* Code snippet for Direct Methods
|
||||
|
||||
### 0.0.11 (2017-03-10)
|
||||
* Send/monitor C2D message
|
||||
* Code snippet for C2D message
|
||||
|
||||
### 0.0.10 (2017-03-06)
|
||||
* JavaScript code snippet to send/monitor D2C message
|
||||
|
||||
### 0.0.9 (2017-02-28)
|
||||
* Show verbose info when monitoring messages
|
||||
* Output refinement for JSON object
|
||||
|
||||
### 0.0.8 (2017-02-27)
|
||||
* Send messages to Azure Event Hub
|
||||
* Monitor Event Hub messages
|
||||
|
||||
### 0.0.7
|
||||
* Show detailed info when listing devices
|
||||
|
||||
### 0.0.6
|
||||
* Deploy and run in remote machine
|
||||
|
||||
### 0.0.5
|
||||
* Include device-discovery-cli into extension
|
||||
|
||||
### 0.0.4
|
||||
* Add instruction if device-discovery-cli is not installed
|
||||
|
||||
### 0.0.3
|
||||
* Discover Ethernet, USB serial, WiFi devices
|
||||
|
||||
### 0.0.2
|
||||
* Device management (List, Create, Delete)
|
||||
|
||||
### 0.0.1
|
||||
* Send messages to Azure IoT Hub
|
||||
* Monitor device-to-cloud messages
|
||||
## 0.1.0 (2017-??-??)
|
||||
* First Release
|
||||
|
|
88
README.md
88
README.md
|
@ -1,25 +1,6 @@
|
|||
# Azure IoT Toolkit
|
||||
|
||||
Toolkit makes Azure IoT Development easier. For more awesome Azure IoT projects and resources, please visit https://aka.ms/azure.iot
|
||||
|
||||
## Features
|
||||
|
||||
[x] Device Explorer
|
||||
|
||||
[x] Send messages to Azure IoT Hub (device-to-cloud message)
|
||||
|
||||
[x] Monitor device-to-cloud messages
|
||||
|
||||
[x] Code snippet for IoT Hub
|
||||
|
||||
[x] Send/monitor messages from Azure IoT Hub to device (cloud-to-device message)
|
||||
|
||||
[x] Device management (List, Create, Delete)
|
||||
|
||||
[x] Invoke Direct Method
|
||||
|
||||
[x] Get/update Device Twin
|
||||
|
||||
Interact with Azure IoT Hub, IoT Device Management, IoT Hub Code Snippets.
|
||||
|
||||
## Device Explorer
|
||||
|
||||
|
@ -40,33 +21,17 @@ Toolkit makes Azure IoT Development easier. For more awesome Azure IoT projects
|
|||
|
||||
1. In Explorer of VS Code, click "IoT Hub Devices" in the bottom left corner.
|
||||
|
||||
![Click Device Explorer](images/device-explorer-click.png)
|
||||
![Click Device Explorer](https://github.com/formulahendry/vscode-azure-iot-toolkit/raw/master/images/device-explorer-click.png)
|
||||
|
||||
2. If you have not set Iot Hub Connection String before, an input box will pop up, then enter your Iot Hub Connection String (It is one-time configuration).
|
||||
|
||||
![Enter Connection String](images/enter-connection-string.png)
|
||||
![Enter Connection String](https://github.com/formulahendry/vscode-azure-iot-toolkit/raw/master/images/enter-connection-string.png)
|
||||
|
||||
3. The device list will be shown.
|
||||
|
||||
![Device Explorer](images/device-explorer.png)
|
||||
![Device Explorer](https://github.com/formulahendry/vscode-azure-iot-toolkit/raw/master/images/device-explorer.png)
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Keyboard Shortcuts | Menu Contexts |
|
||||
| --- | --- | --- |
|
||||
| IoT: Send message to IoT Hub | Ctrl+Alt+F9 | view/item/context |
|
||||
| IoT: Start monitoring IoT Hub message | Ctrl+Alt+F10 | view/title |
|
||||
| IoT: Stop monitoring IoT Hub message | Ctrl+Alt+F11 | editor/context (in output panel) |
|
||||
| IoT: Send C2D message to device | None | view/item/context |
|
||||
| IoT: Start monitoring C2D message | None | view/item/context |
|
||||
| IoT: Stop monitoring C2D message | None | editor/context (in output panel) |
|
||||
| IoT: List device | Ctrl+Alt+F1 | None |
|
||||
| IoT: Create device | Ctrl+Alt+F2 | view/title |
|
||||
| IoT: Delete device | Ctrl+Alt+F3 | view/item/context |
|
||||
|
||||
## Usages
|
||||
|
||||
* Code Snippets
|
||||
## Code Snippets
|
||||
|
||||
| Trigger | Content |
|
||||
| ---- | ---- |
|
||||
|
@ -84,54 +49,37 @@ Toolkit makes Azure IoT Development easier. For more awesome Azure IoT projects
|
|||
|
||||
## Configuration
|
||||
|
||||
To set the Device Connection String which is used to send device-to-cloud message or other functions as a device simulator:
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.deviceConnectionString": "HostName=<my-hub>.azure-devices.net;DeviceId=<known-device-id>;SharedAccessKey=<known-device-key>"
|
||||
}
|
||||
```
|
||||
|
||||
To set the IoT Hub Connection String to monitor device-to-cloud message or other functions as a service simulator:
|
||||
IoT Hub Connection String:
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.iotHubConnectionString": "HostName=<my-hub>.azure-devices.net;SharedAccessKeyName=<my-policy>;SharedAccessKey=<my-policy-key>"
|
||||
}
|
||||
```
|
||||
|
||||
To set the IoT Hub Consumer Group (default is "$Default"):
|
||||
Device Connection String:
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.deviceConnectionString": "HostName=<my-hub>.azure-devices.net;DeviceId=<known-device-id>;SharedAccessKey=<known-device-key>"
|
||||
}
|
||||
```
|
||||
|
||||
IoT Hub Consumer Group (default is "$Default"):
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.iotHubConsumerGroup": "$Default"
|
||||
}
|
||||
```
|
||||
|
||||
To set whether to show verbose info when monitoring messages (default is `true`):
|
||||
Whether to show verbose info when monitoring messages (default is `false`):
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.showVerboseMessage": true
|
||||
"azure-iot-toolkit.showVerboseMessage": false
|
||||
}
|
||||
```
|
||||
|
||||
To set whether to stringify device-to-cloud messages (default is `true`):
|
||||
Whether to stringify device-to-cloud messages (default is `false`):
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.iotHubD2CMessageStringify": true
|
||||
"azure-iot-toolkit.iotHubD2CMessageStringify": false
|
||||
}
|
||||
```
|
||||
|
||||
## Telemetry data
|
||||
By default, anonymous telemetry data collection is turned on to understand user behavior to improve this extension. To disable it, update the settings.json as below:
|
||||
```json
|
||||
{
|
||||
"azure-iot-toolkit.enableAppInsights": false
|
||||
}
|
||||
```
|
||||
|
||||
## Change Log
|
||||
See Change Log [here](CHANGELOG.md)
|
||||
|
||||
## Issues
|
||||
Submit the [issues](https://github.com/Microsoft/vscode-azure-iot-toolkit/issues) if you find any bug or have any suggestion.
|
||||
|
||||
## Contribution
|
||||
Fork the [repo](https://github.com/Microsoft/vscode-azure-iot-toolkit) and submit pull requests.
|
Двоичные данные
images/device-explorer.png
Двоичные данные
images/device-explorer.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 38 KiB После Ширина: | Высота: | Размер: 69 KiB |
76
package.json
76
package.json
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"name": "azure-iot-toolkit",
|
||||
"displayName": "Azure IoT Toolkit",
|
||||
"description": "Interact with Azure IoT Hub; IoT Device Management; IoT Hub Code Snippets;",
|
||||
"version": "0.1.4",
|
||||
"publisher": "formulahendry",
|
||||
"description": "Interact with Azure IoT Hub, IoT Device Management, IoT Hub Code Snippets",
|
||||
"version": "0.1.0",
|
||||
"publisher": "vsciot-vscode",
|
||||
"icon": "logo.png",
|
||||
"engines": {
|
||||
"vscode": "^1.13.0"
|
||||
|
@ -20,14 +20,6 @@
|
|||
"explorer",
|
||||
"cloud"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-azure-iot-toolkit/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Microsoft/vscode-azure-iot-toolkit/blob/master/README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode-azure-iot-toolkit.git"
|
||||
},
|
||||
"activationEvents": [
|
||||
"*",
|
||||
"onView:iotHubDevices",
|
||||
|
@ -55,15 +47,15 @@
|
|||
"commands": [
|
||||
{
|
||||
"command": "azure-iot-toolkit.sendD2CMessage",
|
||||
"title": "IoT: Send message to IoT Hub"
|
||||
"title": "IoT: Send D2C message to IoT Hub"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.startMonitorIoTHubMessage",
|
||||
"title": "IoT: Start monitoring IoT Hub message"
|
||||
"title": "IoT: Start monitoring D2C message"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.stopMonitorIoTHubMessage",
|
||||
"title": "IoT: Stop monitoring IoT Hub message"
|
||||
"title": "IoT: Stop monitoring D2C message"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.sendC2DMessage",
|
||||
|
@ -110,44 +102,6 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
{
|
||||
"command": "azure-iot-toolkit.sendD2CMessage",
|
||||
"key": "ctrl+alt+f9"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.startMonitorIoTHubMessage",
|
||||
"key": "ctrl+alt+f10"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.stopMonitorIoTHubMessage",
|
||||
"key": "ctrl+alt+f11"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.listDevice",
|
||||
"key": "ctrl+alt+f1"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.createDevice",
|
||||
"key": "ctrl+alt+f2"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.deleteDevice",
|
||||
"key": "ctrl+alt+f3"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.discoverDevice",
|
||||
"key": "ctrl+alt+f6"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.deploy",
|
||||
"key": "ctrl+alt+f4"
|
||||
},
|
||||
{
|
||||
"command": "azure-iot-toolkit.run",
|
||||
"key": "ctrl+alt+f5"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"view/title": [
|
||||
{
|
||||
|
@ -209,11 +163,6 @@
|
|||
"command": "azure-iot-toolkit.stopMonitorC2DMessage",
|
||||
"group": "azure-iot-toolkit@2"
|
||||
},
|
||||
{
|
||||
"when": "!inOutput",
|
||||
"command": "azure-iot-toolkit.sendMessageToEventHub",
|
||||
"group": "azure-iot-toolkit@1"
|
||||
},
|
||||
{
|
||||
"when": "resourceFilename == azure-iot-device-twin.json",
|
||||
"command": "azure-iot-toolkit.updateDeviceTwin",
|
||||
|
@ -242,18 +191,13 @@
|
|||
},
|
||||
"azure-iot-toolkit.showVerboseMessage": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"default": false,
|
||||
"description": "Whether to show verbose info when monitoring messages."
|
||||
},
|
||||
"azure-iot-toolkit.iotHubD2CMessageStringify": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"default": false,
|
||||
"description": "Whether to stringify device-to-cloud messages."
|
||||
},
|
||||
"azure-iot-toolkit.enableAppInsights": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Whether to enable AppInsights to track anonymous telemetry data."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -281,10 +225,10 @@
|
|||
"vscode": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"applicationinsights": "^0.21.0",
|
||||
"azure-event-hubs": "0.0.6",
|
||||
"azure-iot-device": "1.1.7",
|
||||
"azure-iot-device-mqtt": "1.1.7",
|
||||
"azure-iothub": "^1.1.13"
|
||||
"azure-iothub": "^1.1.13",
|
||||
"vscode-extension-telemetry": "0.0.8"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { DeviceExplorer } from "./deviceExplorer";
|
||||
import { EventHubMessageExplorer } from "./eventHubMessageExplorer";
|
||||
import { IotHubC2DMessageExplorer } from "./iotHubC2DMessageExplorer";
|
||||
|
@ -21,7 +20,6 @@ export class AzureIoTExplorer {
|
|||
|
||||
constructor(context: vscode.ExtensionContext) {
|
||||
let outputChannel = vscode.window.createOutputChannel("Azure IoT Toolkit");
|
||||
let appInsightsClient = new AppInsightsClient();
|
||||
this._iotHubC2DMessageExplorer = new IotHubC2DMessageExplorer(outputChannel);
|
||||
this._iotHubMessageExplorer = new IoTHubMessageExplorer(outputChannel);
|
||||
this._eventHubMessageExplorer = new EventHubMessageExplorer(outputChannel);
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
"use strict";
|
||||
import { Client as EventHubClient } from "azure-event-hubs";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class BaseExplorer {
|
||||
protected _outputChannel: vscode.OutputChannel;
|
||||
protected _appInsightsClient: AppInsightsClient;
|
||||
|
||||
constructor(outputChannel: vscode.OutputChannel) {
|
||||
this._outputChannel = outputChannel;
|
||||
|
@ -71,7 +70,7 @@ export class BaseExplorer {
|
|||
}
|
||||
|
||||
protected stopMonoitor(eventHubClient: EventHubClient, label: string, aiEvent: string) {
|
||||
AppInsightsClient.sendEvent(aiEvent);
|
||||
TelemetryClient.sendEvent(aiEvent);
|
||||
if (eventHubClient) {
|
||||
this.outputLine(label, "Stop monitoring ...");
|
||||
eventHubClient.close();
|
||||
|
@ -87,11 +86,11 @@ export class BaseExplorer {
|
|||
if (err) {
|
||||
this.outputLine(label, `Failed to send message to [${target}]`);
|
||||
this.outputLine(label, err.toString());
|
||||
AppInsightsClient.sendEvent(aiEventName, { Result: "Fail" });
|
||||
TelemetryClient.sendEvent(aiEventName, { Result: "Fail" });
|
||||
}
|
||||
if (result) {
|
||||
this.outputLine(label, `[Success] Message sent to [${target}]`);
|
||||
AppInsightsClient.sendEvent(aiEventName, { Result: "Success" });
|
||||
TelemetryClient.sendEvent(aiEventName, { Result: "Success" });
|
||||
}
|
||||
client.close(() => { return; });
|
||||
};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
"user strict";
|
||||
|
||||
export class Constants {
|
||||
public static ExtensionId = "vsciot-vscode.azure-iot-toolkit";
|
||||
public static AIKey = "d8505d40-fc60-45f8-98b3-3bcd5c23843d";
|
||||
|
||||
public static IoTHub = "IoT Hub";
|
||||
public static EventHub = "Event Hub";
|
||||
|
||||
|
@ -27,12 +30,16 @@ export class Constants {
|
|||
public static IoTHubDirectMethodLabel = "DirectMethod";
|
||||
public static IoTHubDeviceTwinLabel = "DeviceTwin";
|
||||
|
||||
public static IoTHubAIStartMonitorEvent = "D2C.startMonitoring";
|
||||
public static IoTHubAIStopMonitorEvent = "D2C.stopMonitoring";
|
||||
public static IoTHubAIMessageEvent = "D2C.Send";
|
||||
public static IoTHubAIStartMonitorC2DEvent = "C2D.startMonitoring";
|
||||
public static IoTHubAIStopMonitorC2DEvent = "C2D.stopMonitoring";
|
||||
public static IoTHubAIC2DMessageEvent = "C2D.Send";
|
||||
public static IoTHubAILoadDeviceTreeEvent = "AZ.LoadDeviceTree";
|
||||
public static IoTHubAIStartMonitorEvent = "AZ.D2C.startMonitoring";
|
||||
public static IoTHubAIStopMonitorEvent = "AZ.D2C.stopMonitoring";
|
||||
public static IoTHubAIMessageEvent = "AZ.D2C.Send";
|
||||
public static IoTHubAIStartMonitorC2DEvent = "AZ.C2D.startMonitoring";
|
||||
public static IoTHubAIStopMonitorC2DEvent = "AZ.C2D.stopMonitoring";
|
||||
public static IoTHubAIC2DMessageEvent = "AZ.C2D.Send";
|
||||
public static IoTHubAIInvokeDeviceMethodEvent = "AZ.DeviceMethod.Invoke";
|
||||
public static IoTHubAIGetDeviceTwinEvent = "AZ.DeviceTwin.Get";
|
||||
public static IoTHubAIUpdateDeviceTwinEvent = "AZ.DeviceTwin.Update";
|
||||
|
||||
public static EventHubAIStartMonitorEvent = "EventHub.startMonitoring";
|
||||
public static EventHubAIStopMonitorEvent = "EventHub.stopMonitoring";
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
"use strict";
|
||||
import { ConnectionString } from "azure-iot-device";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
import iothub = require("azure-iothub");
|
||||
|
||||
|
@ -14,7 +15,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
|
||||
public async listDevice() {
|
||||
let label = "Device";
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -22,7 +23,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
let registry = iothub.Registry.fromConnectionString(iotHubConnectionString);
|
||||
this._outputChannel.show();
|
||||
this.outputLine(label, "Querying devices...");
|
||||
AppInsightsClient.sendEvent(`${label}.List`);
|
||||
TelemetryClient.sendEvent(`AZ.${label}.List`);
|
||||
registry.list((err, deviceList) => {
|
||||
this.outputLine(label, `${deviceList.length} device(s) found`);
|
||||
deviceList.forEach((device, index) => {
|
||||
|
@ -33,7 +34,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
|
||||
public async getDevice(deviceId: string) {
|
||||
let label = "Device";
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -47,7 +48,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
|
||||
public async createDevice() {
|
||||
let label = "Device";
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
|
||||
public async deleteDevice(deviceItem?: DeviceItem) {
|
||||
let label = "Device";
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
private done(op: string, label: string, hostName: string = null) {
|
||||
return (err, deviceInfo, res) => {
|
||||
if (err) {
|
||||
AppInsightsClient.sendEvent(`${label}.${op}`, { Result: "Fail" });
|
||||
TelemetryClient.sendEvent(`AZ.${label}.${op}`, { Result: "Fail" });
|
||||
this.outputLine(label, `[${op}] error: ${err.toString()}`);
|
||||
}
|
||||
if (res) {
|
||||
|
@ -103,7 +104,7 @@ export class DeviceExplorer extends BaseExplorer {
|
|||
if (res.statusCode < 300) {
|
||||
result = "Success";
|
||||
}
|
||||
AppInsightsClient.sendEvent(`${label}.${op}`, { Result: result });
|
||||
TelemetryClient.sendEvent(`AZ.${label}.${op}`, { Result: result });
|
||||
this.outputLine(label, `[${op}][${result}] status: ${res.statusCode} ${res.statusMessage}`);
|
||||
}
|
||||
if (deviceInfo) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { ConnectionString } from "azure-iot-device";
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
import iothub = require("azure-iothub");
|
||||
|
||||
|
@ -15,7 +16,7 @@ export class DeviceTree implements vscode.TreeDataProvider<DeviceItem> {
|
|||
|
||||
public refresh(): void {
|
||||
this._onDidChangeTreeData.fire();
|
||||
AppInsightsClient.sendEvent("RefreshDeviceTree");
|
||||
TelemetryClient.sendEvent("AZ.RefreshDeviceTree");
|
||||
}
|
||||
|
||||
public getTreeItem(element: DeviceItem): vscode.TreeItem {
|
||||
|
@ -23,11 +24,12 @@ export class DeviceTree implements vscode.TreeDataProvider<DeviceItem> {
|
|||
}
|
||||
|
||||
public async getChildren(element?: DeviceItem): Promise<DeviceItem[]> {
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAILoadDeviceTreeEvent);
|
||||
let registry = iothub.Registry.fromConnectionString(iotHubConnectionString);
|
||||
let devices = [];
|
||||
let hostName = Utility.getHostName(iotHubConnectionString);
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
import { Client as EventHubClient, Sender as EventHubSender } from "azure-event-hubs";
|
||||
import { Client, Message } from "azure-iot-device";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class EventHubMessageExplorer extends BaseExplorer {
|
||||
|
@ -15,8 +15,9 @@ export class EventHubMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async sendMessageToEventHub() {
|
||||
let eventHubConnectionString = await Utility.getConfig(Constants.EventHubConnectionstringKey, Constants.EventHubConnectionStringTitle);
|
||||
let eventHubPath = await Utility.getConfig(Constants.EventHubPathKey, Constants.EventHubPathTitle);
|
||||
let eventHubConnectionString = await Utility.getConnectionString(Constants.EventHubConnectionstringKey,
|
||||
Constants.EventHubConnectionStringTitle);
|
||||
let eventHubPath = await Utility.getConnectionString(Constants.EventHubPathKey, Constants.EventHubPathTitle);
|
||||
if (!eventHubConnectionString || !eventHubPath) {
|
||||
return;
|
||||
}
|
||||
|
@ -40,8 +41,9 @@ export class EventHubMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async startMonitorEventHubMessage() {
|
||||
let eventHubConnectionString = await Utility.getConfig(Constants.EventHubConnectionstringKey, Constants.EventHubConnectionStringTitle);
|
||||
let eventHubPath = await Utility.getConfig(Constants.EventHubPathKey, Constants.EventHubPathTitle);
|
||||
let eventHubConnectionString = await Utility.getConnectionString(Constants.EventHubConnectionstringKey,
|
||||
Constants.EventHubConnectionStringTitle);
|
||||
let eventHubPath = await Utility.getConnectionString(Constants.EventHubPathKey, Constants.EventHubPathTitle);
|
||||
if (!eventHubConnectionString || !eventHubPath) {
|
||||
return;
|
||||
}
|
||||
|
@ -52,11 +54,11 @@ export class EventHubMessageExplorer extends BaseExplorer {
|
|||
let receiveAfterTime = Date.now() - 5000;
|
||||
this._outputChannel.show();
|
||||
this.outputLine(Constants.EventHubMonitorLabel, `Start monitoring ${Constants.EventHub} ...`);
|
||||
AppInsightsClient.sendEvent(Constants.EventHubAIStartMonitorEvent);
|
||||
TelemetryClient.sendEvent(Constants.EventHubAIStartMonitorEvent);
|
||||
this.startMonitor(this._eventHubClient, Constants.EventHubMonitorLabel, consumerGroup);
|
||||
} catch (e) {
|
||||
this.outputLine(Constants.EventHubMonitorLabel, e);
|
||||
AppInsightsClient.sendEvent(Constants.EventHubAIStartMonitorEvent, { Result: "Exception", Message: e });
|
||||
TelemetryClient.sendEvent(Constants.EventHubAIStartMonitorEvent, { Result: "Exception", Message: e });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,14 +70,14 @@ export class EventHubMessageExplorer extends BaseExplorer {
|
|||
private sendToEventHubFail(client: EventHubClient, err) {
|
||||
this.outputLine(Constants.EventHubMessageLabel, `Failed to send message to ${Constants.EventHub}`);
|
||||
this.outputLine(Constants.EventHubMessageLabel, err.toString());
|
||||
AppInsightsClient.sendEvent(Constants.EventHubAIMessageEvent, { Result: "Fail" });
|
||||
TelemetryClient.sendEvent(Constants.EventHubAIMessageEvent, { Result: "Fail" });
|
||||
client.close();
|
||||
}
|
||||
|
||||
private sendToEventHubDone(client: EventHubClient) {
|
||||
return () => {
|
||||
this.outputLine(Constants.EventHubMessageLabel, `[Success] Message sent to ${Constants.EventHub}`);
|
||||
AppInsightsClient.sendEvent(Constants.EventHubAIMessageEvent, { Result: "Success" });
|
||||
TelemetryClient.sendEvent(Constants.EventHubAIMessageEvent, { Result: "Success" });
|
||||
client.close();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ import { Client, ConnectionString } from "azure-iot-device";
|
|||
import { clientFromConnectionString } from "azure-iot-device-mqtt";
|
||||
import { Client as ServiceClient } from "azure-iothub";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class IotHubC2DMessageExplorer extends BaseExplorer {
|
||||
|
@ -18,7 +18,7 @@ export class IotHubC2DMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async sendC2DMessage(deviceItem?: DeviceItem) {
|
||||
let iotHubConnectionString = await Utility.getConfig(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ export class IotHubC2DMessageExplorer extends BaseExplorer {
|
|||
|
||||
public async startMonitorC2DMessage(deviceItem?: DeviceItem) {
|
||||
let deviceConnectionString = deviceItem.connectionString ?
|
||||
deviceItem.connectionString : await Utility.getConfig(Constants.DeviceConnectionStringKey, Constants.DeviceConnectionStringTitle);
|
||||
deviceItem.connectionString : await Utility.getConnectionString(Constants.DeviceConnectionStringKey,
|
||||
Constants.DeviceConnectionStringTitle);
|
||||
if (!deviceConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -49,7 +50,7 @@ export class IotHubC2DMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public stopMonitorC2DMessage(): void {
|
||||
AppInsightsClient.sendEvent(Constants.IoTHubAIStopMonitorC2DEvent);
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIStopMonitorC2DEvent);
|
||||
if (this._deviceClient) {
|
||||
this.outputLine(Constants.IoTHubC2DMessageMonitorLabel, "Stop monitoring ...");
|
||||
this._deviceClient.close(() => { return; });
|
||||
|
@ -81,11 +82,11 @@ export class IotHubC2DMessageExplorer extends BaseExplorer {
|
|||
return (err) => {
|
||||
if (err) {
|
||||
this.outputLine(Constants.IoTHubC2DMessageMonitorLabel, err);
|
||||
AppInsightsClient.sendEvent(Constants.IoTHubAIStartMonitorC2DEvent, { Result: "Exception", Message: err });
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIStartMonitorC2DEvent, { Result: "Exception", Message: err });
|
||||
} else {
|
||||
let deviceId = ConnectionString.parse(deviceConnectionString).DeviceId;
|
||||
this.outputLine(Constants.IoTHubC2DMessageMonitorLabel, `Start monitoring C2D message for [${deviceId}]...`);
|
||||
AppInsightsClient.sendEvent(Constants.IoTHubAIStartMonitorC2DEvent);
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIStartMonitorC2DEvent);
|
||||
this._deviceClient.on("message", (msg) => {
|
||||
this.outputLine(Constants.IoTHubC2DMessageMonitorLabel, "Message Received: " + msg.getData());
|
||||
this._deviceClient.complete(msg, this.printResult);
|
||||
|
|
|
@ -4,10 +4,10 @@ import * as fs from "fs";
|
|||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
const deviceTwinJosnFileName = "azure-iot-device-twin.json";
|
||||
|
@ -19,11 +19,12 @@ export class IotHubDeviceTwinExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async getDeviceTwin(deviceId: string) {
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIGetDeviceTwinEvent);
|
||||
let registry = iothub.Registry.fromConnectionString(iotHubConnectionString);
|
||||
this._outputChannel.show();
|
||||
this.outputLine(Constants.IoTHubDeviceTwinLabel, `Get Device Twin for [${deviceId}]...`);
|
||||
|
@ -45,11 +46,12 @@ export class IotHubDeviceTwinExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async updateDeviceTwin() {
|
||||
let iotHubConnectionString = await Utility.getConfig("iotHubConnectionString", "IoT Hub Connection String");
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIUpdateDeviceTwinEvent);
|
||||
const activeTextEditor = vscode.window.activeTextEditor;
|
||||
if (!activeTextEditor || !activeTextEditor.document || !activeTextEditor.document.fileName.endsWith(deviceTwinJosnFileName)) {
|
||||
vscode.window.showWarningMessage(`Please open ${deviceTwinJosnFileName} and try again.`);
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
import { Message } from "azure-iot-common";
|
||||
import { Client as ServiceClient } from "azure-iothub";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class IotHubDirectMethodExplorer extends BaseExplorer {
|
||||
|
@ -14,11 +14,13 @@ export class IotHubDirectMethodExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async invokeDeviceMethod(deviceItem: DeviceItem) {
|
||||
let iotHubConnectionString = await Utility.getConfig(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIInvokeDeviceMethodEvent);
|
||||
|
||||
vscode.window.showInputBox({ prompt: `Enter [Method Name] sent to [${deviceItem.deviceId}]` }).then((methodName: string) => {
|
||||
if (methodName !== undefined) {
|
||||
vscode.window.showInputBox({ prompt: `Enter [Payload] sent to [${deviceItem.deviceId}]` }).then((payload: string) => {
|
||||
|
|
|
@ -3,10 +3,10 @@ import { Client as EventHubClient } from "azure-event-hubs";
|
|||
import { Client, Message } from "azure-iot-device";
|
||||
import { clientFromConnectionString } from "azure-iot-device-mqtt";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { DeviceItem } from "./Model/DeviceItem";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class IoTHubMessageExplorer extends BaseExplorer {
|
||||
|
@ -18,7 +18,8 @@ export class IoTHubMessageExplorer extends BaseExplorer {
|
|||
|
||||
public async sendD2CMessage(deviceItem?: DeviceItem) {
|
||||
let deviceConnectionString = deviceItem.connectionString ?
|
||||
deviceItem.connectionString : await Utility.getConfig(Constants.DeviceConnectionStringKey, Constants.DeviceConnectionStringTitle);
|
||||
deviceItem.connectionString : await Utility.getConnectionString(Constants.DeviceConnectionStringKey,
|
||||
Constants.DeviceConnectionStringTitle);
|
||||
if (!deviceConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +29,7 @@ export class IoTHubMessageExplorer extends BaseExplorer {
|
|||
this._outputChannel.show();
|
||||
try {
|
||||
let client = clientFromConnectionString(deviceConnectionString);
|
||||
let stringify = Utility.getConfigFlag(Constants.IoTHubD2CMessageStringifyKey);
|
||||
let stringify = Utility.getConfig<boolean>(Constants.IoTHubD2CMessageStringifyKey);
|
||||
client.sendEvent(new Message(stringify ? JSON.stringify(message) : message),
|
||||
this.sendEventDone(client, Constants.IoTHubMessageLabel, Constants.IoTHub, Constants.IoTHubAIMessageEvent));
|
||||
} catch (e) {
|
||||
|
@ -39,7 +40,7 @@ export class IoTHubMessageExplorer extends BaseExplorer {
|
|||
}
|
||||
|
||||
public async startMonitorIoTHubMessage() {
|
||||
let iotHubConnectionString = await Utility.getConfig(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
let iotHubConnectionString = await Utility.getConnectionString(Constants.IotHubConnectionStringKey, Constants.IotHubConnectionStringTitle);
|
||||
if (!iotHubConnectionString) {
|
||||
return;
|
||||
}
|
||||
|
@ -50,11 +51,11 @@ export class IoTHubMessageExplorer extends BaseExplorer {
|
|||
this._eventHubClient = EventHubClient.fromConnectionString(iotHubConnectionString);
|
||||
this._outputChannel.show();
|
||||
this.outputLine(Constants.IoTHubMonitorLabel, `Start monitoring [${Constants.IoTHub}] ...`);
|
||||
AppInsightsClient.sendEvent(Constants.IoTHubAIStartMonitorEvent);
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIStartMonitorEvent);
|
||||
this.startMonitor(this._eventHubClient, Constants.IoTHubMonitorLabel, consumerGroup);
|
||||
} catch (e) {
|
||||
this.outputLine(Constants.IoTHubMonitorLabel, e);
|
||||
AppInsightsClient.sendEvent(Constants.IoTHubAIStartMonitorEvent, { Result: "Exception", Message: e });
|
||||
TelemetryClient.sendEvent(Constants.IoTHubAIStartMonitorEvent, { Result: "Exception", Message: e });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"use strict";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { BaseExplorer } from "./baseExplorer";
|
||||
import { Constants } from "./constants";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
import { Utility } from "./utility";
|
||||
|
||||
export class SnippetManager extends BaseExplorer {
|
||||
|
@ -36,7 +36,7 @@ export class SnippetManager extends BaseExplorer {
|
|||
editBuilder.replace(new vscode.Range(document.positionAt(offset),
|
||||
document.positionAt(offset + connectionStringKeyWithAngleBracket.length)),
|
||||
connectionStringValue);
|
||||
AppInsightsClient.sendEvent(`ReplaceConnectionString`, { Type: connectionStringKey });
|
||||
TelemetryClient.sendEvent(`Snippet.ReplaceConnectionString`, { Type: connectionStringKey });
|
||||
});
|
||||
offset = text.indexOf(connectionStringKeyWithAngleBracket, offset + 1);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
"use strict";
|
||||
import * as vscode from "vscode";
|
||||
import TelemetryReporter from "vscode-extension-telemetry";
|
||||
import { Constants } from "./constants";
|
||||
import { Utility } from "./utility";
|
||||
import appInsights = require("applicationinsights");
|
||||
|
||||
export class AppInsightsClient {
|
||||
const extensionVersion: string = vscode.extensions.getExtension(Constants.ExtensionId).packageJSON.version;
|
||||
|
||||
export class TelemetryClient {
|
||||
public static sendEvent(eventName: string, properties?: { [key: string]: string; }): void {
|
||||
if (this._enableAppInsights) {
|
||||
properties = this.addIoTHubHostName(properties);
|
||||
this._client.trackEvent(eventName, properties);
|
||||
}
|
||||
properties = this.addIoTHubHostName(properties);
|
||||
this._client.sendTelemetryEvent(eventName, properties);
|
||||
}
|
||||
|
||||
private static _client = appInsights.getClient("6ada6440-d926-4331-b914-d8f1ea3b012f");
|
||||
private static _enableAppInsights = Utility.getConfiguration().get<boolean>("enableAppInsights");
|
||||
private static _client = new TelemetryReporter(Constants.ExtensionId, extensionVersion, Constants.AIKey);
|
||||
|
||||
private static addIoTHubHostName(properties?: { [key: string]: string; }): any {
|
||||
let newProperties = properties ? properties : {};
|
||||
let iotHubConnectionString = Utility.getConfigWithId(Constants.IotHubConnectionStringKey);
|
||||
let iotHubConnectionString = Utility.getConnectionStringWithId(Constants.IotHubConnectionStringKey);
|
||||
if (!iotHubConnectionString) {
|
||||
iotHubConnectionString = Utility.getConfigWithId(Constants.DeviceConnectionStringKey);
|
||||
iotHubConnectionString = Utility.getConnectionStringWithId(Constants.DeviceConnectionStringKey);
|
||||
}
|
||||
|
||||
if (iotHubConnectionString) {
|
|
@ -1,22 +1,23 @@
|
|||
"use strict";
|
||||
import * as vscode from "vscode";
|
||||
import { AppInsightsClient } from "./appInsightsClient";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
|
||||
export class Utility {
|
||||
public static getConfiguration(): vscode.WorkspaceConfiguration {
|
||||
return vscode.workspace.getConfiguration("azure-iot-toolkit");
|
||||
}
|
||||
|
||||
public static async getConfig(id: string, name: string) {
|
||||
public static async getConnectionString(id: string, name: string) {
|
||||
let config = Utility.getConfiguration();
|
||||
let configValue = config.get<string>(id);
|
||||
if (!configValue || configValue.startsWith("<<insert")) {
|
||||
AppInsightsClient.sendEvent("SetConfig");
|
||||
TelemetryClient.sendEvent("General.SetConfig.Popup");
|
||||
return await vscode.window.showInputBox({
|
||||
prompt: `${name}`,
|
||||
placeHolder: `Enter your ${name}`,
|
||||
}).then((value: string) => {
|
||||
if (value !== undefined) {
|
||||
TelemetryClient.sendEvent("General.SetConfig.Done");
|
||||
config.update(id, value, true);
|
||||
return value;
|
||||
}
|
||||
|
@ -26,7 +27,7 @@ export class Utility {
|
|||
return configValue;
|
||||
}
|
||||
|
||||
public static getConfigWithId(id: string) {
|
||||
public static getConnectionStringWithId(id: string) {
|
||||
let config = Utility.getConfiguration();
|
||||
let configValue = config.get<string>(id);
|
||||
if (!configValue || configValue.startsWith("<<insert")) {
|
||||
|
@ -35,9 +36,9 @@ export class Utility {
|
|||
return configValue;
|
||||
}
|
||||
|
||||
public static getConfigFlag(id: string): boolean {
|
||||
public static getConfig<T>(id: string): T {
|
||||
let config = Utility.getConfiguration();
|
||||
return config.get<boolean>(id);
|
||||
return config.get<T>(id);
|
||||
}
|
||||
|
||||
public static getHostName(iotHubConnectionString: string): string {
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
import * as assert from "assert";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
const extensionId = "formulahendry.azure-iot-toolkit";
|
||||
import { Constants } from "../src/constants";
|
||||
|
||||
suite("Extension Tests", () => {
|
||||
|
||||
test("should be present", () => {
|
||||
assert.ok(vscode.extensions.getExtension(extensionId));
|
||||
assert.ok(vscode.extensions.getExtension(Constants.ExtensionId));
|
||||
});
|
||||
|
||||
// tslint:disable-next-line:only-arrow-functions
|
||||
test("should be able to activate the extension", function (done) {
|
||||
this.timeout(60 * 1000);
|
||||
const extension = vscode.extensions.getExtension(extensionId);
|
||||
const extension = vscode.extensions.getExtension(Constants.ExtensionId);
|
||||
if (!extension.isActive) {
|
||||
extension.activate().then((api) => {
|
||||
done();
|
||||
|
|
|
@ -11,7 +11,7 @@ suite("Utility Tests ", () => {
|
|||
});
|
||||
|
||||
test("should be able to get config", () => {
|
||||
let iotHubD2CMessageStringify = Utility.getConfigFlag(Constants.IoTHubD2CMessageStringifyKey);
|
||||
assert.equal(iotHubD2CMessageStringify, true);
|
||||
let iotHubD2CMessageStringify = Utility.getConfig<boolean>(Constants.IoTHubD2CMessageStringifyKey);
|
||||
assert.equal(iotHubD2CMessageStringify, false);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче