I want to demo a web page being used to interact with a physical object in the same proximity as a web-enabled device (Mac/Windows/Linux laptop). In order to do this, I want to create my own window.bluetooth
object in Javascript that will provide an interface to the host device's Bluetooth controller via the Serial Port Profile. For now it's just a demo, but I might want to develop a generic API to abstract Bluetooth drivers in Javascript.
I'm not particularly concerned with portability or generic solutions at this point. I just want to see if it would work on my laptop with a device I'm building using a BlueSMiRF Silver modem. I know Google Chrome extensions are capable of injecting Javascript into every page the user visits, and NPAPI is capable of compiling native OS code into a form that can communicate with Javascript. It looks like someone has done something vaguely similar before with slightly more specific applications.
My question is, is a Chrome extension with NPAPI the best way to do this? Alternatives could be Flash or a Java applet, but those are kind of 1996 solutions. Here are the metrics I use to evaluate a solution:
- Feasibility. Is it possible?
- Ease of development. How many lines of code would it take?
- Leverage. Does anything else out there already do something similar?
For those of you thinking it's preposterous for the browser to monitor lower-level network status, it's already been done with Wi-Fi.