Return-Path: Delivered-To: apmail-incubator-ofbiz-commits-archive@locus.apache.org Received: (qmail 58318 invoked from network); 24 Dec 2006 16:47:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Dec 2006 16:47:36 -0000 Received: (qmail 32365 invoked by uid 500); 24 Dec 2006 16:47:43 -0000 Delivered-To: apmail-incubator-ofbiz-commits-archive@incubator.apache.org Received: (qmail 32341 invoked by uid 500); 24 Dec 2006 16:47:42 -0000 Mailing-List: contact ofbiz-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ofbiz-dev@incubator.apache.org Delivered-To: mailing list ofbiz-commits@incubator.apache.org Received: (qmail 32320 invoked by uid 99); 24 Dec 2006 16:47:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Dec 2006 08:47:42 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Dec 2006 08:47:09 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 28E251A981A; Sun, 24 Dec 2006 08:45:58 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r490040 - in /incubator/ofbiz/trunk/specialpurpose/pos: config/ src/org/ofbiz/pos/adaptor/ src/org/ofbiz/pos/device/impl/ Date: Sun, 24 Dec 2006 16:45:57 -0000 To: ofbiz-commits@incubator.apache.org From: jleroux@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061224164558.28E251A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jleroux Date: Sun Dec 24 08:45:57 2006 New Revision: 490040 URL: http://svn.apache.org/viewvc?view=rev&rev=490040 Log: This fix closes "Character buffer is out of synch with enter key..." (https://issues.apache.org/jira/browse/OFBIZ-259). More explanations in the Jira issue. Added: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties (with props) Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_es.properties incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_it.properties incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_zh.properties incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.xml incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Scanner.java Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties Sun Dec 24 08:45:57 2006 @@ -1,6 +1,7 @@ -#### +##################################################################### # # OFBiz XUI Properties file used for the XUI interface of the POS module (cf. XUI documentation) +# # Copyright 2001-2006 The Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -16,6 +17,7 @@ # under the License. ##################################################################### Add=Add +AmountInOut=Amount CASH=CASH CASH_DRAWER_COMMUNICATION_ERROR=CASH DRAWER COMMUNICATION ERROR CASH_DRAWER_IS_OPEN=CASH DRAWER IS OPEN @@ -60,6 +62,7 @@ RECEIPT_PRINTER_COMMUNICATION_ERROR=RECEIPT PRINTER COMMUNICATION ERROR REPRINT=REPRINT RESET_XUI=RESET XUI +ReasonInOut=Reason Replace=Replace ReplaceAndDelete=
Replace and
delete SALE_DISC=SALE DISC @@ -84,5 +87,3 @@ problems_reading_card=PROBLEMS READING SWIPED CARD product_not_found=PRODUCT NOT FOUND promo_page=This will be the promo page! -AmountInOut=Amount -ReasonInOut=Reason \ No newline at end of file Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_es.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_es.properties?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_es.properties (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_es.properties Sun Dec 24 08:45:57 2006 @@ -1,4 +1,7 @@ ##################################################################### +# +# OFBiz XUI Properties file used for the XUI interface of the POS module (cf. XUI documentation) +# # Copyright 2001-2006 The Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may not Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_fr.properties Sun Dec 24 08:45:57 2006 @@ -1,4 +1,4 @@ -#### +##################################################################### # # OFBiz XUI Properties file used for the XUI interface of the POS module (cf. XUI documentation) # @@ -17,6 +17,7 @@ # under the License. ##################################################################### Add=Ajouter +AmountInOut=Montant CASH=Esp\u00E8ces CASH_DRAWER_COMMUNICATION_ERROR=Erreur lors de la communication avec le tiroir caisse CASH_DRAWER_IS_OPEN=Le tiroir caisse est ouvert @@ -61,6 +62,7 @@ RECEIPT_PRINTER_COMMUNICATION_ERROR=Erreur lors de la communication avec l'imprimante de caisse REPRINT=R\u00E9afficher RESET_XUI=R\u00E9initialiser +ReasonInOut=Raison Replace=Remplacer ReplaceAndDelete=
Remplacer et
supprimer SALE_DISC=Remise sur la vente @@ -85,5 +87,3 @@ problems_reading_card=Probl\u00E8me lors de la lecture de la carte product_not_found=Produit inconnu ! promo_page=Ce sera la page des promotions... -AmountInOut=Montant -ReasonInOut=Raison \ No newline at end of file Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_it.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_it.properties?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_it.properties (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_it.properties Sun Dec 24 08:45:57 2006 @@ -1,5 +1,7 @@ ##################################################################### # +# OFBiz XUI Properties file used for the XUI interface of the POS module (cf. XUI documentation) +# # Copyright 2001-2006 The Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may not Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_zh.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_zh.properties?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_zh.properties (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/XuiLabels_zh.properties Sun Dec 24 08:45:57 2006 @@ -1,4 +1,4 @@ -#### +##################################################################### # # OFBiz XUI Properties file used for the XUI interface of the POS module (cf. XUI documentation) # Added: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties?view=auto&rev=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties (added) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties Sun Dec 24 08:45:57 2006 @@ -0,0 +1,25 @@ +##################################################################### +# +# File used for the some specific parameters of JavaPOS implementation +# +# Copyright 2001-2006 The Apache Software Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +##################################################################### + +# Defines if many bar codes may be sent in one message alone or only the 1st bar code keeped +MultiBarCodesAllowed=Y +# Defines the max waiting time between 2 bar code scanner messages sent +MaxWaitScanner=100 +# Defines the max waiting time between 2 key pressed +MaxWaitKeyboard=10 \ No newline at end of file Propchange: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.xml?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.xml (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/config/jpos.xml Sun Dec 24 08:45:57 2006 @@ -72,6 +72,21 @@ + + @@ -171,12 +186,12 @@ - + + and JavaComm installed (javax.comm package). See http://www.javapos.com/devint.html about this point... + pos-containers.xml must contains a reference to the logicalName : + --> @@ -220,5 +235,5 @@ - + Modified: incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/adaptor/KeyboardAdaptor.java Sun Dec 24 08:45:57 2006 @@ -25,6 +25,8 @@ import java.util.Map; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; import org.apache.commons.collections.map.LinkedMap; @@ -114,7 +116,11 @@ private class KeyboardListener extends Thread { - private static final long MAX_WAIT = 100; + public final Long MAX_WAIT_SCANNER = new Long(Long.parseLong(UtilProperties.getPropertyValue("jpos.properties", "MaxWaitScanner", "100"))); + public final Long MAX_WAIT_KEYBOARD = new Long(Long.parseLong(UtilProperties.getPropertyValue("jpos.properties", "MaxWaitKeyboard", "10"))); + // By default keyboard entry (login & password 1st) + public Long MAX_WAIT = MAX_WAIT_KEYBOARD; + private List keyCodeData = new LinkedList(); private List keyCharData = new LinkedList(); private long lastKey = -1; @@ -146,6 +152,9 @@ protected synchronized void receiveChar(char keychar) { keyCharData.add(new Character(keychar)); + if (keychar == '\2') { + MAX_WAIT = MAX_WAIT_SCANNER; + } } protected synchronized void sendData() { @@ -177,6 +186,7 @@ keyCharData = new LinkedList(); keyCodeData = new LinkedList(); lastKey = -1; + MAX_WAIT = MAX_WAIT_KEYBOARD; } } else { Debug.logWarning("No receivers configured for key input", module); @@ -211,7 +221,7 @@ public void run() { while (running) { long now = System.currentTimeMillis(); - if ((lastKey > -1) && (now - lastKey) >= MAX_WAIT) { + if ((lastKey > -1) && (now - lastKey) >= MAX_WAIT.intValue()) { this.sendData(); } @@ -219,7 +229,7 @@ break; } else { try { - Thread.sleep(MAX_WAIT); + Thread.sleep(MAX_WAIT.intValue()); } catch (InterruptedException e) { } } Modified: incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Scanner.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Scanner.java?view=diff&rev=490040&r1=490039&r2=490040 ============================================================================== --- incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Scanner.java (original) +++ incubator/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Scanner.java Sun Dec 24 08:45:57 2006 @@ -19,6 +19,7 @@ import jpos.ScannerConst; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.pos.adaptor.DataEventAdaptor; import org.ofbiz.pos.device.GenericDevice; import org.ofbiz.pos.screen.PosScreen; @@ -30,6 +31,7 @@ protected String deviceName = null; protected int timeout = -1; + private static final boolean MULTI_BARCODES_ALLOWED = UtilProperties.propertyValueEqualsIgnoreCase("jpos.properties", "MultiBarCodesAllowed", "Y"); public Scanner(String deviceName, int timeout) { super(deviceName, timeout); @@ -80,13 +82,31 @@ Debug.logWarning("Scanner type checking problems - check scanner driver", module); } - // stuff the data to the Input component - PosScreen.currentScreen.getInput().clearInput(); - PosScreen.currentScreen.getInput().appendString(new String(data)); - - // call the ENTER event - //this.callEnter(); - MenuEvents.addItem(PosScreen.currentScreen, null); + // This deals with multi Bar Codes in one event alone. + // For the moment it works only with barcode id of 1 char (see ScannerKybService). + // I thought that javapos AutoDisable option should be the way but does not seem to work. + // At least with my Zebex handheld and seem also not implemented though present + // in Msr, Kbd ans Scanner services (see autoDisable, getAutoDisable, setAutoDisable). + // I also tried to use setDataEventEnabled around getScanDataLabel/Type without success + // Perhaps I'm missing something here, but have no more time to search... + // I saw in JavaPOS Doc somehting about supplemental barcode. I think it's ok + // because it seems that in this case the scanner is able to deliver only one label. + String toInput = new String(data) + "\n "; + while (toInput.indexOf("\n") > -1) { + int posCR = toInput.indexOf("\n"); + // stuff the data to the Input component + PosScreen.currentScreen.getInput().clearInput(); + PosScreen.currentScreen.getInput().appendString(toInput.substring(0, posCR)); + + // At least one product recognized + MenuEvents.addItem(PosScreen.currentScreen, null); + + if (!MULTI_BARCODES_ALLOWED) { + break; + } + // More products to add + toInput = toInput.substring(posCR+3); + } } } }