-
Notifications
You must be signed in to change notification settings - Fork 55
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
Initial support for iOS, Bluetooth printing #11
base: master
Are you sure you want to change the base?
Conversation
add ios support add the ability to set the printer update the version to 0.0.4 from 0.0.3 add supported printer list add network printing for iOS TODO: be able to select the Printer label type. It is currently hard- coded to use 62mm paper. This needs to be configurable.
when the permissions are listed as required, especially the usb permission, the number of supported devices drops significantly when uploading to the Play Store.
WIP: Add support for iOS and Bluetooth printing (android only for now)
Readme update with new function documentation
@Ayiga are you able to build?
|
Hi, for the life of me, I cannot seem to call the findPrinters function, do
you perhaps know how to translate this typescript to javascript?
Sample:
function findPrinters(success: (printers: Printer[]) => void, failure:
(reason: string) => void): void
What I've got:
cordova.plugins.brotherPrinter.findPrinters(function (a) {
alert(a);
}, viewModel.onSuccess, viewModel.onError);
or even this does not want to
work:cordova.plugins.brotherPrinter.findPrinters(viewModel.onSuccess,
viewModel.onError);
Thank you for the assistance!
…On Fri, Aug 18, 2017 at 11:20 AM, Thomas Gordon Lowrey IV < ***@***.***> wrote:
https://github.com/gordol/cordova-brother-label-printer/
pull/11/files#diff-7ffdcc51506a24e861e75e002ed22eddR19
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATzouekyVnyr6i5vOXsvHRzLNH5Bg6I2ks5sZVdtgaJpZM4O7Ku4>
.
|
fix Bluetooth paired devices check from trying to return non-Brother Label printers as part of the device list. loosen restrictions on the List type passed into ImageBitmapPrint
Permissions Check and Cleanup (Previously Missing)
@dev-fJ-del You should just be able to call findPrinters(). It takes two parameters, a success callback, and a failure callback. Your second example looks correct to me.
That being said, I have not actually tested this PR yet, that's why it's on the dev branch. |
Can you send any log outputs? You should see some log messages if any printers are found. Are you receiving any errors? |
Ok, I got it to work up until where it calls the printViaSDK, I get the error: "ERROR_WRONG_CUSTOM_INFO"
No idea what to do from here on. |
This is some of the new stuff... Hmm... @Ayiga was this pulled over from brother by mistake, or did you need this? cordova-brother-label-printer/src/android/Common.java Lines 87 to 88 in 9d88275
@dev-fJ-del Try modifying this line:
to
Basically, remove the CUSTOM_PAPER_FOLDER bit... and let me know if it works? |
Removed pointless callback (conflicted w/ readme)
@gordol I can build what I had currently without issues. I'll have to repull this repo to make sure everything still works on this end. as far as the |
I've purposely been triggering a network error to occur when calling printViaSDK by having my ipad connected to a different network than that of the brother printer, however the callback never gets runned, instead I see this in my safari and xcode consoles error: Error occured while WLAN printing. Which is line 557 in BrotherPrinter.m file. https://github.com/gordol/cordova-brother-label-printer/blob/dev/src/ios/BrotherPrinter.m#L557 It would be great if the callback actually got triggered with a good error as a response that way I can handle that on the js side. Otherwise, the js side has no idea why the printer didn't print since the callback never gets invoked. |
@VictorCoding What is outputted by this line? |
@gordol i get a |
I'm not super familiar with this IOS code, but looks like the meat of that is happening here: https://github.com/gordol/cordova-brother-label-printer/blob/dev/src/ios/BRWLANPrintOperation.m
What do you have if you dump: My objective C isn't very strong, I'll need to brush up on some basics before I can be of more help. |
Can you put some debug logging here, to see if your printer is ready? https://github.com/gordol/cordova-brother-label-printer/blob/dev/src/ios/BRWLANPrintOperation.m#L61 |
I don't know the details of the IOS Brother SDK, but it seems to me, that what you want are two things... Callbacks for failure to associate with the printer, and a callback for failure to print. On Android, we don't allow a call to
|
@gordol The printer is NOT ready so it skips to line 77. In my javascript implementation for btw, thanks for your assistance even if your objective c game is rusty. at least it's better than me, i dont know objective c at all. |
I believe this is due to the original code for handling the callback in the javascript file: https://github.com/gordol/cordova-brother-label-printer/blob/dev/www/printer.js#L24 And the Original: As you can see in that file, all errors just get console logged instead of passed back to the user. It's one of the things I worked to fix with this pull request: https://github.com/ayiga/cordova-brother-label-printer/blob/master/www/printer.js#L50 But, I haven't been able to come back to this project and update it so that it's "good enough". I will push what I have, but I have added some quick and dirty solutions for what I needed in my particular use case without really addressing the talking points @gordol brought up before. I just haven't had the time to come back, and give it the attention it needs, unfortunately. :( |
Hello, cordova.plugins.brotherPrinter.findNetworkPrinters((success) => {}, (error) => {}) thanks in advance. |
@chetuBhadra93 could you provide the actual data you're getting from the |
Hello @gordol , @VictorCoding @Ayiga .... Not sure what version of XCode you guys are using ... After installing this plugin dev branch, my project will not even compile in Xcode .... please see more detail on #34 |
@arcadius im using version 9.4. |
|
Todo
Label size is currently hard-coded and specified on calls to setPrinter
The supported printer list only contains printers I have tested personally, Brother QL-720NW and Brother QL-820NWB. With changes to allow for the changing of the label type, this would likely support all brother label printers, but it needs to be tested by someone with access.
iOS has bluetooth issues according to @Ayiga in WIP: Add support for iOS and Bluetooth printing #10
Documentation/readme needs to be updated.
Need to test! Anyone have a basic iOS Cordova app to test this with? Should we include a boilerplate example with this plugin to help users get started?