Bluetooth Chat between Android device and PC [closed]

自古美人都是妖i 提交于 2019-12-19 04:11:54

问题


Is it possible to connect the Bluetooth Chat sample with a PC? How can I receive the information to the PC? I thought that I can use the Serial Port Profile (SPP) from the Android device and open a regular COM Terminal on the PC. Actually my application requires sending the accelerometers and other sensors information to a PC in order to know the position of the smartphone. I hope you can help me.


回答1:


You've asked a general question, so the best I can do is give you a general answer. This is a two prong problem. It sounds like you know what you're doing on the android side of things, but we're you're stumbling is on the PC side. Right? As far as PC side goes, you're basically going to need to implement a "bluetooth server". You can use the bluecove library or the standard javax.bluetooth library.




回答2:


The library 32feet.NET that I maintain sounds like what you're looking for. Its for .NET and does Bluetooth, OBEX and IrDA. See for example a simple server example at http://32feet.codeplex.com/wikipage?title=Bluetooth%20Server-side




回答3:


It would be easier to connect the Android and PC to the same network (WiFi/Ethernet) then create a socket connection between the two units. In short:

  1. Join the Android to your network, probably using WiFi.
  2. Join your PC to the network (WiFi/Ethernet).
  3. Create an app on your PC which listens for a socket connection on a port. See Get Closer to the Wire with High-Performance Sockets in .NET.
  4. Open the port in your PC's antivirus firewall.
  5. Create an app on your Android which starts a socket connection to the PC (you will need the PC's internal IP address the port you opened on the PC's antivirus firewall). See Socket Communications.

It is a little complicated, but uses current tech and will give you more options and is easier to implement and maintain then a Bluetooth serial connection.



来源:https://stackoverflow.com/questions/8299779/bluetooth-chat-between-android-device-and-pc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!