Android Question How to realize XMODEM-1K with B4A

MikeFree

Member
Has anyone done some codeing

for receiving files via bluetooth with "XMODEM-1K"-protocol?
see https://en.wikipedia.org/wiki/XMODEM#XMODEM-1K

Backkround:
I use a OBD hardware named FISCONTROL which collects data in logfiles.
This logs can be downloading using XModem.

I m at the moment not so experiencend in B4A but I think a little app can be realized with B4A?

Has anyone an idea?

Thanks for posts
 

emexes

Expert
Licensed User
Lol I thought you were showcasing that you'd implemented it, not looking to get it done.

From memory, the protocol was pretty simple to implement and to use, other than not communicating the file name or length.

It'd be useful for you to have a known working situation that you can use to test your homebrew downloader. Have you already successfully downloaded data from the OBD device using a regular terminal program? How does it initiate the transfer?
 
Upvote 0

MikeFree

Member
Lol I thought you were showcasing that you'd implemented it, not looking to get it done.

From memory, the protocol was pretty simple to implement and to use, other than not communicating the file name or length.

It'd be useful for you to have a known working situation that you can use to test your homebrew downloader. Have you already successfully downloaded data from the OBD device using a regular terminal program? How does it initiate the transfer?

the developer of the OBD hardware provides a youtube video:

does this give the needed answer?
 
Upvote 0

emexes

Expert
Licensed User
does this give the needed answer?
Sure does! 👍

Download a terminal program onto your B4A-bridged Android device and see if you too can download from the OBD device, like they do in the video using TeraTerm. Or if you can't get it going on your Android device, give it a go on your B4A computer (laptop?) using Teraterm.

Once that works, start writing B4A to do the same thing. First step is to send a NAK character (ASCII #21) to the OBD device, and see what comes back. 🍻
 
Upvote 0

MikeFree

Member
the question is ...which library i have to use ...establishing bluetooth connection...sending data to the linked and well selected device....and after sending waiting and receiving data ...storing to logfile e. g. in Android download folder...in case of xmodem protokoll how can i say to my app use this way to get data....has anyone experience?
 
Upvote 0

emexes

Expert
Licensed User
Well, first we have to work out if it's Bluetooth Classic or Bluetooth Low Energy, hence my suggestion that you get it working with a regular terminal app first, so that when we program up XMODEM in B4A, we're not dealing with more unknowns than we need to. 🍻
 
Upvote 0

emexes

Expert
Licensed User
BTW the video looks like it's doing a regular XMODEM receive, no mention of XMODEM-1K. Which is good for us: XMODEM is a simple as it gets, and we're not suffering from international telephone network delays in our link, so the XMODEM-1K isn't going to be noticeably faster than regular XMODEM.

Where did you see the -1K bit mentioned? Does the OBD device support both XMODEM and XMODEM-1K?
 
Upvote 0

MikeFree

Member
hi ... the developer of obd hardware says his device is using XMODEM-1K .... i found a russian app years ago and payed for it but does not work really for my usage ... UDevTerm ultimate ... author Ashot Kocharian ... information see google udevterm.website/en think the programmer stopped working ... i think its possible to realize a bluetooth terminal server app. - The final question is can B4A provide the the needed librarys ?
 
Upvote 0

emexes

Expert
Licensed User
laptop is not comfortable ...mobile always in car ..and easier to handle ...sending log via email to workstation...
Fair enough. Let's get this party started. 🥳

First thing is still to confirm which type of Bluetooth the OBD device is using. I thought I didn't have any Classic Bluetooth SPP devices, but then I remembered that the ELM327 OBD dongles are probably just serial ports, so after I found them and also the OBD port in the new (OBD-wise) car, I connected to it and then spoke with it using the Serial Bluetooth Terminal app. Unfortunately that app doesn't have XMODEM(-1K) so now I am searching for a terminal app that does both Bluetooth AND XModem.

In the meantime, if you want to try talking to your OBD device anyway, these are stages that I went through:

Settings, Bluetooth = list of available devices:

Screenshot_20200720-173158.jpg


Pair with ELM327 OBDII dongle:

Screenshot_20200720-173209.jpg


Paired, ready for use:

Screenshot_20200720-173218.jpg


Start Serial Bluetooth Terminal app:

Screenshot_20200720-173247.jpg


Choose serial port (here only one choice - the paired OBDII dongle):

Screenshot_20200720-173323.jpg


Connected and looking good:

Screenshot_20200720-173331.jpg


Type ATI (attention, identify) command:

Screenshot_20200720-173445.jpg


and OBDII dongle responds with ELM327 and version:

Screenshot_20200720-173452.jpg
 
Upvote 0

MikeFree

Member
it's not only calling the obd device ...the App should store the log ...the obd device will be forced via car FIS menu to start sending log ....the terminal app receives the file and stores it to sdcard or emulated card ... if an app is available it should be possible to simulate with two phones? one is the sender starting file transfer via bluetooth the other is the receiver... but the interessting point is can we program the needed app with B4A ...
 
Upvote 0

emexes

Expert
Licensed User
can we program the needed app with B4A
The downloading and the logging should be quite doable, especially if the Bluetooth serial connection is classic SPP. I'll leave the email side to you; if that turns out to be too fiddly, then another solution is that the data simply sits on the phone and then you can access it via the B4a-Bridge FTP file browser (which is eg how I got those screenshots off my Android phone).

Do you have one of these OBD devices with you (like, in your car parked out front) available to test?

Do you have B4A installed?

Do you have an Android phone with B4A-Bridge installed?

Have you written, compiled, uploaded and run a super-simple app (eg, one button) to make sure the whole development setup works?

Also, more out of interest than of timezone ramifications, whereabouts on the globe are you? I am in Melbourne, Australia.
 
Upvote 0

emexes

Expert
Licensed User
the obd device will be forced via car FIS menu to start sending log ....
Does "log" = "data file transferred from OBD device to B4A app using XMODEM-1K"?

Is there other information being transferred also, other than and outside of the XMODEM-1K file(s)?
 
Upvote 0

DonManfred

Expert
Licensed User
This logs can be downloading using XModem.
Do you have any Documentation in PDF or Weblink for this Communication with the Device?

can be realized with B4A?

Basically it should work if you know how. There are Java implementations for XModem which needs to get wrapped first.
For ex:
 
Upvote 0

MikeFree

Member
i m not so familar with xmodem xmodem-1k ....but if there is a way ....for wrapping....what ever it means ( creating a library for B4A ??) would be nice ....there exist a flashing app which can be used for upload and downloaded to Fiscontrol device ...maybe it works in the same way as downloading a log file. I dont know whether the hardware developer has created the flashing app by himself but he told me that he has no time develop the download app for logfiles....so i decided to ask the community here. B4A seams to be a platform to develop the needed code. On the other hand its interessting that an common obd device can called via terminal program ...as shown above ...:) ..great job
 
Upvote 0

MikeFree

Member
hi ... the developer of obd hardware says his device is using XMODEM-1K .... i found a russian app years ago and payed for it but does not work really for my usage ... UDevTerm ultimate ... author Ashot Kocharian ... information see google udevterm.website/en think the programmer stopped working ... i think its possible to realize a bluetooth terminal server app. - The final question is can B4A provide the the needed librarys ?
 
Upvote 0

DonManfred

Expert
Licensed User
The final question is can B4A provide the the needed librarys ?
As written in #15 of this thread one(you) need to write a wrapper library for the Github project i found (or any other). The wrapper must be written with java.
As of now there is no such library (wrap) available.
 
Upvote 0

MikeFree

Member
As written in #15 of this thread one(you) need to write a wrapper library for the Github project i found (or any other). The wrapper must be written with java.
As of now there is no such library (wrap) available.
ohh that is not a good information thought there is a library available ...
 
Upvote 0
Top