Bluetooth Serial port


(Charles Symons) #1

This is my first posting and I am new to HYPE so forgive me if I have asked a silly question.

I wish to develop a HYPE document that will allow me to click on a button or buttons on the scene that will send s stream of test to an open Bluetooth port.
With the prevalence of IOT these days, I think it would be great if we could use HYPE to be able to receive data or send data to a Bluetooth device connected to the mobile device or computer which is displaying the HYPE scene.

The Bluetooth device will be connected as a serial port (SPP Profile) device to the host system.
I have tried to locate any similar postings but so far failed.
I would be very grateful for any pointers or ideas how I may do this.


(Charles Symons) #2

my spell checker and replaced the word text with test. My apologies for not checking.


#3

There will be punishment - as per Section 8 of the Forum Code.


(Jonathan Deutsch) #4

The general approach is that you need some server-side process that has the capability to communicate to the bluetooth device, and then that process can also be messaged via HTTP requests (AJAX as the main method usually) to then talk to the device. Web pages generally don’t have access to most device hardware, like Bluetooth.

Of course, it would be much nicer if web pages could more directly talk with Hardware, which is why they are trying to make a Web Bluetooth API specification. Google has experimental support it seems:

So in the future this might be the way to go.


(Charles Symons) #5

Thank you for the link.
I will certainly explore this method though it seems quite involved.
I was hoping for a more elegant solution where the HYPE engine would check for any bluetooth devices setup as a serial device and then send data to this port if not in use.

Thank you again.


(Jonathan Deutsch) #6

Hype produces client-side code so is generally limited to the current state of the web. Of course as the Web Bluetooth API gains adoption we’ll be looking at if there is sensibility in integrating with Hype. I suspect you’ll almost always need to interact with code though.


(Charles Symons) #7

Dear Jonathan,
Thank you again for your suggestions.
I am wondering if this is along the lines which I could use.

http://www.java-samples.com/showtutorial.php?tutorialid=11

as this shows an examples of Java being used to locate and send data to the attached Bluetooth port.

Any pointers would be greatly appreciated.

I truly feel that perhaps with the power and ease of designing a HTML5 document with Hype, it could possibly be used as a powerful tool in the field of IOT as most tablets, PC’s, Mac’s etc have a BT port, as well as WIFI, and this opens up the possibilities of running a HYPE designed page on your tablet browser or desktop and directly communicating with home appliances or (e.g. Arduino powered device with Bluetooth).

Thank you again,


(Charles Symons) #8

Yet another link


(Jonathan Deutsch) #9

Note that Java is not the same as JavaScript (their relation ends at the name). Java is a compiled programming language; if you wanted to use these examples you would still need to communicate to a java-based server via client-side javascript AJAX calls.