@twirll/cordova-plugin-devices
v0.2.5
Published
Local network device discovery plugin for Twirll POS
Maintainers
Readme
cordova-plugin-twirll-devices
Printer-focused local-network discovery for Twirll POS.
Discovery layers
- Bonjour/mDNS/DNS-SD
_printer._tcp_ipp._tcp_ipps._tcp
- Fallback TCP connectivity scan of the local private IPv4 /24 subnet
- 9100 RAW
- 631 IPP
- 515 LPR
The fallback only opens a TCP connection. It does not send print data.
API
TwirllDevice.discover({
types: ["printer"],
timeout: 10000
}, function(devices) {
console.log("DEVICES:", JSON.stringify(devices));
}, function(error) {
console.log("ERROR:", error);
});Multiple types:
TwirllDevice.discover({
types: ["printer", "weighing_scale"]
}, success, failure);Stop:
TwirllDevice.stop();Returned fields
deviceType, name, manufacturer, model, serialNumber, macAddress,
hostname, ipAddress, port, protocol, capabilities, and discovery.
MAC/serial are null unless exposed by the discovery/device protocol. The plugin never infers a MAC from an IP address.
Installation
cordova plugin remove cordova-plugin-twirll-devices
cordova plugin add /path/to/cordova-plugin-twirll-devices
cordova prepare
cordova build ios
cordova build androidIf platforms contain stale plugin metadata, recreate them:
cordova platform remove ios
cordova platform remove android
cordova platform add ios
cordova platform add androidImportant production note
The fallback assumes a /24 private IPv4 LAN. It is intended for the common restaurant LAN case. Larger/multi-subnet networks, VLANs and client isolation need additional handling.
The current fallback identifies an endpoint as a printer candidate based on an open common printer port. For high-confidence manufacturer/model/serial/MAC identification, add vendor-specific interrogation handlers for the printer models Twirll supports.
Weighing-scale discovery remains pluggable. Once the exact CAS model is known, its protocol can be added without changing the public JavaScript API.
