Which Bluetooth library is stack independent - java

I making a windows application that needs to use Bluetooth for communication so far as now I have tried blue cove for Java.
It seems to be limited to few stacks only.. I have a Toshiba stack, but I still want a library that could handle most popular stacks.
Doesn't matter if its for C, C++ or Java.

Bluecove is already as good as it gets.
This is due to the unfortunate fact of how Bluetooth is handled on Windows. Instead of agreeing on a single implementation for the whole platform, vendors tend to ship their own stack with the device driver software. This is partly due to historical reasons and partly because hardware vendors don't care enough about this to do anything about it.
Bluecove provides implementations for the Microsoft, Broadcom WIDCOMM and BlueSoleil stacks, which should cover >90% of all available devices. In your case, I see three options:
Try to get your device to work with a different stack. I know for a fact that BlueSoleil works with certain Toshiba-based devices, google should give a good overview of the options for your specific device.
Get another device. Bluetooth dongles are ridiculously cheap these days, so this is a valid option. It's a bit more messy than using a build-in device, but then again, what good is a build-in device if the software doesn't work?
Try to write an implementation for Toshiba devices for Bluecove yourself. IIRC Toshiba does provide an SDK upon request. You might run into legal issues though if the license forbids integration with Bluecove in some way.
Morale of the story: Bluetooth drivers are a mess, especially on Windows. Be sure to check your software's requirements before you buy your next device.

Related

Stable alternative to RXTX

After using RXTX for a number of different projects, I've come across many annoying discrepancies and issues that can only sensibly be put down to bugs in the library - deadlocks, race hazards, and monitor threads deep in the RXTX library being left open preventing the program from closing (even though all ports I was using have been closed!) Running the latest "unstable" version has helped a bit, but it's still far from where I'd call it reliable, and activity on the project seems rather low at present.
However, searching for free cross-platform alternatives to RXTX doesn't seem to come up with much else.
Is there another library that anyone's tried with more luck? I don't need parallel port support, just serial, and it doesn't necessarily have to be compatible with RXTX or the javax.comm API.
We have moved to java-simple-serial-connector which seems to be very stable and comfortable at the current release 0.9.0. For now, it works on windows and linux systems. We use it for modem interactions.
There's jSerialComm too.
Serial communication in Java is a mess. I've had trouble with jSSC with a virtual usb serial on linux, but with serial-comm it connected.
RXTX is a mess.
At least I think that now this SO question has all of the worth mentioning serial communication java libraries.
There's a few of them out there now, now that Arduino is pretty popular.
There's Serialio
and PureJavaComm, but it's pretty early on in development from what I can see.
it really depends on what your needs are. RXTX has been ported pretty much everywhere, so it is widely available.
One of the issues of RXTX I faced was the delay closing the port. When checking with setserial the port configuration I discovered a parameter closing_delay=3000. This means that the port closes 3 sec after the close() method was executed. Resetting the closing_delay toany value is ignored by RXTX. RXTX insists in 3sec delay.
the JSSC library performed to our satisfaction
Serialio lib is $49/platform/developer seat which gets you unlimited distribution in unlimited apps so not too pricey. The Mac library has been stable and reliable for us in an undemanding application and availability/compatibility has been good throughout for the various Mac platforms and OS/X releases.
I use socat configured to serve a socket for a serial port.
The downside is that baud rate etc. is given to the socat invocation, it is not something you can readily alter from your program.
On the upside is I can connect across a network without anything more than changing the IP address I connect to.
jSerialCom is good !
'https://github.com/Fazecast/jSerialComm'
And here is its' wiki pageļ¼š https://github.com/Fazecast/jSerialComm

Android vs Blackberry development (reusable code?)

