Skip to content

Commit

Permalink
eslint 관련 부족했던 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
extracold1209 authored and entrydev committed Jan 23, 2020
1 parent 1407123 commit f0fb7fd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 52 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/renderer/modal/*
**/renderer/lang/*
*.bundle.js*
*.build.js*
102 changes: 53 additions & 49 deletions app/src/main/datahandler/handler.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,82 @@
'use strict';

function Handler(config) {
this.config = config;
switch (config.entry.protocol) {
case 'bytearray': {
this.sendHandler = require('./bytearray.js').create(config.id, config.entry.bufferSize || config.entry.buffersize);
break;
}
case 'json': {
this.sendHandler = require('./json.js').create(config.id);
break;
}
this.config = config;
switch (config.entry.protocol) {
case 'bytearray': {
this.sendHandler = require('./bytearray.js').create(
config.id,
config.entry.bufferSize || config.entry.buffersize,
);
break;
}
case 'json': {
this.sendHandler = require('./json.js').create(config.id);
break;
}
// case 'dmp': {
// this.sendHandler = require('./dmp.js').create(config.id);
// break;
// }
}
}
}

Handler.prototype.encode = function() {
if (this.sendHandler) {
return this.sendHandler.encode();
}
if (this.sendHandler) {
return this.sendHandler.encode();
}
};

Handler.prototype.decode = function(data, type) {
if (type == 'binary') {
if (data[1] != 0x00) {
if (!this.receiveHandler) {
switch (data[5]) {
case 0x01: {
this.receiveHandler = require('./bytearray.js').create(this.config.id);
break;
}
if (type == 'binary') {
if (data[1] != 0x00) {
if (!this.receiveHandler) {
switch (data[5]) {
case 0x01: {
this.receiveHandler = require('./bytearray.js').create(this.config.id);
break;
}
// case 0x03: {
// this.receiveHandler = require('./dmp.js').create(this.config.id);
// break;
// }
}
}
if (this.receiveHandler) {
this.receiveHandler.decode(data);
}
}
} else if (type == 'utf8') {
if (!this.receiveHandler) {
this.receiveHandler = require('./json.js').create(this.config.id);
}
if (this.receiveHandler) {
this.receiveHandler.decode(data);
}
}
}
}
if (this.receiveHandler) {
this.receiveHandler.decode(data);
}
}
} else if (type == 'utf8') {
if (!this.receiveHandler) {
this.receiveHandler = require('./json.js').create(this.config.id);
}
if (this.receiveHandler) {
this.receiveHandler.decode(data);
}
}
};

Handler.prototype.e = function(arg) {
if (this.receiveHandler) {
return this.receiveHandler.e(arg);
}
return false;
if (this.receiveHandler) {
return this.receiveHandler.e(arg);
}
return false;
};

Handler.prototype.read = function(arg) {
if (this.receiveHandler) {
return this.receiveHandler.read(arg);
}
return 0;
if (this.receiveHandler) {
return this.receiveHandler.read(arg);
}
return 0;
};

Handler.prototype.write = function(arg1, arg2) {
if (this.sendHandler) {
return this.sendHandler.write(arg1, arg2);
}
return false;
if (this.sendHandler) {
return this.sendHandler.write(arg1, arg2);
}
return false;
};

module.exports.create = function(config) {
return new Handler(config);
return new Handler(config);
};
6 changes: 3 additions & 3 deletions app/src/main/serial/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ class SerialConnector extends BaseConnector {
!this.isSending
) {
this.isSending = true;

let resultData = data;
if (this.options.stream === 'string') {
data = Buffer.from(data, 'utf8');
resultData = Buffer.from(data, 'utf8');
}
this.serialPort.write(data, () => {
this.serialPort.write(resultData, () => {
if (this.serialPort) {
this.serialPort.drain(() => {
this.received = true;
Expand Down
2 changes: 2 additions & 0 deletions app/src/renderer/js/rendererRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class RendererRouter {
const { appName } = this.sharedObject;
const { translator, Modal } = window;
const translate = (str) => translator.translate(str);

// eslint-disable-next-line new-cap
const modal = new Modal.default();

if (appName === 'hardware' && navigator.onLine) {
Expand Down

0 comments on commit f0fb7fd

Please sign in to comment.