jinnsky / bluetron Goto Github PK
View Code? Open in Web Editor NEWDesktop application to interact with BLE devices.
Desktop application to interact with BLE devices.
OS: Windows 10
Visual Studio 2015
libusb library problem, building for electron
I adding the next code in the gulpfile.js
file to solving the error, between fix-node-usb
and rebuild-usb
tasks
gulp.task('add-timespec-def', ['fix-node-usb'], () => {
// Add HAVE_STRUCT_TIMESPEC definition
if (platform === 'win32') {
var fs = require('fs')
var file = 'app\\node_modules\\usb\\libusb\\libusb\\os\\threads_windows.h'
var data = fs.readFileSync(file).toString().split("\n")
data.splice(43, 0, '#define HAVE_STRUCT_TIMESPEC')
var text = data.join("\n")
fs.writeFile(file, text, function (err) {
if (err) return console.log(err)
});
}
})
And edit the rebuild-usb
task ading add-timespec-def
task
gulp.task('rebuild-usb', ['add-timespec-def'], () => {
This isn't a good solution. The position of the HAVE_STRUCT_TIMESPEC in threads_windows.h
file, can change in other libusb versions.
Other solution that is most better.
gulp.task('add-timespec-def', ['fix-node-usb'], () => {
// Add HAVE_STRUCT_TIMESPEC and _TIMESPEC_DEFINED definition
if (platform === 'win32') {
var fs = require('fs')
var file = 'app\\node_modules\\usb\\libusb.gypi'
var data = fs.readFileSync(file).toString().split("\n")
data.splice(126, 0, ' \'defines\':[')
data.splice(127, 0, ' \'HAVE_STRUCT_TIMESPEC=1\',')
data.splice(128, 0, ' \'_TIMESPEC_DEFINED=1\'')
data.splice(129, 0, ' ]')
var text = data.join("\n")
fs.writeFile(file, text, function (err) {
if (err) return console.log(err)
});
}
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.