I know this question has come up in some form, one way or another. However, a lot of them are outdated, so I figured I'd ask again plus also ask the real reason for this question.
Both Android and BB development can be accomplished via Java, and while Android adds a lot of classes and functionality on top of the Java SDK, Blackberry seems to rely on Java's J2ME. If I write an application that targets both platforms, especially from a media playback perspective, how much code reuse can I expect between both platforms? For the record, a PhoneGap based app is not possible (esp due to BB's implementation of Webkit).
IMHO, don't expect to reuse tons of code. These are the areas where you probably can't share code: UI, network, security, regex, java 1.4+ classes.
Also, android doesn't need a self made eventing system. All activities can talk with each other, or you can use services... BlackBerry doesn't have any of this.
I've being working with these two platforms for a while, and I only share the idea... The implementation is almost specific for each one.
I work on a large app which shares common code across Android, BlackBerry, MIDP, and J2SE (i.e. Desktop Java). I would say that about 75% of the code on a given platform is common code.
Pros:
One lot of code to develop/test. This is a huge positive!
If you ever decide to port to other platforms, you've already done most of it.
Cons:
You're limited to java 1.3 compatibility in the common code (no annotations, collections, etc).
UI differences can be a pain, particularly with the different event models. MVC is your friend here - at least you can share the model!
You'll want to write wrapper classes for all the platform-dependent stuff which needs to interact with your common code. This is extra code which you wouldn't have to write if you weren't code sharing.
Whether it's going to be worth your while depends on a few things... I'd at least think about the following:
How large is the project? (Larger = more of a case for sharing code.)
How much of your core functionality is realistically going to be shareable? You mention media playback - if that's going to be 80% of your app's code then it's probably not worth the effort to set up shared code.
How familiar are you with the different platforms? (More familiar = more idea of the potential pitfalls = more likely to know which code should be shared and how to structure it.)
Android and Blackberry code can be reused. I have done it before and works beautifully. A few small differences do exist. I cant remember them all, but a few
Https / Http api calls are different. So you need to code them a bit differently for both.
Blackberry compiler does not like unused imports
Other than these, I think you will be ok. But yes, do give it a shot saves a lot of time.

What languages/internet protocols for controlling robots/electronics remotely?

I wonder what languages are used in robots and electronics. Is it low level languages like Java, C, C++ etc?
And if these robots and electronics could be controlled from another place, what protocol is used?
It couldn't be HTTP Rest, could it? :)
Ada is also becoming a viable choice for programming language even for smaller platform. Ada has very good support for low-level operations, as well as high-level things.
As examples of smaller platforms, Ada is available for the Atmel AVR (8-bit) as AVR-Ada. See http://sourceforge.net/apps/mediawiki/avr-ada/index.php?title=Main_Page
For LEGO MindStorms, Ada is available from GNAT as GPL version, which also support the Ravenscar tasking profile. Hence you can easily create multitasking applications on the MindStorms platform. See http://libre.adacore.com/libre/tools/mindstorms/
How about LEGO Mindstorms? Unless you have specific requirements regarding the physical properties of the robot that would rule out Mindstorms/NXT, you can do a lot with it. And it's a serious piece of kit - don't be fooled by the "LEGO" brand.
http://mindstorms.lego.com/en-us/Default.aspx
In addition to shipping with its own programming language, it is also supported by Microsoft Robotics Developer Studio - so you can use .Net to code for it.
http://msdn.microsoft.com/en-us/robotics/default
The great thing about it is that it is actually LEGO, with its inherently modular brick system for constructing the robot itself, and so allows for a lot of rapid prototyping and experimenting, without having to buy specialized parts.
It has built in Bluetooth, allowing for remote control. You can also download your compiled program code to it, so that it operates autonomously, either through USB or Bluetooth.
I bought the previous version back in 2008, and expanded with some regular Technics models for parts. It includes stuff like touch sensors, sound sensors, ultrasonic sensors, light / colour sensors and (two way) servo motors, and you can get third party add-ons like gyroscope, accelerometer, compass etc. Great fun.
I would say that it depends on your project. I've used C/Assembler to program an electronic microprocessor, but I know that you can use high-level programming languages as well for some projects, if your robots operating system allows it. Such as Java/C# and so on.
There are a variety of protocols used to connect to an instrument, and my believe is that TCP/IP or UDP/IP is the most common. But some people prefer to write/program their own protocols.
Most of the robots I built were built with Lego Mindstorms. There are a few languages you can use, but the default language is a visual workbench. You can remotely control the robot via Bluetooth or IR (and Lego includes a USB-connected IR transmitter)
C/C++, Java and Python.
I would say C/C++ are more widely used than languages like Java and Python for programming robots, simply because there is so much stuff already out there. And C is also a very commonly used language for embedded applications. Many people I know in industry use C as the means for controlling robots and hardware like RS-232, UARTs, stepper motors etc.
When I was working in academic research, my German colleagues used Java almost exclusively on autonomous robots, with satisfactory results. If you use Java you simply have to abstract the hardware when you are using it, which can be done with Player / Stage or ROS.
It all depends on what you want to do, I guess. In my particular area (Mitsubishi PLCs) C++ is the language of choice. Other industries use C++ to program robotics, such as Honda ASIMO. AMD ATi use Python to program their Graphic Accelerators. Pretty much any language that can talk to a communications port can be used for robotics.
As for controlling them remotely, Battlebots would probably be a sterling example:
Whichever language you choose, you will soon find that you will need to speak in terms of zeroes and ones ;)
I recent made a simple remote controlled robot programmed in Java with the help of this book
http://www.google.co.uk/products/catalog?q=build+java+robots&hl=en&cid=346434932749925759&ei=WATITISGE5_g2ASm_tilCQ&sa=title&ved=0CAcQ8wIwADgA#p
This book showed me how to talk to the robot using bluetooth.
I've also read that BASIC is a good language to get started with, when build your first robot.
Disclaimer: I'm no expert.
I only really have experience with Arduino, which can be programmed with assembly or C (the AVR-GCC toolchain). However, if the target environment is sufficiently powerful or has enough memory, there's nothing to stop one from using a higher level language -- aside from other technical constraints such as, say, a hard realtime requirement -- such as, say, Lua or something even higher-level.
As for communications, it depends on the final transport medium as well. For, say, Bluetooth, Zigbee, just digital radio communication, or maybe, you know, a couple of wires (or even one wire) or whatever, it'd be some sufficiently low-bandwidth serial protocol... But of course, it all depends on the target platform.
For what it's worth, regarding HTTP -- I built an HTTP controllable RGB moodlight (that smoothly fades between colors! :P) using Arduino and the Ethernet Shield available for it. The HTTP server runs on the Arduino.
You can control Robots and electronic gadgets with different type of languages in which you are most comfortable .But it also depends on the type of the gadgets you are trying to control i.e if you are developing a robot or gadget from scratch you can program it with the language of your choice like C ,C++. Python ,Java etc .You can also use the the Embedded language to program the controller with your choice of language there are many different compilers available only to compile your program form the controller for example MicroC is one of them which I use often use to compile my Embedded code for microcontrollers .If you are programming some kind of board like Arduino then you can use its own IDE where you can program it . To control the the Robots and gadgets remotely you can use many different ways i.e .:
Internet : You can use internet to control them by integrating them with modules like ESP8266 , NodeMcu , GSM modules etc and use a custom web application ,Mobile app to control them.This comes under Internet Of Things (IOT).
2.Bluetooth : You can even use Bluetooth to control the devices by integrating a bluetooth module with your device but the range of bluetooth is low .
Radio Frequency RF: You can also use radio frequency RF modules to control robots in remote areas but the cost of implementation is higher than rest of the cases .

Network Intrusion Detection System in Java..!

I am planning on implementing a NIDS (Net Intrusion Detection System) in the Java programming language.
After searching, I found two libraries for this.
1) Jpcap
2) jNetPcap
Which one should I use and why?
Which is more preferable to use?
It appears development has stopped on Jpcap. Their last release was 2007. In contrast, jNetPcap has had very recent releases. The underlying libpcap C library that they both wrap has continued to evolve, so I would go with jNetPcap for that reason.
On the other hand, libpcap is a fairly simple API. If you are comfortable with C, then you may gain performance advantages by using the library directly instead of going through a Java wrapper. Something to consider, anyway.
One simple idea I've had for network intrusion was to listen for messages on the braodcast IP address. New comers to the network may likely need an IP address from the DHCP server. If this is so, then they will have to send out a broadcast that a DHCP server will respond to . You could write a program that sits on client A and displays popups whenever it hears something on the broadcast address.
If it's still an issue, use .NET version jnetpcap. I built a NIDS for a master's term project and I tried to use Java and get jpcap and similar working but it was near impossible. So I went for the most viable option c# and it worked alot easier, even thought I didn't know it then.
Also use ikvm since you will need to use weka.jar from .NET as well.

Enumerating USB Devices on Windows with Java

In a previous SO question, it was mentioned that USB devices can be mounted using the following approach in Windows:
MOUNTVOL C:\USB: \\?\Volume{ebc79032-5270-11d8-a724-806d6172696f}\
My question is what is that String starting with \\?\Volume called, and what is the best way to retrieve that. I would rather not use .NET if possible since you can't really 'bundle' the .NET runtime without physically installing it on the machine as far as I know.
I would also be interested in using JNA if that is possible.
You can't bundle the Java "...runtime without physically installing it on the machine..." either.
Enumerating the device after it is mounting should be straightforward. Actually mounting the device should NOT be straightforward since Java (and .NET) are both designed to abstract away the hardware.
I recommend that you pick a more appropriate tool for this. Either choose to simply invoke another process to run the mount command (knowing that it won't be portable), or choose a tool that does not abstract away the hardware, or at least less so (perhaps Python?).
EDIT: Clarification on JVM install...
Excellent point--a JVM installation can be much less invasive than a .NET installation since the latter MUST integrate with the OS while the former merely CAN integrate with the OS. So, yes, including a private JVM install is viable and perhaps desirable.
NOTE: The question includes the mount command for the USB device, which tends to emphasize that aspect as a primary requirement.
What kind of USB device are you looking for? The bit you quote is only applicable to USB disk drives, not USB devices in general.

Categories