class: center, middle # node-machinetalk A library to use Machinetalk on Node.js https://github.com/bobvanderlinden/node-machinetalk .footnote[ by Bob van der Linden ] --- # Overview * Motivation * What is node-machinetalk * Usage * Web-based example interface * Demo * Questions --- # About me -- * Introduced to 3D printing a year ago -- * Working part-time with tiny 3D print company -- * Web development -- * Android development -- * OSS projects in off-hours --- # Motivation -- * Controlling Machinekit from a browser -- * Zero-install client -- * Cross-platform -- * Single point for upgrades -- * Integration into existing applications -- * Easy to run on non-Machinekit systems --- # Why Node.js * Javascript: familiar for a lot of developers * Ecosystem: a lot of packages * Focus on web * Simple runtime --- # What is node-machinetalk * Discovering * Monitoring * Controlling Machinekit instances on a network --- class: checklist # What is node-machinetalk -- * .fa.fa-check-square-o[] Discovery .right[MachinetalkBrowser] -- * .fa.fa-check-square-o[] status .right[StatusClient] -- * .fa.fa-check-square-o[] error .right[ErrorClient] -- * .fa.fa-check-square-o[] preview .right[PreviewClient] -- * .fa.fa-check-square-o[] command .right[TaskCommandClient] -- * .fa.fa-square-o[] file (FTP) * .fa.fa-square-o[] Remote HAL * .fa.fa-square-o[] Tying it all together .right[MachineClient] --- # Dependencies -- * Discovery * node-mdns * Avahi/Bonjour -- * Communication * node-zmq -- * Protobuf encoding * machinekit-protobuf-node * ProtoBuf.js .footnote[https://github.com/bobvanderlinden/machinekit-protobuf-node] --- # Usage -- Initialize your project ```sh npm init ``` -- Install node-machinetalk ```sh npm install machinetalk ``` -- .footnote[https://github.com/bobvanderlinden/node-machinetalk#examples] --- # Usage (discovery) ```js var machinetalk = require('machinetalk'); var machinetalkbrowser = new machinetalk.MachineTalkBrowser(); machinetalkbrowser.start(); machinetalkbrowser.on('serviceUp', function(service) { switch (service.name) { case 'status': /* initializeStatusClient(service.dsn); */ break; } }); ``` --- # Usage (status) ```js statusclient = new machinetalk.StatusClient(dsn); statusclient.connect(); statusclient.subscribe('task'); statusclient.subscribe('motion'); statusclient.subscribe('io'); statusclient.subscribe('interp'); statusclient.subscribe('config'); statusclient.on('statuschanged', function(status) { console.log(status); }); ``` --- # Usage (status object)
--- class: middle center # node-machinetalk-example* A web interface for Machinekit https://github.com/bobvanderlinden/node-machinetalk-example .footnote[*name will hopefully change] --- class: middle center # DEMO --- # Web interface -- * Prototype! -- * Webserver * Based on .nowrap[node-machinetalk] * Communication using Socket.io * Cross-platform * Allows remote usage -- * Web interface * Cross-browser * Build in components --- # Thanks! * Michael Habeler * Alexander Rössler * Bas de Bruijn * All contributors --- class: center middle # Questions?