Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR_WRONG_CUSTOM_INFO -> TD-2120N #67

Open
MicaelMnl69 opened this issue Apr 22, 2024 · 7 comments
Open

ERROR_WRONG_CUSTOM_INFO -> TD-2120N #67

MicaelMnl69 opened this issue Apr 22, 2024 · 7 comments

Comments

@MicaelMnl69
Copy link

MicaelMnl69 commented Apr 22, 2024

Hello, i'dont know why it still doesn't work i have read this PR(#46) and this issue (#45) i have add a customPaperFilePath to my printer obj like that without success (I have the same label printer TD-2120N)

setPrinter: function (printer: any, onSuccess: any, onError:any) {
        if (cordova.platformId == 'ios' && printer['paperLabelName'] && printer['paperLabelName'].startsWith('W')) {
            var iosLabelName = IOS_PAPER_LABEL_MAP[printer['paperLabelName']];
            if (iosLabelName) {
                //console.log('Converting paperLabelName to ' + iosLabelName + ' for ios ');
                printer['paperLabelName'] = iosLabelName;
            }
        }

        if (printer['paperLabelName'] == 'CUSTOM') {
            printer.customPaperFilePath ='/public/media/brother/51x26/51x26.bin';
        }

        cordova.exec(onSuccess, onError, 'BrotherPrinter', 'setPrinter', [printer]);
    },

logs

To Native Cordova ->  BrotherPrinter setPrinter BrotherPrinter1723215947 ["options": [{
    customPaperFilePath = "public/media/brother/51x26/51x26.bin";
    ipAddress = "192.168.0.109";
    macAddress = "00:80:77:4d:e7:88";
    modelName = "Brother TD-2120N";
    orientation = LANDSCAPE;
    paperLabelName = CUSTOM;
    port = NET;
    serialNumber = B3G233707;
}]]

Thanks

@arcadius
Copy link

What err are you getting @MicaelMnl69 ?

@MicaelMnl69
Copy link
Author

MicaelMnl69 commented Apr 22, 2024

ERROR_WRONG_CUSTOM_INFO @arcadius

kSelectedDevice             = Brother TD-2120N
kIPAddress                  = 192.168.0.111
kSerialNumber               = 0
==== in printViaSdk with callback id                = BrotherPrinter1812653357 ...  operation: <BRWLANPrintOperation: 0x157213360>
==== in printViaSdk with callback id                = BrotherPrinter1812653357 ...  operation adding to que: <BRWLANPrintOperation: 0x157213360>
==== in printViaSdk with callback id                = BrotherPrinter1812653357 ...  operation: <BRWLANPrintOperation: 0x157213360>  END
Communication Result: 1
Error Code in BrotherPrinter is: 0
==== in main error code in instance is -34
isFinishedForWLAN ....
Error Code in BrotherPrinter is: -34

@arcadius
Copy link

Hello @MicaelMnl69 , I do not have access to the TD-2120N, so I am not sure I can help.
However, the line
modelName = "Brother TD-2120N";
does not look right as usually, there is no "Brother" or space in model names.

Maybe @TristanGodal can help?

@robr2112
Copy link

Assuming that the "51x26.bin" file was generated using the TD-2120N Windows Driver (if not, then that's the problem)....

I would guess the problem is that the customPaperFilePath is not a FULL path to the file, since you have only specified a partial path. Assuming the file is located inside your App Documents Directory at this partial path, try prepending the app directory path.

@MicaelMnl69
Copy link
Author

MicaelMnl69 commented Apr 25, 2024

Hello, thank you for your answers,

I have tried with modelName = "TD-2120N" @arcadius but it does not work either. And, @robr2112 , yes the file is generated by the Windows Driver and the path corresponds to the root path of my React Capacitor project

@robr2112
Copy link

@MicaelMnl69 OK thanks for clarifications.

What I meant by "full path" is that when your app is installed onto an iOS device, it will live inside a "sandbox" path in the iOS device file system.

While your path to the paper BIN file may be at the root level of your APP, it is NOT at the root level of the device.

For example, here is a path to a bin file (included inside the app bundle) that works for one of my Swift apps:

  • "/private/var/containers/Bundle/Application/0B1DF56E-2968-4292-B00E-5F1C1A5BDB98/MyApp.app/myPaperFile.bin"

Everything before and including "MyApp.app" is the path to your app on the device. Together, it provides the "full path" to the BIN file.

In Swift, there are methods available to get this path. For a Bundle Resource, I use this one:

  • Bundle.main.path(forResource: "MyPaperFile.bin", ofType: nil)

For the app documents folder, you may do something like this (in Swift):

I suspect Capacitor provides similar APIs to get these paths.

Anyway, I cannot say with certainty that the "relative path" you are using will fail in a Cordova/Capacitor app. It depends on whether Capacitor does something in the compiler to resolve your partial path into the full path that the SDK requires.
But, this is my best guess for why the SDK is failing with that specific error.

@MicaelMnl69
Copy link
Author

MicaelMnl69 commented Apr 26, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants