A while ago I've begun with programming in Fantom and recently I wanted to try out a different kind of project. I wanted to write a program that could read data from my electricity meter at home through the Meter-Bus protocol.
I did some digging and eventually stumbled upon the java MBus (jmbus) library. Immediately I was thinking about using it through JavaFFI in Fantom, but I eventually ran into a small problem; the jmbus library requires you (as far as I currently know) to add a commandline argument which directs to the JNI library and it requires you to install a separate native RXTX library.
This was solved rather quickly, but I was wondering.. Would it be possible to communicate with a serial port through Fantom directly and therefore not needing to add a commandline argument? That would only leave the problem of interpreting the meter-bus protocol.
If anyone knows if it would be possible directly through Fantom, please let me know!
Greetings, Wesley
SlimerDudeTue 30 Jun 2020
Hi Wesley,
As you elude to, Fantom is essentially a Java program, so if you're looking for a native Fantom driver to talk to the serial port then you're actually looking for a Java driver.
Java itself isn't as low level to talk directly to IO ports - that job is usually handed off to native C code, which is then wrapped up in a Java interface / native class.
Given you've already found a Java library that talks to the serial port, I think your actual question is, "Is there any other Java library that talks the serial port?"
Fantom and Java hobbyists don't usually talk to serial ports, so I think you'll have more luck posting on the SkySpark forum (as I'm also assuming your question is SkySpark related).
Wesley Wed 10 Jun 2020
Hey!
A while ago I've begun with programming in Fantom and recently I wanted to try out a different kind of project. I wanted to write a program that could read data from my electricity meter at home through the Meter-Bus protocol.
I did some digging and eventually stumbled upon the java MBus (jmbus) library. Immediately I was thinking about using it through JavaFFI in Fantom, but I eventually ran into a small problem; the jmbus library requires you (as far as I currently know) to add a commandline argument which directs to the JNI library and it requires you to install a separate native RXTX library.
This was solved rather quickly, but I was wondering.. Would it be possible to communicate with a serial port through Fantom directly and therefore not needing to add a commandline argument? That would only leave the problem of interpreting the meter-bus protocol.
If anyone knows if it would be possible directly through Fantom, please let me know!
Greetings, Wesley
SlimerDude Tue 30 Jun 2020
Hi Wesley,
As you elude to, Fantom is essentially a Java program, so if you're looking for a native Fantom driver to talk to the serial port then you're actually looking for a Java driver.
Java itself isn't as low level to talk directly to IO ports - that job is usually handed off to native C code, which is then wrapped up in a Java interface / native class.
Given you've already found a Java library that talks to the serial port, I think your actual question is, "Is there any other Java library that talks the serial port?"
Fantom and Java hobbyists don't usually talk to serial ports, so I think you'll have more luck posting on the SkySpark forum (as I'm also assuming your question is SkySpark related).
Good luck!