1
0
Fork 0

Merge pull request #2120 from rigrig/apploader-improvements

Apploader.js improvements
master
Gordon Williams 2022-09-12 08:18:24 +01:00 committed by GitHub
commit b3b3e94615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 10 deletions

View File

@ -16,12 +16,15 @@ var SETTINGS = {
}; };
var APPSDIR = __dirname+"/../apps/"; var APPSDIR = __dirname+"/../apps/";
var noble; var noble;
try { ["@abandonware/noble", "noble"].forEach(module => {
noble = require('@abandonware/noble'); if (!noble) try {
} catch (e) {} noble = require(module);
if (!noble) try { } catch(e) {
noble = require('noble'); if (e.code !== 'MODULE_NOT_FOUND') {
} catch (e) { } throw e;
}
}
});
if (!noble) { if (!noble) {
console.log("You need to:") console.log("You need to:")
console.log(" npm install @abandonware/noble") console.log(" npm install @abandonware/noble")
@ -60,6 +63,10 @@ dirs.forEach(dir => {
var args = process.argv; var args = process.argv;
var bangleParam = args.findIndex(arg => /-b\d/.test(arg));
if (bangleParam!==-1) {
deviceId = "BANGLEJS"+args.splice(bangleParam, 1)[0][2];
}
if (args.length==3 && args[2]=="list") cmdListApps(); if (args.length==3 && args[2]=="list") cmdListApps();
else if (args.length==3 && args[2]=="devices") cmdListDevices(); else if (args.length==3 && args[2]=="devices") cmdListDevices();
else if (args.length==4 && args[2]=="install") cmdInstallApp(args[3]); else if (args.length==4 && args[2]=="install") cmdInstallApp(args[3]);
@ -74,11 +81,10 @@ apploader.js list
- list available apps - list available apps
apploader.js devices apploader.js devices
- list available device addresses - list available device addresses
apploader.js install appname [de:vi:ce:ad:dr:es] apploader.js install [-b1] appname [de:vi:ce:ad:dr:es]
NOTE: Currently this App Loader expects the device it uploads to NOTE: By default this App Loader expects the device it uploads to
(deviceId) to be BANGLEJS2, so it won't work for Bangle.js 1 without (deviceId) to be BANGLEJS2, pass '-b1' for it to work with Bangle.js 1
modification.
`); `);
process.exit(0); process.exit(0);
} }