Last active
April 8, 2021 08:58
-
-
Save snoepje0/64c94ade7bfe570010a64a10bf37b807 to your computer and use it in GitHub Desktop.
Python file for turning a raspberry pi into a barcode logging device. Requires a barcode scanner. For SSCC support, requires that the <GS> symbol be replace in-device to <TAB>.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys, re, requests, json, datetime | |
from evdev import InputDevice, categorize, ecodes | |
import evdev | |
SSCC = { | |
"^00(\d{18})" : "Serial Shipping Container Code (SSCC) " , | |
"^01(\d{14})" : "Global Trade Item Number (GTIN)" , | |
"^02(\d{14})" : "GTIN of contained trade items" , | |
"^10([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Batch or lot number" , | |
"^11(\d{6})" : "Production date (YYMMDD)" , | |
"^12(\d{6})" : "Due date (YYMMDD)" , | |
"^13(\d{6})" : "Packaging date (YYMMDD)" , | |
"^15(\d{6})" : "Best before date (YYMMDD)" , | |
"^16(\d{6})" : "Sell by date (YYMMDD)" , | |
"^17(\d{6})" : "Expiration date (YYMMDD)" , | |
"^20(\d{2})" : "Internal product variant" , | |
"^21([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Serial number" , | |
"^22([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Consumer product variant" , | |
"^243([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,28})" : "Third Party Controlled, Serialised Extension of GTIN (TPX)" , | |
"^240([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Additional product identification assigned by the manufacturer" , | |
"^241([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Customer part number" , | |
"^242(\d{0,6})" : "Made-to-Order variation number" , | |
"^243([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Packaging component number" , | |
"^250([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Secondary serial number" , | |
"^251([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Reference to source entity" , | |
"^253(\d{13})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,17})" : "Global Document Type Identifier (GDTI)" , | |
"^254([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "GLN extension component" , | |
"^255(\d{13})(\d{0,12})" : "Global Coupon Number (GCN)" , | |
"^30(\d{0,8})" : "Variable count of items (variable measure trade item)" , | |
"^3100(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3101(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3102(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3103(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3104(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3105(\d{6})" : "Net weight, kilograms (variable measure trade item)" , | |
"^3110(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3111(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3112(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3113(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3114(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3115(\d{6})" : "Length or first dimension, metres (variable measure trade item)" , | |
"^3120(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3121(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3122(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3123(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3124(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3125(\d{6})" : "Width, diameter, or second dimension, metres (variable measure trade item)" , | |
"^3130(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3131(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3132(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3133(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3134(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3135(\d{6})" : "Depth, thickness, height, or third dimension, metres (variable measure trade item)" , | |
"^3140(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3141(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3142(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3143(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3144(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3145(\d{6})" : "Area, square metres (variable measure trade item)" , | |
"^3150(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3151(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3152(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3153(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3154(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3155(\d{6})" : "Net volume, litres (variable measure trade item)" , | |
"^3160(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3161(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3162(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3163(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3164(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3165(\d{6})" : "Net volume, cubic metres (variable measure trade item)" , | |
"^3200(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3201(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3202(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3203(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3204(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3205(\d{6})" : "Net weight, pounds (variable measure trade item)" , | |
"^3210(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3211(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3212(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3213(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3214(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3215(\d{6})" : "Length or first dimension, inches (variable measure trade item)" , | |
"^3220(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3221(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3222(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3223(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3224(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3225(\d{6})" : "Length or first dimension, feet (variable measure trade item)" , | |
"^3230(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3231(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3232(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3233(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3234(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3235(\d{6})" : "Length or first dimension, yards (variable measure trade item)" , | |
"^3240(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3241(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3242(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3243(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3244(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3245(\d{6})" : "Width, diameter, or second dimension, inches (variable measure trade item)" , | |
"^3250(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3251(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3252(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3253(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3254(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3255(\d{6})" : "Width, diameter, or second dimension, feet (variable measure trade item)" , | |
"^3260(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3261(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3262(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3263(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3264(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3265(\d{6})" : "Width, diameter, or second dimension, yards (variable measure trade item)" , | |
"^3270(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3271(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3272(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3273(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3274(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3275(\d{6})" : "Depth, thickness, height, or third dimension, inches (variable measure trade item)" , | |
"^3280(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3281(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3282(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3283(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3284(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3285(\d{6})" : "Depth, thickness, height, or third dimension, feet (variable measure trade item)" , | |
"^3290(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3291(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3292(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3293(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3294(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3295(\d{6})" : "Depth, thickness, height, or third dimension, yards (variable measure trade item)" , | |
"^3300(\d{6})" : "Logistic weight, kilograms" , | |
"^3301(\d{6})" : "Logistic weight, kilograms" , | |
"^3302(\d{6})" : "Logistic weight, kilograms" , | |
"^3303(\d{6})" : "Logistic weight, kilograms" , | |
"^3304(\d{6})" : "Logistic weight, kilograms" , | |
"^3305(\d{6})" : "Logistic weight, kilograms" , | |
"^3310(\d{6})" : "Length or first dimension, metres" , | |
"^3311(\d{6})" : "Length or first dimension, metres" , | |
"^3312(\d{6})" : "Length or first dimension, metres" , | |
"^3313(\d{6})" : "Length or first dimension, metres" , | |
"^3314(\d{6})" : "Length or first dimension, metres" , | |
"^3315(\d{6})" : "Length or first dimension, metres" , | |
"^3320(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3321(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3322(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3323(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3324(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3325(\d{6})" : "Width, diameter, or second dimension, metres" , | |
"^3330(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3331(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3332(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3333(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3334(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3335(\d{6})" : "Depth, thickness, height, or third dimension, metres" , | |
"^3340(\d{6})" : "Area, square metres" , | |
"^3341(\d{6})" : "Area, square metres" , | |
"^3342(\d{6})" : "Area, square metres" , | |
"^3343(\d{6})" : "Area, square metres" , | |
"^3344(\d{6})" : "Area, square metres" , | |
"^3345(\d{6})" : "Area, square metres" , | |
"^3350(\d{6})" : "Logistic volume, litres" , | |
"^3351(\d{6})" : "Logistic volume, litres" , | |
"^3352(\d{6})" : "Logistic volume, litres" , | |
"^3353(\d{6})" : "Logistic volume, litres" , | |
"^3354(\d{6})" : "Logistic volume, litres" , | |
"^3355(\d{6})" : "Logistic volume, litres" , | |
"^3360(\d{6})" : "Logistic volume, cubic metres" , | |
"^3361(\d{6})" : "Logistic volume, cubic metres" , | |
"^3362(\d{6})" : "Logistic volume, cubic metres" , | |
"^3363(\d{6})" : "Logistic volume, cubic metres" , | |
"^3364(\d{6})" : "Logistic volume, cubic metres" , | |
"^3365(\d{6})" : "Logistic volume, cubic metres" , | |
"^3370(\d{6})" : "Kilograms per square metre" , | |
"^3371(\d{6})" : "Kilograms per square metre" , | |
"^3372(\d{6})" : "Kilograms per square metre" , | |
"^3373(\d{6})" : "Kilograms per square metre" , | |
"^3374(\d{6})" : "Kilograms per square metre" , | |
"^3375(\d{6})" : "Kilograms per square metre" , | |
"^3400(\d{6})" : "Logistic weight, pounds" , | |
"^3401(\d{6})" : "Logistic weight, pounds" , | |
"^3402(\d{6})" : "Logistic weight, pounds" , | |
"^3403(\d{6})" : "Logistic weight, pounds" , | |
"^3404(\d{6})" : "Logistic weight, pounds" , | |
"^3405(\d{6})" : "Logistic weight, pounds" , | |
"^3410(\d{6})" : "Length or first dimension, inches" , | |
"^3411(\d{6})" : "Length or first dimension, inches" , | |
"^3412(\d{6})" : "Length or first dimension, inches" , | |
"^3413(\d{6})" : "Length or first dimension, inches" , | |
"^3414(\d{6})" : "Length or first dimension, inches" , | |
"^3415(\d{6})" : "Length or first dimension, inches" , | |
"^3420(\d{6})" : "Length or first dimension, feet" , | |
"^3421(\d{6})" : "Length or first dimension, feet" , | |
"^3422(\d{6})" : "Length or first dimension, feet" , | |
"^3423(\d{6})" : "Length or first dimension, feet" , | |
"^3424(\d{6})" : "Length or first dimension, feet" , | |
"^3425(\d{6})" : "Length or first dimension, feet" , | |
"^3430(\d{6})" : "Length or first dimension, yards" , | |
"^3431(\d{6})" : "Length or first dimension, yards" , | |
"^3432(\d{6})" : "Length or first dimension, yards" , | |
"^3433(\d{6})" : "Length or first dimension, yards" , | |
"^3434(\d{6})" : "Length or first dimension, yards" , | |
"^3435(\d{6})" : "Length or first dimension, yards" , | |
"^3440(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3441(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3442(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3443(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3444(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3445(\d{6})" : "Width, diameter, or second dimension, inches" , | |
"^3450(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3451(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3452(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3453(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3454(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3455(\d{6})" : "Width, diameter, or second dimension, feet" , | |
"^3460(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3461(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3462(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3463(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3464(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3465(\d{6})" : "Width, diameter, or second dimension, yard" , | |
"^3470(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3471(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3472(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3473(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3474(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3475(\d{6})" : "Depth, thickness, height, or third dimension, inches" , | |
"^3480(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3481(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3482(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3483(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3484(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3485(\d{6})" : "Depth, thickness, height, or third dimension, feet" , | |
"^3490(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3491(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3492(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3493(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3494(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3495(\d{6})" : "Depth, thickness, height, or third dimension, yards" , | |
"^3500(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3501(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3502(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3503(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3504(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3505(\d{6})" : "Area, square inches (variable measure trade item)" , | |
"^3510(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3511(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3512(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3513(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3514(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3515(\d{6})" : "Area, square feet (variable measure trade item)" , | |
"^3520(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3521(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3522(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3523(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3524(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3525(\d{6})" : "Area, square yards (variable measure trade item)" , | |
"^3530(\d{6})" : "Area, square inches" , | |
"^3531(\d{6})" : "Area, square inches" , | |
"^3532(\d{6})" : "Area, square inches" , | |
"^3533(\d{6})" : "Area, square inches" , | |
"^3534(\d{6})" : "Area, square inches" , | |
"^3535(\d{6})" : "Area, square inches" , | |
"^3540(\d{6})" : "Area, square feet" , | |
"^3541(\d{6})" : "Area, square feet" , | |
"^3542(\d{6})" : "Area, square feet" , | |
"^3543(\d{6})" : "Area, square feet" , | |
"^3544(\d{6})" : "Area, square feet" , | |
"^3545(\d{6})" : "Area, square feet" , | |
"^3550(\d{6})" : "Area, square yards" , | |
"^3551(\d{6})" : "Area, square yards" , | |
"^3552(\d{6})" : "Area, square yards" , | |
"^3553(\d{6})" : "Area, square yards" , | |
"^3554(\d{6})" : "Area, square yards" , | |
"^3555(\d{6})" : "Area, square yards" , | |
"^3560(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3561(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3562(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3563(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3564(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3565(\d{6})" : "Net weight, troy ounces (variable measure trade item)" , | |
"^3570(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3571(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3572(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3573(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3574(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3575(\d{6})" : "Net weight (or volume), ounces (variable measure trade item)" , | |
"^3600(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3601(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3602(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3603(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3604(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3605(\d{6})" : "Net volume, quarts (variable measure trade item)" , | |
"^3610(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3611(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3612(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3613(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3614(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3615(\d{6})" : "Net volume, gallons U.S. (variable measure trade item)" , | |
"^3620(\d{6})" : "Logistic volume, quarts" , | |
"^3621(\d{6})" : "Logistic volume, quarts" , | |
"^3622(\d{6})" : "Logistic volume, quarts" , | |
"^3623(\d{6})" : "Logistic volume, quarts" , | |
"^3624(\d{6})" : "Logistic volume, quarts" , | |
"^3625(\d{6})" : "Logistic volume, quarts" , | |
"^3630(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3631(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3632(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3633(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3634(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3635(\d{6})" : "Logistic volume, gallons U.S." , | |
"^3640(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3641(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3642(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3643(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3644(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3645(\d{6})" : "Net volume, cubic inches (variable measure trade item)" , | |
"^3650(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3651(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3652(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3653(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3654(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3655(\d{6})" : "Net volume, cubic feet (variable measure trade item)" , | |
"^3660(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3661(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3662(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3663(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3664(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3665(\d{6})" : "Net volume, cubic yards (variable measure trade item)" , | |
"^3670(\d{6})" : "Logistic volume, cubic inches" , | |
"^3671(\d{6})" : "Logistic volume, cubic inches" , | |
"^3672(\d{6})" : "Logistic volume, cubic inches" , | |
"^3673(\d{6})" : "Logistic volume, cubic inches" , | |
"^3674(\d{6})" : "Logistic volume, cubic inches" , | |
"^3675(\d{6})" : "Logistic volume, cubic inches" , | |
"^3680(\d{6})" : "Logistic volume, cubic feet" , | |
"^3681(\d{6})" : "Logistic volume, cubic feet" , | |
"^3682(\d{6})" : "Logistic volume, cubic feet" , | |
"^3683(\d{6})" : "Logistic volume, cubic feet" , | |
"^3684(\d{6})" : "Logistic volume, cubic feet" , | |
"^3685(\d{6})" : "Logistic volume, cubic feet" , | |
"^3690(\d{6})" : "Logistic volume, cubic yards" , | |
"^3691(\d{6})" : "Logistic volume, cubic yards" , | |
"^3692(\d{6})" : "Logistic volume, cubic yards" , | |
"^3693(\d{6})" : "Logistic volume, cubic yards" , | |
"^3694(\d{6})" : "Logistic volume, cubic yards" , | |
"^3695(\d{6})" : "Logistic volume, cubic yards" , | |
"^37(\d{0,8})" : "Count of trade items or trade item pieces contained in a logistic unit" , | |
"^3900(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3901(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3902(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3903(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3904(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3905(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3906(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3907(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3908(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3909(\d{0,15})" : "Applicable amount payable or Coupon value, local currency" , | |
"^3910(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3911(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3912(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3913(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3914(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3915(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3916(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3917(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3918(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3919(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code" , | |
"^3920(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3921(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3922(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3923(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3924(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3925(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3926(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3927(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3928(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3929(\d{0,15})" : "Applicable amount payable, single monetary area (variable measure trade item)" , | |
"^3930(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3931(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3932(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3933(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3934(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3935(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3936(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3937(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3938(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3939(\d{3})(\d{0,15})" : "Applicable amount payable with ISO currency code (variable measure trade item)" , | |
"^3940(\d{4})" : "Percentage discount of a coupon" , | |
"^3941(\d{4})" : "Percentage discount of a coupon" , | |
"^3942(\d{4})" : "Percentage discount of a coupon" , | |
"^3943(\d{4})" : "Percentage discount of a coupon" , | |
"^400([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Customers purchase order number" , | |
"^401([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Global Identification Number for Consignment (GINC)" , | |
"^402(\d{17})" : "Global Shipment Identification Number (GSIN)" , | |
"^403([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Routing code" , | |
"^410(\d{13})" : "Ship to - Deliver to Global Location Number" , | |
"^411(\d{13})" : "Bill to - Invoice to Global Location Number" , | |
"^412(\d{13})" : "Purchased from Global Location Number" , | |
"^413(\d{13})" : "Ship for - Deliver for - Forward to Global Location Number" , | |
"^414(\d{13})" : "Identification of a physical location - Global Location Number" , | |
"^415(\d{13})" : "Global Location Number of the invoicing party" , | |
"^416(\d{13})" : "GLN of the production or service location" , | |
"^417(\d{13})" : "Party GLN" , | |
"^420([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Ship to - Deliver to postal code within a single postal authority" , | |
"^421(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,9})" : "Ship to - Deliver to postal code with ISO country code" , | |
"^422(\d{3})" : "Country of origin of a trade item" , | |
"^423(\d{3})(\d{0,12})" : "Country of initial processing" , | |
"^424(\d{3})" : "Country of processing" , | |
"^425(\d{3})(\d{0,12})" : "Country of disassembly" , | |
"^426(\d{3})" : "Country covering full process chain" , | |
"^427([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,3})" : "Country subdivision Of origin" , | |
"^7001(\d{13})" : "NATO Stock Number (NSN)" , | |
"^7002([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "UN/ECE meat carcasses and cuts classification" , | |
"^7003(\d{10})" : "Expiration date and time" , | |
"^7004(\d{0,4})" : "Active potency" , | |
"^7005([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,12})" : "Catch area" , | |
"^7006(\d{6})" : "First freeze date " , | |
"^7007(\d{6,12})" : "Harvest date" , | |
"^7008([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,3})" : "Species for fishery purposes" , | |
"^7009([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,10})" : "Fishing gear type" , | |
"^7010([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,2})" : "Production method" , | |
"^7020([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Refurbishment lot ID" , | |
"^7021([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Functional status" , | |
"^7022([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Revision status" , | |
"^7023([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Global Individual Asset Identifier (GIAI) of an assembly" , | |
"^7030(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7031(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7032(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7033(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7034(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7035(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7036(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7037(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7038(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7039(\d{3})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,27})" : "Number of processor with ISO Country Code" , | |
"^7040(\d[\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{3})" : "GS1 UIC with Extension 1 and Importer index" , | |
"^710([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "National Healthcare Reimbursement Number (NHRN) - Germany PZN" , | |
"^711([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "National Healthcare Reimbursement Number (NHRN) - France CIP" , | |
"^712([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "National Healthcare Reimbursement Number (NHRN) - Spain CN" , | |
"^713([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "National Healthcare Reimbursement Number (NHRN) - Brasil DRN" , | |
"^714([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "National Healthcare Reimbursement Number (NHRN) - Portugal AIM" , | |
"^7230([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7231([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7232([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7233([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7234([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7235([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7236([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7237([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7238([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7239([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{2,30})" : "Certification reference" , | |
"^7240 ([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Protocol ID" , | |
"^8001(\d{14})" : "Roll products (width, length, core diameter, direction, splices)" , | |
"^8002([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Cellular mobile telephone identifier" , | |
"^8003(\d{14})([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,16})" : "Global Returnable Asset Identifier (GRAI)" , | |
"^8004([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Global Individual Asset Identifier (GIAI)" , | |
"^8005(\d{6})" : "Price per unit of measure" , | |
"^8006(\d{14})(\d{2})(\d{2})" : "Identification of an individual trade item piece" , | |
"^8007([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,34})" : "International Bank Account Number (IBAN) " , | |
"^8008(\d{8})(\d{0,4})" : "Date and time of production" , | |
"^8009([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,50})" : "Optically Readable Sensor Indicator" , | |
"^8010([\x23\x2D\x2F\x30-\x39\x41-\x5A]{0,30})" : "Component/Part Identifier (CPID)" , | |
"^8011(\d{0,12})" : "Component/Part Identifier serial number (CPID SERIAL)" , | |
"^8012([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,20})" : "Software version" , | |
"^8013([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Global Model Number (GMN)" , | |
"^8017(\d{18})" : "Global Service Relation Number to identify the relationship between an organisation offering services and the provider of services" , | |
"^8018(\d{18})" : "Global Service Relation Number to identify the relationship between an organisation offering services and the recipient of services" , | |
"^8019(\d{0,10})" : "Service Relation Instance Number (SRIN)" , | |
"^8020([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,25})" : "Payment slip reference number" , | |
"^8026(\d{14})(\d{2})(\d{2})" : "Identification of pieces of a trade item (ITIP) contained in a logistic unit" , | |
"^8110([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,70})" : "Coupon code identification for use in North America" , | |
"^8111(\d{4})" : "Loyalty points of a coupon" , | |
"^8112([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,70})" : "Paperless coupon code identification for use in North America" , | |
"^8200([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,70})" : "Extended Packaging URL " , | |
"^90([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,30})" : "Information mutually agreed between trading partners" , | |
"^91([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^92([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^93([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^94([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^95([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^96([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^97([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^98([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" , | |
"^99([\x21-\x22\x25-\x2F\x30-\x39\x41-\x5A\x5F\x61-\x7A]{0,90})" : "Company internal information" | |
} | |
scancodes = { | |
0: None, 1: u'ESC', 2: u'1', 3: u'2', 4: u'3', 5: u'4', 6: u'5', 7: u'6', 8: u'7', 9: u'8', | |
10: u'9', 11: u'0', 12: u'-', 13: u'=', 14: u'BKSP', 15: u'\t', 16: u'Q', 17: u'W', 18: u'E', 19: u'R', | |
20: u'T', 21: u'Y', 22: u'U', 23: u'I', 24: u'O', 25: u'P', 26: u'[', 27: u']', 28: u'\n', 29: "", | |
30: u'A', 31: u'S', 32: u'D', 33: u'F', 34: u'G', 35: u'H', 36: u'J', 37: u'K', 38: u'L', 39: u';', | |
40: u'"', 41: u'`', 42: "", 43: u'\\', 44: u'Z', 45: u'X', 46: u'C', 47: u'V', 48: u'B', 49: u'N', | |
50: u'M', 51: u',', 52: u'.', 53: u'/', 54: "", 56: "", 100: "" | |
} | |
file = open("/home/pi/codes.csv","a+") | |
def find_device(): | |
devices = [evdev.InputDevice(path) for path in evdev.list_devices()] | |
for device in devices: | |
if("barcode" in device.name.lower()): | |
print("\n Barcode scanner found\n") | |
#print(device.path , device.name, device.phys) | |
return device | |
def decode_SSCC(buffer): | |
buffer = buffer.replace("]C1" , "\t") | |
list = buffer.split("\t") | |
#split on the known endpoints of information. Next step is apply the regex | |
result = [] | |
#print(len(list)) | |
for string in list: | |
if(string == ''): | |
continue | |
#print("Pass in Regex Code " + string) | |
for regex in SSCC: | |
if(re.search(regex, string) is not None): | |
SSCCString = re.search(regex, string).group() | |
partition = SSCCString.partition(re.split(regex,string)[1]) | |
result.append("("+str(partition[0]) + ")"+ str(partition[1])) | |
list.append(string.partition(SSCCString)[2]) | |
return ' '.join(result)+"\n" | |
def decode_barcode(buffer): | |
#print(buffer) | |
#print("Decode: " + buffer) | |
if(buffer.startswith("]C1")): | |
#SSCC code | |
#print("SSCC") | |
buffer = decode_SSCC(buffer) | |
file.write(str(datetime.datetime.now()) + "\t" + str(buffer)) | |
file.flush() | |
def evdev_reader(): | |
device = find_device() | |
buffer = '' | |
for event in device.read_loop(): | |
if event.type == ecodes.EV_KEY: | |
eventData = categorize(event) | |
if eventData.keystate == 1: | |
key_lookup = scancodes.get(eventData.scancode) | |
#print (u'You Pressed the {} key!'.format(key_lookup)) | |
buffer = str(buffer) + str(key_lookup) | |
if(eventData.scancode == 28): | |
decode_barcode(buffer) | |
buffer = '' | |
continue | |
evdev_reader() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment