B4J Question [REQ] Library for accessing DS18B20 like sensor data with Raspberry Pi...

rbghongade

Active Member
Licensed User
Longtime User
Dear friends,
I came across this java library at http://hirt.se/blog/?p=493 . It gives access to the sensors connected to Raspberry pi GPIO pins. Devices include DHT11, DS18B20....
The jar file is available with the library. Is it possible to include the same in B4J ( maybe by using wrapper etc...) If so I request someone to create a B4J library.
regards,
 

DonManfred

Expert
Licensed User
Longtime User
by using wrapper
Seems to be possible with a small wrapper.
But i´m not sure if you can add .so files with a b4j library... With Android you can if they are the right ones

I do not have an raspPI, sorry. Just looked shortly above the code and the downloadable archive
 
Last edited:
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
If this means no more need to read the logged values from a file, +1!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no special problem with creating a wrapper for this library.

The so file is loaded in DHTSensor:
B4X:
static {
     System.loadLibrary("dht");
   }

The simplest way to solve the configuration issues is to copy the so file from the jar file to File.DirTemp or any other folder and then load it with System.load instead of loadLibrary.
System.load allows you to explicitly set the file name.
 
Upvote 0

rbghongade

Active Member
Licensed User
Longtime User
Dear Erel,
I am still unable to understand the wrapping and usage of the library. Can you please elaborate it?
sorry to bother you again,
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
@DonManfred was not sure whether it is possible to wrap this library as it loads a native library. I answered that it is possible and explained how it can be done.

In order to wrap this library you will need some Java knowledge.

Will @DonManfred Come to the rescue??
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I saw Erels answer and i got the message in it (how it works) and i´m positive it will work.

maybe i´ll do a wrap... Just a bit timeless these days (lot of work, other projects i´m working on)

Edit: The only problem i have is not to have any RaspPI to test it...
 
Upvote 0
Top