1

I'd like to establish a simulated Bluetooth connection between two Java programs running on the same machine. I am writing to program that uses BlueCove's BT library to connect to a hardware device; I pass the bluetooth address (ex. "btspp://1C659DF6B5AC:1;master=false;encrypt=false;authenticate=false", which contains the device's mac address) to my program to connect.

I would like to write another java program that emulates the hardware device so that I can do testing (my hardware is not currently working). Is there a way to simulate a bluetooth device with either a mac address or some other kind of bluetooth address which can send data over to my program?

mewsicalcat
  • 63
  • 1
  • 7

1 Answers1

0

By emulating the hardware you are possibly doing more work than needed, is it possible to create a mock connection "before" the BT library has been invoked (or for you to remove it temporarily)?

By doing this you can craft some code which behaves like the connection, but doesn't require you writing device drivers.

Jonatan
  • 2,734
  • 2
  • 22
  • 33
  • do you mean creating a separate thread, for example, that can respond to commands sent over bluetooth? To start my connection, I call `StreamConnection sc=null; OutputStream dataout=null; InputStream datain=null; sc = (StreamConnection )Connector.open("btspp://1C659DF6B5AC:1;master=false;encrypt=false;authenticate=false"); System.out.println("Right affter Connector.open"); dataout = sc.openDataOutputStream(); datain = sc.openDataInputStream();` – mewsicalcat Jul 17 '12 at 15:52
  • Perhaps you would need a separate thread, I'm not sure you would though. But basically what you could do is to create an object which behaves kind of like a BT device, but doesn't offer any real functionality. It would feature things as establishing a connection, etc. This is called "mocking" (see: http://en.wikipedia.org/wiki/Mock_object). – Jonatan Jul 17 '12 at 15:55