private static BleDeviceDataEvents GetDataEvent(string identifier, string serviceUUID, string characteristicUUID) { BleCharastericsKeyInfo key = new BleCharastericsKeyInfo(identifier, serviceUUID, characteristicUUID); BleDeviceDataEvents data = null; if (s_deviceDataEvents.TryGetValue(key, out data)) { return(data); } data = new BleDeviceDataEvents(); s_deviceDataEvents.Add(key, data); return(data); }
private static void UpdateDeviceData() { // read/notify data var readDatas = javaWrapper.GetCharacteristicDatas(); foreach (var readData in readDatas) { var key = new BleCharastericsKeyInfo(readData.deviceAddr, readData.serviceUuid, readData.characteristic); BleDeviceDataEvents dataEvt = null; if (!s_deviceDataEvents.TryGetValue(key, out dataEvt)) { Debug.LogError("Not Found key"); continue; } if (readData.isNotify) { dataEvt.CallNotify(readData.serviceUuid, readData.characteristic, readData.data); } else { dataEvt.CallRead(readData.serviceUuid, readData.characteristic, readData.data); } } }