user1020943
user1020943

Reputation: 11

Working with Bluetooth

I'm using 32feet.NET library for my project, my project is to control a robot using bluetooth protocol. I have to send a char or maybe array of chars as an instruction but unfortunately I'm not familiar with 32feet.NET (I can just find all bluetooth devices and send a pairing request to any of them so far ) and there is no good Instruction manual on Library support site Could anyone please help me to do basic send/receive operations so I can move forward myself with more complex tasks?

Upvotes: 0

Views: 4473

Answers (2)

L.B
L.B

Reputation: 116178

Here is an example for connection

BluetoothAddress addr = new BluetoothAddress(0x0016756A4CD1);
BluetoothEndPoint ep = new BluetoothEndPoint(addr, BluetoothService.DialupNetworking);
BluetoothClient cln = new BluetoothClient();
cln.Connect(ep);

(DialupNetworking is just an example. You should find in your Robot's manuals which service to connect to) After that you can send and receive bytes using GetStream() method of BluetoothClient.

byte[] buf = .....
cln.GetStream().Write(buf, 0, buf.Length);

But what you should send or receive is device-specific and you should read the manuals of your robot.

For example after connecting to DialupNetworking service of a cell phone you can use AT command set to send/read SMSs

Upvotes: 2

Related Questions