diff --git a/src/eros/eros.go b/src/eros/eros.go index 8f62c16..3e9da2e 100644 --- a/src/eros/eros.go +++ b/src/eros/eros.go @@ -1,6 +1,47 @@ package eros +import ( + "github.com/prologic/bitcask" + "protomolecule/src/dust" + "encoding/json" +) + +var db *bitcask.Bitcask + +// these values should be defined by config +var DataDir string = "./.eros-data" +// // + // -// Bitcask DB holds the devices captured during scanning +// Bitcask DB holds the devices captured during scanning // +// MAC (Key) +// Device Local Name (LocalName) +// Raw Advertisement Packet (Advertisement) +// Services UUIDs (Services) // + +//this struct is to be marshalled into json before stored in bitcask +type Details struct { + LocalName string + Advertisement []byte + Services []string +} + +// we use this to nest the populated Details struct associated with the MAC +type Device struct { + MAC string + Info Details +} + +func Awaken() { + //log.Debug().Str("DataDir",DataDir).Msg("Initializing eros...") + db, err := bitcask.Open(DataDir) + if err != nil { + panic(err.Error) + } +} + +func Remember(mac string, adv []byte, services []string) { + // placeholder +}