3 Replies Latest reply on Jun 21, 2013 3:00 AM by Pietro Francesco Maggi

    ET1 Barcode Hardware Trigger Issue

      Hi ,

      i am using Rho Mobile Suit RMS 2.2.1

       

      I have implemented Barcode scanning in my rhoelement type application but it is not seems to work with hardware trigger of ET1.

       

      i have disabled the Data wedge. this code was working with earlier version of RMS.

       

      def multiscan

            begin

            scanner =""

            if $scanners and $scanners.count > 0

              scanner = $scanners[0]['deviceName']

              puts "multiscan - using scanner: #{scanner}"

              Barcode.disable()

              Barcode.enable(url_for(:action => :multi_callback), {:deviceName => scanner})

            end

          rescue Exception => e

            Alert.show_popup(e.message)

          end

        end

       

      def multi_callback

          status = @params['status']

          barcode = @params['barcode']

            if status == 'ok'

              Alert.show_popup(barcode)

           else

            puts status

          end

      end

       

      this code is working with a button on screen but not with hardware trigger

       

      def take

          scanner = @params['scannerName']

          Barcode.disable()

          Barcode.take_barcode(url_for(:action => :take_callback), {:deviceName => scanner})

        end

       

        def take_callback

          status = @params['status']

          barcode = @params['barcode']

          puts 'take_callback'

          puts 'status = ' + status.to_s unless status == nil

          puts 'barcode = ' + barcode.to_s unless barcode == nil

            if status == 'ok'

                  WebView.execute_js("ScannedValue('#{barcode}')")

             end

         end

        • Re: ET1 Barcode Hardware Trigger Issue
          Kutir Mobility

          Are you getting any error message? Where are you initializing $scanners?

           

          Thanks,

          Javier

          Kutir Mobility

            • Re: ET1 Barcode Hardware Trigger Issue

              Hi i m using these lines to initializing scanner

               

              if !$scanners

                    $scanners = []

               

               

                    puts "is_motorola_device: #{System.get_property('is_motorola_device')}"

                    puts "has_camera: #{System.get_property('has_camera')}"

                    if System::get_property('has_camera')

                      Barcode.enumerate('/app/BarcodeFeature/enum_callback')

                    elsif System::get_property('has_camera')

                      #TODO Write non motorola specific device (with camera) code to access List of scanners may be a dummy name for device camera

                    end

                  end

                end

               

               

                def enum_callback

                  puts "inside BarcodeFeature enum_callback"

                  $scanners = @params['scannerArray']

                  puts "$scanners : #{$scanners}"

                end

                • Re: ET1 Barcode Hardware Trigger Issue
                  Pietro Francesco Maggi

                  Hi Amit,

                  I think that the first "if System::get_property('has_camera')" needs to be changed to "if System::get_property('is_motorola_device')".

                   

                  Then, on an MSI device, with version 2.2 you can have better performance using the Scanner API than the Barcode API. You can use the RhoElements Tutorial to see how to use it. Just remember that on the ET1 the camera is the "SCN1" scanner and the optional imager module is the "SCN2", if mounted.

                   

                  Regarding your initial question, hw trigger barcode scanning. I think that the default behaviour is to support the Scanner API with the HW triggers, Barcode API does not support HW triggering out of the box (on version 2.2, version 4.0 it's another story).

                   

                  Best regards

                  Pietro