| @@ -57,8 +57,12 @@ func LoopADStructures(b []byte, i [][2]int, id string) model.BeaconEvent { | |||||
| be.ID = id | be.ID = id | ||||
| be.Name = id | be.Name = id | ||||
| break | break | ||||
| } else if checkMinewB7(ad) { | |||||
| fmt.Println("Minew B7 vendor format") | |||||
| } else if checkMinewDeviceInfo(ad) { | |||||
| be = parseMinewDeviceInfo(ad) | |||||
| be.ID = id | |||||
| be.Name = id | |||||
| break | |||||
| } else if checkMinewAccData(ad) { | |||||
| break | break | ||||
| } | } | ||||
| } | } | ||||
| @@ -116,14 +120,40 @@ func parseEddystoneState(ad []byte) model.BeaconEvent { | |||||
| } | } | ||||
| } | } | ||||
| // I dont think this is always true, but for testing is ok | |||||
| func checkMinewB7(ad []byte) bool { | |||||
| // Minew Battery level | |||||
| func checkMinewDeviceInfo(ad []byte) bool { | |||||
| if len(ad) >= 4 && | if len(ad) >= 4 && | ||||
| len(ad) != 19 && | |||||
| ad[1] == 0x16 && | |||||
| ad[2] == 0xE1 && | |||||
| ad[3] == 0xFF { | |||||
| fmt.Println("Minew device info") | |||||
| return true | |||||
| } | |||||
| return false | |||||
| } | |||||
| func parseMinewDeviceInfo(ad []byte) model.BeaconEvent { | |||||
| fmt.Printf("ad: %x\n", ad) | |||||
| return model.BeaconEvent{ | |||||
| Battery: uint32(ad[6]), | |||||
| Type: "Minew B7", | |||||
| } | |||||
| } | |||||
| func checkMinewAccData(ad []byte) bool { | |||||
| if len(ad) == 19 && | |||||
| ad[1] == 0x16 && | ad[1] == 0x16 && | ||||
| ad[2] == 0xE1 && | ad[2] == 0xE1 && | ||||
| ad[3] == 0xFF { | ad[3] == 0xFF { | ||||
| fmt.Println("Minew Acc data") | |||||
| return true | return true | ||||
| } | } | ||||
| return false | return false | ||||
| } | } | ||||
| // func parseMinewAccData(ad []byte) model.BeaconEvent { | |||||
| // } | |||||