Rho::PrinterZebra.getPrinterByID returns instance of Barcode class

K Krystian Sikora 3 years 6 months ago
2 1 0

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 #
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

Please Register or Login to post a reply

1 Replies

V Vinod Shankar K

Hi

We tested it with below same code but we didn’t see this issue on MC40 QL320 BT printer.
getPrinterByID returned Rho::PrinterZebra class.

Can you check is there any other value assigned in @@printers array.

Also can you try same thing using JavaScript.

Regards
Vinod Shankar

CONTACT
Can’t find what you’re looking for?