Merge fix from master (#833)
This commit is contained in:
Родитель
13be33c3c0
Коммит
6b56228cdb
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -65,20 +65,19 @@ export class AnsiCCodeGenerator implements CodeGenerator {
|
|||
connectionTypeValue}" -r "${sdkReferenceTypeValue}" -l ansic -o "${
|
||||
outputDir}" -n "${projectName}"`;
|
||||
|
||||
let message = `${DigitalTwinConstants.dtPrefix} generate PnP device code.`;
|
||||
utils.channelShowAndAppendLine(this.channel, message);
|
||||
let message: string;
|
||||
|
||||
try {
|
||||
await utils.runCommand(command, [], cmdPath, this.channel);
|
||||
message = `${
|
||||
DigitalTwinConstants.dtPrefix} generate PnP device code completed.`;
|
||||
utils.channelShowAndAppendLine(this.channel, message);
|
||||
return true;
|
||||
} catch {
|
||||
message =
|
||||
`${DigitalTwinConstants.dtPrefix} generate PnP device codefailed.`;
|
||||
`${DigitalTwinConstants.dtPrefix} generate PnP device code failed.`;
|
||||
utils.channelShowAndAppendLine(this.channel, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
message =
|
||||
`${DigitalTwinConstants.dtPrefix} generate PnP device code completed.`;
|
||||
utils.channelShowAndAppendLine(this.channel, message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -510,10 +510,13 @@ export class AZ3166Device extends ArduinoDeviceBase {
|
|||
const executeSetAzIoTHub = async () => {
|
||||
try {
|
||||
const data = `${command} "${configValue}"\r\n`;
|
||||
await this.sendDataViaSerialPort(port, data.slice(0, 120));
|
||||
if (data.length > 120) {
|
||||
const maxDataLength = 256;
|
||||
await this.sendDataViaSerialPort(
|
||||
port, data.slice(0, maxDataLength));
|
||||
if (data.length > maxDataLength) {
|
||||
await delay(1000);
|
||||
await this.sendDataViaSerialPort(port, data.slice(120));
|
||||
await this.sendDataViaSerialPort(
|
||||
port, data.slice(maxDataLength));
|
||||
}
|
||||
|
||||
await delay(1000);
|
||||
|
@ -531,7 +534,7 @@ export class AZ3166Device extends ArduinoDeviceBase {
|
|||
// Configure serial port callbacks
|
||||
port.on('open', () => {
|
||||
port.write(
|
||||
'\r\nhelp\r\n', AZ3166Device.serialport.endings.BothNLAndCR,
|
||||
'\r\nhelp\r\n',
|
||||
// tslint:disable-next-line: no-any
|
||||
(error: any) => {
|
||||
if (rejectIfError(error)) return;
|
||||
|
@ -584,7 +587,7 @@ export class AZ3166Device extends ArduinoDeviceBase {
|
|||
.then(() => {
|
||||
port.write(
|
||||
'\r\nhelp\r\n',
|
||||
AZ3166Device.serialport.endings.BothNLAndCR,
|
||||
|
||||
// tslint:disable-next-line: no-any
|
||||
(error: any) => {
|
||||
rejectIfError(error);
|
||||
|
@ -660,7 +663,7 @@ export class AZ3166Device extends ArduinoDeviceBase {
|
|||
(resolve: (value: boolean) => void, reject: (value: Error) => void) => {
|
||||
try {
|
||||
port.write(
|
||||
data, AZ3166Device.serialport.endings.BothNLAndCR,
|
||||
data,
|
||||
// tslint:disable-next-line: no-any
|
||||
(err: any) => {
|
||||
if (err) {
|
||||
|
|
|
@ -119,6 +119,11 @@ export class ProjectEnvironmentConfiger {
|
|||
let project;
|
||||
let projectRootPath = '';
|
||||
if (platform === PlatformType.EmbeddedLinux) {
|
||||
const result = await RemoteExtension.checkRemoteExtension(channel);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
telemetryContext.properties.projectHostType = 'Container';
|
||||
project = new ioTContainerizedProjectModule.IoTContainerizedProject(
|
||||
context, channel, telemetryContext);
|
||||
|
|
|
@ -23,11 +23,6 @@ var STOPBITS = [1, 1.5, 2];
|
|||
var PARITY = ['none', 'even', 'mark', 'odd', 'space'];
|
||||
var FLOWCONTROLS = ['xon', 'xoff', 'xany', 'rtscts'];
|
||||
var SET_OPTIONS = ['brk', 'cts', 'dtr', 'dts', 'rts'];
|
||||
const endings = {
|
||||
Newline: 'Newline',
|
||||
CarriageReturn: 'Carriage return',
|
||||
BothNLAndCR: 'Both NL & CR'
|
||||
} ;
|
||||
|
||||
// Stuff from ReadStream, refactored for our usage:
|
||||
var kPoolSize = 40 * 1024;
|
||||
|
@ -221,7 +216,7 @@ SerialPort.prototype.isOpen = function() {
|
|||
return this.fd !== null && !this.closing;
|
||||
};
|
||||
|
||||
SerialPort.prototype.write = function(buffer, ending, callback) {
|
||||
SerialPort.prototype.write = function(buffer, callback) {
|
||||
if (!this.isOpen()) {
|
||||
debug('write attempted, but port is not open');
|
||||
return this._error(new Error('Port is not open'), callback);
|
||||
|
@ -231,20 +226,6 @@ SerialPort.prototype.write = function(buffer, ending, callback) {
|
|||
buffer = Buffer.from(buffer);
|
||||
}
|
||||
|
||||
switch (ending) {
|
||||
case endings.Newline:
|
||||
buffer = Buffer.concat([buffer, Buffer.from('\n')]);
|
||||
break;
|
||||
case endings.CarriageReturn:
|
||||
buffer = Buffer.concat([buffer, Buffer.from('\r')]);
|
||||
break;
|
||||
case endings.BothNLAndCR:
|
||||
buffer = Buffer.concat([buffer, Buffer.from('\r\n')]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
debug(`write ${buffer.length} bytes of data`);
|
||||
SerialPortBinding.write(this.fd, buffer, (err) => {
|
||||
if (err) {
|
||||
|
@ -491,7 +472,6 @@ SerialPort.prototype.drain = function(callback) {
|
|||
|
||||
SerialPort.parsers = parsers;
|
||||
SerialPort.list = SerialPortBinding.list;
|
||||
SerialPort.endings = endings;
|
||||
|
||||
// Write a depreciation warning once
|
||||
Object.defineProperty(SerialPort, 'SerialPort', {
|
||||
|
|
Загрузка…
Ссылка в новой задаче