Merge branch 'test-mysql2' into fix-node-mysql

This commit is contained in:
Dave Conway-Jones 2021-11-18 08:50:13 +00:00 committed by GitHub
commit da01c7493c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 36 additions and 62 deletions

View File

@ -1,13 +1,12 @@
sudo: false
language: node_js
matrix:
allow_failures:
- node_js: 16
# allow_failures:
# - node_js: 16
include:
- node_js: 16
- node_js: 14
- node_js: 12
- node_js: 10
# - python: 2.7
# language: python
# before_script: pip install flake8

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-data-generator",
"version" : "0.2.0",
"version" : "1.0.0",
"description" : "A Node-RED node to create a string of dummy data values from a template. Useful for test-cases.",
"dependencies" : {
"dummy-json": "^2.0.0"
"dummy-json": "^3.0.4"
},
"repository" : {
"type":"git",

View File

@ -171,24 +171,19 @@ if len(sys.argv) > 2:
data = 0
elif cmd == "mouse": # catch mice button events
file = open( "/dev/input/mice", "rb" )
f = open( "/dev/input/mice", "rb" )
oldbutt = 0
def getMouseEvent():
global oldbutt
global pin
buf = file.read(3)
pin = pin & 0x07
button = ord( buf[0] ) & pin # mask out just the required button(s)
if button != oldbutt: # only send if changed
oldbutt = button
print(button)
while True:
try:
getMouseEvent()
buf = f.read(3)
pin = pin & 0x07
button = struct.unpack('3b',buf)[0] & pin # mask out just the required button(s)
if button != oldbutt: # only send if changed
oldbutt = button
print(button)
except:
file.close()
f.close()
sys.exit(0)
elif cmd == "kbd": # catch keyboard button events
@ -196,7 +191,7 @@ if len(sys.argv) > 2:
while not os.path.isdir("/dev/input/by-path"):
sleep(10)
infile = subprocess.check_output("ls /dev/input/by-path/ | grep -m 1 'kbd'", shell=True).strip()
infile_path = "/dev/input/by-path/" + infile
infile_path = "/dev/input/by-path/" + infile.decode("utf-8")
EVENT_SIZE = struct.calcsize('llHHI')
file = open(infile_path, "rb")
event = file.read(EVENT_SIZE)

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-pi-gpio",
"version": "2.0.0-beta4",
"version": "2.0.1",
"description": "The basic Node-RED node for Pi GPIO",
"dependencies" : {
},

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pi-mcp3008",
"version" : "0.5.0",
"version" : "0.5.1",
"description" : "A Node-RED node to read from the MCP3008 Analogue to Digital Converter",
"dependencies" : {
"mcp-spi-adc": "^3.2.0"

View File

@ -29,7 +29,6 @@ module.exports = function(RED) {
this.bus = parseInt(n.bus || 0);
this.dev = n.dev || "3008";
this.mcp3xxx = [];
var node = this;
this.cb = function (err) { if (err) { node.error("Error: "+err); } };
this.opt = { speedHz:20000, deviceNumber:node.dnum, busNumber:node.bus };
var chans = parseInt(this.dev.substr(3));
@ -40,14 +39,14 @@ module.exports = function(RED) {
fs.statSync("/dev/spidev"+node.bus+"."+node.dnum);
if (node.mcp3xxx.length === 0) {
for (var i=0; i<chans; i++) {
if (node.dev === "3002") { mcp3xxx.push(mcpadc.openMcp3002(i, opt, cb)); }
if (node.dev === "3004") { mcp3xxx.push(mcpadc.openMcp3004(i, opt, cb)); }
if (node.dev === "3008") { mcp3xxx.push(mcpadc.openMcp3008(i, opt, cb)); }
if (node.dev === "3201") { mcp3xxx.push(mcpadc.openMcp3201(i, opt, cb)); }
if (node.dev === "3202") { mcp3xxx.push(mcpadc.openMcp3202(i, opt, cb)); }
if (node.dev === "3204") { mcp3xxx.push(mcpadc.openMcp3204(i, opt, cb)); }
if (node.dev === "3208") { mcp3xxx.push(mcpadc.openMcp3208(i, opt, cb)); }
if (node.dev === "3304") { mcp3xxx.push(mcpadc.openMcp3304(i, opt, cb)); }
if (node.dev === "3002") { node.mcp3xxx.push(mcpadc.openMcp3002(i, node.opt, node.cb)); }
if (node.dev === "3004") { node.mcp3xxx.push(mcpadc.openMcp3004(i, node.opt, node.cb)); }
if (node.dev === "3008") { node.mcp3xxx.push(mcpadc.openMcp3008(i, node.opt, node.cb)); }
if (node.dev === "3201") { node.mcp3xxx.push(mcpadc.openMcp3201(i, node.opt, node.cb)); }
if (node.dev === "3202") { node.mcp3xxx.push(mcpadc.openMcp3202(i, node.opt, node.cb)); }
if (node.dev === "3204") { node.mcp3xxx.push(mcpadc.openMcp3204(i, node.opt, node.cb)); }
if (node.dev === "3208") { node.mcp3xxx.push(mcpadc.openMcp3208(i, node.opt, node.cb)); }
if (node.dev === "3304") { node.mcp3xxx.push(mcpadc.openMcp3304(i, node.opt, node.cb)); }
}
}
node.on("input", function(msg) {
@ -76,7 +75,7 @@ module.exports = function(RED) {
for (var i=0; i<chans; i++) {
node.mcp3xxx[i].close(function() { j += 1; if (j === chans) {done()} });
}
mcp3xxx = [];
node.mcp3xxx = [];
}
else { done(); }
});

View File

@ -257,6 +257,7 @@
oneditprepare: function() {
var previous = null;
var blist = [
{value:"230400",label:"230400",hasValue:false},
{value:"115200",label:"115200",hasValue:false},
{value:"57600",label:"57600",hasValue:false},
{value:"38400",label:"38400",hasValue:false},

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-serialport",
"version" : "0.14.1",
"version" : "0.15.0",
"description" : "Node-RED nodes to talk to serial ports",
"dependencies" : {
"serialport" : "^9.1.0"
"serialport" : "^9.2.5"
},
"repository" : {
"type":"git",
@ -13,12 +13,12 @@
"license": "Apache-2.0",
"keywords": [ "node-red", "serial" ],
"node-red": {
"version": ">=0.18.0",
"version": ">=1.0.0",
"nodes": {
"serialport": "25-serial.js"
}
},
"engines" : { "node" : ">=8.6.0" },
"engines" : { "node" : ">=10.0.0" },
"author": {
"name": "Dave Conway-Jones",
"email": "ceejay@vnet.ibm.com",

View File

@ -48,14 +48,14 @@
"ngeohash": "^0.6.3",
"node-red": "^2.1.3",
"node-red-node-test-helper": "^0.2.7",
"nodemailer": "^6.7.0",
"nodemailer": "^6.7.1",
"poplib": "^0.1.7",
"proxyquire": "^2.1.3",
"pushbullet": "^2.4.0",
"sentiment": "^2.1.0",
"should": "^13.2.3",
"sinon": "~7.5.0",
"smtp-server": "~3.9.0",
"smtp-server": "^3.9.0",
"supertest": "^4.0.2",
"when": "^3.7.8"
},

View File

@ -121,6 +121,7 @@ module.exports = function(RED) {
if (done) { done(); }
return
}
var bind = [];
if (Array.isArray(msg.payload)) {
bind = msg.payload;
@ -137,36 +138,15 @@ module.exports = function(RED) {
node.error(err, msg);
}
else {
// if (rows.constructor.name === "OkPacket") {
// msg.payload = JSON.parse(JSON.stringify(rows));
// }
// else if (rows.constructor.name === "Array") {
// if (rows[0] && rows[0].constructor.name === "RowDataPacket") {
// msg.payload = rows.map(v => Object.assign({}, v));
// }
// else if (rows[0] && rows[0].constructor.name === "Array") {
// if (rows[0][0] && rows[0][0].constructor.name === "RowDataPacket") {
// msg.payload = rows.map(function(v) {
// if (!Array.isArray(v)) { return v; }
// v.map(w => Object.assign({}, w))
// });
// }
// else { msg.payload = rows; }
// }
// else { msg.payload = rows; }
// }
// else { msg.payload = rows; }
msg.payload = rows;
send(msg);
status = { fill: "green", shape: "dot", text: RED._("mysql.status.ok") };
node.status(status);
}
if (done) { done(); }
// if (node.mydbConfig.pool._freeConnections.indexOf(node.mydbConfig.connection) === -1) {
// node.mydbConfig.connection.release();
// }
});
})
}
else {
if (typeof msg.topic !== 'string') { node.error("msg.topic : "+RED._("mysql.errors.notstring")); done(); }

View File

@ -2,7 +2,7 @@
<script type="text/html" data-help-name="MySQLdatabase">
<p>データベースにアクセスするための認証情報を追加します。</p>
<p>タイムゾーンには、GMT, EST5EDT, UTC のような値を設定します。</p>
<p>The Charset defaults to the "old" 3 byte Mysql UTF8. 絵文字などをサポートする必要がある場合は、UTF8MB4 を使用してください。</p>
<p>文字セットのデフォルトは「古い」3バイトのMysql UTF8です。絵文字などをサポートする必要がある場合は、UTF8MB4 を使用してください。</p>
</script>
<script type="text/html" data-help-name="mysql">

View File

@ -1,9 +1,9 @@
{
"name": "node-red-node-mysql",
"version": "0.3.0",
"version": "1.0.0-beta",
"description": "A Node-RED node to read and write to a MySQL database",
"dependencies": {
"mysql": "^2.18.1"
"mysql2": "^2.3.3"
},
"repository": {
"type": "git",