mobile receipt printing with J2ME via Bluetooth - java-me

I need to make an app in J2ME that can be able to read a SMS and then print it on an epson tm-p60 printer(ESC/POS emulation) via bluetooth.
i looked at the epson supprt site but the only ADK/drivers they provide are for:
1.Sun Java2 SDK Standard Edition Version 1.4.2_10
2.Sun Java2 SDK Standard Edition Version 1.4.2_04
3.Sun Java SE Development Kit 6 Update 3
so i don't know how am i gonna be able to use ESC/POS commands inJ2ME.
I'm a bit clueless on how i will approach this project.. plus w/c would be better to use for this project? Netbeans or Eclipse?
Thanks!

SPP (Serial Port Profile) over Bluetooth means using an RFCOMM connection to send and receive data as if it were a physical serial connection. This is part of JSR 82, so you will be able to develop only on handsets that support this JSR.
You need to:
Figure out how to discover bluetooth devices, and scan for SPP services on a discovered device, then connect to one of those services, using one of the many JSR 82 tutorials out there.
Then send ESC/POS protocol data over that connection -- I assume you have the protocol specification available? Google turned up this application programming guide.
HTH.

JSR-82 Bluetooth API support L2CAP protocol, RFCOMM and OBEX profile. I don't know detail of Bluetooth basic printing profile (BPP) but, if you look into basic printing profile document you can find that BPP built on OBEX profile.
I can't find open source project for BPP on JSR-82. Please try to search it, but if you can't find one you might need to write your own.

Related

Progressive web app beacon search

Is it possible to search for beacon data (uuid, url, ...) with a progressive web application using just web technologies that is without using native mobile technologies (Android, ios, ...)?
Thanks in advance.
Unfortunately, this is not possible as of July 2020. While Google has been working on the WebBluetooth project to bring support for many bluetooth operations to the browser, at least in Google Chrome implementations on Android 6+, Mac or ChromeOS.
Scanning for beacons is not yet possible as of this writing. The API requires that the OS scan for devices matching a requested criteria, and then let the user choose a device to connect to using a user interface. This essentially rules out beacon detection.
Bluetooth scanning APIs are still in draft form here.
EDIT: The APIs mentioned by #zurfyx in the answer below allow you to scan for and connect to an advertised GATT service, but do not allow you to read the data in the advertisement. This is a critical distinction, as reading the data in the advertisement is the key capability required for actual bluetooth beacon detection. That capability is missing from that API. Without that capability, it is impossible to detect a beacon, it is only possible to connect to a BLE device that might be an Eddystone or other service advertisement-based beacon.
UPDATE July 2020: Safari will not be getting any WebBluetooth APIs at all due to privacy concerns, according to a June 2020 announcement by Apple This makes Bluetooth scanning impossible on iOS we apps for the foreseeable future.
As of July 2020, Chrome does not support scanning arbitrary advertisements. See status here: https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md
Disclaimer: I wrote eddystone-web-bluetooth (a library which makes it easy to read and write to an Eddystone device). github#eddystone-web-bluetooth npm#eddystone-web-bluetooth
It is possible to scan for Bluetooth devices by using the Web Bluetooth API (currently supported only by Chrome).
By using Bluetooth GATT service, you can connect to Eddystone devices and send/receive data by communicating following their public specifications (which are basically a list of request codes, and the format in which to send and expect their responses).
These services include information such as:
URL
Advertising interval
Lock state
and more
By using the Bluetooth standard information you can get to know the most generic device information, such as its id and name:
navigator.bluetooth.requestDevice
#beaufortfrancois wrote the probably first Eddystone Web Bluetooth configuration code (source code / demo), so it is probably worth a read if you want to dig more into this. I learned a lot from it.

Send a string from Arduino to Windows Store App via Bluetooth?

I am trying to get a Unity3d Windows Store App game to read a string of text that is sent from an Arduino Uno Rev3 over Bluetooth.
Unfortunately, the Windows Store App platform does not allow use of the System.IO.Ports namespace, so I am not sure how to get it to read the Bluetooth data.
Does anybody know how to read data from Bluetooth in a Windows Store App?
Any help is appreciated,
Thanks
If your HC-06 has COM-port capabilities, then you can use: [https://learn.microsoft.com/en-us/uwp/api/windows.devices.serialcommunication
there is a sample on Github:
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/SerialArduino
To find out if your device has COM-port capability on windows 10 go to settings/Bluetooth, pair device and go to more settings, tab com-ports and try to add port. If the list is empty unfortunately you can not use Windows.Devices.SerialCommunication APIs to communicate with an Arduino device.
Another way is to use the Bluetooth GATT protocol for communication.
It allows you to read and write data and subscribe to indicate and notify events.
For this there is also a sample on github:
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLEClient
It depends on your HC-06 what Gatt-services are available but there is most likely a service that can reed and write and get notifications.
Hope this can help you,
Groover
I ended up using a BLE solution based on this example:
https://www.simplicity.be/article/eddy-and-his-stones-diy-arduino-beacon-mobile-apps/

Is there a way to connect to iBeacon while my Bluetooth device is invisible?

I'm researching iBeacons. Can I connect to iBeacons while my Bluetooth is invisible (to be protected from hacks)?
I don't have beacons to test myself and can't find any clear explanation online.
iBeacons connect to mobile phones using Bluetooth, so it is essential to have that turned on. You also need to have installed an app with iBeacon support in order to receive communication from them.
If you'd wish to use a solution that does not utilize Bluetooth, you could try out IndoorAtlas. It's an indoor navigation technology based on Earth's geomagnetic fields. It's also completely hardware-free solution, just requires you to collect fingerprints in the area you are going to use for your project.
Three points:
iBeacon technology does not rely on a bluetooth connection to your phone. Beacons are one way transmitters. They do not listen to or otherwise receive any info from your device. Beacon technology following this model is inherently privacy friendly.
Mobile devices cannot detect Bluetooth beacons with the Bluetooth radio turned off. Sorry, it is just not possible.
Properly built beacon apps will not expose your mobile device's Bluetooth info because they are receive only. Of course, other apps on your phone might use bluetooth for other purposes, so your best bet is to audit apps using bluetooth and remove any that are not doing what you want.
I just bought some beacons and tested that, The answer is YES. it is possible to read beacons mac addresses while using the phone's Bluetooth connection as invisible. Using this you will get access to your beacon in any open place without getting hacked through Bluetooth.
Thanks all for your answers.

Does the Universal Windows Application infrastructure support any Serial Port communications?

I have a WPF desktop application that would make a good candidate as a Universal Windows App. The application has a must-have dependence on USB or Bluetooth devices that act as a Serial Port.
In all my reading I've yet to discover whether there is any access to a SerialPort API in a UWA.
I suspect the answer is 'No support'. If so, does anyone know of a USB or Bluetooth GPS that supports whatever APIs the UWA has for that sort of thing. I have to be able to read things like ground speed, elevation, rate of climb, etc.
If the answer is 'Supported', could you point me to some documentation.
For the "Bluetooth devices that act as a Serial Port", I assume you mean the RFCOMM. They are both supported on Windows Runtime since Windows 8.1 and you can also use them in the Universal Windows Application.
namespace: Windows.Devices.Usb and Windows.Devices.Bluetooth.Rfcomm.
About the Bluetooth GPS, I'm not sure if it uses RFCOMM or not (it depends on the devices), and it is also possible to use the GATT.
Code Sample: Custom USB device access sample

How to communicate with mobile devices using Bluetooth in j2me?

I need to develop a project based on Bluetooth in mobile. Since I am new to j2me I studied some of the articles and run the project until the discovery of devices and services. I need to communicate between devices and transfer the desired files. I search code for client server communication through Bluetooth and got it but I didn't know how to run those code and implement further.
I have go through articles and I can run client server communication. Now I need to transfer the file and communicate to the user which was beyond the limit of my mobile through the another mobile which was within my limit.
JSR82.com has many articles and tutorials about how to use bluetooth from J2ME.
Better you refer the book, "BLUETOTH APPLICATION PROGRAMMING WITH JAVA API" by C.Balakumar. It is helpfull to you.

Resources