Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Dim bc As ByteConverter
Dim key As Int = -1 'type is important. Must be Int.
If AdvertisingData.ContainsKey(key) Then
Dim b() As Byte = AdvertisingData.Get(key)
Dim hex As String = bc.HexFromBytes(b)
'Temperatur
Private temperature As Int
Private tem1,tem2,hum As Int
Private temp1,hum1 As Float
Dim temperatureSign As Boolean = Bit.And(b(4), 0x80) <> 0
temperature = Bit.And(b(4), 0x7f)' + (b(5) / 100.0)
If temperatureSign Then
temperature = -temperature
End If
tem1 = temperature
tem2 = b(5)
'Luftfeuchtigkeit
Dim Str3 As String
Str3 = hex.SubString2(6, 8)
hum = Bit.ParseInt(Str3, 16)
'Ergebniss
temp1 = tem1&"."&tem2 ' = Grad
hum1 = hum/2 ' = Relative Luftfeuchtigkeit
End If
End Sub