public Gatt Connect() { AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); var activity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); m_gatt = new Gatt(); m_gatt.OnConnected += TriggerOnConnected; var callbacks = new AndroidJavaObject("com.blatand.GattCallbackInterfacer", new Gatt.InternalGattCallback(m_gatt)); m_gatt.m_callbacks = callbacks; if (GetSDKInt() >= 23) { m_gatt.AndroidObject = m_androidObject.Call <AndroidJavaObject>("connectGatt", activity, false, callbacks, 2); } else { m_gatt.AndroidObject = m_androidObject.Call <AndroidJavaObject>("connectGatt", activity, false, callbacks); } return(m_gatt); }
void TriggerOnConnected(Gatt gatt) { OnConnected(this, gatt); }
internal GattService(AndroidJavaObject androidObject, Gatt gatt) : base(androidObject) { m_characteristics = new Dictionary <string, GattCharacteristic>(); Gatt = gatt; }
public InternalGattCallback(Gatt source) : base() { m_source = source; }