2 Replies Latest reply on Aug 19, 2014 4:00 AM by Krystian Sikora

    Rho::PrinterZebra.getPrinterByID returns instance of Barcode class

    Krystian Sikora

      Hello,

       

      I'm testing printer functionality in my application and I'm experiencing strange behaviour.

      I'm using PrinterZebra module and my application is configured properly to use that module.

       

      In my test application I first search for Printers (which is already paired with the mobile device MC40 android 4.1)

       

          @@printers = []
          Rho::PrinterZebra.searchPrinters({ 'connectionType'  => Rho::Printer::CONNECTION_TYPE_BLUETOOTH,
                                        'deviceAddress'   => '00:22:58:3A:DB:C0'},
                                        url_for(:action => :find_printer_callback) )
      

       

      Then in the find printer callback:

       

      def find_printer_callback
          if @params['status'] == 'PRINTER_STATUS_SUCCESS'
            if !@params['printerID'].nil? 
              app_info "PrinterID is defined in params"
              app_info @params.to_s
              printerId = @params['printerID']
              app_info "Found: #{printerId}"
              @@printers.push printerId   
            else
              app_info "Done Searching"
              app_info "Getting printer instance #{@@printers[0]}"
              printerDevice = Rho::PrinterZebra.getPrinterByID(@@printers[0])
              app_info "getPrinterByID returned #{printerDevice.class}"
              # Let's try connecting
              printerDevice.connect url_for(:action => :printer_connect_callback)
              @printer = printerDevice
            end
          else
            app_info "Printer status: " + @params['status']
          end
        end
      

       

      Everything works as expected until getPrinterByID returns an instance of Barcode class, in my logs I can see the following:

       

      I/APP     ( 4643): I 08/18/2014 14:20:15:390 0000123c APP CategoryController| Done Searching

      I/APP     ( 4643): I 08/18/2014 14:20:15:391 0000123c APP CategoryController| Getting printer instance ZEBRA_PRINTER_1

      I/APP     ( 4643): I 08/18/2014 14:20:15:393 0000123c APP CategoryController| getPrinterByID returned Rho::Barcode

      I/APP     ( 4643): I 08/18/2014 14:20:15:395 0000123c                  APP| App error: undefined method `connect' for #<Rho::Barcode:0x51bc7090>

      I/APP     ( 4643):  apps/app/Category/category_controller.rb:294:in `find_printer_callback'

       

      I'm using RMS 4.1.1 on Windows. The Printer is Zebra P4T connected to MC40 device.

      There is definitively some problem here. Please help