Example #1
0
            except Exception:
                pass
            return self.status

    driver_config = {}
    if config.get('display_driver', 'device_name'):
        driver_config['customer_display_device_name'] =\
            config.get('display_driver', 'device_name')
    if config.getint('display_driver', 'device_rate'):
        driver_config['customer_display_device_rate'] =\
            config.getint('display_driver', 'device_rate')
    if config.getfloat('display_driver', 'device_timeout'):
        driver_config['customer_display_device_timeout'] =\
            config.getfloat('display_driver', 'device_timeout')
    driver_name = 'bixolon'
    if config.has_option('display_driver', 'driver_name'):
        driver_name = config.get('display_driver', 'driver_name')

    display_driver = DisplayDriver(driver_config, use_driver_name=driver_name)
    drivers['display_driver'] = display_driver


@app.route('/hw_proxy/send_text_customer_display',
           methods=['POST', 'GET', 'PUT', 'OPTIONS'])
@cross_origin(headers=['Content-Type'])
@check(installed, meta)
def send_text_customer_display():
    app.logger.debug('LCD: Call send_text')
    text_to_display = request.json['params']['text_to_display']
    lines = simplejson.loads(text_to_display)
    app.logger.debug('LCD: lines=%s', lines)
Example #2
0
from pif import get_public_ip
from xmlescpos import Layout

from pywebdriver import app, config, drivers

from .base_driver import ThreadDriver

meta = {
    "name": "ESCPOS Printer",
    "description": """This plugin add the support of ESCPOS Printer for your
        pywebdriver""",
    "require_pip": ["pyxmlescpos"],
    "require_debian": [],
}

if (config.has_option("escpos_driver", "device_type")
        and config.get("escpos_driver", "device_type") == "serial"):
    device_type = "serial"
elif (config.has_option("escpos_driver", "device_type")
      and config.get("escpos_driver", "device_type") == "win32"):
    device_type = "win32"
else:
    device_type = "usb"

SUPPORTED_DEVICES = [
    {
        "vendor": 0x04B8,
        "product": 0x0E03,
        "name": "Epson TM-T20"
    },
    {
Example #3
0
            except Exception:
                pass
            return self.status

    driver_config = {}
    if config.get('display_driver', 'device_name'):
        driver_config['customer_display_device_name'] =\
            config.get('display_driver', 'device_name')
    if config.getint('display_driver', 'device_rate'):
        driver_config['customer_display_device_rate'] =\
            config.getint('display_driver', 'device_rate')
    if config.getfloat('display_driver', 'device_timeout'):
        driver_config['customer_display_device_timeout'] =\
            config.getfloat('display_driver', 'device_timeout')
    driver_name = 'bixolon'
    if config.has_option('display_driver', 'driver_name'):
        driver_name = config.get('display_driver', 'driver_name')

    display_driver = DisplayDriver(driver_config, use_driver_name=driver_name)
    drivers['display_driver'] = display_driver


@app.route(
    '/hw_proxy/send_text_customer_display',
    methods=['POST', 'GET', 'PUT', 'OPTIONS'])
@cross_origin(headers=['Content-Type'])
@check(installed, meta)
def send_text_customer_display():
    app.logger.debug('LCD: Call send_text')
    text_to_display = request.json['params']['text_to_display']
    lines = simplejson.loads(text_to_display)
Example #4
0
            except Exception:
                pass
            return self.status

    driver_config = {}
    if config.get("display_driver", "device_name"):
        driver_config["customer_display_device_name"] = config.get(
            "display_driver", "device_name")
    if config.getint("display_driver", "device_rate"):
        driver_config["customer_display_device_rate"] = config.getint(
            "display_driver", "device_rate")
    if config.getfloat("display_driver", "device_timeout"):
        driver_config["customer_display_device_timeout"] = config.getfloat(
            "display_driver", "device_timeout")
    driver_name = "bixolon"
    if config.has_option("display_driver", "driver_name"):
        driver_name = config.get("display_driver", "driver_name")

    display_driver = DisplayDriver(driver_config, use_driver_name=driver_name)
    drivers["display_driver"] = display_driver


@app.route("/hw_proxy/send_text_customer_display",
           methods=["POST", "GET", "PUT"])
@check(installed, meta)
def send_text_customer_display():
    app.logger.debug("LCD: Call send_text")
    text_to_display = request.json["params"]["text_to_display"]
    lines = simplejson.loads(text_to_display)
    app.logger.debug("LCD: lines=%s", lines)
    display_driver.push_task("send_text", lines)
Example #5
0
from .base_driver import ThreadDriver
from xmlescpos import Layout
from escpos import capabilities
from escpos.magicencode import MagicEncode
import usb.core
import math

meta = {
    'name': "ESCPOS Printer",
    'description': """This plugin add the support of ESCPOS Printer for your
        pywebdriver""",
    'require_pip': ['pyxmlescpos'],
    'require_debian': [],
}

if (config.has_option('escpos_driver', 'device_type')
        and config.get('escpos_driver', 'device_type') == 'serial'):
    device_type = 'serial'
else:
    device_type = 'usb'

SUPPORTED_DEVICES = [
    {
        'vendor': 0x04b8,
        'product': 0x0e03,
        'name': 'Epson TM-T20'
    },
    {
        'vendor': 0x04b8,
        'product': 0x0202,
        'name': 'Epson TM-T70'