| @@ -129,6 +129,7 @@ func getLikelyLocations(appState *appcontext.AppState, writer *kafka.Writer) { | |||||
| r.Distance = beacon.BeaconMetrics[mSize-1].Distance | r.Distance = beacon.BeaconMetrics[mSize-1].Distance | ||||
| r.Location = bestLocName | r.Location = bestLocName | ||||
| r.LastSeen = beacon.BeaconMetrics[mSize-1].Timestamp | r.LastSeen = beacon.BeaconMetrics[mSize-1].Timestamp | ||||
| r.RSSI = beacon.BeaconMetrics[mSize-1].RSSI | |||||
| if beacon.LocationConfidence == settings.LocationConfidence && beacon.PreviousConfidentLocation != bestLocName { | if beacon.LocationConfidence == settings.LocationConfidence && beacon.PreviousConfidentLocation != bestLocName { | ||||
| beacon.LocationConfidence = 0 | beacon.LocationConfidence = 0 | ||||
| @@ -15,6 +15,6 @@ type Tracks struct { | |||||
| Subject string `json:"subject"` | Subject string `json:"subject"` | ||||
| SubjectName string `json:"subjectName"` | SubjectName string `json:"subjectName"` | ||||
| Floor string `json:"floor"` | Floor string `json:"floor"` | ||||
| Signal int `json:"signal"` | |||||
| Signal int64 `json:"signal"` | |||||
| Building string `json:"building"` | Building string `json:"building"` | ||||
| } | } | ||||
| @@ -43,6 +43,7 @@ type HTTPLocation struct { | |||||
| ID string `json:"id"` | ID string `json:"id"` | ||||
| Location string `json:"location"` | Location string `json:"location"` | ||||
| LastSeen int64 `json:"last_seen"` | LastSeen int64 `json:"last_seen"` | ||||
| RSSI int64 `json:"rssi"` | |||||
| } | } | ||||
| // Beacon holds all relevant information about a tracked beacon device. | // Beacon holds all relevant information about a tracked beacon device. | ||||
| @@ -61,7 +61,7 @@ func LocationToBeaconService(msg model.HTTPLocation, db *gorm.DB, writer *kafka. | |||||
| } | } | ||||
| // status, subject, subject name? | // 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) | fmt.Println("Error in saving distance for beacon: ", err) | ||||
| return | return | ||||
| } | } | ||||