public static void ConnectToPeripheral(string identifier, Action <string> connectedPeripheralAction = null, Action <string, string> discoveredServiceAction = null, Action <string, string, string> discoveredCharacteristicAction = null, Action <string> disconnectedPeripheralAction = null) { if (!s_isInitialized) { return; } //Debug.Log("Connect to peripheral " + identifier); if (s_deviceDiscoverEvents.ContainsKey(identifier)) { return; } var addr = DeviceAddressDatabase.GetAddressValue(identifier); DllInterface.ConnectDevice(addr); var evt = new BleDiscoverEvents(connectedPeripheralAction, discoveredServiceAction, discoveredCharacteristicAction, disconnectedPeripheralAction); s_deviceDiscoverEvents.Add(identifier, evt); }
public static void ConnectToPeripheral(string identifier, Action <string> connectedPeripheralAction = null, Action <string, string> discoveredServiceAction = null, Action <string, string, string> discoveredCharacteristicAction = null, Action <string> disconnectedPeripheralAction = null) { if (javaWrapper == null) { return; } javaWrapper.ConnectRequest(identifier); var deviceEvent = new BleDiscoverEvents( connectedAct: connectedPeripheralAction, discoveredServiceAct: discoveredServiceAction, discoveredCharacteristicAct: discoveredCharacteristicAction, disconnectedAct: disconnectedPeripheralAction ); s_deviceDiscoverEvents[identifier] = deviceEvent; }