Skip to content

Latest commit

 

History

History
108 lines (77 loc) · 2.8 KB

README.md

File metadata and controls

108 lines (77 loc) · 2.8 KB

Cordova PowaPOS Plugin

Plugin to connect and interact with PowaPOS devices

Supported PowaPOS Devices

  • T-Series

##Example application

Coming soon

Installation

From master (latest)

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

Stable (npm)

cordova plugin add 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.plugins.powaPOS.connect(onSuccess, onError)
  • window.plugins.powaPOS.scannerBeep(beepType, onSuccess, onError)
  • window.plugins.powaPOS.scannerAutoScanOnOff(autoScan, onSuccess, onError)
  • window.plugins.powaPOS.openCashDrawer(onSuccess, onError)
  • window.plugins.powaPOS.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