Avetana Bluetooth JSR-82 on Linux Ubuntu 6.10

avetanaBluetooth in a JSR-82 implementation for Desktop PCs running Windows, Linux or MacOS X. While Windows and MacOS X versions come with commercial license only, Linux implementation is distribuited under GPL license and can be download for free from sourceforge repository. You have to compile by yourself avetanaBluetooth on your Linux box.

Documentation related to Avetana refers to libbluetooth (libbluetooth1) as the native library needed to compile JNI part of the JSR-82 library. However, Ubuntu 6.10 comes with new libbluetooth2 library. All distribution-related packaged have been migrated to the new library, but some 3rd party software still refer to the old library. Avetana Bluetooth is one of these. Compiler stops with an error caused by missing symbol “sdp_cstate_t”. Looking at source code of libbluetooth2, I’ve found that “sdp_cstate_t” is never defined in header files included by Avetana source code nor it is present in any other header file provided by libbluetooth; that’s why that struct is missing! It has been included (moved?) in the “sdp.c” implementation file.

To get avetanaBluetooth compiled (and running!), I’ve just copied the source fragment:

typedef struct {
	uint8_t length;
	unsigned char data[16];
} __attribute__ ((packed)) sdp_cstate_t;

in structs declaration of BlueZ.cpp source file (located in the “c” directory of the distribution package) and the Avetana Bluetooth stack compiles without any problem. The system configuration was: Ubuntu Linux 6.10 with kernel 2.6.17, gcc 4.1, g++ 4.1, jdk 1.6.0. Enjoy JSR-82 on your newest Linux box!

8 pensieri su “Avetana Bluetooth JSR-82 on Linux Ubuntu 6.10

  1. Rob Rawlins

    I’m having issues getting this to work, I’m new to both linux, C and JAVA and trying to break down exactly what i should be doing is tough.

    I’m getting this error during compilation, but dont understand how your patch works.

    where -exactlty- should i be copying that snippet of code too?

    Thanks,

    Rob

  2. Bruno

    Hi, y have problems installing avetana in ubuntu 6.10,
    I’m getting this error during compilation,

    checking for gcc… gcc
    checking for C compiler default output file name… a.out
    checking whether the C compiler works… yes
    checking whether we are cross compiling… no
    checking for suffix of executables…
    checking for suffix of object files… o
    checking whether we are using the GNU C compiler… yes
    checking whether gcc accepts -g… yes
    checking for gcc option to accept ISO C89… none needed
    checking whether make sets $(MAKE)… yes
    checking how to run the C preprocessor… gcc -E
    checking for grep that handles long lines and -e… /bin/grep
    checking for egrep… /bin/grep -E
    checking for ANSI C header files… yes
    checking for sys/types.h… yes
    checking for sys/stat.h… yes
    checking for stdlib.h… yes
    checking for string.h… yes
    checking for memory.h… yes
    checking for strings.h… yes
    checking for inttypes.h… yes
    checking for stdint.h… yes
    checking for unistd.h… yes
    checking bluetooth/bluetooth.h usability… yes
    checking bluetooth/bluetooth.h presence… yes
    checking for bluetooth/bluetooth.h… yes
    checking for hci_open_dev in -lbluetooth… yes
    checking for ANSI C header files… (cached) yes
    checking for stdlib.h… (cached) yes
    checking sys/ioctl.h usability… yes
    checking sys/ioctl.h presence… yes
    checking for sys/ioctl.h… yes
    checking sys/socket.h usability… yes
    checking sys/socket.h presence… yes
    checking for sys/socket.h… yes
    checking for unistd.h… (cached) yes
    checking whether gcc needs -traditional… no
    checking for stdlib.h… (cached) yes
    checking for GNU libc compatible malloc… yes
    checking for memset… yes
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating c/Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    (mkdir build; javac -d build @javaSourceFiles)
    mkdir: no se puede crear el directorio `build’: El fichero ya existe
    javac: no source files
    Usage: javac
    use -help for a list of possible options
    make: *** [classes] Error 2

    I do not understand the cause of the errors, but I imagine that you solved it.
    Thanks for the aid

    Bruno

  3. Rob Rawlins

    Thanks gerdavax,

    I think i’ve got the java libs up and running propperly now, but I have no real way of testing them, do you have any examples code for device and service discovery? it would be a great help to look at some simple scripts and learn how they work.

    Thanks again for any help,

    Rob

  4. Bruno

    HI, thanks for the aid, but the problem is that the directory “build” is created during the installation process and creates it but empty. For that reason, I do not have the “javaSourcesfiles”.

    Thank you very much by the aid.
    I Really would appreciate some advice

    saludos
    BR1

  5. gerdavax Autore articolo

    Bruno, I experienced the same problem but I can’t remember how I solved it 🙁 Sorry about that. I’ll send you the source archive I’ve on my PC.

    Rob, sorry for this late reply, I’ll publish a sample code in a few days.

  6. Frank Wartena

    I tried to compile the library and ran into the same problem. I hope this workaround is still useful for some visitors.

    For some reason the install script cannot properly create the javaSourceFiles document. This should be accomplished by the following command in the makefile:

    @find {de,com,javax} -iname *.java > javaSourceFiles

    By running this command manually (without the @) in the console, the javaSourceFiles document is properly created. After doing that you can run ./install to build the library and now it should work.

    Don’t worry about the build directory, this will be properly filled with class files if you created the right javaSourceFiles document before running ./install.

    So the compilation finished successfully, however I ran into a problem with the use of the library. Two functions I would like to use do not work properly:

    1. de.avetana.bluetooth.stack.BlueZ.authenticate
    When trying to pair with another device by making use of this function I get a BlueZException saying “Device is not connected!!”. I’m sure my device is on and discoverable (because I discovered it before calling authenticate).

    2. de.avetana.bluetooth.stack.BlueZ.unpair
    When trying to remove the pairing with another device I get a java.lang.UnsatisfiedLinkError: unPairN.

    I’m using the exact same Java code as I used in Windows when making use of the AvetanaBT trial version for Windows. There it works perfectly. I understand that there is probably a different code-base for the gpl version and the commercial version (especially since the latest gpl release is from April 2006!!)… I’m curious if you encounter the same errors when calling these functions or if there is something going wrong with the compilation on my machine…

    I hope any of you can help me with this.

    Thanks,
    Frank

Lascia un commento