cordova-plugin-powapos

Cordova plugin to connect to PowaPOS device

Usage no npm install needed!

<script type="module">
  import cordovaPluginPowapos from 'https://cdn.skypack.dev/cordova-plugin-powapos';
</script>

README

Cordova PowaPOS Plugin

Plugin to connect and interact with PowaPOS devices

Supported PowaPOS Devices

  • T-Series

Example application

Coming soon

Installation

From master

cordova plugin add https://github.com/geo242/cordova-plugin-powapos

Removing the Plugin from project

Using cordova CLI

cordova plugin rm cordova-plugin-powapos

Supported Platforms

  • iOS >=7.0
  • Android - coming soon

Using the plugin

Cordova initializes the plugin as window.plugins.powaPOS object.

Methods

  • window.geofence.connect(onSuccess, onError)
  • window.geofence.scannerBeep(beepType, onSuccess, onError)
  • window.geofence.scannerAutoScanOnOff(autoScan, onSuccess, onError)
  • window.geofence.openCashDrawer(onSuccess, onError)
  • window.geofence.printReceipt(receiptContent, onSuccess, onError)

All methods returning promises, but you can also use standard callback functions.

Events

For listening for any events generated by the device, you can either:

  • Override the handleDataReceived method
    • window.plugins.powaPOS.handleDataReceived(data)
  • Listen for window event
    • window.addEventListener('PowaPOS', function (event) { console.log(event.dataType); console.log(event.data); })
Event Data Types
  • PowaTSeries_deviceConnectedAtPort
  • PowaTSeries_deviceDisconnectedAtPort
  • PowaTSeries_connectionStateChanged
  • PowaTSeries_bootcodeUpdateProgress
  • PowaTSeries_ftdiDeviceReceivedData
  • PowaTSeries_hidDeviceConnectedAtPort
  • PowaTSeries_hidDeviceDisconnectedAtPort
  • PowaTSeries_hidDeviceReceivedData
  • PowaTSeries_receivedData
  • PowaTSeries_updateProgress
  • PowaTSeries_tseriesCashDrawerAttached
  • PowaTSeries_tseriesCashDrawerDetached
  • PowaTSeries_tseriesDidFinishInitializing
  • PowaTSeries_tseriesDidFinishUpdating
  • PowaTSeries_tseriesDidFinishUpdatingBootcode
  • PowaTSeries_tseriesDidStartUpdating
  • PowaTSeries_tseriesFailedUpdatingBootcode
  • PowaTSeries_tseriesOutOfPaper
  • PowaTSeries_tseriesPrinterResult
  • PowaS10Scanner_connectionStateChanged
  • PowaS10Scanner_scannedBarcode
  • PowaS10Scanner_scannedBarcodeData
  • PowaScanner_scannerDidFinishInitializing
  • rotationSensor

Plugin initialization

The plugin is not available until deviceready event is fired.

document.addEventListener('deviceready', function () {
    // window.plugins.powaPOS is now available
    window.plugins.powaPOS.connect();
}, false);

Platform specifics

iOS

Plugin is written in Swift. All XCode project options to enable swift support are set up automatically after plugin is installed.

License

This software is released under the Apache 2.0 License.

© 2015 iVerticle - All rights reserved