clean up and re-organize

This commit is contained in:
kayos 2021-06-01 19:18:35 -07:00
parent 91ba197c6c
commit f5126f85bc
4 changed files with 110 additions and 576 deletions

481
UUIDs.txt
View File

@ -1,481 +0,0 @@
0xFEFF GN Netcom
0xFEFE GN ReSound A/S
0xFEFD Gimbal, Inc.
0xFEFC Gimbal, Inc.
0xFEFB Telit Wireless Solutions (Formerly Stollmann E+V GmbH)
0xFEFA PayPal, Inc.
0xFEF9 PayPal, Inc.
0xFEF8 Aplix Corporation
0xFEF7 Aplix Corporation
0xFEF6 Wicentric, Inc.
0xFEF5 Dialog Semiconductor GmbH
0xFEF4 Google
0xFEF3 Google
0xFEF2 CSR
0xFEF1 CSR
0xFEF0 Intel
0xFEEF Polar Electro Oy
0xFEEE Polar Electro Oy
0xFEED Tile, Inc.
0xFEEC Tile, Inc.
0xFEEB Swirl Networks, Inc.
0xFEEA Swirl Networks, Inc.
0xFEE9 Quintic Corp.
0xFEE8 Quintic Corp.
0xFEE7 Tencent Holdings Limited.
0xFEE6 Silvair, Inc.
0xFEE5 Nordic Semiconductor ASA
0xFEE4 Nordic Semiconductor ASA
0xFEE3 Anki, Inc.
0xFEE2 Anki, Inc.
0xFEE1 Anhui Huami Information Technology Co., Ltd.
0xFEE0 Anhui Huami Information Technology Co., Ltd.
0xFEDF Design SHIFT
0xFEDE Coin, Inc.
0xFEDD Jawbone
0xFEDC Jawbone
0xFEDB Perka, Inc.
0xFEDA ISSC Technologies Corp.
0xFED9 Pebble Technology Corporation
0xFED8 Google
0xFED7 Broadcom
0xFED6 Broadcom
0xFED5 Plantronics Inc.
0xFED4 Apple, Inc.
0xFED3 Apple, Inc.
0xFED2 Apple, Inc.
0xFED1 Apple, Inc.
0xFED0 Apple, Inc.
0xFECF Apple, Inc.
0xFECE Apple, Inc.
0xFECD Apple, Inc.
0xFECC Apple, Inc.
0xFECB Apple, Inc.
0xFECA Apple, Inc.
0xFEC9 Apple, Inc.
0xFEC8 Apple, Inc.
0xFEC7 Apple, Inc.
0xFEC6 Kocomojo, LLC
0xFEC5 Realtek Semiconductor Corp.
0xFEC4 PLUS Location Systems
0xFEC3 360fly, Inc.
0xFEC2 Blue Spark Technologies, Inc.
0xFEC1 KDDI Corporation
0xFEC0 KDDI Corporation
0xFEBF Nod, Inc.
0xFEBE Bose Corporation
0xFEBD Clover Network, Inc
0xFEBC Dexcom Inc
0xFEBB adafruit industries
0xFEBA Tencent Holdings Limited
0xFEB9 LG Electronics
0xFEB8 Facebook, Inc.
0xFEB7 Facebook, Inc.
0xFEB6 Vencer Co., Ltd
0xFEB5 WiSilica Inc.
0xFEB4 WiSilica Inc.
0xFEB3 Taobao
0xFEB2 Microsoft Corporation
0xFEB1 Electronics Tomorrow Limited
0xFEB0 Nest Labs Inc
0xFEAF Nest Labs Inc
0xFEAE Nokia
0xFEAD Nokia
0xFEAC Nokia
0xFEAB Nokia
0xFEAA Google
0xFEA9 Savant Systems LLC
0xFEA8 Savant Systems LLC
0xFEA7 UTC Fire and Security
0xFEA6 GoPro, Inc.
0xFEA5 GoPro, Inc.
0xFEA4 Paxton Access Ltd
0xFEA3 ITT Industries
0xFEA2 Intrepid Control Systems, Inc.
0xFEA1 Intrepid Control Systems, Inc.
0xFEA0 Google
0xFE9F Google
0xFE9E Dialog Semiconductor B.V.
0xFE9D Mobiquity Networks Inc
0xFE9C GSI Laboratories, Inc.
0xFE9B Samsara Networks, Inc
0xFE9A Estimote
0xFE99 Currant Inc
0xFE98 Currant Inc
0xFE97 Tesla Motors Inc.
0xFE96 Tesla Motors Inc.
0xFE95 Xiaomi Inc.
0xFE94 OttoQ In
0xFE93 OttoQ In
0xFE92 Jarden Safety & Security
0xFE91 Shanghai Imilab Technology Co.,Ltd
0xFE90 JUMA
0xFE8F CSR
0xFE8E ARM Ltd
0xFE8D Interaxon Inc.
0xFE8C TRON Forum
0xFE8B Apple, Inc.
0xFE8A Apple, Inc.
0xFE89 B&O Play A/S
0xFE88 SALTO SYSTEMS S.L.
0xFE87 Qingdao Yeelink Information Technology Co., Ltd.
0xFE86 HUAWEI Technologies Co., Ltd.
0xFE85 RF Digital Corp
0xFE84 RF Digital Corp
0xFE83 Blue Bite
0xFE82 Medtronic Inc.
0xFE81 Medtronic Inc.
0xFE80 Doppler Lab
0xFE7F Doppler Lab
0xFE7E Awear Solutions Ltd
0xFE7D Aterica Health Inc.
0xFE7C Telit Wireless Solutions (Formerly Stollmann E+V GmbH)
0xFE7B Orion Labs, Inc.
0xFE7A Bragi GmbH
0xFE79 Zebra Technologies
0xFE78 Hewlett-Packard Company
0xFE77 Hewlett-Packard Company
0xFE76 TangoMe
0xFE75 TangoMe
0xFE74 unwire
0xFE73 Abbott (formerly St. Jude Medical, Inc.)
0xFE72 Abbott (formerly St. Jude Medical, Inc.)
0xFE71 Plume Design Inc
0xFE70 Beijing Jingdong Century Trading Co., Ltd.
0xFE6F LINE Corporation
0xFE6E The University of Tokyo
0xFE6D The University of Tokyo
0xFE6C TASER International, Inc.
0xFE6B TASER International, Inc.
0xFE6A Kontakt Micro-Location Sp. z o.o.
0xFE69 Qualcomm Life Inc
0xFE68 Qualcomm Life Inc
0xFE67 Lab Sensor Solutions
0xFE66 Intel Corporation
0xFE65 CHIPOLO d.o.o.
0xFE64 Siemens AG
0xFE63 Connected Yard, Inc.
0xFE62 Indagem Tech LLC
0xFE61 Logitech International SA
0xFE60 Lierda Science & Technology Group Co., Ltd.
0xFE5F Eyefi, Inc.
0xFE5E Plastc Corporation
0xFE5D Grundfos A/S
0xFE5C million hunters GmbH
0xFE5B GT-tronics HK Ltd
0xFE5A Cronologics Corporation
0xFE59 Nordic Semiconductor ASA
0xFE58 Nordic Semiconductor ASA
0xFE57 Dotted Labs
0xFE56 Google Inc.
0xFE55 Google Inc.
0xFE54 Motiv, Inc.
0xFE53 3M
0xFE52 SetPoint Medical
0xFE51 SRAM
0xFE50 Google Inc.
0xFE4F Molekule, Inc.
0xFE4E NTT docomo
0xFE4D Casambi Technologies Oy
0xFE4C Volkswagen AG
0xFE4B Signify Netherlands B.V. (formerly Philips Lighting B.V.)
0xFE4A OMRON HEALTHCARE Co., Ltd.
0xFE49 SenionLab AB
0xFE48 General Motors
0xFE47 General Motors
0xFE46 B&O Play A/S
0xFE45 Snapchat Inc
0xFE44 SK Telecom
0xFE43 Andreas Stihl AG & Co. KG
0xFE42 Nets A/S
0xFE41 Inugo Systems Limited
0xFE40 Inugo Systems Limited
0xFE3F Friday Labs Limited
0xFE3E BD Medical
0xFE3D BD Medical
0xFE3C alibaba
0xFE3B Dolby Laboratories
0xFE3A TTS Tooltechnic Systems AG & Co. KG
0xFE39 TTS Tooltechnic Systems AG & Co. KG
0xFE38 Spaceek LTD
0xFE37 Spaceek LTD
0xFE36 HUAWEI Technologies Co., Ltd
0xFE35 HUAWEI Technologies Co., Ltd
0xFE34 SmallLoop LLC
0xFE33 CHIPOLO d.o.o.
0xFE32 Pro-Mark, Inc.
0xFE31 Volkswagen AG
0xFE30 Volkswagen AG
0xFE2F CRESCO Wireless, Inc
0xFE2E ERi,Inc.
0xFE2D SMART INNOVATION Co.,Ltd
0xFE2C Google
0xFE2B ITT Industries
0xFE2A DaisyWorks, Inc.
0xFE29 Gibson Innovations
0xFE28 Ayla Networks
0xFE27 Google
0xFE26 Google
0xFE25 Apple, Inc.
0xFE24 August Home Inc
0xFE23 Zoll Medical Corporation
0xFE22 Zoll Medical Corporation
0xFE21 Bose Corporation
0xFE20 Emerson
0xFE1F Garmin International, Inc.
0xFE1E Smart Innovations Co., Ltd
0xFE1D Illuminati Instrument Corporation
0xFE1C NetMedia, Inc.
0xFE1B Tyto Life LLC
0xFE1A Tyto Life LLC
0xFE19 Google, Inc
0xFE18 Runtime, Inc.
0xFE17 Telit Wireless Solutions GmbH
0xFE16 Footmarks, Inc.
0xFE15 Amazon.com Services, Inc..
0xFE14 Flextronics International USA Inc.
0xFE13 Apple Inc.
0xFE12 M-Way Solutions GmbH
0xFE11 GMC-I Messtechnik GmbH
0xFE10 LAPIS Technology Co., Ltd.
0xFE0F Signify Netherlands B.V. (formerly Philips Lighting B.V.)
0xFE0E Setec Pty Ltd
0xFE0D Procter & Gamble
0xFE0C Procter & Gamble
0xFE0B ruwido austria gmbh
0xFE0A ruwido austria gmbh
0xFE09 Pillsy, Inc.
0xFE08 Microsoft
0xFE07 Sonos, Inc.
0xFE06 Qualcomm Technologies, Inc.
0xFE05 CORE Transport Technologies NZ Limited
0xFE04 OpenPath Security Inc
0xFE03 Amazon.com Services, Inc.
0xFE02 Robert Bosch GmbH
0xFE01 Duracell U.S. Operations Inc.
0xFE00 Amazon.com Services, Inc.
0xFDFF OSRAM GmbH
0xFDFE ADHERIUM(NZ) LIMITED
0xFDFD RecursiveSoft Inc.
0xFDFC Optrel AG
0xFDFB Tandem Diabetes Care
0xFDFA Tandem Diabetes Care
0xFDF9 INIA
0xFDF8 Onvocal
0xFDF7 HP Inc.
0xFDF6 AIAIAI ApS
0xFDF5 Milwaukee Electric Tools
0xFDF4 O. E. M. Controls, Inc.
0xFDF3 Amersports
0xFDF2 AMICCOM Electronics Corporation
0xFDF1 LAMPLIGHT Co.,Ltd
0xFDF0 Google Inc.
0xFDEF ART AND PROGRAM, INC.
0xFDEE Huawei Technologies Co., Ltd.
0xFDED Pole Star
0xFDEC Mannkind Corporation
0xFDEB Syntronix Corporation
0xFDEA SeeScan, Inc
0xFDE9 Spacesaver Corporation
0xFDE8 Robert Bosch GmbH
0xFDE7 SECOM Co., LTD
0xFDE6 Intelletto Technologies Inc
0xFDE5 SMK Corporation
0xFDE4 JUUL Labs, Inc.
0xFDE3 Abbott Diabetes Care
0xFDE2 Google Inc.
0xFDE1 Fortin Electronic Systems
0xFDE0 John Deere
0xFDDF Harman International
0xFDDE Noodle Technology Inc.
0xFDDD Arch Systems Inc
0xFDDC 4iiii Innovations Inc.
0xFDDB Samsung Electronics Co., Ltd.
0xFDDA MHCS
0xFDD9 Jiangsu Teranovo Tech Co., Ltd.
0xFDD8 Jiangsu Teranovo Tech Co., Ltd.
0xFDD7 Emerson
0xFDD6 Ministry of Supply
0xFDD5 Brompton Bicycle Ltd
0xFDD4 LX Solutions Pty Limited
0xFDD3 FUBA Automotive Electronics GmbH
0xFDD2 Bose Corporation
0xFDD1 Huawei Technologies Co., Ltd
0xFDD0 Huawei Technologies Co., Ltd
0xFDCF Nalu Medical, Inc
0xFDCE SENNHEISER electronic GmbH & Co. KG
0xFDCD Qingping Technology (Beijing) Co., Ltd.
0xFDCC Shoof Technologies
0xFDCB Meggitt SA
0xFDCA Fortin Electronic Systems
0xFDC9 Busch-Jaeger Elektro GmbH
0xFDC8 Hach Danaher
0xFDC7 Eli Lilly and Company
0xFDC6 Eli Lilly and Company
0xFDC5 Automatic Labs
0xFDC4 Simavita (Aust) Pty Ltd
0xFDC3 Baidu Online Network Technology (Beijing) Co., Ltd
0xFDC2 Baidu Online Network Technology (Beijing) Co., Ltd
0xFDC1 Hunter Douglas
0xFDC0 Hunter Douglas
0xFDBF California Things Inc.
0xFDBE California Things Inc.
0xFDBD Clover Network, Inc.
0xFDBC Emerson
0xFDBB Profoto
0xFDBA Comcast Cable Corporation
0xFDB9 Comcast Cable Corporation
0xFDB8 LivaNova USA Inc.
0xFDB7 LivaNova USA Inc.
0xFDB6 GWA Hygiene GmbH
0xFDB5 ECSG
0xFDB4 HP Inc
0xFDB3 Audiodo AB
0xFDB2 Portable Multimedia Ltd
0xFDB1 Proxy Technologies, Inc.
0xFDB0 Proxy Technologies, Inc.
0xFDAF Wiliot LTD
0xFDAE Houwa System Design, k.k.
0xFDAD Houwa System Design, k.k.
0xFDAC Tentacle Sync GmbH
0xFDAB Xiaomi Inc.
0xFDAA Xiaomi Inc.
0xFDA9 Rhombus Systems, Inc.
0xFDA8 PSA Peugeot Citroën
0xFDA7 WWZN Information Technology Company Limited
0xFDA6 WWZN Information Technology Company Limited
0xFDA5 Neurostim OAB, Inc.
0xFDA4 Inseego Corp.
0xFDA3 Inseego Corp.
0xFDA2 Groove X, Inc
0xFDA1 Groove X, Inc
0xFDA0 Secugen Corporation
0xFD9F VitalTech Affiliates LLC
0xFD9E The Coca-Cola Company
0xFD9D Gastec Corporation
0xFD9C Huawei Technologies Co., Ltd.
0xFD9B Huawei Technologies Co., Ltd.
0xFD9A Huawei Technologies Co., Ltd.
0xFD99 ABB Oy
0xFD98 Disney Worldwide Services, Inc.
0xFD97 June Life, Inc.
0xFD96 Google LLC
0xFD95 Rigado
0xFD94 Hewlett Packard Enterprise
0xFD93 Bayerische Motoren Werke AG
0xFD92 Qualcomm Technologies International, Ltd. (QTIL)
0xFD91 Groove X, Inc.
0xFD90 Guangzhou SuperSound Information Technology Co.,Ltd
0xFD8F Matrix ComSec Pvt. Ltd.
0xFD8E Motorola Solutions
0xFD8D quip NYC Inc.
0xFD8C Google LLC
0xFD8B Jigowatts Inc.
0xFD8A Signify Netherlands B.V.
0xFD89 Urbanminded LTD
0xFD88 Urbanminded LTD
0xFD87 Google LLC
0xFD86 Abbott
0xFD85 Husqvarna AB
0xFD84 Tile, Inc.
0xFD83 iNFORM Technology GmbH
0xFD82 Sony Corporation
0xFD81 CANDY HOUSE, Inc.
0xFD80 Phindex Technologies, Inc
0xFD7F Husqvarna AB
0xFD7E Samsung Electronics Co., Ltd.
0xFD7D Center for Advanced Research Wernher Von Braun
0xFD7C Toshiba Information Systems(Japan) Corporation
0xFD7B WYZE LABS, INC.
0xFD7A Withings
0xFD79 Withings
0xFD78 Withings
0xFD77 Withings
0xFD76 Insulet Corporation
0xFD75 Insulet Corporation
0xFD74 BRControls Products BV
0xFD73 BRControls Products BV
0xFD72 Logitech International SA
0xFD71 GN Hearing A/S
0xFD70 GuangDong Oppo Mobile Telecommunications Corp., Ltd
0xFD6F Apple, Inc.
0xFD6E Polidea sp. z o.o.
0xFD6D Sigma Elektro GmbH
0xFD6C Samsung Electronics Co., Ltd.
0xFD6B rapitag GmbH
0xFD6A Emerson
0xFD69 Samsung Electronics Co., Ltd
0xFD68 Ubique Innovation AG
0xFD67 Montblanc Simplo GmbH
0xFD66 Zebra Technologies Corporation
0xFD65 Razer Inc.
0xFD64 INRIA
0xFD63 Fitbit, Inc.
0xFD62 Fitbit, Inc.
0xFD61 Arendi AG
0xFD60 Sercomm Corporation
0xFD5F Oculus VR, LLC
0xFD5E Tapkey GmbH
0xFD5D maxon motor ltd.
0xFD5C React Mobile
0xFD5B V2SOFT INC.
0xFD5A Samsung Electronics Co., Ltd.
0xFD59 Samsung Electronics Co., Ltd.
0xFD58 Volvo Car Corporation
0xFD57 Volvo Car Corporation
0xFD56 Resmed Ltd
0xFD55 Braveheart Wireless, Inc.
0xFD54 Qingdao Haier Technology Co., Ltd.
0xFD53 PCI Private Limited
0xFD52 UTC Fire and Security
0xFD51 UTC Fire and Security
0xFD50 Hangzhou Tuya Information Technology Co., Ltd
0xFD4F Forkbeard Technologies AS
0xFD4E 70mai Co.,Ltd.
0xFD4D 70mai Co.,Ltd.
0xFD4C Adolf Wuerth GmbH & Co KG
0xFD4B Samsung Electronics Co., Ltd.
0xFD4A Sigma Elektro GmbH
0xFD49 Panasonic Corporation
0xFD48 Geberit International AG
0xFD47 Liberty Global Inc.
0xFD46 Lemco IKE
0xFD45 GB Solution co.,Ltd
0xFD44 Apple Inc.
0xFD43 Apple Inc.
0xFD42 Globe (Jiangsu) Co.,Ltd
0xFD41 Amazon Lab126
0xFD40 Beflex Inc.
0xFD3F Cognosos, Inc
0xFD3E Pure Watercraft, inc.
0xFD3D Woan Technology (Shenzhen) Co., Ltd.
0xFD3C Redline Communications Inc.
0xFD3B Verkada Inc.
0xFD3A Verkada Inc.
0xFD39 PREDIKTAS
0xFD38 Danfoss A/S
0xFD37 TireCheck GmbH
0xFD36 Google LLC
0xFD35 Transsion Holdings Limited
0xFD34 Aerosens LLC.
0xFD33 DashLogic, Inc.
0xFD32 Gemalto Holding BV
0xFD31 LG Electronics Inc.
0xFD30 Sesam Solutions BV
0xFD2F Bitstrata Systems Inc.
0xFD2E Bitstrata Systems Inc.
0xFD2D Xiaomi Inc.
0xFD2C The Access Technologies
0xFD2B The Access Technologies
0xFD2A Sony Corporation
0xFD29 Asahi Kasei Corporation
0xFD28 Julius Blum GmbH
0xFD27 i2Systems
0xFD26 Novo Nordisk A/S
0xFD25 GD Midea Air-Conditioning Equipment Co., Ltd.
0xFD24 GD Midea Air-Conditioning Equipment Co., Ltd.
0xFD23 DOM Sicherheitstechnik GmbH & Co. KG
0xFD22 Huawei Technologies Co., Ltd.
0xFD21 Huawei Technologies Co., Ltd.
0xFD20 GN Hearing A/S
0xFD1F 3M

123
main.go
View File

@ -15,7 +15,38 @@ import (
"github.com/rs/zerolog/log"
)
func listen() {
var (
manufLoad bool
)
func loginit() {
// setup json logfile
// TODO: make this a command line argument
var logDir string = "./.logs/"
err := os.MkdirAll(logDir, 0755)
if err != nil {
panic(err.Error())
}
Now := time.Now()
date := Now.Format(time.RFC3339)
logFileName := date + ".log"
lf, err := os.OpenFile(logDir+logFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
panic(err.Error())
}
// define pretty printer
consoleWriter := zerolog.ConsoleWriter{Out: os.Stderr}
// initialize simultaneous pretty printing and json logging
multi := zerolog.MultiLevelWriter(consoleWriter, lf)
log.Logger = zerolog.New(multi).With().Timestamp().Logger()
// suppress debug messages unless -d is called
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}
func cliFlags() {
flag.Parse()
if *projVars.AFlag {
@ -32,10 +63,11 @@ func listen() {
if *projVars.MFlag != "0" {
projVars.ManuFile = *projVars.MFlag
manufLoad = true
}
}
func obey() {
func sigHandler() {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
@ -61,70 +93,59 @@ func init() {
Mailbox: make(chan protogen.Postcard),
}
// setup json logfile
// TODO: make this a command line argument
var logDir string = "./.logs/"
err := os.MkdirAll(logDir, 0755)
if err != nil {
panic(err.Error())
}
Now := time.Now()
date := Now.Format(time.RFC3339)
logFileName := date + ".log"
lf, err := os.OpenFile(logDir+logFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
panic(err.Error())
}
// define pretty printer
consoleWriter := zerolog.ConsoleWriter{Out: os.Stderr}
// initialize simultaneous pretty printing and json logging
multi := zerolog.MultiLevelWriter(consoleWriter, lf)
log.Logger = zerolog.New(multi).With().Timestamp().Logger()
// suppress debug messages unless -d is called
zerolog.SetGlobalLevel(zerolog.InfoLevel)
listen()
obey()
loginit()
cliFlags()
sigHandler()
log.Debug().Msg("Logging initialized")
// see ./src/eros
log.Debug().Msg("Initializing database engine")
eros.Awaken()
if *projVars.MFlag != "0" {
// loading manufacturer info from json file determined by flag
if manufLoad {
eros.ManufLoad()
}
}
func earToTheWire() {
var sublog zerolog.Logger
// Define our IPC callbacks here
interpret := func(m protogen.Postcard) {
switch m.Command {
case "quit":
sublog.Warn().
Int("from", m.From).
Msg("IPC_QUIT")
os.Exit(0)
}
}
for {
select {
case postcard := <- protogen.ScanMgr.Mailbox:
sublog = log.With().Int("scan_id", postcard.From).Logger()
interpret(postcard)
}
}
}
func main() {
defer eros.Slumber()
var scan *protogen.Scan
go func() {
for {
select {
case postcard := <- protogen.ScanMgr.Mailbox:
log.Info().
Int("originating_scan_id", postcard.From).
Str("message", postcard.Message).
Msg("Mailbox_IPC")
if postcard.Message == "quit" {
log.Warn().
Int("from", postcard.From).
Msg("Received command to quit via Mailbox")
os.Exit(0)
}
}
}
}()
// Note: the tinygo bluetooth (prototooth here) library does already have a channel system for starting and stopping scans
// the rational behind implementing an additional IPC system has to do with potentially doing more than just BLE
//
// this starts our IPC listener so that we are ready to catch any incoming IPC messages before we start any scans
go earToTheWire()
scan = protogen.ScanMgr.NewScan()

View File

@ -91,6 +91,8 @@ func ManfCheck(TargetAdvertData bluetooth.AdvertisementPayload) string {
// resultHandler is called by the bluetooth library upon device discovery to handle the result
func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.ScanResult) {
var sublog zerolog.Logger
projVars.ScanAdapter.SetConnectHandler(func(Result bluetooth.Addresser, connected bool) {
// It seems that because this is a callback that the library calls itself that it is passing us "connected" as an argument
// therefore I think what we're supposed to do is store that boolean so we can then reference it later
@ -101,24 +103,22 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
addr := result.Address.String()
lname := result.LocalName()
//adbytes := payload.Bytes()
uuids := payload.ServiceUUIDOut()
rssi := result.RSSI
EnumedManuf := ""
// TODO: probably make this a function or a method in eros(?)
//
//---attempts to set the manufacturer value----
//range through the uuids in the payload and compare
//known manufacturers list
uuids := payload.ServiceUUIDOut()
for range uuids {
//for every element within the manufacturers list
// check each UUID
for _, man := range eros.Manufacturers.Entries {
// pull the UUID the current element of the manufacturer list
currManufErosOut := man.UUIDs /* current element from manufacturer data */
// for each manufacturer's UUID's comapre check the
// advertisment payload for a match
// for each manufacturer's UUID: compare the advertisment payload for a match
for _, manusss := range currManufErosOut {
manufBool := payload.HasServiceUUID(manusss)
//if there is a UUID match then assign the Manufacturer's name
@ -131,8 +131,6 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
}
}
//
var sublog zerolog.Logger
//ManufOut := ManfCheck(payload)
@ -157,7 +155,7 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
//Services level logging
// TODO:
// Fix Loggin output here -- Prob shouldnt output this much info
// Fix Logging output here -- Prob shouldnt output this much info
// for each service discovered
// only each device
sublog = log.With().Int("Scan_ID", s.ID).
@ -176,11 +174,8 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
// Upon finding new and valid info we update the time for last activity
s.Activity = time.Now()
//dev := s.NewDevice(lname, addr, ManufOut, rssi)
dev := s.NewDevice(lname, addr, EnumedManuf, rssi)
//AdvServBuf := make([]byte, 255)
// Record all the services advertised, append them into the nested struct within Device
for _, uuid := range uuids {
svc := &eros.Service{
@ -198,18 +193,18 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
////////////////////////////////////////////////////////////////////////
//var PreTargetHandling type
// var TargetDeviceService *bluetooth.DeviceService
// var TargetDeviceServiceChar *bluetooth.DeviceCharacteristic
//Attempt to connect -- This should be put in bluestuff once its working
//time.Sleep(5 * time.Second)
//var TargetDeviceService *bluetooth.DeviceService
//var TargetDeviceServiceChar *bluetooth.DeviceCharacteristic
sublog.Info().Str("Adapter", "Attempting Connection").Msg("ADAPTER_STATUS")
//creates a new timer of d (time.Duration)
// TODO: re-assess the timeout mechanism
// this is largely going to depend on how concurrent we can get (at least with only one ble adapter)
// creates a new timer of d (time.Duration)
// outputs time on {timer_Name}.C chan
//can then be checked against tick (time.Time)
// can then be checked against tick (time.Time)
TimerCounts := time.NewTimer(10 * time.Millisecond)
var (
@ -273,15 +268,11 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
Str("Value", string(ServBuf[:SerReadPos])).
Msg("GATT_SERVICE")
//ReadPos, _ := char.Read(Charbuf)
sublog.Debug().Str("status", "Attempting to Retrieve Characteristic List").Msg("ADAPTER_STATUS")
chars, _ := srvcs.DiscoverCharacteristics(nil)
dev.Services = append(dev.Services, charSer)
for _, char := range chars {
ReadPos, _ := char.Read(Charbuf)
sublog.Info().Str("UUID", char.UUID().String()).
@ -291,6 +282,8 @@ func (s *Scan) resultHandler(scanAdapter *bluetooth.Adapter, result bluetooth.Sc
}
// finished with this device
TargetDevice.Disconnect()
sublog.Info().Str("Adapter", "Successfully Disconnected From Target").Msg("ADAPTER_STATUS")
projVars.ConnectedToTarget = false
@ -304,18 +297,10 @@ func (s *Scan) Start() error {
s.Started = time.Now()
// create list of devices in the Area of Operation
log.Debug().Msg("Creating Device Map")
log.Info().Msg("Enabling Adapter")
if projVars.TrackingMode == true {
log.Info().Str("Mode", "Tracking Mode Enabled").Msg("PROTO_MODE")
}
if projVars.AttackMode == true {
log.Info().Str("Mode", "Attack Mode Enabled").Msg("PROTO_MODE")
}
//log.Debug().Msg("Creating Device Map")
// Enable BLE interface
log.Debug().Msg("Enabling Adapter")
err := projVars.ScanAdapter.Enable()
if err != nil {
return err
@ -323,17 +308,18 @@ func (s *Scan) Start() error {
adapterId := projVars.ScanAdapter.ID
log.Info().
Str("ID", adapterId).
Msg("Starting scan")
Bool("MODE_TRACK", projVars.TrackingMode).
Bool("MODE_ATTACK", projVars.AttackMode).
Msg("Starting new ProtoMolecule BLE Scan")
projVars.ScanAdapter.Scan(s.resultHandler)
err = projVars.ScanAdapter.Scan(s.resultHandler)
if err != nil {
return err
}
//projVars.ScanAdapter.StopScan()
//dust.Must("start scan", err)
//time.Sleep(20 * time.Millisecond)
return nil
}

View File

@ -27,14 +27,22 @@ type Meta struct {
// Postcard will encapsulate interprocess communication messages that we send back to the main thread
type Postcard struct {
// From is the ScanID the message originated from
// From - the ScanID the message originated from
From int
// Stamp - the time the IPC message was created
Stamp time.Time
// Device ID - relevant DeviceID (if applicable) - Remember to use Scan.Devices[id] for easy referral
DeviceID int
// probably a string
Message string
// Command - the actual IPC command
Command string
// Arguments - augmenting arguments to the command
Arguments []string
}
// Instance of a BLE scan