Procházet zdrojové kódy

chore: add RSSI to location event and persist in tracks

master
Blaz Smehov před 2 týdny
rodič
revize
23208dc32d
4 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. +1
    -0
      cmd/location/main.go
  2. +1
    -1
      internal/pkg/model/tracks.go
  3. +1
    -0
      internal/pkg/model/types.go
  4. +1
    -1
      internal/pkg/service/beacon_service.go

+ 1
- 0
cmd/location/main.go Zobrazit soubor

@@ -129,6 +129,7 @@ func getLikelyLocations(appState *appcontext.AppState, writer *kafka.Writer) {
r.Distance = beacon.BeaconMetrics[mSize-1].Distance
r.Location = bestLocName
r.LastSeen = beacon.BeaconMetrics[mSize-1].Timestamp
r.RSSI = beacon.BeaconMetrics[mSize-1].RSSI

if beacon.LocationConfidence == settings.LocationConfidence && beacon.PreviousConfidentLocation != bestLocName {
beacon.LocationConfidence = 0


+ 1
- 1
internal/pkg/model/tracks.go Zobrazit soubor

@@ -15,6 +15,6 @@ type Tracks struct {
Subject string `json:"subject"`
SubjectName string `json:"subjectName"`
Floor string `json:"floor"`
Signal int `json:"signal"`
Signal int64 `json:"signal"`
Building string `json:"building"`
}

+ 1
- 0
internal/pkg/model/types.go Zobrazit soubor

@@ -43,6 +43,7 @@ type HTTPLocation struct {
ID string `json:"id"`
Location string `json:"location"`
LastSeen int64 `json:"last_seen"`
RSSI int64 `json:"rssi"`
}

// Beacon holds all relevant information about a tracked beacon device.


+ 1
- 1
internal/pkg/service/beacon_service.go Zobrazit soubor

@@ -61,7 +61,7 @@ func LocationToBeaconService(msg model.HTTPLocation, db *gorm.DB, writer *kafka.
}

// status, subject, subject name?
if err := db.Create(&model.Tracks{UUID: msg.ID, Timestamp: time.Now(), Gateway: gw.ID, GatewayMac: gw.MAC, Tracker: msg.ID, Floor: gw.Floor, Building: gw.Building, TrackerMac: tracker.MAC}).Error; err != nil {
if err := db.Create(&model.Tracks{UUID: msg.ID, Timestamp: time.Now(), Gateway: gw.ID, GatewayMac: gw.MAC, Tracker: msg.ID, Floor: gw.Floor, Building: gw.Building, TrackerMac: tracker.MAC, Signal: msg.RSSI}).Error; err != nil {
fmt.Println("Error in saving distance for beacon: ", err)
return
}


Načítá se…
Zrušit
Uložit