Update version to 0.2.1, update BI, handle devices with X.509 cert (#9)

* Update version to 0.2.1, update BI, handle devices with x509 cert

* Update changelog
This commit is contained in:
Jun Han 2017-08-24 14:40:05 +08:00 коммит произвёл GitHub
Родитель 9bfdada4a8
Коммит 297b3c2102
5 изменённых файлов: 19 добавлений и 4 удалений

Просмотреть файл

@ -1,3 +1,7 @@
### 0.2.1 (2017-08-24)
* Add 'Azure' category
* Handle devices with X.509 cert
### 0.2.0 (2017-08-21) ### 0.2.0 (2017-08-21)
* Migrate as official extension * Migrate as official extension

Просмотреть файл

@ -2,7 +2,7 @@
"name": "azure-iot-toolkit", "name": "azure-iot-toolkit",
"displayName": "Azure IoT Toolkit", "displayName": "Azure IoT Toolkit",
"description": "Interact with Azure IoT Hub, IoT Device Management, IoT Hub Code Snippets", "description": "Interact with Azure IoT Hub, IoT Device Management, IoT Hub Code Snippets",
"version": "0.2.0", "version": "0.2.1",
"publisher": "vsciot-vscode", "publisher": "vsciot-vscode",
"icon": "logo.png", "icon": "logo.png",
"engines": { "engines": {

Просмотреть файл

@ -41,6 +41,8 @@ export class Constants {
public static IoTHubAIGetDeviceTwinEvent = "AZ.DeviceTwin.Get"; public static IoTHubAIGetDeviceTwinEvent = "AZ.DeviceTwin.Get";
public static IoTHubAIUpdateDeviceTwinEvent = "AZ.DeviceTwin.Update"; public static IoTHubAIUpdateDeviceTwinEvent = "AZ.DeviceTwin.Update";
public static IoTHubAIStartLoadDeviceTreeEvent = "General.StartLoadDeviceTree";
public static EventHubAIStartMonitorEvent = "EventHub.startMonitoring"; public static EventHubAIStartMonitorEvent = "EventHub.startMonitoring";
public static EventHubAIStopMonitorEvent = "EventHub.stopMonitoring"; public static EventHubAIStopMonitorEvent = "EventHub.stopMonitoring";
public static EventHubAIMessageEvent = "EventHub.Send"; public static EventHubAIMessageEvent = "EventHub.Send";

Просмотреть файл

@ -29,6 +29,7 @@ export class DeviceTree implements vscode.TreeDataProvider<DeviceItem> {
return; return;
} }
TelemetryClient.sendEvent(Constants.IoTHubAIStartLoadDeviceTreeEvent);
let registry = iothub.Registry.fromConnectionString(iotHubConnectionString); let registry = iothub.Registry.fromConnectionString(iotHubConnectionString);
let devices = []; let devices = [];
let hostName = Utility.getHostName(iotHubConnectionString); let hostName = Utility.getHostName(iotHubConnectionString);
@ -36,13 +37,21 @@ export class DeviceTree implements vscode.TreeDataProvider<DeviceItem> {
return new Promise<DeviceItem[]>((resolve, reject) => { return new Promise<DeviceItem[]>((resolve, reject) => {
registry.list((err, deviceList) => { registry.list((err, deviceList) => {
if (err) { if (err) {
TelemetryClient.sendEvent(Constants.IoTHubAILoadDeviceTreeEvent, { Result: "Fail", Message: err.message });
reject(`[Failed to list IoT Hub devices] ${err.message}`); reject(`[Failed to list IoT Hub devices] ${err.message}`);
} else { } else {
TelemetryClient.sendEvent(Constants.IoTHubAILoadDeviceTreeEvent); TelemetryClient.sendEvent(Constants.IoTHubAILoadDeviceTreeEvent, { Result: "Success", DeviceCount: deviceList.length.toString() });
deviceList.forEach((device, index) => { deviceList.forEach((device, index) => {
let image = device.connectionState.toString() === "Connected" ? "device-on.png" : "device-off.png"; let image = device.connectionState.toString() === "Connected" ? "device-on.png" : "device-off.png";
let deviceConnectionString = "";
if (device.authentication.SymmetricKey.primaryKey != null) {
deviceConnectionString = ConnectionString.createWithSharedAccessKey(hostName, device.deviceId,
device.authentication.SymmetricKey.primaryKey);
} else if (device.authentication.x509Thumbprint.primaryThumbprint != null) {
deviceConnectionString = ConnectionString.createWithX509Certificate(hostName, device.deviceId);
}
devices.push(new DeviceItem(device.deviceId, devices.push(new DeviceItem(device.deviceId,
ConnectionString.createWithSharedAccessKey(hostName, device.deviceId, device.authentication.SymmetricKey.primaryKey), deviceConnectionString,
this.context.asAbsolutePath(path.join("resources", image)), this.context.asAbsolutePath(path.join("resources", image)),
{ {
command: "azure-iot-toolkit.getDevice", command: "azure-iot-toolkit.getDevice",

Просмотреть файл

@ -10,7 +10,7 @@
], ],
"max-line-length": [ "max-line-length": [
true, true,
150 200
], ],
"no-empty": false, "no-empty": false,
"object-literal-sort-keys": false "object-literal-sort-keys": false