-
Notifications
You must be signed in to change notification settings - Fork 29
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
Request for Help: Implementing or Using This Project in an Android Kotlin App #71
Comments
It depends on your needs. If you you only need to embed this app to your app, you can use webview (Capacitor for example). Otherwise you need to port niimbluelib to desired language. Maybe this project code can help you somehow (first option): https://github.com/dotnetdreamer/capacitor-niimbot-printer |
I really appreciate your reply and feedback, but what I need is the second option. Do you have any suggestions or anything to port nimbluelib to kotlin? |
I have tried several times, but it only works for Niimbot B21. I want it to work, for Niimbot B21 and B1. Can you help me a little? |
There is a port of niimprint to Kotlin, I think you can extend it or use it as a starting point https://github.com/terratempest/android_niimprint |
Sure |
B1 and B21 has differences in print sequence. See this page: https://multimote.github.io/niimbluelib/documents/NIIMBOT_print_tasks.html |
thank you, this is what i have tried
I would really appreciate and be grateful for any help or input you may have. |
thanks,
is that normal? shouldn't the response be the same on index 2 and 5, that is 20 or 0x14? |
Yes. Check the real B1 exchange: AndBondStyle/niimprint#31 (comment) allowPrintClear() Not needed for B1. while (!endPagePrint())
delay(50) For B1 you need to send only single PageEnd. private suspend fun startPrint(): Boolean {
val resp = sendCommand(0x01.toByte(), byteArrayOf(0x01.toByte()))
return resp[4] != 0.toByte() // i: 2 or 5, res: 0x02 or 2
} That's not correct for B1. You should use this format (7 data bytes): https://github.com/MultiMote/niimbluelib/blob/19c3072d135eb53b1ff198ab8771a164583bf8bf/src/packets/packet_generator.ts#L168-L170 See the full print task implementation here: https://github.com/MultiMote/niimbluelib/blob/19c3072d135eb53b1ff198ab8771a164583bf8bf/src/print_tasks/B1PrintTask.ts |
@MultiMote I am very grateful for your input and direction. Overall I have successfully printed using both types of printers (B21 and B1) but when I print on the B1 printer the results shift to the right.
and this is the print result: |
Please attach the original image and your full packet exchange log (encoded to hex). Use following format if you can:
|
sure, wait a minute |
@MultiMote this the original image: this full packet exchange log:
|
@MultiMote wow, awesome thanks a lot @MultiMote for everything, now it works normally |
on SET_DIMENSION my width and height are swapped. that's all |
@MultiMote Oh yeah there's more, how do you know the size of paper used in the printer? |
POST https://print.niimbot.com/api/template/getCloudTemplateByOneCode HTTP/1.1
Content-Type: application/json
niimbot-user-agent: AppVersionName/999.0.0
{ "oneCode" : "LABEL_BARCODE" } There is no offline way of doing this known to me. |
Hi everyone,
I'm currently working on an Android application using Kotlin and I need some assistance with implementing or using this project in my app. It is important to note that I have very limited knowledge of TypeScript and almost no experience with it.
Could anyone with experience in both TypeScript and Kotlin help guide me through this process? Any advice, examples, or resources would be greatly appreciated.
Thank you in advance for your support!
The text was updated successfully, but these errors were encountered: