Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
3a07d0e1
Commit
3a07d0e1
authored
Sep 08, 2015
by
Amanda Ghassaei
Browse files
fixed node comm
parent
1f5eac07
Changes
1
Hide whitespace changes
Inline
Side-by-side
node/nodeServer.js
View file @
3a07d0e1
...
@@ -18,7 +18,7 @@ var io = require('socket.io').listen(8080);
...
@@ -18,7 +18,7 @@ var io = require('socket.io').listen(8080);
//defaults
//defaults
var
portName
=
null
;
var
portName
=
null
;
var
currentPort
=
null
;
var
currentPort
=
null
;
var
baudRate
=
96
00
;
var
baudRate
=
1152
00
;
//io.sockets.on('connection', function (socket) {
//io.sockets.on('connection', function (socket) {
// socket.emit('baudRate', baudRate);
// socket.emit('baudRate', baudRate);
...
@@ -50,8 +50,12 @@ io.on('connection', function(socket){
...
@@ -50,8 +50,12 @@ io.on('connection', function(socket){
});
});
socket
.
on
(
'
dataOut
'
,
function
(
data
){
socket
.
on
(
'
dataOut
'
,
function
(
data
){
data
+=
'
\n
'
;
console
.
log
(
"
Sending data:
"
+
data
);
console
.
log
(
"
Sending data:
"
+
data
);
currentPort
.
write
(
new
Buffer
([
parseInt
(
data
)]));
currentPort
.
write
(
new
Buffer
(
data
),
function
(
err
,
res
)
{
if
(
err
)
onPortError
(
err
);
});
// currentPort.write(new Buffer([parseInt(data)]));//write byte
});
});
socket
.
on
(
'
flush
'
,
function
(){
socket
.
on
(
'
flush
'
,
function
(){
...
@@ -145,7 +149,7 @@ io.on('connection', function(socket){
...
@@ -145,7 +149,7 @@ io.on('connection', function(socket){
}
}
function
onPortData
(
data
){
function
onPortData
(
data
){
//
console.log(data);
console
.
log
(
data
);
socket
.
emit
(
"
dataIn
"
,
data
);
socket
.
emit
(
"
dataIn
"
,
data
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment