├── .gitignore ├── start.sh ├── DTPrint ├── start.sh ├── site │ ├── files │ │ └── num.jpg │ ├── lsusb.html │ ├── login.html │ ├── files.html │ ├── sets.html │ ├── printers.html │ ├── base.css │ ├── print.html │ └── edprint.html ├── pytest.ini ├── dbinstall.py ├── testkbd.py ├── unit-test-1.py ├── DTPrint.service ├── sample.xml ├── test.py ├── exceptions.py ├── dbDTPrint.py ├── lsusb.py ├── vikitest.py ├── constants.py └── printer.py ├── install ├── pyusb-1.0.0rc1 │ ├── setup.cfg │ ├── ACKNOWLEDGEMENTS │ ├── docs │ │ └── faq.rst │ ├── LICENSE │ ├── PKG-INFO │ ├── usb │ │ ├── _debug.py │ │ ├── _lookup.py │ │ ├── _interop.py │ │ └── __init__.py │ ├── build │ │ ├── lib.linux-i686-2.7 │ │ │ └── usb │ │ │ │ ├── _debug.py │ │ │ │ ├── _lookup.py │ │ │ │ ├── _interop.py │ │ │ │ └── __init__.py │ │ ├── lib.linux-armv7l-2.7 │ │ │ └── usb │ │ │ │ ├── _debug.py │ │ │ │ ├── _lookup.py │ │ │ │ ├── _interop.py │ │ │ │ └── __init__.py │ │ └── lib.linux-x86_64-2.7 │ │ │ └── usb │ │ │ ├── _debug.py │ │ │ ├── _lookup.py │ │ │ ├── _interop.py │ │ │ └── __init__.py │ ├── README.rst │ ├── setup.py │ └── ReleaseNotes.rst ├── sysinstall.service ├── install.sh └── sysinstall.py ├── test.py ├── icelog.py ├── dbinstall.py ├── site_icerest ├── regm3.html ├── ot.html ├── login.html ├── devset.html ├── ed_sets.html ├── sets_driver.html ├── help.html ├── index.html ├── users.html ├── sets.html ├── regm1.html ├── head.html ├── regm2.html ├── ed_user.html ├── devinfo.html ├── help_egais.html ├── ed_device.html ├── autosets.html └── js │ └── funct.js ├── site ├── ot.html ├── regm3.html ├── login.html ├── devset.html ├── ed_sets.html ├── sets_driver.html ├── help.html ├── regm1.html ├── index.html ├── users.html ├── sets.html ├── head.html ├── regm2.html ├── template │ └── egais_doc.html ├── ed_user.html ├── devinfo.html ├── help_egais.html ├── js │ └── icecash.js ├── ed_device.html └── autosets.html ├── _recalc.py ├── serialtokbd.py ├── utils ├── dbusjab2.py ├── dbusjab.py ├── _sendFAX.py ├── _sendJabber.py ├── .vimrc └── desert.vim ├── _prize.py ├── crontab ├── fhtml.py ├── clientIceRest.py ├── bsIceCash.py ├── prizeIceCash.py ├── zIceCash.py └── skserv.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | /usr/bin/python dIceCash.py& 2 | exit 0 3 | -------------------------------------------------------------------------------- /DTPrint/start.sh: -------------------------------------------------------------------------------- 1 | /usr/bin/python DTPrint.py& 2 | exit 0 3 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = README.rst 3 | -------------------------------------------------------------------------------- /DTPrint/site/files/num.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redeyser/IceCash2/HEAD/DTPrint/site/files/num.jpg -------------------------------------------------------------------------------- /DTPrint/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | minversion = 2 3 | norecursedirs = .git .tox venv* requirements* 4 | python_files = unit-test-*.py 5 | 6 | -------------------------------------------------------------------------------- /DTPrint/dbinstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | # version 1.000 4 | import dbDTPrint as dbd 5 | 6 | db = dbd.dbDTPrint('mysql','localhost','root','mysql1024') 7 | db._create() 8 | 9 | -------------------------------------------------------------------------------- /DTPrint/testkbd.py: -------------------------------------------------------------------------------- 1 | import usb.core 2 | import usb.util 3 | kbd=usb.core.find(idVendor=0x0749, idProduct=0x1000) 4 | msg="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x01\x00\x00\x00\x01" 5 | interface=0x0 6 | out_ep=0x81 7 | kbd.write(out_ep, msg, interface) 8 | -------------------------------------------------------------------------------- /DTPrint/site/lsusb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %devices% 6 |
idVendoridProductVendorProductInterfaceepinepout
7 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf8 -*- 3 | # IceBonus client v 0.001 4 | import string 5 | import skserv 6 | import sys 7 | import time 8 | import os 9 | 10 | sc=skserv.SockClient("10.5.5.1",10100) 11 | print sc.soc 12 | if not sc.soc==None: 13 | sc.close() 14 | -------------------------------------------------------------------------------- /DTPrint/unit-test-1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2 2 | import pytest 3 | import lsusb 4 | 5 | 6 | def test_lsserial_1(): 7 | assert sorted(lsusb.lsdir('/dev')) == sorted(lsusb.lsdir_old('/dev')) 8 | assert sorted(lsusb.lsserial()) == sorted(lsusb.lsserial_old()) 9 | print(lsusb.lsusb()) 10 | -------------------------------------------------------------------------------- /icelog.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | import datetime 4 | def addLog(fname, msg): 5 | dt=datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S") 6 | f =open(fname,"a") 7 | f.write(dt+"\n") 8 | f.write(msg) 9 | f.write("-"*80+"\n") 10 | f.close() 11 | 12 | 13 | -------------------------------------------------------------------------------- /dbinstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | # version 1.000 4 | import dbIceCash as dbd 5 | 6 | db = dbd.dbIceCash('mysql','localhost','root','mysql1024') 7 | db._create() 8 | #db = dbd.dbIceCash(dbd.DATABASE, "localhost", dbd.MYSQL_USER, dbd.MYSQL_PASSWORD) 9 | #if db.open(): 10 | # db.price_load("site/files/download/price/pos1.spr") 11 | # db.close() 12 | 13 | -------------------------------------------------------------------------------- /DTPrint/DTPrint.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=DTPrint 3 | After=syslog.target 4 | After=network.target 5 | After=mysql.service 6 | Requires=mysql.service 7 | 8 | [Service] 9 | Type=forking 10 | WorkingDirectory=/root/dtprint 11 | 12 | User=root 13 | Group=root 14 | 15 | ExecStart=/bin/sh /root/dtprint/start.sh 16 | TimeoutSec=10 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /site_icerest/regm3.html: -------------------------------------------------------------------------------- 1 | Убрать все карты (D) 2 | Тип бонусной операции 3 | Размер списания 4 | 5 | -------------------------------------------------------------------------------- /DTPrint/site/login.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Авторизация
4 | Пароль 5 | 6 |
7 | 8 |
9 |
10 | -------------------------------------------------------------------------------- /install/sysinstall.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=dIceServ 3 | After=syslog.target 4 | After=network.target 5 | After=mysql.service 6 | Requires=mysql.service 7 | 8 | [Service] 9 | Type=forking 10 | WorkingDirectory=/home/iceserv/dIceServ 11 | 12 | User=root 13 | Group=root 14 | 15 | ExecStart=/bin/sh /home/iceserv/dIceServ/start.sh 16 | TimeoutSec=10 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /site/ot.html: -------------------------------------------------------------------------------- 1 |
2 | Отчеты 3 | 4 | 5 | 6 | 7 |
Z-отчеты
Чеки
В начало
8 | 9 |
10 | 11 | -------------------------------------------------------------------------------- /site_icerest/ot.html: -------------------------------------------------------------------------------- 1 |
2 | Отчеты 3 | 4 | 5 | 6 | 7 |
Z-отчеты
Чеки
В начало
8 | 9 |
10 | 11 | -------------------------------------------------------------------------------- /_recalc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | import dbIceCash,zIceCash 4 | from clientEgais import * 5 | #Пример скрипта для пересчета зет отчета 6 | db = dbIceCash.dbIceCash(dbIceCash.DATABASE, 'localhost', dbIceCash.MYSQL_USER, dbIceCash.MYSQL_PASSWORD) 7 | if db.open(): 8 | pass 9 | else: 10 | sys.exit(1) 11 | 12 | db._read_sets() 13 | #z=zIceCash.zIceCash(db) 14 | #print z._Z_recalc(1) 15 | egais=EgaisClient(db.sets["egais_ip"],8080,db) 16 | egais._recalc() 17 | 18 | -------------------------------------------------------------------------------- /site/regm3.html: -------------------------------------------------------------------------------- 1 | Убрать все карты (D) 2 | Тип бонусной операции (F9) 3 | Размер списания (F7) 4 | Продолжить печать (F10) 5 | 6 | -------------------------------------------------------------------------------- /serialtokbd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import serial 3 | import sys 4 | import os 5 | 6 | if not len(sys.argv): 7 | sys.halt(1) 8 | 9 | p=sys.argv[1] 10 | ser = serial.Serial( 11 | port=p, 12 | baudrate=9600, 13 | parity=serial.PARITY_NONE, 14 | stopbits=serial.STOPBITS_ONE, 15 | ) 16 | 17 | #ser.open() 18 | x='' 19 | while 1: 20 | a=ser.read(1) 21 | if ord(a)==13: 22 | os.system("xvkbd -display :0.0 -xsendevent -text \"%s\\r\"" % x) 23 | x='' 24 | else: 25 | x=x+a 26 | 27 | ser.close() 28 | -------------------------------------------------------------------------------- /DTPrint/sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | dtpadm 4 | sam.net 5 | 6 | 7 | set_style 8 | bold;2x;;; 9 | 10 | 11 | print_text 12 | 13 | 14 | 15 | THE END 16 | 17 | 18 | 19 | 20 | 21 | cut 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/ACKNOWLEDGEMENTS: -------------------------------------------------------------------------------- 1 | Alan Aguiar 2 | jaseg 3 | Johannes Stezenbach 4 | Marijn van Vliet 5 | Stefano Di Martino 6 | Simon Norberg 7 | iThompson 8 | Harry Bock 9 | ponty 10 | Chris Clark 11 | themperek 12 | David Halter 13 | Robert von Burg 14 | James Rowe 15 | Braiden Kindt 16 | Tormod Volden 17 | Chris Clark 18 | Emmanuel Blot 19 | Peter Bigot 20 | Travis Robinson 21 | Xiaofan Chen 22 | Poul-Henning Kamp 23 | Thomas Reitmayr 24 | Carl Ritson 25 | Romain Aviolat 26 | Walker Inman 27 | Prathmesh Prabhu 28 | André Erdmann 29 | Jeffrey Nichols 30 | Deliang Fan 31 | Matthew Chan 32 | Maximilian Köhl 33 | -------------------------------------------------------------------------------- /site/login.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Авторизация
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Пользователь
Пароль
15 |
16 |
17 | -------------------------------------------------------------------------------- /site/devset.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | %%#table_text_td# style="padding:0px;" %% 4 | %%#table_text_tin# class='itext black small' style="margin:0px" size=40 %% 5 | %table_text% 6 |
7 | 8 | 9 | 12 | 15 | 16 |
10 | 11 | 13 | 14 |
17 |
18 | -------------------------------------------------------------------------------- /site_icerest/login.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Авторизация
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Пользователь
Пароль
15 |
16 |
17 | -------------------------------------------------------------------------------- /install/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #cp serialtokbd.py /home/kassir 3 | #chown kassir:kassir /home/kassir/serialtokbd.py 4 | #chmod a+x /home/kassir/serialtokbd.py 5 | 6 | apt-get install python-mysqldb python-usb python-qrcode python-requests python-serial 7 | 8 | cd pyusb-1.0.0rc1 9 | python setup.py build 10 | python setup.py install 11 | cd .. 12 | 13 | cd ../DTPrint 14 | python dbinstall.py 15 | python ../install/sysinstall.py ../install DTPrint 16 | 17 | cd .. 18 | python dbinstall.py 19 | python install/sysinstall.py install dIceCash 20 | 21 | systemctl enable dIceCash.service 22 | systemctl enable DTPrint.service 23 | systemctl start dIceCash.service 24 | systemctl start DTPrint.service 25 | -------------------------------------------------------------------------------- /site_icerest/devset.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | %%#table_text_td# style="padding:0px;" %% 4 | %%#table_text_tin# class='itext black small' style="margin:0px" size=40 %% 5 | %table_text% 6 |
7 | 8 | 9 | 12 | 15 | 16 |
10 | 11 | 13 | 14 |
17 |
18 | -------------------------------------------------------------------------------- /DTPrint/site/files.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Загрузить файл на сервер: 5 | 6 | Имя файла: 7 | 8 | 9 |
10 |
11 | 12 | 15 | 18 | %files% 19 |
13 | Файлы на сервере 14 | 16 | Удалить 17 |
20 |
21 | -------------------------------------------------------------------------------- /site/ed_sets.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | %%#table_sets_caption# class='vcenter flame small'%% 8 | %%#table_sets_value# class='itext ice norm' size=10%% 9 | %table_sets% 10 | 11 | 14 | 17 | 18 | 19 |
НастройкаЗначение
12 | 13 | 15 | 16 |
20 |
21 | -------------------------------------------------------------------------------- /site_icerest/ed_sets.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | %%#table_sets_caption# class='vcenter flame small'%% 8 | %%#table_sets_value# class='itext ice norm' size=10%% 9 | %table_sets% 10 | 11 | 14 | 17 | 18 | 19 |
НастройкаЗначение
12 | 13 | 15 | 16 |
20 |
21 | -------------------------------------------------------------------------------- /site/sets_driver.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 21 | 22 |
4 |
5 | Драйвер 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Подключение
Статус
Текст в чеке
Настройки
В начало
13 | 14 |
15 |
17 | 20 |
23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /site_icerest/sets_driver.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 21 | 22 |
4 |
5 | Драйвер 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Подключение
Статус
Текст в чеке
Настройки
В начало
13 | 14 |
15 |
17 | 20 |
23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /site/help.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 22 | 23 |
4 |
5 | Документация 6 | 7 | 8 | 9 | 10 | 11 |
Регистрация
Егаис
Отчеты
В начало
12 | 13 |
14 |
16 | 21 |
24 | -------------------------------------------------------------------------------- /site_icerest/help.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 22 | 23 |
4 |
5 | Документация 6 | 7 | 8 | 9 | 10 | 11 |
Регистрация
Егаис
Отчеты
В начало
12 | 13 |
14 |
16 | 21 |
24 | -------------------------------------------------------------------------------- /install/sysinstall.py: -------------------------------------------------------------------------------- 1 | import os,sys,re 2 | if len(sys.argv)==1: 3 | print "add param1" 4 | sys.exit() 5 | path=sys.argv[1] 6 | prog=sys.argv[2] 7 | d=os.getcwd() 8 | f=open(path+"/sysinstall.service","r") 9 | fw=open("/etc/systemd/system/%s.service" % prog,"w") 10 | lines=f.readlines() 11 | for l in lines: 12 | r=re.search("WorkingDirectory",l) 13 | if r!=None: 14 | l="WorkingDirectory=%s\n" % d 15 | r=re.search("Description",l) 16 | if r!=None: 17 | l="Description=%s\n" % prog 18 | r=re.search("ExecStart",l) 19 | if r!=None: 20 | p="/bin/sh "+d+"/start.sh" 21 | l="ExecStart=%s\n" % p 22 | fw.write(l) 23 | f.close() 24 | #os.system("ln -s /etc/systemd/system/%s /etc/systemd/system/multi-user.target.wants/%s.service" % (prog,prog)) 25 | #os.system("systemctl enable %s.service" % prog) 26 | #os.system("systemctl start %s.service" % prog) 27 | -------------------------------------------------------------------------------- /DTPrint/site/sets.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | Сетевой адрес сервиса:
4 | Сотевой порт сервиса:
5 | 6 |
7 |
8 |
9 |
10 | Пароль пользователя:
11 | Пароль администратора:
12 | 13 |
14 |
15 | 16 | -------------------------------------------------------------------------------- /site/regm1.html: -------------------------------------------------------------------------------- 1 | Отмена (/) 2 | Тип чека (PgUp) 3 | Сторно (*) 4 | Колич (+) 5 | Цена (-) 6 | Скидка (F8) 7 | Оплата (Insert) 8 | Безнал (Delete) 9 | 10 | -------------------------------------------------------------------------------- /site/index.html: -------------------------------------------------------------------------------- 1 |
2 | IceCash %version%
3 | %placename% 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Регистрация
Настройки
Сервис
Отчеты
ЕГАИС
Помощь
Выход
13 | #%regcode%:%idplace%.%nkassa% 14 | 15 |
16 | -------------------------------------------------------------------------------- /utils/dbusjab2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | DEBUG = True 4 | import dbus, gobject,re,pynotify,os 5 | from dbus.mainloop.glib import DBusGMainLoop 6 | def check_ding(p): 7 | #print p 8 | server=p[0] 9 | sender=p[1][0] 10 | message=p[1][1] 11 | sender = sender.encode('utf-8') 12 | message = message.encode('utf-8') 13 | f=open("_","w") 14 | f.write(message) 15 | f.close() 16 | os.system("echo '%s' | python _sendFAX.py localhost 10111 Star +bw" % sender) 17 | os.system("cat _ | python _sendFAX.py localhost 10111 Star -") 18 | if __name__ == '__main__': 19 | dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 20 | bus = dbus.SessionBus() 21 | bus.add_signal_receiver(check_ding, 22 | dbus_interface="org.gajim.dbus.RemoteInterface", 23 | signal_name="NewMessage") 24 | loop = gobject.MainLoop() 25 | loop.run() 26 | -------------------------------------------------------------------------------- /site_icerest/index.html: -------------------------------------------------------------------------------- 1 |
2 | IceCash %version%
3 | %placename% 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Регистрация
Настройки
Сервис
Отчеты
ЕГАИС
Помощь
Выход
13 | #%regcode%:%idplace%.%nkassa% 14 | 15 |
16 | -------------------------------------------------------------------------------- /DTPrint/site/printers.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | %printers% 16 |
Наимен.Произв.Тип подключ.Сет АдресСет ПортКод кодировки
17 |
18 | 22 | 23 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /site/users.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 32 | 33 |
4 |
5 | Пользователи 6 | 7 | 8 | 9 | 10 |
Добавить
Настройки
В начало
11 | 12 |
13 |
15 |
16 | 17 | 18 | 19 | 20 | 21 | %%#table_users# onclick='edit_user(%id%);'%% 22 | %table_users% 23 | 24 |
#LoginТипНомер
25 | 29 | 30 |
31 |
34 | -------------------------------------------------------------------------------- /site_icerest/users.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 32 | 33 |
4 |
5 | Пользователи 6 | 7 | 8 | 9 | 10 |
Добавить
Настройки
В начало
11 | 12 |
13 |
15 |
16 | 17 | 18 | 19 | 20 | 21 | %%#table_users# onclick='edit_user(%id%);'%% 22 | %table_users% 23 | 24 |
#LoginТипНомер
25 | 29 | 30 |
31 |
34 | -------------------------------------------------------------------------------- /site/sets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 23 | 24 |
4 |
5 | Настройки 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Пользователи
Драйвер
Сервер
Клиент
Магазин
Оборудование
В начало
15 | 16 |
17 |
19 | 22 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /site_icerest/sets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 23 | 24 |
4 |
5 | Настройки 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Пользователи
Драйвер
Сервер
Клиент
Магазин
Оборудование
В начало
15 | 16 |
17 |
19 | 22 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /site_icerest/regm1.html: -------------------------------------------------------------------------------- 1 | Отмена 2 | Тип чека 3 | Сторно 4 | Колич 5 | Цена 6 | Заказы 7 | Удалить заказ 8 | Оплата 9 | Безнал 10 | 11 | -------------------------------------------------------------------------------- /site_icerest/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | IceCash 4 | 5 | 6 | 7 | 8 | 9 | 15 | %body% 16 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /site_icerest/regm2.html: -------------------------------------------------------------------------------- 1 | Сохранить чек ([) 2 | Отложенные чеки (]) 3 | Копия чека 4 | Открыть ящик (PgDn) 5 | На весь экран (F) 6 | watch (W) 7 | ПечатьШК (F5) 8 | Снять X-Отчет 9 | Снять Z-Отчет 10 | 11 | -------------------------------------------------------------------------------- /site/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | IceCash 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | %body% 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /_prize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | import dbIceCash,prizeIceCash,sys,random 4 | db = dbIceCash.dbIceCash(dbIceCash.DATABASE, 'localhost', dbIceCash.MYSQL_USER, dbIceCash.MYSQL_PASSWORD) 5 | if db.open(): 6 | pass 7 | else: 8 | print "DTPWeb Server down. Database not exist" 9 | sys.exit(1) 10 | 11 | db._read_sets() 12 | ps=prizeIceCash.prizeIceCash("1",db.idplace,db.nkassa,db.sets['backoffice_ip'],int(db.sets['prize_port'])) 13 | if ps.connect(): 14 | print "Сервер призов доступен\n" 15 | else: 16 | print "Сервер призов не доступен" 17 | sys.exit(1) 18 | if not ps.cmd_info(): 19 | print "Сервер деактивирован" 20 | sys.exit(1) 21 | 22 | for l in ps.info: 23 | print l 24 | print "\n" 25 | 26 | ncheck=random.randrange(1000) 27 | idtrsc=1 28 | summa=500 29 | if ps.cmd_gen(ncheck,idtrsc,summa): 30 | print "Результат генерации:",ps.gen 31 | else: 32 | print "Ошибка генерации приза!!!" 33 | sys.exit(1) 34 | if ps.cmd_close(): 35 | print "Транзакция успешно закрыта" 36 | else: 37 | print "Ошибка закрытия транзакции" 38 | #print "Попытка повторно закрыть транзакцию:" 39 | #print ps.cmd_close() 40 | ps.close() 41 | -------------------------------------------------------------------------------- /site/regm2.html: -------------------------------------------------------------------------------- 1 | Сохранить чек ([) 2 | Отложенные чеки (]) 3 | Копия чека (F2) 4 | Открыть ящик (PgDn) 5 | На весь экран (F) 6 | watch (W) 7 | ПечатьШК (F5) 8 | Открыть смену 9 | Снять X-Отчет 10 | Снять Z-Отчет 11 | 12 | -------------------------------------------------------------------------------- /site/template/egais_doc.html: -------------------------------------------------------------------------------- 1 |
Документ Перемещения
2 |
3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 20 | 24 | 25 |
Получатель: 9 | 10 | 11 |
Параметры: 16 | 17 | 18 | 19 | 21 | 22 | 23 |
26 | 27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/docs/faq.rst: -------------------------------------------------------------------------------- 1 | FAQ 2 | === 3 | 4 | How do I fix "No backend available" errors? 5 | ------------------------------------------- 6 | 7 | Generally, there are four possible causes for this problem: 8 | 9 | 1. You didn't install libusb library. 10 | 2. Your libusb library isn't in the standard shared library paths. 11 | 3. Your libusb version is too old. 12 | 4. Your PyUSB version is too old. 13 | 14 | To debug what's wrong, run the following script in your environment:: 15 | 16 | import os 17 | os.environ['PYUSB_DEBUG'] = 'debug' 18 | import usb.core 19 | usb.core.find() 20 | 21 | This will print debug messages to the console. If you still have problems 22 | to figure out what's going on, please ask for help in the mailing list, 23 | providing the debug output. 24 | 25 | How do I enforce a backend? 26 | --------------------------- 27 | 28 | Here is an example for the *libusb1* backend:: 29 | 30 | >>> import usb.core 31 | >>> from usb.backend import libusb1 32 | >>> be = libusb1.get_backend() 33 | >>> dev = usb.core.find(backend=be) 34 | 35 | How can I pass the libusb library path to the backend? 36 | ------------------------------------------------------ 37 | 38 | Check the *Specify libraries by hand* section in the tutorial_. 39 | 40 | .. _tutorial: https://github.com/walac/pyusb/docs/tutorial.rst 41 | 42 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2009-2014 Wander Lairson Costa. All Rights Reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. The name of the author may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 20 | EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 22 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 26 | OF SUCH DAMAGE. 27 | 28 | -------------------------------------------------------------------------------- /crontab: -------------------------------------------------------------------------------- 1 | SHELL=/bin/sh 2 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 3 | ICEDIR=/home/kassir/dIceCash 4 | 5 | # m h dom mon dow user command 6 | 17 * * * * root cd / && run-parts --report /etc/cron.hourly 7 | 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 8 | 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 9 | 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) 10 | # time 11 | 55 * * * * root ntpdate blue.beer 12 | 50 * * * * root ntpdate office 13 | # shutdown 14 | 00 02 * * * root shutdown -h now 15 | # upload 16 | */5 * * * * kassir cd $ICEDIR && python dUpload.py dw_zets 17 | */10 * * * * kassir cd $ICEDIR && python dUpload.py dw_price 18 | */12 * * * * kassir cd $ICEDIR && python dUpload.py dw_actions 19 | */14 * * * * kassir cd $ICEDIR && python dUpload.py dw_sets 20 | #upgrade 21 | 15 * * * * root cd $ICEDIR && python dUpload.py dw_upgrade_prog 22 | 16 * * * * root cd $ICEDIR && python dUpload.py dw_upgrade_base 23 | 20 * * * * root cd $ICEDIR && python dUpload.py do_upgrade_base 24 | #egais 25 | */10 * * * * kassir cd $ICEDIR && python dUpload.py restart_egais 26 | */15 * * * * kassir cd $ICEDIR && python dUpload.py ex_egais 27 | 30 * * * * kassir cd $ICEDIR && python dUpload.py vf_egais 28 | 00 23 * * * kassir gmessage -center -ontop -sticky -nofocus -title 'Выключение' -wrap -fg red -display :0 "Не забудте снять Z-отчет. Кассу не выключайте, это важно для выгрузки зет отчета на сервер. Касса выключится самостоятельно." 29 | 30 | -------------------------------------------------------------------------------- /utils/dbusjab.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | DEBUG = True 4 | import dbus, gobject,re,pynotify,os 5 | from dbus.mainloop.glib import DBusGMainLoop 6 | dingregex = re.compile(r'(ding)',re.IGNORECASE) 7 | def check_ding(account, sender, message, conv, flags): 8 | sender = sender.encode('utf-8') 9 | message = message.encode('utf-8') 10 | obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") 11 | purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") 12 | title = purple.PurpleConversationGetTitle(conv).encode('utf-8') 13 | if not title: 14 | title = conv 15 | if len(dingregex.findall(message)) > 0: 16 | pass 17 | #pynotify.init("Basics") 18 | #notify = pynotify.Notification("DING DING DING","{} called for DING DING DING in {}".format(sender,title),"emblem-danger") 19 | #notify.set_timeout(pynotify.EXPIRES_NEVER) 20 | #notify.show() 21 | 22 | if DEBUG: 23 | print "sender: {} message: {}, account: {}, conversation: {}, flags: {}, title: {}".format(sender,message,account,conv,flags,title) 24 | f=open("_","w") 25 | f.write(message) 26 | f.close() 27 | os.system("echo '%s' | python _sendFAX.py localhost 10111 Star +bw" % sender) 28 | os.system("cat _ | python _sendFAX.py localhost 10111 Star -") 29 | if __name__ == '__main__': 30 | dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 31 | bus = dbus.SessionBus() 32 | bus.add_signal_receiver(check_ding, 33 | dbus_interface="im.pidgin.purple.PurpleInterface", 34 | signal_name="ReceivedImMsg") 35 | loop = gobject.MainLoop() 36 | loop.run() 37 | -------------------------------------------------------------------------------- /utils/_sendFAX.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import clientDrv,sys,datetime 3 | 4 | if len(sys.argv)<2: 5 | print "add parameters server port printer" 6 | sys.exit(1) 7 | (server,port,printer)=sys.argv[1:4] 8 | if len(sys.argv)>4: 9 | style=sys.argv[4] 10 | else: 11 | style="" 12 | if style.find("b")!=-1: 13 | bright=10 14 | else: 15 | bright=0 16 | if style.find("i")!=-1: 17 | invert=1 18 | else: 19 | invert=0 20 | if style.find("h")!=-1: 21 | height=1 22 | else: 23 | height=0 24 | if style.find("f")!=-1: 25 | font=3 26 | else: 27 | font=0 28 | if style.find("w")!=-1: 29 | big=1 30 | else: 31 | big=0 32 | if style.find("+")!=-1: 33 | head=True 34 | else: 35 | head=False 36 | if style.find("-")!=-1: 37 | cut=True 38 | else: 39 | cut=False 40 | if style.find("*")!=-1: 41 | beep=True 42 | else: 43 | beep=False 44 | 45 | drv = clientDrv.DTPclient(server,int(port),"dtpadm") 46 | if not drv.connect(): 47 | sys.exit(1) 48 | text=sys.stdin.read() 49 | text=text.replace("
","\n") 50 | text=text.replace("<","<") 51 | text=text.replace(">",">") 52 | if beep: 53 | drv._cm(printer,"_beep",{}) 54 | dt=datetime.datetime.today() 55 | tm=dt.strftime("%Y-%m-%d %H:%M") 56 | if head: 57 | drv._cm(printer,"prn_lines",{'text':tm,"width":0,"height":0,"font":0,"bright":10,"big":0,"invert":1,"align":"centers"}) 58 | r=drv._cm(printer,"prn_lines",{'text':text.decode("utf8"),"width":0,"height":height,"font":font,"bright":bright,"big":big,"invert":invert,"align":"left"}) 59 | if cut: 60 | drv._cm(printer,"_cut",{"type":0}) 61 | #r=drv._cm(printer,"prn_lines",{'text':u"\n\n\n\n\n\n\n","width":0,"height":1,"font":0,"bright":10,"big":0,"invert":0,"align":"left"}) 62 | print r 63 | if r: 64 | sys.exit(0) 65 | else: 66 | sys.exit(1) 67 | 68 | -------------------------------------------------------------------------------- /site/ed_user.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 37 | 40 | 43 | 44 | 45 |
Тип: 8 | 11 |
Login: 16 | 17 | Номер: 20 | 21 |
Пароль: 26 | 27 | CSS: 30 | 31 |
35 | 36 | 38 | 39 | 41 | 42 |
46 |
47 | -------------------------------------------------------------------------------- /utils/_sendJabber.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys,os,xmpp,time 3 | 4 | username = 'bot@beer/sender' 5 | passwd = 'bot123' 6 | 7 | to=sys.argv[1] 8 | msg="" 9 | line = sys.stdin.readline() 10 | while line: 11 | msg=msg+line 12 | line = sys.stdin.readline() 13 | 14 | m = sys.stdin.readlines() 15 | msg.decode('utf8') 16 | 17 | to=to.split(",") 18 | jid = xmpp.JID(username) 19 | 20 | client = xmpp.Client(jid.getDomain(),debug=[]) 21 | con=client.connect() 22 | if not con: 23 | print 'could not connect!' 24 | sys.exit() 25 | auth=client.auth(jid.getNode(), passwd, 'isendler') 26 | if not auth: 27 | print 'could not connect!' 28 | sys.exit() 29 | print "auth.",auth 30 | client.sendInitPresence() 31 | for n in to: 32 | client.send(xmpp.Message(n,msg)) 33 | client.disconnect() 34 | -------------------------------------------------------------------------------- /DTPrint/test.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 2 | import printer 3 | 4 | #Epson = printer.Serial("/dev/ttyS0") 5 | Epson = printer.Serial("/dev/ttyUSB0") 6 | #Epson = escpos.Escpos(0x1c8a,0x3012,0,0x81,0x01) 7 | #Epson = printer.Usb(0x1c8a,0x3012,0,in_ep=0x81, out_ep=0x02) 8 | #Epson = printer.Network('172.16.200.8', port=9600) 9 | #s=u"Скорость печати Сегодня большинство прикладных программ работают под Windows XPи Vista, выводящими документ в виде графики. Поэтому проблема скорости печати сводится не столько к скорости протягивания бумаги, сколько к корректной работе драйвера с графикой. Поэтому для TSP650 были разработаны новые драйверы, которые позволяют печатать 19 стандартных чеков с интерфесом LPT (параллельным) и 32 - при использовании USB. Скорость механизма - до 150 мм в секунду (зависит от качества бумаги). Разрешение графики - 203 точки на дюйм.\n" 10 | #s=u"С наступающим новым\n2016 годом!\n\n\n\n" 11 | s=u"test string\n" 12 | #Epson.set(codepage="cp866",realcode=17,bold=True,size="2x",font="c",inverted=False,align="center") 13 | #Epson.set(codepage="cp866",code=17,bold=True,size="2x",font="c",inverted=False,align="center") 14 | #Epson.text(s) 15 | #Epson.barcode("2000000040011","EAN13",255,6,"ABOVE","B") 16 | #Epson.image("unix.png") 17 | #Epson.image("action.png") 18 | #Epson.image("mutant.png") 19 | #Epson.image("mutant2.png") 20 | #for i in range(10): 21 | #Epson.text(s) 22 | #Epson.qr("Привет с большого бодуна") 23 | #Epson.beep() 24 | Epson.set(font="a") 25 | Epson.text(s) 26 | Epson.set(font="b") 27 | Epson.text(s) 28 | Epson.set(font="c") 29 | Epson.text(s) 30 | Epson.cut() 31 | #Epson.cut() 32 | #Epson._get_sensor(1) 33 | #Epson._get_sensor(2) 34 | #Epson._get_sensor(3) 35 | #Epson._get_sensor(4) 36 | #print Epson.is_error() 37 | #Epson.cashdraw(2) 38 | #Epson.cashdraw(5) 39 | #Epson.cashdraw(5) 40 | #Epson.cashdraw(5) 41 | #Epson.cashdraw(5) 42 | #Epson.cashdraw(5) 43 | #Epson.cashdraw(5) 44 | #Epson.cashdraw(5) 45 | #Epson.cashdraw(5) 46 | #Epson.cashdraw(5) 47 | #Epson.cashdraw(5) 48 | #Epson.cashdraw(5) 49 | #Epson.cashdraw(5) 50 | 51 | #Bus 001 Device 004: ID 1c8a:3012 52 | #Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter 53 | #Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 54 | #Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 55 | -------------------------------------------------------------------------------- /site_icerest/ed_user.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 43 | 46 | 49 | 50 | 51 |
Тип: 8 | 11 |
Login: 16 | 17 | Номер: 20 | 21 |
Пароль: 26 | 27 | CSS: 30 | 31 |
Принтер: 36 | 37 |
41 | 42 | 44 | 45 | 47 | 48 |
52 |
53 | -------------------------------------------------------------------------------- /DTPrint/exceptions.py: -------------------------------------------------------------------------------- 1 | """ ESC/POS Exceptions classes """ 2 | 3 | import os 4 | 5 | class Error(Exception): 6 | """ Base class for ESC/POS errors """ 7 | def __init__(self, msg, status=None): 8 | Exception.__init__(self) 9 | self.msg = msg 10 | self.resultcode = 1 11 | if status is not None: 12 | self.resultcode = status 13 | 14 | def __str__(self): 15 | return self.msg 16 | 17 | # Result/Exit codes 18 | # 0 = success 19 | # 10 = No Barcode type defined 20 | # 20 = Barcode size values are out of range 21 | # 30 = Barcode text not supplied 22 | # 40 = Image height is too large 23 | # 50 = No string supplied to be printed 24 | # 60 = Invalid pin to send Cash Drawer pulse 25 | 26 | 27 | class BarcodeTypeError(Error): 28 | def __init__(self, msg=""): 29 | Error.__init__(self, msg) 30 | self.msg = msg 31 | self.resultcode = 10 32 | 33 | def __str__(self): 34 | return "No Barcode type is defined" 35 | 36 | class BarcodeSizeError(Error): 37 | def __init__(self, msg=""): 38 | Error.__init__(self, msg) 39 | self.msg = msg 40 | self.resultcode = 20 41 | 42 | def __str__(self): 43 | return "Barcode size is out of range" 44 | 45 | class BarcodeCodeError(Error): 46 | def __init__(self, msg=""): 47 | Error.__init__(self, msg) 48 | self.msg = msg 49 | self.resultcode = 30 50 | 51 | def __str__(self): 52 | return "Code was not supplied" 53 | 54 | class ImageSizeError(Error): 55 | def __init__(self, msg=""): 56 | Error.__init__(self, msg) 57 | self.msg = msg 58 | self.resultcode = 40 59 | 60 | def __str__(self): 61 | return "Image height is longer than 255px and can't be printed" 62 | 63 | class TextError(Error): 64 | def __init__(self, msg=""): 65 | Error.__init__(self, msg) 66 | self.msg = msg 67 | self.resultcode = 50 68 | 69 | def __str__(self): 70 | return "Text string must be supplied to the text() method" 71 | 72 | 73 | class CashDrawerError(Error): 74 | def __init__(self, msg=""): 75 | Error.__init__(self, msg) 76 | self.msg = msg 77 | self.resultcode = 60 78 | 79 | def __str__(self): 80 | return "Valid pin must be set to send pulse" 81 | -------------------------------------------------------------------------------- /DTPrint/dbDTPrint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | # version 1.002 4 | # DataBase for Driver Thermal Printer 5 | import my 6 | import os 7 | import re 8 | from md5 import md5 9 | import tbDTPrint as tbs 10 | 11 | DATABASE = "DTPrint" 12 | MYSQL_USER = "dtprint" 13 | MYSQL_PASSWORD = "dtprint2048" 14 | 15 | TYPE_CONNECT = ['SERIAL','USB','NET'] 16 | TYPE_DEVICE = ['ESCPOS','ESCPOS_OLD','KKM_FPRINT','KKM_SHTRIHM'] 17 | 18 | class dbDTPrint(my.db): 19 | def __init__(self,dbname,host,user,password): 20 | my.db.__init__(self,dbname,host,user,password) 21 | self.tb_sets = tbs.tb_sets ('tp_sets') 22 | self.tb_logs = tbs.tb_logs ('tp_logs') 23 | self.tb_printers = tbs.tb_printers ('tp_printers') 24 | 25 | def _log(self,ip,user,cmd,url,xml,result=0): 26 | self.run(self.tb_logs._add([ip,user,cmd,url,xml,result])); 27 | 28 | 29 | def _read_sets(self): 30 | self.sets={} 31 | data = self.get(self.tb_sets._getall()) 32 | for d in data: 33 | self.sets[d[1]]=d[2] 34 | 35 | def _packid(self): 36 | n=0 37 | prn=self.get(self.tb_printers._get()) 38 | for p in prn: 39 | n=n+1 40 | self.run(self.tb_printers._newid(p[0],n)) 41 | 42 | 43 | def _create(self): 44 | if self.open(): 45 | self.run("drop database %s" % DATABASE) 46 | self.run("create database %s" % DATABASE) 47 | self.run("create user 'dtprint'@'localhost' IDENTIFIED BY 'dtprint2048'") 48 | self.run("grant all on "+DATABASE+".* to 'dtprint'@'localhost'") 49 | self.run("flush privileges") 50 | self.run("use %s" % DATABASE) 51 | self.run(self.tb_sets._create()) 52 | self.run(self.tb_sets._add(['server_ip',''])) 53 | self.run(self.tb_sets._add(['server_port','10111'])) 54 | self.run(self.tb_sets._add(['password_adm',md5("dtpadm").hexdigest()])) 55 | self.run(self.tb_sets._add(['password_usr',md5("usr").hexdigest()])) 56 | 57 | self.run(self.tb_logs._create()) 58 | self.run(self.tb_logs._add(['localhost','adm','INSTALL','/','',0])) 59 | self.run(self.tb_printers._create()) 60 | print "created database" 61 | else: 62 | print "error.not_open" 63 | 64 | 65 | -------------------------------------------------------------------------------- /fhtml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | 4 | """ 5 | Functions html 6 | """ 7 | def ht_reptags_arr(html,amark,aval): 8 | for i in range(len(amark)): 9 | if aval[i]==None: 10 | aval[i]='None'; 11 | html=html.replace(amark[i],aval[i]) 12 | return html 13 | 14 | def ht_reptags_hash(html,h): 15 | for key,val in h.items(): 16 | k="%"+key+"%" 17 | if type(val)!=unicode: 18 | val=str(val) 19 | selected = "%"+key+"_"+val+"%" 20 | html=html.replace(k,val) 21 | html=html.replace(selected,"selected") 22 | return html 23 | 24 | def ht_arrstr2select(arr,val): 25 | s="" 26 | for i in range(len(arr)): 27 | if arr[i]==val: 28 | ch='selected' 29 | else: 30 | ch="" 31 | s+="\n" % (arr[i],ch,arr[i][:40]) 32 | return s 33 | 34 | def ht_arr2select(arr,val): 35 | s="" 36 | for i in range(len(arr)): 37 | if i==val: 38 | ch='selected' 39 | else: 40 | ch="" 41 | s+="\n" % (i,ch,arr[i]) 42 | return s 43 | 44 | def ht_arr2table(arr,tag,tr_on,tin_on): 45 | s="" 46 | for i in range(len(arr)): 47 | on=tr_on.replace("%id%",str(i)) 48 | s+="\n" % (tag,on,tag,i,tag,i,arr[i],tin_on) 50 | return s 51 | 52 | def ht_db2select(records,field_id,field_val,val): 53 | s="" 54 | for record in records: 55 | if record[field_id]==val: 56 | ch='selected' 57 | else: 58 | ch="" 59 | s+="\n" % (record[field_id],ch,record[field_val]) 60 | return s 61 | 62 | def ht_db2table(records,fields,idx,tr_on): 63 | s="" 64 | for record in records: 65 | id=record[idx] 66 | on=tr_on.replace("%id%",str(id)) 67 | s+="" % on 68 | for field in fields: 69 | s+="%s" % record[field] 70 | s+="" 71 | return s 72 | 73 | def ht_hash2table_input(h,caption,value): 74 | s="" 75 | for k,v in h.items(): 76 | s+="%s\n" % (caption,k,value,k,v) 77 | return s 78 | 79 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: pyusb 3 | Version: 1.0.0rc1 4 | Summary: Python USB access module 5 | Home-page: http://pyusb.sourceforge.net 6 | Author: Wander Lairson Costa 7 | Author-email: wander.lairson@gmail.com 8 | License: BSD 9 | Description: 10 | PyUSB offers easy USB devices communication in Python. 11 | It should work without additional code in any environment with 12 | Python >= 2.4, ctypes and an pre-built usb backend library 13 | (currently, libusb 0.1.x, libusb 1.x, and OpenUSB). 14 | 15 | Platform: UNKNOWN 16 | Classifier: Development Status :: 4 - Beta 17 | Classifier: Intended Audience :: Developers 18 | Classifier: Intended Audience :: Information Technology 19 | Classifier: Intended Audience :: Manufacturing 20 | Classifier: Intended Audience :: Science/Research 21 | Classifier: Intended Audience :: System Administrators 22 | Classifier: Intended Audience :: Telecommunications Industry 23 | Classifier: License :: OSI Approved :: BSD License 24 | Classifier: Natural Language :: English 25 | Classifier: Operating System :: MacOS :: MacOS X 26 | Classifier: Operating System :: Microsoft :: Windows :: Windows Vista 27 | Classifier: Operating System :: Microsoft :: Windows :: Windows 7 28 | Classifier: Operating System :: POSIX :: BSD :: FreeBSD 29 | Classifier: Operating System :: POSIX :: BSD :: NetBSD 30 | Classifier: Operating System :: POSIX :: BSD :: OpenBSD 31 | Classifier: Operating System :: POSIX :: Linux 32 | Classifier: Operating System :: POSIX :: SunOS/Solaris 33 | Classifier: Programming Language :: Python :: 2.4 34 | Classifier: Programming Language :: Python :: 2.5 35 | Classifier: Programming Language :: Python :: 2.6 36 | Classifier: Programming Language :: Python :: 2.7 37 | Classifier: Programming Language :: Python :: 3 38 | Classifier: Programming Language :: Python :: Implementation :: CPython 39 | Classifier: Programming Language :: Python :: Implementation :: IronPython 40 | Classifier: Programming Language :: Python :: Implementation :: Jython 41 | Classifier: Programming Language :: Python :: Implementation :: PyPy 42 | Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator 43 | Classifier: Topic :: Software Development :: Libraries 44 | Classifier: Topic :: Software Development :: Libraries :: Python Modules 45 | Classifier: Topic :: System :: Hardware :: Hardware Drivers 46 | -------------------------------------------------------------------------------- /site/devinfo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
%result%
Регистрационные
Заводской номер: %dev_id%
Фискализирован: %f_fiskal%
Дата фискализации: %n_dtfiskal%
ИНН: %n_inn%
Номер ЭКЛЗ: %n_ideklz%
Дата установки ЭКЛЗ: %n_dteklz%
Текущее время: %dt_date% %dt_time%
Оперативные
Смена открыта: %f_opensm%
Режим: %dev_mode%
Номер чека: %c_check%
Наличные в кассе: %c_sum%
Датчики
Механическая поломка: %fc_bracked%
Ошибка отрезчика: %fc_nocut%
Перегрев: %fc_hot%
Нет бумаги: %fc_notpaper%
Открыта крышка: %f_opencap%
Есть рулон: %f_ispaper%
Слабое напряжение батарейки: %f_easypower%
27 | 28 | -------------------------------------------------------------------------------- /site_icerest/devinfo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
%result%
Регистрационные
Заводской номер: %dev_id%
Фискализирован: %f_fiskal%
Дата фискализации: %n_dtfiskal%
ИНН: %n_inn%
Номер ЭКЛЗ: %n_ideklz%
Дата установки ЭКЛЗ: %n_dteklz%
Текущее время: %dt_date% %dt_time%
Оперативные
Смена открыта: %f_opensm%
Режим: %dev_mode%
Номер чека: %c_check%
Наличные в кассе: %c_sum%
Датчики
Механическая поломка: %fc_bracked%
Ошибка отрезчика: %fc_nocut%
Перегрев: %fc_hot%
Нет бумаги: %fc_notpaper%
Открыта крышка: %f_opencap%
Есть рулон: %f_ispaper%
Слабое напряжение батарейки: %f_easypower%
27 | 28 | -------------------------------------------------------------------------------- /site/help_egais.html: -------------------------------------------------------------------------------- 1 |

Описание работы с ЕГАИС

2 |

3 | ЕГАИС - это Единая государственная автоматизированная информационная система учета оборота алкогольной продукции. Торговля крепким алкоголем возможна только при наличии ключа ЭЦП JaCarta, который привязан к конкретному магазину. 4 | Внешне JaCarta выглядит как обычная флешка. Обратите внимание - в рабочем состоянии на JaCarta должна гореть лампочка. Если лампочка не горит - перезагрузите компьютер или вставьте ее в другое гнездо USB. 5 | Также необходимым требованием для продажи крепкого алкоголя является наличие сканера двухмерных штрихкодов.
Кроме этого, на компьютере должен быть запущен сервис (программа) для обмена данными с сервером ЕГАИС. 6 | Программа эта называется "Универсальный транспортный модуль", сокращенно УТМ. Работоспособность УТМ можно проверить, если зайти в пункт меню ЕГАИС. Если УТМ не работает, вы увидите соответствующую надпись. 7 | Можно попробовать перезапустить сервис. Для этого в меню "Сервис" нужно выбрать пункт "Перезапуск ЕГАИС". 8 |

9 |

Продажа крепкого алкоголя

10 |

11 | Продажа крепкого алкоголя происходит следующим образом. Сначала вы считываете сканером обычный штрихкод на бутылке. Если в прайсе этот товар внесен как "АЛКОГОЛЬ", то программа запросит дополнительный код, который нужно считать 12 | 2D сканером с бутылки. Если код считан верно, то позиция появится в чеке. Повторно отбитую бутылку в чек добавлять нельзя, так как каждая бутылка содержит свою уникальную марку. После оплаты и распечатки основного чека, принтер 13 | чеков выдаст ЕГАИС чек, на котором будет распечатан QR-код со ссылкой на чек в интернете. 14 |

15 |

Подтверждение приходов

16 |

17 | Приходы на кассе прогружаются автоматически. Если у вас есть не подтвержденные документы, соответсвующее сообщение появится на экране. Для подтверждения нужно выбрать пункт меню "ЕГАИС" и нажать "Просмотр". 18 | В диалоговом окне выберите статус "Новые" и нажмите кнопку просмотр. На экране появится список не подтвержденных документов. Раскройте докумет, ознакомьтесь с его содержимым, сверьте с реальным документом. 19 | Если документа нет у вас на руках, созвонитесь с офисом и уточните объемы прихода. Если приход указан верно, выставьте статус "Закрыто", опрерацию "Подтвердить" 20 | и нажмите кнопку "Сохранить". В случае отказа от поставки, в статусе выставляйте "Отвергнуть". Документы автоматически уйдут поставщику. 21 |

22 | 23 | -------------------------------------------------------------------------------- /site_icerest/help_egais.html: -------------------------------------------------------------------------------- 1 |

Описание работы с ЕГАИС

2 |

3 | ЕГАИС - это Единая государственная автоматизированная информационная система учета оборота алкогольной продукции. Торговля крепким алкоголем возможна только при наличии ключа ЭЦП JaCarta, который привязан к конкретному магазину. 4 | Внешне JaCarta выглядит как обычная флешка. Обратите внимание - в рабочем состоянии на JaCarta должна гореть лампочка. Если лампочка не горит - перезагрузите компьютер или вставьте ее в другое гнездо USB. 5 | Также необходимым требованием для продажи крепкого алкоголя является наличие сканера двухмерных штрихкодов.
Кроме этого, на компьютере должен быть запущен сервис (программа) для обмена данными с сервером ЕГАИС. 6 | Программа эта называется "Универсальный транспортный модуль", сокращенно УТМ. Работоспособность УТМ можно проверить, если зайти в пункт меню ЕГАИС. Если УТМ не работает, вы увидите соответствующую надпись. 7 | Можно попробовать перезапустить сервис. Для этого в меню "Сервис" нужно выбрать пункт "Перезапуск ЕГАИС". 8 |

9 |

Продажа крепкого алкоголя

10 |

11 | Продажа крепкого алкоголя происходит следующим образом. Сначала вы считываете сканером обычный штрихкод на бутылке. Если в прайсе этот товар внесен как "АЛКОГОЛЬ", то программа запросит дополнительный код, который нужно считать 12 | 2D сканером с бутылки. Если код считан верно, то позиция появится в чеке. Повторно отбитую бутылку в чек добавлять нельзя, так как каждая бутылка содержит свою уникальную марку. После оплаты и распечатки основного чека, принтер 13 | чеков выдаст ЕГАИС чек, на котором будет распечатан QR-код со ссылкой на чек в интернете. 14 |

15 |

Подтверждение приходов

16 |

17 | Приходы на кассе прогружаются автоматически. Если у вас есть не подтвержденные документы, соответсвующее сообщение появится на экране. Для подтверждения нужно выбрать пункт меню "ЕГАИС" и нажать "Просмотр". 18 | В диалоговом окне выберите статус "Новые" и нажмите кнопку просмотр. На экране появится список не подтвержденных документов. Раскройте докумет, ознакомьтесь с его содержимым, сверьте с реальным документом. 19 | Если документа нет у вас на руках, созвонитесь с офисом и уточните объемы прихода. Если приход указан верно, выставьте статус "Закрыто", опрерацию "Подтвердить" 20 | и нажмите кнопку "Сохранить". В случае отказа от поставки, в статусе выставляйте "Отвергнуть". Документы автоматически уйдут поставщику. 21 |

22 | 23 | -------------------------------------------------------------------------------- /clientIceRest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | 4 | """ 5 | Web Client for IceServ 6 | License GPL 7 | writed by Romanenko Ruslan 8 | redeyser@gmail.com 9 | """ 10 | import httplib, urllib 11 | import my 12 | import json 13 | import os 14 | 15 | _LIMIT=100 16 | 17 | class IceRestClient: 18 | 19 | def __init__(self,db): 20 | self.db=db 21 | self.server_port=int(self.db.sets['server_port'])+2 22 | self.server_ip=self.db.sets['icerest_ip'] 23 | self.idplace=self.db.sets['idplace'] 24 | self.nkassa=self.db.sets['nkassa'] 25 | 26 | def connect(self): 27 | #print "connect:",self.server_ip,self.server_port 28 | try: 29 | self.conn = httplib.HTTPConnection("%s:%d" % (self.server_ip,self.server_port)) 30 | return True 31 | except: 32 | print "not connect" 33 | return False 34 | 35 | def get(self,_type,page,params): 36 | self.data="" 37 | #print _type,page,params 38 | if not self.connect(): 39 | print "error connect" 40 | return False 41 | if _type=='GET': 42 | p='_user=kassa1&_password=1' 43 | for k,v in params.items(): 44 | if p!='': 45 | p+='&' 46 | p+="%s=%s" %(k,v) 47 | page=page+"?"+p 48 | params=urllib.urlencode(params) 49 | headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/xml"} 50 | try: 51 | self.conn.request(_type,page,params,headers) 52 | response = self.conn.getresponse() 53 | if response.status!=200: 54 | print "error_status" 55 | return False 56 | self.data=response.read() 57 | except: 58 | print "error get data" 59 | return False 60 | finally: 61 | self.conn.close() 62 | return True 63 | 64 | def get_zakaz_list(self): 65 | if not self.get('GET','/zakaz/list',{}): 66 | return False 67 | self.zakaz=json.loads(self.data) 68 | return True 69 | 70 | def block_zakaz(self,id): 71 | if not self.get('GET','/zakaz/block',{'id':id}): 72 | return False 73 | d=json.loads(self.data) 74 | return d['result'] 75 | 76 | def unblock_zakaz(self,id): 77 | if not self.get('GET','/zakaz/block',{'id':id,'unblock':1}): 78 | return False 79 | d=json.loads(self.data) 80 | return d['result'] 81 | 82 | def clear_zakaz(self,id): 83 | if not self.get('GET','/zakaz/clear',{'id':id}): 84 | return False 85 | d=json.loads(self.data) 86 | return d['result'] 87 | 88 | -------------------------------------------------------------------------------- /site/js/icecash.js: -------------------------------------------------------------------------------- 1 | 2 | function showdoc(d){ 3 | content=_getdata("/help?id="+d); 4 | doctext.innerHTML=content; 5 | doc.hidden=false; 6 | } 7 | function edit_user(iduser){ 8 | ed_content=_getdata("/user?iduser="+iduser); 9 | ed_user.innerHTML="
Редактирование пользователя
"+ed_content; 10 | ed_user.hidden=false; 11 | } 12 | 13 | function edit_sets(group){ 14 | ed_content=_getdata("/sets_get?group="+group); 15 | ed_sets.innerHTML="
Редактирование настроек
"+ed_content; 16 | ed_sets.hidden=false; 17 | } 18 | 19 | function edit_autosets(){ 20 | ed_content=_getdata("/sets/autosets"); 21 | ed_sets.innerHTML="
Редактирование настроек
"+ed_content; 22 | ed_sets.hidden=false; 23 | } 24 | 25 | function ch_dev(v){ 26 | ed_content=_getdata("/printer?idprinter="+v); 27 | if (ed_content!='0'){ 28 | ed_drv.innerHTML="
Подключение принтера
"+ed_content; 29 | ed_drv.hidden=false; 30 | } 31 | } 32 | function alert_message(head,content){ 33 | message_content.innerHTML="
"+head+"
"+content; 34 | message.hidden=false; 35 | // message_btn.focus(); 36 | } 37 | 38 | function edit_drv(level){ 39 | a=['dev','status','text'] 40 | url=['printer','printer/status','printer/textlines'] 41 | head=['Подключение принтера','Статус принтера','Текст в чеке'] 42 | cur=a.indexOf(level) 43 | 44 | ed_content=_getdata(url[cur]); 45 | 46 | if (ed_content=='0'){ 47 | alert_message('Ошибка','Драйвер принтеров не отвечает
Проверьте сервис DTPrint '); 48 | return; 49 | } 50 | if (ed_content.substr(0,1)==":"){ 51 | alert_message('Ошибка драйвера',ed_content); 52 | return; 53 | } 54 | ed_drv.innerHTML="
"+head[cur]+"
"+ed_content; 55 | ed_drv.hidden=false; 56 | return; 57 | } 58 | 59 | function cmd_autocreate(){ 60 | result=_postdata("/cmd_autocreate",["printer"],["Fprint"]); 61 | if (result=="0"){ 62 | message_content.innerHTML="
Предупреждение
"+"Новые устройсва не найдены"; 63 | message.hidden=false; 64 | }else{ 65 | edit_drv("dev"); 66 | } 67 | } 68 | 69 | function cmd_prn_setcurdatetime(){ 70 | result=_postdata("/cmd/prn_setcurdatetime",["printer"],["Fprint"]); 71 | alert(result); 72 | if (result.substr(0,1)==":"){ 73 | alert_message('Ошибка драйвера',result); 74 | return; 75 | }else{ 76 | edit_drv("dev"); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /site/ed_device.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 42 | 43 | 44 | 47 | 48 | 60 | 61 |
Принтер: 7 | 10 |
Тип принтера: %type_device%
Модель: %vendor%
Ширина (симв): %width%
Ширина (точ): %dpi%
Скорость: %speed%
Пароль польз.:
Пароль админ.:
37 | 38 | 40 | 41 |
45 | 46 |
49 | 50 | 51 | 52 | 53 | 54 | 57 | 58 |
%result%
Номер: %dev_id%
Время: %dt_date% %dt_time%
55 | 56 |
59 |
62 |
63 | -------------------------------------------------------------------------------- /utils/.vimrc: -------------------------------------------------------------------------------- 1 | set autoindent 2 | set tabstop=4 3 | set softtabstop=4 4 | set shiftwidth=4 5 | set smarttab 6 | set expandtab 7 | colors desert 8 | syntax on 9 | set background=dark 10 | set ignorecase 11 | set smartcase 12 | set hlsearch 13 | set incsearch 14 | set nowrap 15 | set listchars+=precedes:<,extends:> 16 | set sidescroll=5 17 | set sidescrolloff=5 18 | set guifont=terminus 19 | 20 | " автодополнение фигурной скобки (так, как я люблю :) 21 | imap { {}O 22 | "imap bi 23 | nmap i#doom_changed :read !date J 24 | imap #doom_changed :read !date J 25 | "nmap 0d4l$ 26 | "nmap 0i$ 27 | " автодополнение по Control+Space 28 | imap 29 | 30 | " 'умный' Home 31 | nmap ^ 32 | imap I 33 | 34 | " выход без сохранения 35 | imap :q! 36 | nmap :q! 37 | 38 | " выход с сохранением 39 | imap :wq 40 | nmap :wq 41 | 42 | " сохранение текущего буфера 43 | imap :wa 44 | nmap :w 45 | 46 | " сохранение всех буферов 47 | "imap :waa 48 | "nmap :wa 49 | 50 | " список буферов 51 | "imap :buffers 52 | "nmap :buffers 53 | 54 | " закрыть буфер 55 | imap :bda 56 | nmap :bd 57 | 58 | " открыть буфер 59 | imap :e 60 | nmap :e 61 | 62 | " следующий буфер 63 | imap :bn!a 64 | nmap :bn! 65 | 66 | " предыдущий буфер 67 | imap :bp!a 68 | nmap :bp! 69 | 70 | "создать вкладку 71 | imap :tabnewa 72 | nmap :tabnew 73 | 74 | "закрыть вкладку 75 | "imap c :tabca 76 | "nmap c :tabc 77 | 78 | "Следующая вкладка 79 | imap :tabnexta 80 | nmap :tabnext 81 | "Предыдущая вкладка 82 | imap :tabpreva 83 | nmap :tabprev 84 | 85 | "Разбить экран 86 | imap :!./% 87 | nmap :!./% 88 | imap s 89 | nmap s 90 | 91 | "Сместить экран 92 | imap 4+ 93 | nmap 4+ 94 | imap 4- 95 | nmap 4- 96 | imap 4< 97 | nmap 4< 98 | imap 4> 99 | nmap 4> 100 | 101 | 102 | "Навигация 103 | imap j 104 | nmap j 105 | imap k 106 | nmap k 107 | imap h 108 | nmap h 109 | imap l 110 | nmap l 111 | 112 | " вкл/выкл отображения номеров строк 113 | imap :setnu!a 114 | nmap :setnu! 115 | -------------------------------------------------------------------------------- /site_icerest/ed_device.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 42 | 43 | 44 | 47 | 48 | 60 | 61 |
Принтер: 7 | 10 |
Тип принтера: %type_device%
Модель: %vendor%
Ширина (симв): %width%
Ширина (точ): %dpi%
Скорость: %speed%
Пароль польз.:
Пароль админ.:
37 | 38 | 40 | 41 |
45 | 46 |
49 | 50 | 51 | 52 | 53 | 54 | 57 | 58 |
%result%
Номер: %dev_id%
Время: %dt_date% %dt_time%
55 | 56 |
59 |
62 |
63 | -------------------------------------------------------------------------------- /bsIceCash.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf8 -*- 3 | # IceBonus client v 0.001 4 | import string 5 | import skserv 6 | import sys 7 | import time 8 | import os 9 | 10 | const_error=1 11 | const_error_connect=2 12 | const_error_wait=3 13 | 14 | CARD_DISCONT=2 15 | CARD_CERT=1 16 | CARD_BONUS=0 17 | 18 | class SkClient(skserv.SockClient): 19 | def run(self): 20 | accept=self.mrecv() 21 | if accept==skserv.msg_err: 22 | return 0 23 | lines = sys.stdin.readlines() 24 | error=0 25 | for line in lines: 26 | self.msend(line); 27 | error=self.mrecv() 28 | print error 29 | if str(error)==skserv.msg_err: 30 | break 31 | return 1 32 | 33 | class bsIceCash: 34 | def __init__(self,place,nkassa,addr,port): 35 | self.addr=addr 36 | self.port=port 37 | self.place=place 38 | self.nkassa=nkassa 39 | self.sc=None 40 | 41 | def connect(self): 42 | try: 43 | self.sc=SkClient(self.addr,self.port) 44 | self.data=self.sc.mrecv() 45 | if self.data=='ok': 46 | return True 47 | else: 48 | return False 49 | except: 50 | self.sc=None 51 | print "error connect" 52 | return False 53 | 54 | def close(self): 55 | if self.sc!=None: 56 | self.sc.close() 57 | 58 | def cmd(self,_cmd,_card,_summa=0,_ncheck=0,_idtrsc=0): 59 | if self.sc==None: 60 | return False 61 | arr=[_cmd,_card,str(self.place),str(self.nkassa),str(_ncheck),str(_idtrsc),str(_summa)] 62 | msg=skserv.separator.join(arr) 63 | #print msg 64 | self.sc.msend(msg) 65 | self.data=self.sc.mrecv() 66 | if len(self.data)==0: 67 | return False 68 | else: 69 | return True 70 | 71 | def cmd_ping(self): 72 | return self.cmd("ping","0") 73 | 74 | def cmd_info(self,_card): 75 | self.info={} 76 | fd=['id','shk','name_f','name_i','name_o','type','discount','dtborn','off','sum','dedproc','addproc'] 77 | result = self.cmd("info",_card) 78 | if result: 79 | data=self.data.split(skserv.separator) 80 | if len(data)<11: 81 | return False 82 | for i in range(12): 83 | self.info[fd[i]]=data[i] 84 | return True 85 | 86 | def cmd_addsum(self,_card,_sum,_ncheck,_idtrsc): 87 | return self.cmd("addsum",_card,_sum,_ncheck,_idtrsc) 88 | 89 | def cmd_dedsum(self,_card,_sum,_ncheck,_idtrsc): 90 | return self.cmd("dedsum",_card,_sum,_ncheck,_idtrsc) 91 | 92 | def cmd_closesum(self,_card): 93 | return self.cmd("closesum",_card) 94 | 95 | -------------------------------------------------------------------------------- /DTPrint/lsusb.py: -------------------------------------------------------------------------------- 1 | import os; 2 | import sys; 3 | import re; 4 | import subprocess 5 | PIPE = subprocess.PIPE 6 | 7 | def lsdir_old(dir): 8 | cmd='ls %s' % dir 9 | p = subprocess.Popen(cmd, shell=True, stdout=PIPE) 10 | files=p.stdout.read().split("\n") 11 | del files[len(files)-1] 12 | return files 13 | 14 | def lsdir(dir): 15 | return os.listdir(dir) 16 | 17 | def lsserial_old(f=""): 18 | cmd='ls /dev/ttyS*' 19 | if f!="": 20 | f=" | grep %s" % f 21 | p = subprocess.Popen(cmd, shell=True, stdout=PIPE) 22 | lsserial1=p.stdout.read().split("\n") 23 | del lsserial1[len(lsserial1)-1] 24 | cmd='ls /dev/serial/by-id/*'+f 25 | p = subprocess.Popen(cmd, shell=True, stdout=PIPE) 26 | lsserial2=p.stdout.read().split("\n") 27 | del lsserial2[len(lsserial2)-1] 28 | if f=="": 29 | return lsserial1+lsserial2 30 | else: 31 | return lsserial2 32 | 33 | 34 | def lsserial(filter=""): 35 | """Return list of persistent serial ports with detachable serial ports (USB) filter applied.""" 36 | persistent = [f for f in map(lambda filename: os.path.join('/dev', filename), os.listdir('/dev')) if (not os.path.isdir(f) and ('ttyS' in f))] 37 | detachable = [f for f in map(lambda filename: os.path.join('/dev/serial/by-id', filename), os.listdir('/dev/serial/by-id'))] if os.path.isdir('/dev/serial/by-id') else [] 38 | return (persistent + detachable) if (filter == "") else detachable 39 | 40 | 41 | def lsusb(): 42 | cmd='lsusb' 43 | p = subprocess.Popen(cmd, shell=True, stdout=PIPE) 44 | lsusb=p.stdout.read().split("\n") 45 | devices={} 46 | for l in lsusb: 47 | if l!='': 48 | r=re.search("ID (.+?) ",l) 49 | uid=r.group(1) 50 | if not devices.has_key(uid): 51 | p = subprocess.Popen("lsusb -vvv -d %s" % uid, shell=True, stdout=PIPE) 52 | lsv=p.stdout.read() 53 | r=re.search("idVendor *0x(.{4})",lsv) 54 | idvendor=r.group(1) 55 | r=re.search("idProduct *0x(.{4})",lsv) 56 | idproduct=r.group(1) 57 | r=re.search("iManufacturer *\d+ (.*?)\n",lsv) 58 | vendor=r.group(1) 59 | r=re.search("iProduct *\d+ (.*?)\n",lsv) 60 | product=r.group(1) 61 | epout="" 62 | epin="" 63 | interface="" 64 | r=re.search("iInterface *(\d*)",lsv) 65 | if r!=None: 66 | interface=r.group(1) 67 | r=re.search("bEndpointAddress *(0x.*?) .*?OUT\n",lsv) 68 | if r!=None: 69 | epout=r.group(1) 70 | r=re.search("bEndpointAddress *(0x.*?) .*?IN\n",lsv) 71 | if r!=None: 72 | epin=r.group(1) 73 | devices[uid]=[idvendor,idproduct,vendor,product,interface,epin,epout] 74 | return devices 75 | -------------------------------------------------------------------------------- /prizeIceCash.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf8 -*- 3 | # IcePrize client v 0.001 4 | import string 5 | import skserv 6 | import sys 7 | import time 8 | import os 9 | 10 | const_error=1 11 | const_error_connect=2 12 | const_error_wait=3 13 | 14 | text_separator=";;" 15 | msg_err="err" 16 | 17 | class SkClient(skserv.SockClient): 18 | def run(self): 19 | accept=self.mrecv() 20 | if accept==skserv.msg_err: 21 | return 0 22 | lines = sys.stdin.readlines() 23 | error=0 24 | for line in lines: 25 | self.msend(line); 26 | error=self.mrecv() 27 | print error 28 | if str(error)==skserv.msg_err: 29 | break 30 | return 1 31 | 32 | class prizeIceCash: 33 | def __init__(self,idsystem,idplace,nkassa,addr,port): 34 | self.addr=addr 35 | self.port=port 36 | self.idsystem=idsystem 37 | self.idplace=idplace 38 | self.nkassa=nkassa 39 | 40 | def connect(self): 41 | try: 42 | self.sc=SkClient(self.addr,self.port) 43 | self.data=self.sc.mrecv() 44 | #print "connect prize %s %s" % (self.addr,self.port) 45 | if self.data=='ok': 46 | return True 47 | else: 48 | return False 49 | except: 50 | self.sc=None 51 | print "error connect" 52 | return False 53 | 54 | def close(self): 55 | if self.sc!=None: 56 | self.sc.close() 57 | 58 | def cmd(self,_cmd,_params=[]): 59 | if self.sc==None: 60 | return False 61 | msg=skserv.separator.join([_cmd]+_params) 62 | #print msg 63 | self.sc.msend(msg) 64 | self.data=self.sc.mrecv() 65 | if len(self.data)==0: 66 | return False 67 | else: 68 | if self.data==msg_err: 69 | return False 70 | return True 71 | 72 | def cmd_info(self): 73 | result = self.cmd("info",[self.idsystem]) 74 | if result: 75 | self.info=self.data.replace(text_separator," ").decode("utf8") 76 | else: 77 | self.info="" 78 | return result 79 | 80 | def cmd_gen(self,ncheck,idtrsc,summa): 81 | result=self.cmd("gen",[str(self.idsystem),str(self.idplace),str(self.nkassa),str(ncheck),str(idtrsc),str(summa)]) 82 | if result: 83 | keys=["idtrsc","idprize","type","idtov"] 84 | self.gen=dict(zip(keys,self.data.split(skserv.separator))) 85 | self.gen['idtov']=self.gen['idtov'].decode('utf8') 86 | else: 87 | self.gen={} 88 | print self.gen 89 | return result 90 | 91 | def cmd_close(self,idtrsc=None): 92 | if idtrsc==None: 93 | idtrsc=self.gen['idtrsc'] 94 | result = self.cmd("close",[str(self.idsystem),str(idtrsc)]) 95 | if result: 96 | pass 97 | #print self.data 98 | else: 99 | pass 100 | return result 101 | 102 | -------------------------------------------------------------------------------- /DTPrint/site/base.css: -------------------------------------------------------------------------------- 1 | /* CSS WEB SERVICE */ 2 | 3 | h1 { 4 | color:#a0a0a0; 5 | } 6 | 7 | 8 | body { 9 | margin: 0; 10 | background: #303030; 11 | color:#a0a0a0; 12 | margin:20px; 13 | } 14 | a { 15 | text-decoration:none; 16 | margin-right:5px; 17 | margin-top:5px; 18 | padding:5px; 19 | color:#a0a0a0; 20 | background:#101010; 21 | border: 1px solid #000; 22 | border-top:1px solid #606060; 23 | border-left:1px solid #606060; 24 | border-radius:5px; 25 | } 26 | a:hover { 27 | color:#70e080; 28 | text-shadow: 0px 0px 10px #006000; 29 | } 30 | 31 | .leftstr, .rightstr { 32 | float: left; 33 | width: 25%; 34 | } 35 | 36 | .rightstr { 37 | text-align: right; 38 | } 39 | .backlight { 40 | background:#333; 41 | } 42 | .tb td { 43 | padding:3px; 44 | border-style:solid; 45 | border-collapse:separate; 46 | border: 1px solid #303030; 47 | border-bottom:1px solid #606060; 48 | border-right:1px solid #606060; 49 | background-color:#000; 50 | } 51 | .tb td:hover { 52 | background-color:#101010; 53 | } 54 | .tb th { 55 | padding:3px; 56 | border-style:solid; 57 | border-collapse:separate; 58 | border: 1px solid #000; 59 | background-color:#303030; 60 | } 61 | .window { 62 | background: #404040; 63 | border: 1px solid #303030; 64 | border-top:1px solid #505050; 65 | border-left:1px solid #505050; 66 | border-radius:5px; 67 | box-shadow:5px 5px 10px 0px #000; 68 | margin-right:10px; 69 | margin-top:10px; 70 | padding:10px; 71 | } 72 | .menu { 73 | margin: 0px; 74 | padding: 5px; 75 | width:150px; 76 | text-align:left; 77 | font-size:12pt; 78 | min-height:40px; 79 | } 80 | .w800 { 81 | width: 800px; 82 | } 83 | .w400 { 84 | width: 400px; 85 | } 86 | .w200 { 87 | width: 200px; 88 | } 89 | .red { 90 | color:#30c0a0; 91 | text-shadow: 0 0px 5px #000080; 92 | } 93 | .green { 94 | color:#30c070; 95 | text-shadow: 0 0px 5px #00a000; 96 | } 97 | .white { 98 | color:#a0a0a0; 99 | } 100 | .big { 101 | font-size:18pt; 102 | } 103 | .small { 104 | font-size:8pt; 105 | } 106 | .marg { 107 | margin:20px; 108 | } 109 | .scroll { 110 | overflow:auto; 111 | } 112 | .padd { 113 | padding:10px; 114 | } 115 | .vcenter { 116 | vertical-align:middle; 117 | } 118 | .but:hover { 119 | text-decoration: none; 120 | color:#70e080; 121 | text-shadow: 0px 0px 10px #006000; 122 | } 123 | .but { 124 | color:#d0d0d0; 125 | background:#101010; 126 | border: 1px solid #000; 127 | border-top:1px solid #606060; 128 | border-left:1px solid #606060; 129 | border-radius:5px; 130 | text-shadow: 0px 0px 10px #000000; 131 | padding:2px; 132 | } 133 | .itext { 134 | border-radius:5px; 135 | background:#000; 136 | border: 1px solid #303030; 137 | border-bottom:1px solid #606060; 138 | border-right:1px solid #606060; 139 | border-radius:5px; 140 | padding:2px; 141 | margin:5px; 142 | font-size: 10pt; 143 | } 144 | .itext:hover { 145 | background-color:#101010; 146 | } 147 | 148 | -------------------------------------------------------------------------------- /utils/desert.vim: -------------------------------------------------------------------------------- 1 | " Vim color file 2 | " Maintainer: Hans Fugal 3 | " Last Change: $Date: 2004/06/13 19:30:30 $ 4 | " Last Change: $Date: 2004/06/13 19:30:30 $ 5 | " URL: http://hans.fugal.net/vim/colors/desert.vim 6 | " Version: $Id: desert.vim,v 1.1 2004/06/13 19:30:30 vimboss Exp $ 7 | 8 | " cool help screens 9 | " :he group-name 10 | " :he highlight-groups 11 | " :he cterm-colors 12 | 13 | set background=dark 14 | if version > 580 15 | " no guarantees for version 5.8 and below, but this makes it stop 16 | " complaining 17 | hi clear 18 | if exists("syntax_on") 19 | syntax reset 20 | endif 21 | endif 22 | let g:colors_name="desert" 23 | 24 | hi Normal guifg=White guibg=grey20 25 | 26 | " highlight groups 27 | hi Cursor guibg=khaki guifg=slategrey 28 | "hi CursorIM 29 | "hi Directory 30 | "hi DiffAdd 31 | "hi DiffChange 32 | "hi DiffDelete 33 | "hi DiffText 34 | "hi ErrorMsg 35 | hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none 36 | hi Folded guibg=grey30 guifg=gold 37 | hi FoldColumn guibg=grey30 guifg=tan 38 | hi IncSearch guifg=slategrey guibg=khaki 39 | "hi LineNr 40 | hi ModeMsg guifg=goldenrod 41 | hi MoreMsg guifg=SeaGreen 42 | hi NonText guifg=LightBlue guibg=grey30 43 | hi Question guifg=springgreen 44 | hi Search guibg=peru guifg=wheat 45 | hi SpecialKey guifg=yellowgreen 46 | hi StatusLine guibg=#c2bfa5 guifg=black gui=none 47 | hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none 48 | hi Title guifg=indianred 49 | hi Visual gui=none guifg=khaki guibg=olivedrab 50 | "hi VisualNOS 51 | hi WarningMsg guifg=salmon 52 | "hi WildMenu 53 | "hi Menu 54 | "hi Scrollbar 55 | "hi Tooltip 56 | 57 | " syntax highlighting groups 58 | hi Comment guifg=SkyBlue 59 | hi Constant guifg=#ffa0a0 60 | hi Identifier guifg=palegreen 61 | hi Statement guifg=khaki 62 | hi PreProc guifg=indianred 63 | hi Type guifg=darkkhaki 64 | hi Special guifg=navajowhite 65 | "hi Underlined 66 | hi Ignore guifg=grey40 67 | "hi Error 68 | hi Todo guifg=orangered guibg=yellow2 69 | 70 | " color terminal definitions 71 | hi SpecialKey ctermfg=green 72 | hi NonText cterm=bold ctermfg=darkblue 73 | hi Directory ctermfg=darkcyan 74 | hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1 75 | hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green 76 | hi Search cterm=NONE ctermfg=grey ctermbg=blue 77 | hi MoreMsg ctermfg=green 78 | hi ModeMsg cterm=NONE ctermfg=brown 79 | hi LineNr ctermfg=3 80 | hi Question ctermfg=green 81 | hi StatusLine cterm=bold,reverse 82 | hi StatusLineNC cterm=reverse 83 | hi VertSplit cterm=reverse 84 | hi Title ctermfg=darkred 85 | hi Visual cterm=reverse 86 | hi VisualNOS cterm=bold,underline 87 | hi WarningMsg ctermfg=1 88 | hi WildMenu ctermfg=0 ctermbg=3 89 | hi Folded ctermfg=darkgrey ctermbg=NONE 90 | hi FoldColumn ctermfg=darkgrey ctermbg=NONE 91 | hi DiffAdd ctermbg=4 92 | hi DiffChange ctermbg=5 93 | hi DiffDelete cterm=bold ctermfg=4 ctermbg=6 94 | hi DiffText cterm=bold ctermbg=1 95 | hi Comment ctermfg=5 96 | hi Constant ctermfg=darkgreen 97 | hi Special ctermfg=brown 98 | hi Identifier ctermfg=darkcyan 99 | hi Statement ctermfg=brown 100 | hi PreProc ctermfg=darkred 101 | hi Type ctermfg=darkcyan 102 | hi Underlined cterm=underline ctermfg=darkmagenta 103 | hi Ignore cterm=bold ctermfg=7 104 | hi Ignore ctermfg=darkgrey 105 | hi Error cterm=bold ctermfg=7 ctermbg=1 106 | 107 | 108 | "vim: sw=4 109 | -------------------------------------------------------------------------------- /zIceCash.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | # version 2.000 4 | # Zet for IceCash 5 | """ 6 | Логика работы с Zet отчетом 7 | """ 8 | import datetime 9 | 10 | class zIceCash: 11 | def __init__(self,db): 12 | self.db = db 13 | 14 | def _calc(self,full=True,idbegin=None,idend=None): 15 | self.db.ZetLast=None 16 | if idbegin==None: 17 | if self.db._Zet_last(): 18 | idbegin = self.db.ZetLast['end_ncheck']+1 19 | else: 20 | idbegin=None 21 | if not self.db._trsc_calc(idbegin,idend,full=full): 22 | return False 23 | if self.db.Zet['c_sale']==0: 24 | return False 25 | return True 26 | 27 | def _Z_recalc(self,id): 28 | self.db._Zet_get(id) 29 | id0=int(self.db.Zet['begin_ncheck']) 30 | id1=int(self.db.Zet['end_ncheck']) 31 | if self._calc(idbegin=id0,idend=id1): 32 | self.db.Zet['up']=0 33 | r=self.db._Zet_update(id) 34 | return r 35 | else: 36 | return False 37 | 38 | def _Z(self,idbegin=None,idend=None): 39 | if self._calc(idbegin=idbegin,idend=idend): 40 | if self.db.ZetLast!=None: 41 | number=self.db.ZetLast['number'] 42 | else: 43 | number=0 44 | self.db.Zet['number']=number+1 45 | self.db.Zet['idplace']=self.db.idplace 46 | self.db.Zet['nkassa']=self.db.nkassa 47 | r=self.db._Zet_add() 48 | if r: 49 | pass 50 | #Автоматическая выгрузка файла 51 | #self._get_xml(self.db.ZetID) 52 | #self._save_xml() 53 | return r 54 | else: 55 | return False 56 | 57 | def _gets(self,cur=True,up=None): 58 | cur_month_begin=datetime.date.today().replace(day=1) 59 | cur_month_end=None 60 | if not cur: 61 | day=datetime.timedelta(days=1) 62 | cur_month_end=cur_month_begin-day 63 | cur_month_begin=cur_month_end.replace(day=1) 64 | return self.db._Zet_gets(cur_month_begin,cur_month_end,up=up) 65 | 66 | def _get_xml(self,id): 67 | self.XML_Zet="" 68 | if not self.db._Zet_get_html(id): 69 | return False 70 | head="" 71 | for k,v in self.db.Zet.items(): 72 | x="<%s>%s\n" % (k,v,k) 73 | head+=x 74 | 75 | body="" 76 | for n in self.db.Zet_ct: 77 | hline=self.db.tb_Zet_cont.result2values(n) 78 | sline="" 79 | for k,v in hline.items(): 80 | sline+="\t<%s>%s\n" % (k,v,k) 81 | x="\n%s\n\n" % (sline) 82 | body+=x 83 | 84 | self.XML_Zet='\n\n\n\n'+head+"\n\n\n"+body+"\n\n" 85 | return True 86 | 87 | def _save_xml(self): 88 | path='site/files/upload/' 89 | idplace=self.db.Zet['idplace'] 90 | nkassa=self.db.Zet['nkassa'] 91 | id=self.db.Zet['id'] 92 | dt=self.db.Zet['date'] 93 | fn=path+"zet_%s_%s_%s_%s.xml" % (idplace,nkassa,id,dt) 94 | f=open(fn,"w") 95 | f.write(self.XML_Zet) 96 | f.close() 97 | return fn 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/usb/_debug.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | __author__ = 'Wander Lairson Costa' 30 | 31 | __all__ = ['methodtrace', 'functiontrace'] 32 | 33 | import logging 34 | import usb._interop as _interop 35 | 36 | _enable_tracing = False 37 | 38 | def enable_tracing(enable): 39 | global _enable_tracing 40 | _enable_tracing = enable 41 | 42 | def _trace_function_call(logger, fname, *args, **named_args): 43 | logger.debug( 44 | # TODO: check if 'f' is a method or a free function 45 | fname + '(' + \ 46 | ', '.join((str(val) for val in args)) + \ 47 | ', '.join((name + '=' + str(val) for name, val in named_args.items())) + ')' 48 | ) 49 | 50 | # decorator for methods calls tracing 51 | def methodtrace(logger): 52 | def decorator_logging(f): 53 | if not _enable_tracing: 54 | return f 55 | def do_trace(*args, **named_args): 56 | # this if is just a optimization to avoid unecessary string formatting 57 | if logging.DEBUG >= logger.getEffectiveLevel(): 58 | fn = type(args[0]).__name__ + '.' + f.__name__ 59 | _trace_function_call(logger, fn, *args[1:], **named_args) 60 | return f(*args, **named_args) 61 | _interop._update_wrapper(do_trace, f) 62 | return do_trace 63 | return decorator_logging 64 | 65 | # decorator for methods calls tracing 66 | def functiontrace(logger): 67 | def decorator_logging(f): 68 | if not _enable_tracing: 69 | return f 70 | def do_trace(*args, **named_args): 71 | # this if is just a optimization to avoid unecessary string formatting 72 | if logging.DEBUG >= logger.getEffectiveLevel(): 73 | _trace_function_call(logger, f.__name__, *args, **named_args) 74 | return f(*args, **named_args) 75 | _interop._update_wrapper(do_trace, f) 76 | return do_trace 77 | return decorator_logging 78 | -------------------------------------------------------------------------------- /DTPrint/site/print.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Принтер: 5 | 8 | Команда: 9 | 12 | Номер: 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 32 | 33 | 50 | 51 | 78 | 79 |
80 | 81 |
82 | Программа печати 83 | 84 | 85 |
NКомандаПараметры
86 |
87 | 88 |
89 | XML файл 90 | 91 |
92 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-i686-2.7/usb/_debug.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | __author__ = 'Wander Lairson Costa' 30 | 31 | __all__ = ['methodtrace', 'functiontrace'] 32 | 33 | import logging 34 | import usb._interop as _interop 35 | 36 | _enable_tracing = False 37 | 38 | def enable_tracing(enable): 39 | global _enable_tracing 40 | _enable_tracing = enable 41 | 42 | def _trace_function_call(logger, fname, *args, **named_args): 43 | logger.debug( 44 | # TODO: check if 'f' is a method or a free function 45 | fname + '(' + \ 46 | ', '.join((str(val) for val in args)) + \ 47 | ', '.join((name + '=' + str(val) for name, val in named_args.items())) + ')' 48 | ) 49 | 50 | # decorator for methods calls tracing 51 | def methodtrace(logger): 52 | def decorator_logging(f): 53 | if not _enable_tracing: 54 | return f 55 | def do_trace(*args, **named_args): 56 | # this if is just a optimization to avoid unecessary string formatting 57 | if logging.DEBUG >= logger.getEffectiveLevel(): 58 | fn = type(args[0]).__name__ + '.' + f.__name__ 59 | _trace_function_call(logger, fn, *args[1:], **named_args) 60 | return f(*args, **named_args) 61 | _interop._update_wrapper(do_trace, f) 62 | return do_trace 63 | return decorator_logging 64 | 65 | # decorator for methods calls tracing 66 | def functiontrace(logger): 67 | def decorator_logging(f): 68 | if not _enable_tracing: 69 | return f 70 | def do_trace(*args, **named_args): 71 | # this if is just a optimization to avoid unecessary string formatting 72 | if logging.DEBUG >= logger.getEffectiveLevel(): 73 | _trace_function_call(logger, f.__name__, *args, **named_args) 74 | return f(*args, **named_args) 75 | _interop._update_wrapper(do_trace, f) 76 | return do_trace 77 | return decorator_logging 78 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-armv7l-2.7/usb/_debug.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | __author__ = 'Wander Lairson Costa' 30 | 31 | __all__ = ['methodtrace', 'functiontrace'] 32 | 33 | import logging 34 | import usb._interop as _interop 35 | 36 | _enable_tracing = False 37 | 38 | def enable_tracing(enable): 39 | global _enable_tracing 40 | _enable_tracing = enable 41 | 42 | def _trace_function_call(logger, fname, *args, **named_args): 43 | logger.debug( 44 | # TODO: check if 'f' is a method or a free function 45 | fname + '(' + \ 46 | ', '.join((str(val) for val in args)) + \ 47 | ', '.join((name + '=' + str(val) for name, val in named_args.items())) + ')' 48 | ) 49 | 50 | # decorator for methods calls tracing 51 | def methodtrace(logger): 52 | def decorator_logging(f): 53 | if not _enable_tracing: 54 | return f 55 | def do_trace(*args, **named_args): 56 | # this if is just a optimization to avoid unecessary string formatting 57 | if logging.DEBUG >= logger.getEffectiveLevel(): 58 | fn = type(args[0]).__name__ + '.' + f.__name__ 59 | _trace_function_call(logger, fn, *args[1:], **named_args) 60 | return f(*args, **named_args) 61 | _interop._update_wrapper(do_trace, f) 62 | return do_trace 63 | return decorator_logging 64 | 65 | # decorator for methods calls tracing 66 | def functiontrace(logger): 67 | def decorator_logging(f): 68 | if not _enable_tracing: 69 | return f 70 | def do_trace(*args, **named_args): 71 | # this if is just a optimization to avoid unecessary string formatting 72 | if logging.DEBUG >= logger.getEffectiveLevel(): 73 | _trace_function_call(logger, f.__name__, *args, **named_args) 74 | return f(*args, **named_args) 75 | _interop._update_wrapper(do_trace, f) 76 | return do_trace 77 | return decorator_logging 78 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-x86_64-2.7/usb/_debug.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | __author__ = 'Wander Lairson Costa' 30 | 31 | __all__ = ['methodtrace', 'functiontrace'] 32 | 33 | import logging 34 | import usb._interop as _interop 35 | 36 | _enable_tracing = False 37 | 38 | def enable_tracing(enable): 39 | global _enable_tracing 40 | _enable_tracing = enable 41 | 42 | def _trace_function_call(logger, fname, *args, **named_args): 43 | logger.debug( 44 | # TODO: check if 'f' is a method or a free function 45 | fname + '(' + \ 46 | ', '.join((str(val) for val in args)) + \ 47 | ', '.join((name + '=' + str(val) for name, val in named_args.items())) + ')' 48 | ) 49 | 50 | # decorator for methods calls tracing 51 | def methodtrace(logger): 52 | def decorator_logging(f): 53 | if not _enable_tracing: 54 | return f 55 | def do_trace(*args, **named_args): 56 | # this if is just a optimization to avoid unecessary string formatting 57 | if logging.DEBUG >= logger.getEffectiveLevel(): 58 | fn = type(args[0]).__name__ + '.' + f.__name__ 59 | _trace_function_call(logger, fn, *args[1:], **named_args) 60 | return f(*args, **named_args) 61 | _interop._update_wrapper(do_trace, f) 62 | return do_trace 63 | return decorator_logging 64 | 65 | # decorator for methods calls tracing 66 | def functiontrace(logger): 67 | def decorator_logging(f): 68 | if not _enable_tracing: 69 | return f 70 | def do_trace(*args, **named_args): 71 | # this if is just a optimization to avoid unecessary string formatting 72 | if logging.DEBUG >= logger.getEffectiveLevel(): 73 | _trace_function_call(logger, f.__name__, *args, **named_args) 74 | return f(*args, **named_args) 75 | _interop._update_wrapper(do_trace, f) 76 | return do_trace 77 | return decorator_logging 78 | -------------------------------------------------------------------------------- /site_icerest/autosets.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 20 | 21 | 22 | 28 | 29 | 30 | 36 | 37 | 38 | 44 | 45 | 46 | 52 | 53 | 54 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
Текущий принтер: %d_name%
Тип принтера: %d_devtype%
Скорость: %d_speed%
Текущий сканнер: 8 | 11 |
Печатать заголовок: 15 | 19 |
Переводить на летнее/зимнее время : 23 | 27 |
Автоматическое обнуление наличности : 31 | 35 |
Автоматическое открытие ящика : 39 | 43 |
Использовать нож : 47 | 51 |
Игнорировать ошибки : 55 | 59 |
Печатать номер чека : 63 | 67 |
76 |
77 | 78 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/usb/_lookup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Walker Inman 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""usb._lookups - Lookup tables for USB 30 | """ 31 | 32 | descriptors = { 33 | 0x1 : "Device", 34 | 0x2 : "Configuration", 35 | 0x3 : "String", 36 | 0x4 : "Interface", 37 | 0x5 : "Endpoint", 38 | 0x6 : "Device qualifier", 39 | 0x7 : "Other speed configuration", 40 | 0x8 : "Interface power", 41 | 0x9 : "OTG", 42 | 0xA : "Debug", 43 | 0xB : "Interface association", 44 | 0xC : "Security", 45 | 0xD : "Key", 46 | 0xE : "Encryption type", 47 | 0xF : "Binary device object store (BOS)", 48 | 0x10 : "Device capability", 49 | 0x11 : "Wireless endpoint companion", 50 | 0x30 : "SuperSpeed endpoint companion", 51 | } 52 | 53 | device_classes = { 54 | 0x0 : "Specified at interface", 55 | 0x2 : "Communications Device", 56 | 0x9 : "Hub", 57 | 0xF : "Personal Healthcare Device", 58 | 0xDC : "Diagnostic Device", 59 | 0xE0 : "Wireless Controller", 60 | 0xEF : "Miscellaneous", 61 | 0xFF : "Vendor-specific", 62 | } 63 | 64 | interface_classes = { 65 | 0x0 : "Reserved", 66 | 0x1 : "Audio", 67 | 0x2 : "CDC Communication", 68 | 0x3 : "Human Interface Device", 69 | 0x5 : "Physical", 70 | 0x6 : "Image", 71 | 0x7 : "Printer", 72 | 0x8 : "Mass Storage", 73 | 0x9 : "Hub", 74 | 0xA : "CDC Data", 75 | 0xB : "Smart Card", 76 | 0xD : "Content Security", 77 | 0xE : "Video", 78 | 0xF : "Personal Healthcare", 79 | 0xDC : "Diagnostic Device", 80 | 0xE0 : "Wireless Controller", 81 | 0xEF : "Miscellaneous", 82 | 0xFE : "Application Specific", 83 | 0xFF : "Vendor Specific", 84 | } 85 | 86 | ep_attributes = { 87 | 0x0 : "Control", 88 | 0x1 : "Isochronous", 89 | 0x2 : "Bulk", 90 | 0x3 : "Interrupt", 91 | } 92 | 93 | MAX_POWER_UNITS_USB2p0 = 2 # mA 94 | MAX_POWER_UNITS_USB_SUPERSPEED = 8 # mA 95 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/README.rst: -------------------------------------------------------------------------------- 1 | ======================================= 2 | PyUSB 1.0 - Easy USB access from Python 3 | ======================================= 4 | 5 | Introduction 6 | ============ 7 | 8 | The PyUSB module provides for Python easy access to the host 9 | machine's Universal Serial Bus (USB) system. 10 | 11 | Until 0.4 version, PyUSB used to be a thin wrapper over libusb. 12 | With 1.0 version, things changed considerably. Now PyUSB is an 13 | API rich, backend neutral Python USB module easy to use. 14 | 15 | As with most Python modules, PyUSB's documentation is based on Python 16 | doc strings and can therefore be manipulated by tools such as pydoc. 17 | 18 | You can also find a tutorial at: 19 | https://github.com/walac/pyusb/blob/master/docs/tutorial.rst. 20 | 21 | PyUSB is being developed and tested on Linux and Windows, but it should work 22 | fine on any platform running Python >= 2.4, ctypes and at least one of the 23 | builtin backends. 24 | 25 | PyUSB supports libusb 0.1, libusb 1.0 and OpenUSB, but the user does not need 26 | to worry about that, unless in some corner cases. 27 | 28 | If you have any question about PyUSB, you can use the PyUSB mailing list 29 | hosted in the SourceForge. In the PyUSB website (http://walac.github.io/pyusb) 30 | you can find instructions on how to subscribe to the mailing list. 31 | 32 | Installing PyUSB on GNU/Linux Systems 33 | ===================================== 34 | 35 | These instructions are for Debian-based systems. Instructions for 36 | other flavors of GNU/Linux should be similar. 37 | 38 | You will first need to install the following packages: 39 | 40 | 1) python (PyUSB is useless without it), version >= 2.4 41 | 2) At least one of the supported libraries (libusb 1.0, libusb 0.1 or OpenUSB) 42 | 3) If your Python version is < 2.5, you have to install ctypes as a separate 43 | package, because these versions of Python does not ship it. 44 | 45 | For example, the command:: 46 | 47 | $ sudo apt-get install python libusb-1.0-0 48 | 49 | should install all these packages on most Debian-based systems with 50 | access to the proper package repositories. 51 | 52 | Once the above packages are installed, you can install PyUSB 53 | with the command:: 54 | 55 | $ sudo python setup.py install 56 | 57 | Run it as root from within the same directory as this README file. 58 | 59 | You can also use `pip `_ to 60 | install PyUSB:: 61 | 62 | $ sudo pip install pyusb --pre 63 | 64 | Just bear in mind that you still follow to procedure to install the 65 | libusb library. 66 | 67 | Installing PyUSB on Windows 68 | =========================== 69 | 70 | Now that PyUSB is 100% written in Python, you install it on Windows 71 | in the same way you do on Linux:: 72 | 73 | python setup.py install 74 | 75 | If you get some kind of "command not found" error, make sure to add 76 | the Python install directory to your PATH environment variable or 77 | give the complete path to the Python interpreter. 78 | 79 | Remember that you need libusb (1.0 or 0.1) or OpenUSB running on your 80 | system. For Windows users, libusb 0.1 is provided through 81 | `libusb-win32 `_ 82 | package. Check the libusb website for updates 83 | (http://www.libusb.org). 84 | 85 | Reporting bugs/Submitting patches 86 | ================================= 87 | 88 | Some people have been sending patches and reporting bugs directly 89 | at my email. Please, do it through 90 | `github `_, I had a hardtime tracking 91 | their names to put them in the acknowledgments file. ;-) 92 | 93 | PS: this README file was based on the great Josh Lifton's one... ^_^ 94 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-i686-2.7/usb/_lookup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Walker Inman 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""usb._lookups - Lookup tables for USB 30 | """ 31 | 32 | descriptors = { 33 | 0x1 : "Device", 34 | 0x2 : "Configuration", 35 | 0x3 : "String", 36 | 0x4 : "Interface", 37 | 0x5 : "Endpoint", 38 | 0x6 : "Device qualifier", 39 | 0x7 : "Other speed configuration", 40 | 0x8 : "Interface power", 41 | 0x9 : "OTG", 42 | 0xA : "Debug", 43 | 0xB : "Interface association", 44 | 0xC : "Security", 45 | 0xD : "Key", 46 | 0xE : "Encryption type", 47 | 0xF : "Binary device object store (BOS)", 48 | 0x10 : "Device capability", 49 | 0x11 : "Wireless endpoint companion", 50 | 0x30 : "SuperSpeed endpoint companion", 51 | } 52 | 53 | device_classes = { 54 | 0x0 : "Specified at interface", 55 | 0x2 : "Communications Device", 56 | 0x9 : "Hub", 57 | 0xF : "Personal Healthcare Device", 58 | 0xDC : "Diagnostic Device", 59 | 0xE0 : "Wireless Controller", 60 | 0xEF : "Miscellaneous", 61 | 0xFF : "Vendor-specific", 62 | } 63 | 64 | interface_classes = { 65 | 0x0 : "Reserved", 66 | 0x1 : "Audio", 67 | 0x2 : "CDC Communication", 68 | 0x3 : "Human Interface Device", 69 | 0x5 : "Physical", 70 | 0x6 : "Image", 71 | 0x7 : "Printer", 72 | 0x8 : "Mass Storage", 73 | 0x9 : "Hub", 74 | 0xA : "CDC Data", 75 | 0xB : "Smart Card", 76 | 0xD : "Content Security", 77 | 0xE : "Video", 78 | 0xF : "Personal Healthcare", 79 | 0xDC : "Diagnostic Device", 80 | 0xE0 : "Wireless Controller", 81 | 0xEF : "Miscellaneous", 82 | 0xFE : "Application Specific", 83 | 0xFF : "Vendor Specific", 84 | } 85 | 86 | ep_attributes = { 87 | 0x0 : "Control", 88 | 0x1 : "Isochronous", 89 | 0x2 : "Bulk", 90 | 0x3 : "Interrupt", 91 | } 92 | 93 | MAX_POWER_UNITS_USB2p0 = 2 # mA 94 | MAX_POWER_UNITS_USB_SUPERSPEED = 8 # mA 95 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-armv7l-2.7/usb/_lookup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Walker Inman 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""usb._lookups - Lookup tables for USB 30 | """ 31 | 32 | descriptors = { 33 | 0x1 : "Device", 34 | 0x2 : "Configuration", 35 | 0x3 : "String", 36 | 0x4 : "Interface", 37 | 0x5 : "Endpoint", 38 | 0x6 : "Device qualifier", 39 | 0x7 : "Other speed configuration", 40 | 0x8 : "Interface power", 41 | 0x9 : "OTG", 42 | 0xA : "Debug", 43 | 0xB : "Interface association", 44 | 0xC : "Security", 45 | 0xD : "Key", 46 | 0xE : "Encryption type", 47 | 0xF : "Binary device object store (BOS)", 48 | 0x10 : "Device capability", 49 | 0x11 : "Wireless endpoint companion", 50 | 0x30 : "SuperSpeed endpoint companion", 51 | } 52 | 53 | device_classes = { 54 | 0x0 : "Specified at interface", 55 | 0x2 : "Communications Device", 56 | 0x9 : "Hub", 57 | 0xF : "Personal Healthcare Device", 58 | 0xDC : "Diagnostic Device", 59 | 0xE0 : "Wireless Controller", 60 | 0xEF : "Miscellaneous", 61 | 0xFF : "Vendor-specific", 62 | } 63 | 64 | interface_classes = { 65 | 0x0 : "Reserved", 66 | 0x1 : "Audio", 67 | 0x2 : "CDC Communication", 68 | 0x3 : "Human Interface Device", 69 | 0x5 : "Physical", 70 | 0x6 : "Image", 71 | 0x7 : "Printer", 72 | 0x8 : "Mass Storage", 73 | 0x9 : "Hub", 74 | 0xA : "CDC Data", 75 | 0xB : "Smart Card", 76 | 0xD : "Content Security", 77 | 0xE : "Video", 78 | 0xF : "Personal Healthcare", 79 | 0xDC : "Diagnostic Device", 80 | 0xE0 : "Wireless Controller", 81 | 0xEF : "Miscellaneous", 82 | 0xFE : "Application Specific", 83 | 0xFF : "Vendor Specific", 84 | } 85 | 86 | ep_attributes = { 87 | 0x0 : "Control", 88 | 0x1 : "Isochronous", 89 | 0x2 : "Bulk", 90 | 0x3 : "Interrupt", 91 | } 92 | 93 | MAX_POWER_UNITS_USB2p0 = 2 # mA 94 | MAX_POWER_UNITS_USB_SUPERSPEED = 8 # mA 95 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-x86_64-2.7/usb/_lookup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Walker Inman 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""usb._lookups - Lookup tables for USB 30 | """ 31 | 32 | descriptors = { 33 | 0x1 : "Device", 34 | 0x2 : "Configuration", 35 | 0x3 : "String", 36 | 0x4 : "Interface", 37 | 0x5 : "Endpoint", 38 | 0x6 : "Device qualifier", 39 | 0x7 : "Other speed configuration", 40 | 0x8 : "Interface power", 41 | 0x9 : "OTG", 42 | 0xA : "Debug", 43 | 0xB : "Interface association", 44 | 0xC : "Security", 45 | 0xD : "Key", 46 | 0xE : "Encryption type", 47 | 0xF : "Binary device object store (BOS)", 48 | 0x10 : "Device capability", 49 | 0x11 : "Wireless endpoint companion", 50 | 0x30 : "SuperSpeed endpoint companion", 51 | } 52 | 53 | device_classes = { 54 | 0x0 : "Specified at interface", 55 | 0x2 : "Communications Device", 56 | 0x9 : "Hub", 57 | 0xF : "Personal Healthcare Device", 58 | 0xDC : "Diagnostic Device", 59 | 0xE0 : "Wireless Controller", 60 | 0xEF : "Miscellaneous", 61 | 0xFF : "Vendor-specific", 62 | } 63 | 64 | interface_classes = { 65 | 0x0 : "Reserved", 66 | 0x1 : "Audio", 67 | 0x2 : "CDC Communication", 68 | 0x3 : "Human Interface Device", 69 | 0x5 : "Physical", 70 | 0x6 : "Image", 71 | 0x7 : "Printer", 72 | 0x8 : "Mass Storage", 73 | 0x9 : "Hub", 74 | 0xA : "CDC Data", 75 | 0xB : "Smart Card", 76 | 0xD : "Content Security", 77 | 0xE : "Video", 78 | 0xF : "Personal Healthcare", 79 | 0xDC : "Diagnostic Device", 80 | 0xE0 : "Wireless Controller", 81 | 0xEF : "Miscellaneous", 82 | 0xFE : "Application Specific", 83 | 0xFF : "Vendor Specific", 84 | } 85 | 86 | ep_attributes = { 87 | 0x0 : "Control", 88 | 0x1 : "Isochronous", 89 | 0x2 : "Bulk", 90 | 0x3 : "Interrupt", 91 | } 92 | 93 | MAX_POWER_UNITS_USB2p0 = 2 # mA 94 | MAX_POWER_UNITS_USB_SUPERSPEED = 8 # mA 95 | -------------------------------------------------------------------------------- /skserv.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 3 | # Simple multithreading socket server v 1.5 4 | # max buffer 16k, encode/decode utf8 5 | # separator \t 6 | import string 7 | import sys 8 | import socket 9 | import threading 10 | import time 11 | 12 | msg_ok='ok' 13 | msg_err='err' 14 | separator="\t" 15 | 16 | MAX_BUFFER=16000 17 | CONNECT_TIMEOUT=8 18 | 19 | class SockSrv: 20 | def __init__(self,ip,port,maxc): 21 | if ip=='': 22 | ip='' 23 | self.soc = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 24 | self.soc.bind((ip,port)) 25 | self.soc.listen(maxc) 26 | self.maxc=maxc 27 | self.connections=0 28 | 29 | def start(self): 30 | print "skserv.start" 31 | while 1: 32 | (conn,addr) = self.soc.accept() 33 | if self.maxc<=self.connections: 34 | conn.send(msg_err) 35 | conn.close() 36 | else: 37 | self.connections=self.connections+1 38 | thr = CThread(self,conn) 39 | thr.start() 40 | conn.send(msg_ok) 41 | print 'skserv.close' 42 | self.soc.close() 43 | 44 | def process(self,ct,arr): 45 | pass 46 | 47 | 48 | class CThread(threading.Thread): 49 | def __init__(self,socksrv,c): 50 | self.MAXSIZE = MAX_BUFFER 51 | threading.Thread.__init__(self) 52 | self.conn = c 53 | self.stopIt=False 54 | self.arr=[] 55 | self.socksrv=socksrv 56 | 57 | def mrecv(self): 58 | data = self.conn.recv(self.MAXSIZE) 59 | #data=data.decode('utf8') 60 | s = data.rstrip("\r\n") 61 | self.arr = s.split(separator) 62 | return data 63 | 64 | def run(self): 65 | print "skserv.connect" 66 | while not self.stopIt: 67 | data = self.mrecv() 68 | if not data: 69 | self.stopIt=True 70 | break 71 | #print data 72 | self.socksrv.process(self,self.arr) 73 | self.conn.close() 74 | self.socksrv.connections=self.socksrv.connections-1 75 | print "skserv.disconnect [%s]" % (self.socksrv.connections) 76 | 77 | def msend(self,msg): 78 | if len(msg)<=self.MAXSIZE and len(msg)>0: 79 | try: 80 | m=msg.encode('utf8') 81 | except: 82 | m=msg 83 | msg=m 84 | 85 | self.conn.send(msg) 86 | 87 | 88 | class SockClient: 89 | def __init__(self,ip,port): 90 | self.MAXSIZE = MAX_BUFFER 91 | if ip=='': 92 | ip='127.0.0.1' 93 | #print ip+":"+str(port) 94 | self.soc = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 95 | self.soc.settimeout(CONNECT_TIMEOUT) 96 | try: 97 | self.soc.connect((ip,port)) 98 | except: 99 | self.soc = None 100 | 101 | 102 | def mrecv(self): 103 | data = self.soc.recv(self.MAXSIZE) 104 | #data=data.decode('utf8') 105 | s = data.rstrip("\r\n") 106 | self.arr = s.split(separator) 107 | return data 108 | 109 | def msend(self,msg): 110 | if len(msg)<=self.MAXSIZE and len(msg)>0: 111 | self.soc.send(msg) 112 | 113 | def run(self): 114 | pass 115 | 116 | def close(self): 117 | try: 118 | self.soc.close() 119 | except: 120 | pass 121 | 122 | #if len(sys.argv) > 1: 123 | # ip=sys.argv[1] 124 | #else: 125 | # ip='' 126 | # 127 | #if len(sys.argv) > 2: 128 | # port=sys.argv[2] 129 | #else: 130 | # port=7171 131 | # 132 | #try: 133 | # srv=SockSrv(ip,port,1) 134 | # print "starting socket server" 135 | # srv.start() 136 | #except: 137 | # print "error socket server" 138 | # 139 | 140 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/usb/_interop.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | # All the hacks necessary to assure compatibility across all 30 | # supported versions come here. 31 | # Please, note that there is one version check for each 32 | # hack we need to do, this makes maintenance easier... ^^ 33 | 34 | import sys 35 | import array 36 | 37 | __all__ = ['_reduce', '_set', '_next', '_update_wrapper'] 38 | 39 | # we support Python >= 2.4 40 | assert sys.hexversion >= 0x020400f0 41 | 42 | # On Python 3, reduce became a functools module function 43 | try: 44 | import functools 45 | _reduce = functools.reduce 46 | except (ImportError, AttributeError): 47 | _reduce = reduce 48 | 49 | # all, introduced in Python 2.5 50 | try: 51 | _all = all 52 | except NameError: 53 | _all = lambda iter_ : _reduce( lambda x, y: x and y, iter_, True ) 54 | 55 | # we only have the builtin set type since 2.5 version 56 | try: 57 | _set = set 58 | except NameError: 59 | import sets 60 | _set = sets.Set 61 | 62 | # On Python >= 2.6, we have the builtin next() function 63 | # On Python 2.5 and before, we have to call the iterator method next() 64 | def _next(iter): 65 | try: 66 | return next(iter) 67 | except NameError: 68 | return iter.next() 69 | 70 | # functools appeared in 2.5 71 | try: 72 | import functools 73 | _update_wrapper = functools.update_wrapper 74 | except (ImportError, AttributeError): 75 | def _update_wrapper(wrapper, wrapped): 76 | wrapper.__name__ = wrapped.__name__ 77 | wrapper.__module__ = wrapped.__module__ 78 | wrapper.__doc__ = wrapped.__doc__ 79 | wrapper.__dict__ = wrapped.__dict__ 80 | 81 | # this is used (as of May 2015) twice in core, once in backend/openusb, and in 82 | # some unit test code. It would probably be clearer if written in terms of some 83 | # definite 3.2+ API (bytearrays?) with a fallback provided for 2.4+. 84 | def as_array(data=None): 85 | if data is None: 86 | return array.array('B') 87 | 88 | if isinstance(data, array.array): 89 | return data 90 | 91 | try: 92 | return array.array('B', data) 93 | except TypeError: 94 | # When you pass a unicode string or a character sequence, 95 | # you get a TypeError if the first parameter does not match 96 | a = array.array('B') 97 | a.fromstring(data) # deprecated since 3.2 98 | return a 99 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-armv7l-2.7/usb/_interop.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | # All the hacks necessary to assure compatibility across all 30 | # supported versions come here. 31 | # Please, note that there is one version check for each 32 | # hack we need to do, this makes maintenance easier... ^^ 33 | 34 | import sys 35 | import array 36 | 37 | __all__ = ['_reduce', '_set', '_next', '_update_wrapper'] 38 | 39 | # we support Python >= 2.4 40 | assert sys.hexversion >= 0x020400f0 41 | 42 | # On Python 3, reduce became a functools module function 43 | try: 44 | import functools 45 | _reduce = functools.reduce 46 | except (ImportError, AttributeError): 47 | _reduce = reduce 48 | 49 | # all, introduced in Python 2.5 50 | try: 51 | _all = all 52 | except NameError: 53 | _all = lambda iter_ : _reduce( lambda x, y: x and y, iter_, True ) 54 | 55 | # we only have the builtin set type since 2.5 version 56 | try: 57 | _set = set 58 | except NameError: 59 | import sets 60 | _set = sets.Set 61 | 62 | # On Python >= 2.6, we have the builtin next() function 63 | # On Python 2.5 and before, we have to call the iterator method next() 64 | def _next(iter): 65 | try: 66 | return next(iter) 67 | except NameError: 68 | return iter.next() 69 | 70 | # functools appeared in 2.5 71 | try: 72 | import functools 73 | _update_wrapper = functools.update_wrapper 74 | except (ImportError, AttributeError): 75 | def _update_wrapper(wrapper, wrapped): 76 | wrapper.__name__ = wrapped.__name__ 77 | wrapper.__module__ = wrapped.__module__ 78 | wrapper.__doc__ = wrapped.__doc__ 79 | wrapper.__dict__ = wrapped.__dict__ 80 | 81 | # this is used (as of May 2015) twice in core, once in backend/openusb, and in 82 | # some unit test code. It would probably be clearer if written in terms of some 83 | # definite 3.2+ API (bytearrays?) with a fallback provided for 2.4+. 84 | def as_array(data=None): 85 | if data is None: 86 | return array.array('B') 87 | 88 | if isinstance(data, array.array): 89 | return data 90 | 91 | try: 92 | return array.array('B', data) 93 | except TypeError: 94 | # When you pass a unicode string or a character sequence, 95 | # you get a TypeError if the first parameter does not match 96 | a = array.array('B') 97 | a.fromstring(data) # deprecated since 3.2 98 | return a 99 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-i686-2.7/usb/_interop.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | # All the hacks necessary to assure compatibility across all 30 | # supported versions come here. 31 | # Please, note that there is one version check for each 32 | # hack we need to do, this makes maintenance easier... ^^ 33 | 34 | import sys 35 | import array 36 | 37 | __all__ = ['_reduce', '_set', '_next', '_update_wrapper'] 38 | 39 | # we support Python >= 2.4 40 | assert sys.hexversion >= 0x020400f0 41 | 42 | # On Python 3, reduce became a functools module function 43 | try: 44 | import functools 45 | _reduce = functools.reduce 46 | except (ImportError, AttributeError): 47 | _reduce = reduce 48 | 49 | # all, introduced in Python 2.5 50 | try: 51 | _all = all 52 | except NameError: 53 | _all = lambda iter_ : _reduce( lambda x, y: x and y, iter_, True ) 54 | 55 | # we only have the builtin set type since 2.5 version 56 | try: 57 | _set = set 58 | except NameError: 59 | import sets 60 | _set = sets.Set 61 | 62 | # On Python >= 2.6, we have the builtin next() function 63 | # On Python 2.5 and before, we have to call the iterator method next() 64 | def _next(iter): 65 | try: 66 | return next(iter) 67 | except NameError: 68 | return iter.next() 69 | 70 | # functools appeared in 2.5 71 | try: 72 | import functools 73 | _update_wrapper = functools.update_wrapper 74 | except (ImportError, AttributeError): 75 | def _update_wrapper(wrapper, wrapped): 76 | wrapper.__name__ = wrapped.__name__ 77 | wrapper.__module__ = wrapped.__module__ 78 | wrapper.__doc__ = wrapped.__doc__ 79 | wrapper.__dict__ = wrapped.__dict__ 80 | 81 | # this is used (as of May 2015) twice in core, once in backend/openusb, and in 82 | # some unit test code. It would probably be clearer if written in terms of some 83 | # definite 3.2+ API (bytearrays?) with a fallback provided for 2.4+. 84 | def as_array(data=None): 85 | if data is None: 86 | return array.array('B') 87 | 88 | if isinstance(data, array.array): 89 | return data 90 | 91 | try: 92 | return array.array('B', data) 93 | except TypeError: 94 | # When you pass a unicode string or a character sequence, 95 | # you get a TypeError if the first parameter does not match 96 | a = array.array('B') 97 | a.fromstring(data) # deprecated since 3.2 98 | return a 99 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-x86_64-2.7/usb/_interop.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | # All the hacks necessary to assure compatibility across all 30 | # supported versions come here. 31 | # Please, note that there is one version check for each 32 | # hack we need to do, this makes maintenance easier... ^^ 33 | 34 | import sys 35 | import array 36 | 37 | __all__ = ['_reduce', '_set', '_next', '_update_wrapper'] 38 | 39 | # we support Python >= 2.4 40 | assert sys.hexversion >= 0x020400f0 41 | 42 | # On Python 3, reduce became a functools module function 43 | try: 44 | import functools 45 | _reduce = functools.reduce 46 | except (ImportError, AttributeError): 47 | _reduce = reduce 48 | 49 | # all, introduced in Python 2.5 50 | try: 51 | _all = all 52 | except NameError: 53 | _all = lambda iter_ : _reduce( lambda x, y: x and y, iter_, True ) 54 | 55 | # we only have the builtin set type since 2.5 version 56 | try: 57 | _set = set 58 | except NameError: 59 | import sets 60 | _set = sets.Set 61 | 62 | # On Python >= 2.6, we have the builtin next() function 63 | # On Python 2.5 and before, we have to call the iterator method next() 64 | def _next(iter): 65 | try: 66 | return next(iter) 67 | except NameError: 68 | return iter.next() 69 | 70 | # functools appeared in 2.5 71 | try: 72 | import functools 73 | _update_wrapper = functools.update_wrapper 74 | except (ImportError, AttributeError): 75 | def _update_wrapper(wrapper, wrapped): 76 | wrapper.__name__ = wrapped.__name__ 77 | wrapper.__module__ = wrapped.__module__ 78 | wrapper.__doc__ = wrapped.__doc__ 79 | wrapper.__dict__ = wrapped.__dict__ 80 | 81 | # this is used (as of May 2015) twice in core, once in backend/openusb, and in 82 | # some unit test code. It would probably be clearer if written in terms of some 83 | # definite 3.2+ API (bytearrays?) with a fallback provided for 2.4+. 84 | def as_array(data=None): 85 | if data is None: 86 | return array.array('B') 87 | 88 | if isinstance(data, array.array): 89 | return data 90 | 91 | try: 92 | return array.array('B', data) 93 | except TypeError: 94 | # When you pass a unicode string or a character sequence, 95 | # you get a TypeError if the first parameter does not match 96 | a = array.array('B') 97 | a.fromstring(data) # deprecated since 3.2 98 | return a 99 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/usb/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""PyUSB - Easy USB access in Python 30 | 31 | This package exports the following modules and subpackages: 32 | 33 | core - the main USB implementation 34 | legacy - the compatibility layer with 0.x version 35 | backend - the support for backend implementations. 36 | control - USB standard control requests. 37 | libloader - helper module for backend library loading. 38 | 39 | Since version 1.0, main PyUSB implementation lives in the 'usb.core' 40 | module. New applications are encouraged to use it. 41 | """ 42 | 43 | import logging 44 | import os 45 | 46 | __author__ = 'Wander Lairson Costa' 47 | 48 | # Use Semantic Versioning, http://semver.org/ 49 | version_info = (1, 0, 0, 'rc1') 50 | __version__ = '%d.%d.%d%s' % version_info 51 | 52 | __all__ = ['legacy', 'control', 'core', 'backend', 'util', 'libloader'] 53 | 54 | def _setup_log(): 55 | from usb import _debug 56 | logger = logging.getLogger('usb') 57 | debug_level = os.getenv('PYUSB_DEBUG') 58 | 59 | if debug_level is not None: 60 | _debug.enable_tracing(True) 61 | filename = os.getenv('PYUSB_LOG_FILENAME') 62 | 63 | LEVELS = {'debug': logging.DEBUG, 64 | 'info': logging.INFO, 65 | 'warning': logging.WARNING, 66 | 'error': logging.ERROR, 67 | 'critical': logging.CRITICAL} 68 | 69 | level = LEVELS.get(debug_level, logging.CRITICAL + 10) 70 | logger.setLevel(level = level) 71 | 72 | try: 73 | handler = logging.FileHandler(filename) 74 | except: 75 | handler = logging.StreamHandler() 76 | 77 | fmt = logging.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s') 78 | handler.setFormatter(fmt) 79 | logger.addHandler(handler) 80 | else: 81 | class NullHandler(logging.Handler): 82 | def emit(self, record): 83 | pass 84 | 85 | # We set the log level to avoid delegation to the 86 | # parent log handler (if there is one). 87 | # Thanks to Chris Clark to pointing this out. 88 | logger.setLevel(logging.CRITICAL + 10) 89 | 90 | logger.addHandler(NullHandler()) 91 | 92 | 93 | _setup_log() 94 | 95 | # We import all 'legacy' module symbols to provide compatibility 96 | # with applications that use 0.x versions. 97 | from usb.legacy import * 98 | -------------------------------------------------------------------------------- /site/autosets.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 20 | 21 | 22 | 28 | 29 | 30 | 36 | 37 | 38 | 44 | 45 | 46 | 52 | 53 | 54 | 60 | 61 | 62 | 68 | 69 | 70 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
Текущий принтер: %d_name%
Тип принтера: %d_devtype%
Скорость: %d_speed%
Текущий сканнер: 8 | 11 |
Печатать заголовок: 15 | 19 |
Переводить на летнее/зимнее время : 23 | 27 |
Автоматическое обнуление наличности : 31 | 35 |
Автоматическое открытие ящика : 39 | 43 |
Использовать нож : 47 | 51 |
Игнорировать ошибки : 55 | 59 |
Печатать номер чека : 63 | 67 |
Работа с ОФД : 71 | 75 |
84 |
85 | 86 | -------------------------------------------------------------------------------- /DTPrint/vikitest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf8 -*- 3 | # frk object v 2.0.007 4 | import kkmdrv 5 | import serial 6 | import time 7 | from PIL import Image 8 | import qrcode 9 | 10 | const_error=1 11 | const_cmd={'sale':11,'return':13,'X':60,'Z':61,'close_check':55,'cancel_check':56,} 12 | 13 | const_code = u' Код:' 14 | const_count = u' Количество' 15 | const_price = u' Цена' 16 | const_vsego = u' Всего' 17 | const_itogo = u'Итого' 18 | 19 | MAXWIDTH = 48 20 | CMDERR_NO=0 21 | 22 | NULL= chr(0x00) 23 | ENQ = chr(0x05) 24 | STX = chr(0x02) 25 | ETX = chr(0x03) 26 | ACK = chr(0x06) 27 | NAK = chr(0x15) 28 | FS = chr(0x1c) 29 | 30 | """ Конвертация рисунка в массив битов """ 31 | def convert_image(im,img_size): 32 | """ Parse image and prepare it to a printable format """ 33 | pix_line="" 34 | for y in range(img_size[1]): 35 | pix="" 36 | for x in range(img_size[0]): 37 | RGB = im.getpixel((x, y)) 38 | im_color = (RGB[0] + RGB[1] + RGB[2]) 39 | if im_color<600: 40 | b="1" 41 | else: 42 | b="0" 43 | pix += b 44 | pix_line +=pix 45 | return pix_line 46 | 47 | def nd_concat(title,value): 48 | return title.ljust(kkmdrv.MAXWIDTH-len(value),'.')+value 49 | 50 | def _crc(s): 51 | #import pdb; pdb.set_trace() 52 | c=25 53 | for i in s: 54 | c^=ord(i) 55 | sc=(hex(c)).upper() 56 | r=sc[2:] 57 | return r 58 | 59 | class frk: 60 | 61 | def __init__(self,port,speed): 62 | self.MAX_WIDTH=MAXWIDTH 63 | self.password = 'PIRI' 64 | self.admin_password = 'PIRI' 65 | self.port = '/dev/ttyACM0' 66 | self.speed = '57600' 67 | 68 | self.salelines=[] 69 | self.a_startus=['ready','check','error'] 70 | self.error=0 71 | 72 | def connect(self): 73 | try: 74 | self.ser = serial.Serial(self.port, int(self.speed),\ 75 | parity=serial.PARITY_NONE,\ 76 | stopbits=serial.STOPBITS_ONE,\ 77 | timeout=0.2,\ 78 | writeTimeout=0.2) 79 | except: 80 | return False 81 | 82 | try: 83 | #self.kkm=kkmdrv.KKM(self.ser,password=self.password,wide=self.MAX_WIDTH) 84 | #s='RI'+chr(28)+'00'+chr(0x3) 85 | op1='' 86 | for i in range(16): 87 | op1+=FS 88 | kassir=chr(136)+chr(162)+chr(160)+chr(173)+chr(174)+chr(228)+chr(228)+chr(32)+chr(136)+chr(46)+chr(136)+chr(46)+op1 89 | s='RI'+chr(0x29)+'21'+kassir+ETX 90 | path='/home/user/Desktop/WORK/VikiPrint/' 91 | fn=path+"cmd21.viki" 92 | f=open(fn,"w") 93 | crc=_crc(s) 94 | #import pdb; pdb.set_trace() 95 | s=STX+'PI'+s+crc #'\x0d\x0a' 96 | # self.ser.write(ENQ) 97 | # time.sleep(0.1) 98 | # ot=self.ser.read(1) 99 | # t = time.strftime("%d%m%y%H%M%S", time.localtime()) 100 | # bw0='RI&10'+t+ETX 101 | # crc=_crc(bw0) 102 | # bw=STX+'PI'+bw0+crc 103 | # self.ser.write(bw) 104 | # ot=self.ser.read(1) 105 | # import pdb; pdb.set_trace() 106 | #f.write(bw+'\n') 107 | f.write(s) 108 | f.close() 109 | #import pdb; pdb.set_trace() 110 | self.ser.write(s) 111 | #time.sleep(0.5) 112 | err=0 113 | #self._status_ready() 114 | print "connect frk" 115 | except: 116 | err=const_error 117 | #self._status_error() 118 | print "not connect frk" 119 | return True 120 | 121 | #Подключаемся 122 | D=frk('/dev/ttyACM0','57600') 123 | D.connect() 124 | print D.error 125 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-i686-2.7/usb/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""PyUSB - Easy USB access in Python 30 | 31 | This package exports the following modules and subpackages: 32 | 33 | core - the main USB implementation 34 | legacy - the compatibility layer with 0.x version 35 | backend - the support for backend implementations. 36 | control - USB standard control requests. 37 | libloader - helper module for backend library loading. 38 | 39 | Since version 1.0, main PyUSB implementation lives in the 'usb.core' 40 | module. New applications are encouraged to use it. 41 | """ 42 | 43 | import logging 44 | import os 45 | 46 | __author__ = 'Wander Lairson Costa' 47 | 48 | # Use Semantic Versioning, http://semver.org/ 49 | version_info = (1, 0, 0, 'rc1') 50 | __version__ = '%d.%d.%d%s' % version_info 51 | 52 | __all__ = ['legacy', 'control', 'core', 'backend', 'util', 'libloader'] 53 | 54 | def _setup_log(): 55 | from usb import _debug 56 | logger = logging.getLogger('usb') 57 | debug_level = os.getenv('PYUSB_DEBUG') 58 | 59 | if debug_level is not None: 60 | _debug.enable_tracing(True) 61 | filename = os.getenv('PYUSB_LOG_FILENAME') 62 | 63 | LEVELS = {'debug': logging.DEBUG, 64 | 'info': logging.INFO, 65 | 'warning': logging.WARNING, 66 | 'error': logging.ERROR, 67 | 'critical': logging.CRITICAL} 68 | 69 | level = LEVELS.get(debug_level, logging.CRITICAL + 10) 70 | logger.setLevel(level = level) 71 | 72 | try: 73 | handler = logging.FileHandler(filename) 74 | except: 75 | handler = logging.StreamHandler() 76 | 77 | fmt = logging.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s') 78 | handler.setFormatter(fmt) 79 | logger.addHandler(handler) 80 | else: 81 | class NullHandler(logging.Handler): 82 | def emit(self, record): 83 | pass 84 | 85 | # We set the log level to avoid delegation to the 86 | # parent log handler (if there is one). 87 | # Thanks to Chris Clark to pointing this out. 88 | logger.setLevel(logging.CRITICAL + 10) 89 | 90 | logger.addHandler(NullHandler()) 91 | 92 | 93 | _setup_log() 94 | 95 | # We import all 'legacy' module symbols to provide compatibility 96 | # with applications that use 0.x versions. 97 | from usb.legacy import * 98 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-armv7l-2.7/usb/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""PyUSB - Easy USB access in Python 30 | 31 | This package exports the following modules and subpackages: 32 | 33 | core - the main USB implementation 34 | legacy - the compatibility layer with 0.x version 35 | backend - the support for backend implementations. 36 | control - USB standard control requests. 37 | libloader - helper module for backend library loading. 38 | 39 | Since version 1.0, main PyUSB implementation lives in the 'usb.core' 40 | module. New applications are encouraged to use it. 41 | """ 42 | 43 | import logging 44 | import os 45 | 46 | __author__ = 'Wander Lairson Costa' 47 | 48 | # Use Semantic Versioning, http://semver.org/ 49 | version_info = (1, 0, 0, 'rc1') 50 | __version__ = '%d.%d.%d%s' % version_info 51 | 52 | __all__ = ['legacy', 'control', 'core', 'backend', 'util', 'libloader'] 53 | 54 | def _setup_log(): 55 | from usb import _debug 56 | logger = logging.getLogger('usb') 57 | debug_level = os.getenv('PYUSB_DEBUG') 58 | 59 | if debug_level is not None: 60 | _debug.enable_tracing(True) 61 | filename = os.getenv('PYUSB_LOG_FILENAME') 62 | 63 | LEVELS = {'debug': logging.DEBUG, 64 | 'info': logging.INFO, 65 | 'warning': logging.WARNING, 66 | 'error': logging.ERROR, 67 | 'critical': logging.CRITICAL} 68 | 69 | level = LEVELS.get(debug_level, logging.CRITICAL + 10) 70 | logger.setLevel(level = level) 71 | 72 | try: 73 | handler = logging.FileHandler(filename) 74 | except: 75 | handler = logging.StreamHandler() 76 | 77 | fmt = logging.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s') 78 | handler.setFormatter(fmt) 79 | logger.addHandler(handler) 80 | else: 81 | class NullHandler(logging.Handler): 82 | def emit(self, record): 83 | pass 84 | 85 | # We set the log level to avoid delegation to the 86 | # parent log handler (if there is one). 87 | # Thanks to Chris Clark to pointing this out. 88 | logger.setLevel(logging.CRITICAL + 10) 89 | 90 | logger.addHandler(NullHandler()) 91 | 92 | 93 | _setup_log() 94 | 95 | # We import all 'legacy' module symbols to provide compatibility 96 | # with applications that use 0.x versions. 97 | from usb.legacy import * 98 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/build/lib.linux-x86_64-2.7/usb/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009-2014 Wander Lairson Costa 2 | # 3 | # The following terms apply to all files associated 4 | # with the software unless explicitly disclaimed in individual files. 5 | # 6 | # The authors hereby grant permission to use, copy, modify, distribute, 7 | # and license this software and its documentation for any purpose, provided 8 | # that existing copyright notices are retained in all copies and that this 9 | # notice is included verbatim in any distributions. No written agreement, 10 | # license, or royalty fee is required for any of the authorized uses. 11 | # Modifications to this software may be copyrighted by their authors 12 | # and need not follow the licensing terms described here, provided that 13 | # the new terms are clearly indicated on the first page of each file where 14 | # they apply. 15 | # 16 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | # POSSIBILITY OF SUCH DAMAGE. 21 | # 22 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | # MODIFICATIONS. 28 | 29 | r"""PyUSB - Easy USB access in Python 30 | 31 | This package exports the following modules and subpackages: 32 | 33 | core - the main USB implementation 34 | legacy - the compatibility layer with 0.x version 35 | backend - the support for backend implementations. 36 | control - USB standard control requests. 37 | libloader - helper module for backend library loading. 38 | 39 | Since version 1.0, main PyUSB implementation lives in the 'usb.core' 40 | module. New applications are encouraged to use it. 41 | """ 42 | 43 | import logging 44 | import os 45 | 46 | __author__ = 'Wander Lairson Costa' 47 | 48 | # Use Semantic Versioning, http://semver.org/ 49 | version_info = (1, 0, 0, 'rc1') 50 | __version__ = '%d.%d.%d%s' % version_info 51 | 52 | __all__ = ['legacy', 'control', 'core', 'backend', 'util', 'libloader'] 53 | 54 | def _setup_log(): 55 | from usb import _debug 56 | logger = logging.getLogger('usb') 57 | debug_level = os.getenv('PYUSB_DEBUG') 58 | 59 | if debug_level is not None: 60 | _debug.enable_tracing(True) 61 | filename = os.getenv('PYUSB_LOG_FILENAME') 62 | 63 | LEVELS = {'debug': logging.DEBUG, 64 | 'info': logging.INFO, 65 | 'warning': logging.WARNING, 66 | 'error': logging.ERROR, 67 | 'critical': logging.CRITICAL} 68 | 69 | level = LEVELS.get(debug_level, logging.CRITICAL + 10) 70 | logger.setLevel(level = level) 71 | 72 | try: 73 | handler = logging.FileHandler(filename) 74 | except: 75 | handler = logging.StreamHandler() 76 | 77 | fmt = logging.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s') 78 | handler.setFormatter(fmt) 79 | logger.addHandler(handler) 80 | else: 81 | class NullHandler(logging.Handler): 82 | def emit(self, record): 83 | pass 84 | 85 | # We set the log level to avoid delegation to the 86 | # parent log handler (if there is one). 87 | # Thanks to Chris Clark to pointing this out. 88 | logger.setLevel(logging.CRITICAL + 10) 89 | 90 | logger.addHandler(NullHandler()) 91 | 92 | 93 | _setup_log() 94 | 95 | # We import all 'legacy' module symbols to provide compatibility 96 | # with applications that use 0.x versions. 97 | from usb.legacy import * 98 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright (C) 2009-2014 Wander Lairson Costa 4 | # 5 | # The following terms apply to all files associated 6 | # with the software unless explicitly disclaimed in individual files. 7 | # 8 | # The authors hereby grant permission to use, copy, modify, distribute, 9 | # and license this software and its documentation for any purpose, provided 10 | # that existing copyright notices are retained in all copies and that this 11 | # notice is included verbatim in any distributions. No written agreement, 12 | # license, or royalty fee is required for any of the authorized uses. 13 | # Modifications to this software may be copyrighted by their authors 14 | # and need not follow the licensing terms described here, provided that 15 | # the new terms are clearly indicated on the first page of each file where 16 | # they apply. 17 | # 18 | # IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 19 | # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 20 | # ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 21 | # DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 22 | # POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | # THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 25 | # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 26 | # FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 27 | # IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 28 | # NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 29 | # MODIFICATIONS. 30 | 31 | from distutils.core import setup 32 | 33 | import usb 34 | 35 | 36 | setup( 37 | name='pyusb', 38 | version=usb.__version__, 39 | description='Python USB access module', 40 | author='Wander Lairson Costa', 41 | author_email='wander.lairson@gmail.com', 42 | license = 'BSD', 43 | url='http://pyusb.sourceforge.net', 44 | packages=['usb', 'usb.backend'], 45 | long_description = 46 | """ 47 | PyUSB offers easy USB devices communication in Python. 48 | It should work without additional code in any environment with 49 | Python >= 2.4, ctypes and an pre-built usb backend library 50 | (currently, libusb 0.1.x, libusb 1.x, and OpenUSB). 51 | """, 52 | classifiers=[ 53 | 'Development Status :: 4 - Beta', 54 | 'Intended Audience :: Developers', 55 | 'Intended Audience :: Information Technology', 56 | 'Intended Audience :: Manufacturing', # USB automation, or mfg USB devs 57 | 'Intended Audience :: Science/Research', # interface with instruments 58 | 'Intended Audience :: System Administrators', # integrate strange devs 59 | 'Intended Audience :: Telecommunications Industry', # telecomm devs 60 | 'License :: OSI Approved :: BSD License', 61 | 'Natural Language :: English', 62 | # try to union the OSes that can build any of the backend libraries... 63 | 'Operating System :: MacOS :: MacOS X', 64 | 'Operating System :: Microsoft :: Windows :: Windows Vista', 65 | 'Operating System :: Microsoft :: Windows :: Windows 7', 66 | 'Operating System :: POSIX :: BSD :: FreeBSD', 67 | 'Operating System :: POSIX :: BSD :: NetBSD', 68 | 'Operating System :: POSIX :: BSD :: OpenBSD', 69 | 'Operating System :: POSIX :: Linux', 70 | 'Operating System :: POSIX :: SunOS/Solaris', 71 | 'Programming Language :: Python :: 2.4', 72 | 'Programming Language :: Python :: 2.5', 73 | 'Programming Language :: Python :: 2.6', 74 | 'Programming Language :: Python :: 2.7', 75 | 'Programming Language :: Python :: 3', 76 | # source(CPython,Jython,IronPython,PyPy): "The Long Term" section of 77 | # http://ojs.pythonpapers.org/index.php/tpp/article/viewFile/23/23 78 | 'Programming Language :: Python :: Implementation :: CPython', 79 | 'Programming Language :: Python :: Implementation :: IronPython', 80 | 'Programming Language :: Python :: Implementation :: Jython', 81 | 'Programming Language :: Python :: Implementation :: PyPy', 82 | 'Topic :: Scientific/Engineering :' \ 83 | ': Interface Engine/Protocol Translator', 84 | 'Topic :: Software Development :: Libraries', 85 | 'Topic :: Software Development :: Libraries :: Python Modules', 86 | 'Topic :: System :: Hardware :: Hardware Drivers' 87 | ] 88 | ) 89 | 90 | -------------------------------------------------------------------------------- /site_icerest/js/funct.js: -------------------------------------------------------------------------------- 1 | function _putfile(page) { 2 | var file = document.getElementById("file"); 3 | file=file.files[0] 4 | if (!file) { return; } 5 | var xhr = new XMLHttpRequest(); 6 | xhr.open("POST", page, false); 7 | var formData = new FormData(); 8 | formData.append("file", file); 9 | xhr.send(formData); 10 | return xhr.responseText; 11 | } 12 | 13 | function _getdata(page){ 14 | var xhrp = new XMLHttpRequest(); 15 | xhrp.open('GET', page, false); 16 | xhrp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 17 | xhrp.send(); 18 | if (xhrp.status != 200) { 19 | alert( xhrp.status + ': ' + xhrp.statusText ); 20 | return '#err'; 21 | } else { 22 | return xhrp.responseText; 23 | } 24 | return '#err'; 25 | } 26 | 27 | function _postdata(page,a_params,a_values){ 28 | var xhrp = new XMLHttpRequest(); 29 | xhrp.open('POST', page, false); 30 | xhrp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 31 | body=""; 32 | for(var i=0; i0){add="&";}else{add="";} 36 | body = body + add + n + "=" + encodeURIComponent(v); 37 | } 38 | xhrp.send(body); 39 | if (xhrp.status != 200) { 40 | alert( xhrp.status + ': ' + xhrp.statusText ); 41 | return '#err'; 42 | } else { 43 | return xhrp.responseText; 44 | } 45 | return '#err'; 46 | } 47 | 48 | function _relocate(page){ 49 | window.location=page; 50 | } 51 | 52 | function showdoc(d){ 53 | content=_getdata("/help?id="+d); 54 | doctext.innerHTML=content; 55 | doc.hidden=false; 56 | } 57 | function edit_user(iduser){ 58 | ed_content=_getdata("/user?iduser="+iduser); 59 | ed_user.innerHTML="
Редактирование пользователя
"+ed_content; 60 | ed_user.hidden=false; 61 | } 62 | 63 | function edit_sets(group){ 64 | ed_content=_getdata("/sets_get?group="+group); 65 | ed_sets.innerHTML="
Редактирование настроек
"+ed_content; 66 | ed_sets.hidden=false; 67 | } 68 | 69 | function edit_autosets(){ 70 | ed_content=_getdata("/sets/autosets"); 71 | ed_sets.innerHTML="
Редактирование настроек
"+ed_content; 72 | ed_sets.hidden=false; 73 | } 74 | 75 | function ch_dev(v){ 76 | ed_content=_getdata("/printer?idprinter="+v); 77 | if (ed_content!='0'){ 78 | ed_drv.innerHTML="
Подключение принтера
"+ed_content; 79 | ed_drv.hidden=false; 80 | } 81 | } 82 | function alert_message(head,content){ 83 | message_content.innerHTML="
"+head+"
"+content; 84 | message.hidden=false; 85 | // message_btn.focus(); 86 | } 87 | 88 | function edit_drv(level){ 89 | a=['dev','status','text'] 90 | url=['printer','printer/status','printer/textlines'] 91 | head=['Подключение принтера','Статус принтера','Текст в чеке'] 92 | cur=a.indexOf(level) 93 | 94 | ed_content=_getdata(url[cur]); 95 | 96 | if (ed_content=='0'){ 97 | alert_message('Ошибка','Драйвер принтеров не отвечает
Проверьте сервис DTPrint '); 98 | return; 99 | } 100 | if (ed_content.substr(0,1)==":"){ 101 | alert_message('Ошибка драйвера',ed_content); 102 | return; 103 | } 104 | ed_drv.innerHTML="
"+head[cur]+"
"+ed_content; 105 | ed_drv.hidden=false; 106 | return; 107 | } 108 | 109 | function cmd_autocreate(){ 110 | result=_postdata("/cmd_autocreate",["printer"],["Fprint"]); 111 | if (result=="0"){ 112 | message_content.innerHTML="
Предупреждение
"+"Новые устройсва не найдены"; 113 | message.hidden=false; 114 | }else{ 115 | edit_drv("dev"); 116 | } 117 | } 118 | 119 | function cmd_prn_setcurdatetime(){ 120 | result=_postdata("/cmd/prn_setcurdatetime",["printer"],["Fprint"]); 121 | alert(result); 122 | if (result.substr(0,1)==":"){ 123 | alert_message('Ошибка драйвера',result); 124 | return; 125 | }else{ 126 | edit_drv("dev"); 127 | } 128 | } 129 | 130 | 131 | -------------------------------------------------------------------------------- /DTPrint/site/edprint.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | ID:%id% MODEL: 4 | wchar: 5 | wpixel: 6 | 7 | 8 | 47 | 51 | 52 | 66 | 67 |
9 | Наименование:
10 | 11 |
12 | Тип соединения:
13 | 16 |
17 | Тип команд:
18 | 21 |
22 | Устройство: 23 |
26 | speed 27 |
28 | ip: 29 | port:
30 |
31 | charset_driver:
32 | charset_device:
33 | usr/adm pass: 34 | 35 |
36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 |
interface:
40 | 41 | id_vendor:
id_product:
byte01:
byte02:
46 |
48 | Описание:
49 | 50 |
53 | 54 | 55 | 56 | 57 |
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |
68 |
69 |
70 | -------------------------------------------------------------------------------- /install/pyusb-1.0.0rc1/ReleaseNotes.rst: -------------------------------------------------------------------------------- 1 | ========== 2 | PyUSB News 3 | ========== 4 | 5 | What's new in PyUSB 1.0.0 (beta 2)? 6 | =================================== 7 | 8 | - You can now customize the search path for USB libraries (by André Erdmann). 9 | - API improvements (more on that below). 10 | - legacy module fully functional. 11 | - Regressions tests for Python 2.4-3.4. 12 | 13 | WARNING: API breakage ahead!!!!! 14 | -------------------------------- 15 | 16 | - `util.get_string` does not receive the length parameter anymore (by 17 | - the `find` and `find_descriptor` functions now return an iterator when 18 | find_all is true. 19 | - Added the property `extra` for extra descriptors (by Prathmesh Prabhu). 20 | - New function `util.create_buffer`. 21 | - Now `read` and `ctrl_transfer` functions allow inplace reads. 22 | - New method `clear_halt`. 23 | - The functions `is_kernel_driver_active`, `detach_kernel_driver` and 24 | `attach_kernel_driver` does not accept an Interface object anymore. 25 | - `write` and `read` does not receive the interface number anymore. 26 | - added the properties `vendor`, `product` and `serial_number` to the 27 | Device class. 28 | - Support for `str` and `repr` conversions for descriptors (by Walker Inman). 29 | 30 | What's new in PyUSB 1.0.0 (beta 1)? 31 | =================================== 32 | 33 | - Isochronous transfer for libusb 1.0 (by David Halter). 34 | - Experimental OpenUSB support. 35 | - Documentation update. 36 | - ``PYUSB_DEBUG_LEVEL`` environment variable is now called ``PYUSB_DEBUG``. 37 | - Legacy module nwo groups according to their *bus*. 38 | - Version information available for apps (by Chris Clark). 39 | - Faster read operation (by themperek). 40 | - Tox support (by ponty). 41 | - Support for port number info (by Stefano Di Martino). 42 | - Several bug fixes (please, check the Changelog file). 43 | 44 | Known issues 45 | ============ 46 | 47 | - OpenUSB backend hangs on some control transfers. 48 | 49 | TODO 50 | ==== 51 | 52 | - More tests with legacy module. 53 | - Isochronous transfers for libusb-win32. 54 | 55 | What's new in PyUSB 1.0.0 (alpha 3)? 56 | ==================================== 57 | 58 | **WARNING**: this release renames the libusb 1.0 and libusb 0.1 backends. If 59 | your code makes direct access to this backends, you will have to change it. 60 | 61 | - Fixed several legacy module bugs (by Tormod Volden). 62 | - Fixed libusb0 backend for BSDs and Mac OSX. 63 | - Fixed data loss when less the requested number of bytes were read (by 64 | Braiden Kindt). 65 | - Documentation fixes. 66 | 67 | What's new in PyUSB 1.0.0 (alpha 2)? 68 | ==================================== 69 | 70 | - Test firmware now lives in its own respository (https://github.com/walac/bmfw). 71 | - ``USBError`` now has the property ``backend_error_code`` that tells the 72 | backend specific error. 73 | - ``errno`` value in ``USBError`` is translated according to the backend error. 74 | - Now ``Device`` class has the ``bus`` and ``address`` attributes to 75 | differentiate identical devices. 76 | - Optimization when log is disabled (by Emmanuel Blot). 77 | - Several other minor fixes and improvaments (check ChangeLog file). 78 | 79 | Features not implemented 80 | ------------------------ 81 | 82 | - OpenUSB support. 83 | - Isochronous transfer. 84 | 85 | What's new in PyUSB 1.0.0 (alpha 1)? 86 | ==================================== 87 | 88 | This release implements more PyUSB 1.0 features towards beta stage. The new 89 | features implemented include: 90 | 91 | - Standard control requests through usb.control module. 92 | - Request current configuration from device when you do not call 93 | set_configuration. 94 | - get_string function in the usb.util module to get string descriptors. 95 | - Full 0.4 API emulation. 96 | - Device is not reset anymore in test cases to avoid problems in systems 97 | where it does not work. 98 | 99 | Features not implemented 100 | ------------------------ 101 | 102 | - OpenUSB support. 103 | - Isochronous transfer. 104 | 105 | What's new in PyUSB 1.0.0 (alpha 0)? 106 | ==================================== 107 | 108 | This is the first PyUSB 1.0 series public release. This is an alpha release, 109 | which means that most of the features described in the README file and on the 110 | website are not yet stable or even implemented. 111 | 112 | Features not implemented 113 | ------------------------ 114 | 115 | - Full support for legacy 0.4 legacy code (although partial support is provided). 116 | - OpenUSB backend. 117 | - libusb 1.0 windows backend stability (although it is reasonable usable). 118 | - Support for several standard control requests (including GET_STRING). 119 | - Python < 2.6 and Python 3 not yet fully tested. 120 | 121 | Known issues 122 | ------------ 123 | 124 | - ``reset`` method fails under FreeUSB (libusb 1.0 backend). 125 | - ``reset`` method hangs under Windows (libusb 1.0 backend). 126 | - Sometimes occurs `read` timeout on Windows (libusb 1.0 backend). 127 | - Test cases fail to run under cygwin. 128 | -------------------------------------------------------------------------------- /DTPrint/constants.py: -------------------------------------------------------------------------------- 1 | """ ESC/POS Commands (Constants) """ 2 | 3 | # Feed control sequences 4 | CTL_LF = '\x0a' # Print and line feed 5 | CTL_FF = '\x0c' # Form feed 6 | CTL_CR = '\x0d' # Carriage return 7 | CTL_HT = '\x09' # Horizontal tab 8 | CTL_VT = '\x0b' # Vertical tab 9 | # Printer hardware 10 | HW_INIT = '\x1b\x40' # Clear data in buffer and reset modes 11 | HW_SELECT = '\x1b\x3d\x01' # Printer select 12 | HW_RESET = '\x1b\x3f\x0a\x00' # Reset printer hardware 13 | # Cash Drawer 14 | CD_KICK_2 = '\x1b\x70\x00\x19\x02' # Sends a pulse to pin 2 [] 15 | CD_KICK_5 = '\x1b\x70\x01\x19\x02' # Sends a pulse to pin 5 [] 16 | # Paper 17 | PAPER_FULL_CUT = '\x1d\x56\x00' # Full cut paper 18 | PAPER_PART_CUT = '\x1d\x56\x01' # Partial cut paper 19 | 20 | BELL = '\x1e' 21 | GET_SENSOR = '\x10\x04' 22 | # Text format 23 | 24 | BARCODE_TXT_OFF = '\x1d\x48\x00' # HRI barcode chars OFF 25 | BARCODE_TXT_ABV = '\x1d\x48\x01' # HRI barcode chars above 26 | BARCODE_TXT_BLW = '\x1d\x48\x02' # HRI barcode chars below 27 | BARCODE_TXT_BTH = '\x1d\x48\x03' # HRI barcode chars both above and below 28 | BARCODE_FONT_A = '\x1d\x66\x00' # Font type A for HRI barcode chars 29 | BARCODE_FONT_B = '\x1d\x66\x01' # Font type B for HRI barcode chars 30 | BARCODE_HEIGHT = '\x1d\x68\x64' # Barcode Height [1-255] 31 | BARCODE_WIDTH = '\x1d\x77\x03' # Barcode Width [2-6] 32 | BARCODE_UPC_A = '\x1d\x6b\x00' # Barcode type UPC-A 33 | BARCODE_UPC_E = '\x1d\x6b\x01' # Barcode type UPC-E 34 | BARCODE_EAN13 = '\x1d\x6b\x02' # Barcode type EAN13 35 | BARCODE_EAN8 = '\x1d\x6b\x03' # Barcode type EAN8 36 | BARCODE_CODE39 = '\x1d\x6b\x04' # Barcode type CODE39 37 | BARCODE_ITF = '\x1d\x6b\x05' # Barcode type ITF 38 | BARCODE_NW7 = '\x1d\x6b\x06' # Barcode type NW7 39 | 40 | # Image format 41 | S_RASTER_N = '\x1d\x76\x30\x00' # Set raster image normal size 42 | S_RASTER_2W = '\x1d\x76\x30\x01' # Set raster image double width 43 | S_RASTER_2H = '\x1d\x76\x30\x02' # Set raster image double height 44 | S_RASTER_Q = '\x1d\x76\x30\x03' # Set raster image quadruple 45 | 46 | RESET = '\x1b\x40' 47 | 48 | TEXT_STYLE = { 49 | 'underline': { 50 | None: '\x1b\x2d\x00', # Underline font OFF 51 | 1: '\x1b\x2d\x01', # Underline font 1-dot ON 52 | 2: '\x1b\x2d\x02', # Underline font 2-dot ON 53 | }, 54 | 'size': { 55 | 'normal': '\x1b\x21\x00', # Normal text 56 | '2h': '\x1b\x21\x10', # Double height text 57 | '2w': '\x1b\x21\x20', # Double width text 58 | '2x': '\x1b\x21\x30', # Quad area text 59 | }, 60 | 'font': { 61 | 'a': '\x1b\x4d\x00', # Font type A 62 | 'b': '\x1b\x4d\x01', # Font type B 63 | 'c': '\x1b\x4d\x02', # Font type C (may not support) 64 | }, 65 | 'align': { 66 | 'left': '\x1b\x61\x00', # Left justification 67 | 'right': '\x1b\x61\x02', # Right justification 68 | 'center': '\x1b\x61\x01', # Centering 69 | }, 70 | 'inverted': { 71 | False: '\x1d\x42\x00', # Inverted mode ON 72 | True: '\x1d\x42\x01', # Inverted mode OFF 73 | }, 74 | 'color': { 75 | 1: '\x1b\x72\x00', # Select 1st printing color 76 | 2: '\x1b\x72\x00', # Select 2nd printing color 77 | }, 78 | 'bold': { 79 | 0: '\x1b\x45\x00', # Bold font OFF 80 | 1: '\x1b\x45\x01', # Bold font ON 81 | }, 82 | } 83 | 84 | SET_COMMAND_OLD = '\x1b\x1d\x74' 85 | SET_COMMAND = '\x1b\x74' 86 | 87 | PAGE_CP_CODE = { 88 | 'cp437' : 0, 89 | # 'katakana' : 1, 90 | 'cp850' : 2, 91 | 'cp860' : 3, 92 | 'cp863' : 4, 93 | 'cp865' : 5, 94 | 'cp1251' : 6, 95 | 'cp866' : 7, 96 | 'mac_cyrillic': 8, 97 | 'cp775' : 9, 98 | 'cp1253' : 10, 99 | 'cp737' : 11, 100 | 'cp857' : 12, 101 | 'iso8859_9' : 13, 102 | 'cp864' : 14, 103 | 'cp862' : 15, 104 | 'iso8859_2' : 16, 105 | 'cp1253' : 17, 106 | 'cp1250' : 18, 107 | 'cp858' : 19, 108 | 'cp1254' : 20, 109 | # 'TIS_14' : 21, 110 | # 'TIS_17' : 22, 111 | # 'TIS_11' : 23, 112 | 'cp737' : 24, 113 | 'cp1257' : 25, 114 | 'cp847' : 26, 115 | # 'cp720' : 27, 116 | 'cp885' : 28, 117 | 'cp857' : 29, 118 | 'cp1250' : 30, 119 | 'cp775' : 31, 120 | 'cp1254' : 32, 121 | # '' : 33, 122 | 'cp1256' : 34, 123 | 'cp1258' : 35, 124 | 'iso8859_2' : 36, 125 | 'iso8859_3' : 37, 126 | 'iso8859_4' : 38, 127 | 'iso8859_5' : 39, 128 | 'iso8859_6' : 40, 129 | 'iso8859_7' : 41, 130 | 'iso8859_8' : 42, 131 | 'iso8859_9' : 43, 132 | 'iso8859_15' : 44, 133 | # '???' : 45, 134 | 'cp856' : 46, 135 | 'cp874' : 47, 136 | } 137 | -------------------------------------------------------------------------------- /DTPrint/printer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | ''' 3 | @author: Manuel F Martinez 4 | @organization: Bashlinux 5 | @copyright: Copyright (c) 2012 Bashlinux 6 | @license: GPL 7 | ''' 8 | 9 | import usb.core 10 | import usb.util 11 | import serial 12 | import socket 13 | 14 | from escpos import * 15 | from constants import * 16 | from exceptions import * 17 | 18 | class Usb(Escpos): 19 | """ Define USB printer """ 20 | 21 | def __init__(self, idVendor, idProduct, interface=0, in_ep=0x82, out_ep=0x01): 22 | """ 23 | @param idVendor : Vendor ID 24 | @param idProduct : Product ID 25 | @param interface : USB device interface 26 | @param in_ep : Input end point 27 | @param out_ep : Output end point 28 | """ 29 | self.idVendor = idVendor 30 | self.idProduct = idProduct 31 | self.interface = interface 32 | self.in_ep = in_ep 33 | self.out_ep = out_ep 34 | self.open() 35 | 36 | 37 | def open(self): 38 | """ Search device on USB tree and set is as escpos device """ 39 | self.device = usb.core.find(idVendor=self.idVendor, idProduct=self.idProduct) 40 | if self.device is None: 41 | print "Cable isn't plugged in" 42 | 43 | if self.device.is_kernel_driver_active(0): 44 | try: 45 | self.device.detach_kernel_driver(0) 46 | except usb.core.USBError as e: 47 | print "Could not detatch kernel driver: %s" % str(e) 48 | 49 | try: 50 | self.device.set_configuration() 51 | self.device.reset() 52 | except usb.core.USBError as e: 53 | print "Could not set configuration: %s" % str(e) 54 | 55 | 56 | def _raw(self, msg): 57 | """ Print any command sent in raw format """ 58 | self.device.write(self.out_ep, msg, self.interface) 59 | 60 | def _read(self,n=1): 61 | """ Read data """ 62 | result = self.device.read(self.in_ep,n,timeout=1000) 63 | if len(result)==0: 64 | result = self.device.read(self.in_ep,n,timeout=1000) 65 | return result 66 | 67 | def __del__(self): 68 | """ Release USB interface """ 69 | if self.device: 70 | usb.util.dispose_resources(self.device) 71 | self.device = None 72 | 73 | 74 | 75 | class Serial(Escpos): 76 | """ Define Serial printer """ 77 | 78 | def __init__(self, devfile="/dev/ttyS0", baudrate=9600, bytesize=8, timeout=1): 79 | """ 80 | @param devfile : Device file under dev filesystem 81 | @param baudrate : Baud rate for serial transmission 82 | @param bytesize : Serial buffer size 83 | @param timeout : Read/Write timeout 84 | """ 85 | self.devfile = devfile 86 | self.baudrate = baudrate 87 | self.bytesize = bytesize 88 | self.timeout = timeout 89 | self.open() 90 | 91 | 92 | def open(self): 93 | """ Setup serial port and set is as escpos device """ 94 | self.device = serial.Serial(port=self.devfile, baudrate=self.baudrate, bytesize=self.bytesize, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=self.timeout, dsrdtr=True) 95 | 96 | if self.device is not None: 97 | #print "Serial printer enabled" 98 | pass 99 | else: 100 | print "Unable to open serial printer on: %s" % self.devfile 101 | 102 | 103 | def _raw(self, msg): 104 | """ Print any command sent in raw format """ 105 | self.device.write(msg) 106 | 107 | def _read(self,n=1): 108 | """ Read data """ 109 | return self.device.read(n) 110 | 111 | def __del__(self): 112 | """ Close Serial interface """ 113 | if self.device is not None: 114 | self.device.close() 115 | 116 | 117 | 118 | class Network(Escpos): 119 | """ Define Network printer """ 120 | 121 | def __init__(self,host,port=9100): 122 | """ 123 | @param host : Printer's hostname or IP address 124 | @param port : Port to write to 125 | """ 126 | self.host = host 127 | self.port = port 128 | self.open() 129 | 130 | 131 | def open(self): 132 | """ Open TCP socket and set it as escpos device """ 133 | self.device = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 134 | self.device.connect((self.host, self.port)) 135 | 136 | if self.device is None: 137 | print "Could not open socket for %s" % self.host 138 | 139 | 140 | def _raw(self, msg): 141 | """ Print any command sent in raw format """ 142 | self.device.send(msg) 143 | 144 | def _read(self,n=1): 145 | """ Read data """ 146 | return self.device.recv(n) 147 | 148 | def __del__(self): 149 | """ Close TCP connection """ 150 | self.device.close() 151 | 152 | 153 | 154 | class File(Escpos): 155 | """ Define Generic file printer """ 156 | 157 | def __init__(self, devfile="/dev/usb/lp0"): 158 | """ 159 | @param devfile : Device file under dev filesystem 160 | """ 161 | self.devfile = devfile 162 | self.open() 163 | 164 | 165 | def open(self): 166 | """ Open system file """ 167 | self.device = open(self.devfile, "wb") 168 | 169 | if self.device is None: 170 | print "Could not open the specified file %s" % self.devfile 171 | 172 | 173 | def _raw(self, msg): 174 | """ Print any command sent in raw format """ 175 | self.device.write(msg); 176 | 177 | 178 | def __del__(self): 179 | """ Close system file """ 180 | self.device.close() 181 | --------------------------------------------------------------------------------