OnBleDidDisconnect() public method

public OnBleDidDisconnect ( string message ) : void
message string
return void
Beispiel #1
0
        public static bool ConnectPeripheralAtIndex(int peripheralIndex)
        {
            bool result = false;

            // We check for UNITY_IPHONE again so we don't try this if it isn't iOS platform.
                        #if UNITY_IPHONE
            // Now we check that it's actually an iOS device/simulator, not the Unity Player. You only get plugins on the actual device or iOS Simulator.
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                result = _ConnectPeripheralAtIndex(peripheralIndex);
            }
                        #elif UNITY_ANDROID
            if (Application.platform == RuntimePlatform.Android)
            {
                System.Action <string> disconnectCallback = ((string message) =>
                {
                    BLEControllerEventHandler.OnBleDidDisconnect(message);
                });
                System.Action <string> connectCallback = ((string message) =>
                {
                    Debug.Log("BLE Did Connect but wait for service discover before trasmitting.");
                    //BLEControllerEventHandler.OnBleDidConnect(message);
                });
                System.Action <string> receiveDataCallback = ((string message) =>
                {
                    BLEControllerEventHandler.OnBleDidReceiveData(message);
                });
                System.Action <string> readyForDataCallback = ((string message) =>
                {
                    BLEControllerEventHandler.OnBleDidConnect(message);
                });
                result = PluginInstance.Call <bool>("_ConnectPeripheralAtIndex", new object[] { peripheralIndex, new UnityCallback(connectCallback), new UnityCallback(disconnectCallback), new UnityCallback(receiveDataCallback), new UnityCallback(readyForDataCallback) });
            }
            #endif

            return(result);
        }
Beispiel #2
0
 void OnBleDidDisconnectMessage(string message)
 {
     BLEControllerEventHandler.OnBleDidDisconnect(message);
 }