From 87b667c1dc5925ebe5bda97f921446faf04b21cc Mon Sep 17 00:00:00 2001 From: evilsocket Date: Fri, 22 Feb 2019 14:10:49 +0100 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- modules/ble/ble_show_services.go | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/modules/ble/ble_show_services.go b/modules/ble/ble_show_services.go index e6ef706e..58f72a7a 100644 --- a/modules/ble/ble_show_services.go +++ b/modules/ble/ble_show_services.go @@ -205,33 +205,13 @@ func parseProperties(ch *gatt.Characteristic) (props []string, isReadable bool, return } -func isMostlyPrintable(raw []byte) bool { - if raw == nil { - return false - } - - tot := len(raw) - if tot == 0 { - return false - } - - pr := 0 - for _, b := range raw { - if strconv.IsPrint(rune(b)) { - pr++ - } - } - - return (float32(pr) / float32(tot)) >= 0.5 -} - func parseRawData(raw []byte) string { s := "" for _, b := range raw { if strconv.IsPrint(rune(b)) { s += tui.Yellow(string(b)) } else { - s += tui.Dim(fmt.Sprintf("%x", b)) + s += tui.Dim(fmt.Sprintf("%02x", b)) } } return s