• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by nicolas-rios · Jul 12, 2016 at 06:15 PM · networkingbluetoothsocketlistenerguid

Can is use Bluetooth Sockets with InTheHand?

I am trying to establish a bluetooth connection with my PC and my Android's unity application. I was using the InTheHand.dll so i could use its Bluetooth socket functionalities. I successfully create the client on the PC but I am unable to create the server on unity. I create a wrapper class to workaround the GUID serialization problem, but there seems to still be issues when i try to create the Bluetooth listener.

SerializableGuid UUID = new Guid("00001101-0000-1000-8000-00805F9B34FB"); BluetoothListener BTListener = new BluetoothListener(UUID);

where SerializableGuid is here:

[Serializable]

public struct SerializableGuid : IComparable, IComparable, IEquatable {

 public string Value;

 private SerializableGuid(string value)
 {
     Value = value;
 }

 public static implicit operator SerializableGuid(Guid guid)
 {
     return new SerializableGuid(guid.ToString());
 }

 public static implicit operator Guid(SerializableGuid serializableGuid)
 {
     return new Guid(serializableGuid.Value);
 }

 public int CompareTo(object value)
 {
     if (value == null)
         return 1;
     if (!(value is SerializableGuid))
         throw new ArgumentException("Must be SerializableGuid");
     SerializableGuid guid = (SerializableGuid)value;
     return guid.Value == Value ? 0 : 1;
 }

 public int CompareTo(SerializableGuid other)
 {
     return other.Value == Value ? 0 : 1;
 }

 public bool Equals(SerializableGuid other)
 {
     return Value == other.Value;
 }

 public override bool Equals(object obj)
 {
     return base.Equals(obj);
 }

 public override int GetHashCode()
 {
     return (Value != null ? Value.GetHashCode() : 0);
 }

 public override string ToString()
 {
     return (Value != null ? new Guid(Value).ToString() : string.Empty);
 }

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nicolas-rios · Jul 12, 2016 at 07:04 PM 0
Share

Will .Net.Sockets work if I am trying to use bluetooth sockets?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

81 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

java.net.SocketException: recvfrom failed: ECONNRESET 0 Answers

Socket.io, connetion works but can't emit 0 Answers

Can't Add OnClick.Add.Listener To Multiplayer UI 2 Answers

Implement websockets in HoloLens to Connect to Socket.IO 1 Answer

Networking with TLAPI between two different projects 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges