// Use this for initialization void Start() { blueToothPlugin = BlueToothPlugin.GetInstance(); blueToothPlugin.SetDebug(0); blueToothPlugin.Init(); blueToothPlugin.SetConnectionCallbackListener( OnConnected , OnConnecting , OnNotConnected , OnConnectionFailed , OnConnectionLost , OnConnectToDevice ); blueToothPlugin.SetDataCallbackListener(OnRecievedMessage, OnSentMessage, OnLogMessage); bool isEnable = blueToothPlugin.CheckBlueTooth(); Debug.Log("[BlueToothDemo] isBlueToothEnable: " + isEnable); if (!isEnable) { blueToothPlugin.EnsureDiscoverable(); } else { blueToothPlugin.InitServer(); } }
public void CheckBlueTooth() { bool isEnable = blueToothPlugin.CheckBlueTooth(); if (blueEnableText != null) { blueEnableText.text = string.Format("IsBlueToothEnable: {0}", isEnable); } if (isEnable) { notifyButton.interactable = false; } else { notifyButton.interactable = true; } }
// Use this for initialization void Start() { blueToothPlugin = BlueToothPlugin.GetInstance(); blueToothPlugin.SetDebug(0); blueToothPlugin.Init(); blueToothPlugin.SetConnectionCallbackListener( OnConnected ,OnConnecting ,OnNotConnected ,OnConnectionFailed ,OnConnectionLost ,OnConnectToDevice ); blueToothPlugin.SetDataCallbackListener(OnRecievedMessage,OnSentMessage,OnLogMessage); bool isEnable = blueToothPlugin.CheckBlueTooth(); Debug.Log("[BlueToothDemo] isBlueToothEnable: " + isEnable); if(!isEnable){ blueToothPlugin.EnsureDiscoverable(); }else{ blueToothPlugin.InitServer(); } }