|
|
|
@@ -44,13 +44,6 @@ type BeaconAdvertisement struct { |
|
|
|
HSButtonMode string `json:"hb_button_mode"` |
|
|
|
} |
|
|
|
|
|
|
|
// Advertisement describes a generic beacon advertisement payload. |
|
|
|
type Advertisement struct { |
|
|
|
Type string |
|
|
|
Content string |
|
|
|
Seen int64 |
|
|
|
} |
|
|
|
|
|
|
|
// BeaconMetric stores signal and distance data for a beacon. |
|
|
|
type BeaconMetric struct { |
|
|
|
Location string |
|
|
|
@@ -65,13 +58,6 @@ type Location struct { |
|
|
|
Lock sync.RWMutex |
|
|
|
} |
|
|
|
|
|
|
|
// BestLocation represents the most probable location of a beacon. |
|
|
|
type BestLocation struct { |
|
|
|
Distance float64 |
|
|
|
Name string |
|
|
|
LastSeen int64 |
|
|
|
} |
|
|
|
|
|
|
|
// HTTPLocation describes a beacon's state as served over HTTP. |
|
|
|
type HTTPLocation struct { |
|
|
|
Method string `json:"method"` |
|
|
|
@@ -93,13 +79,6 @@ type LocationChange struct { |
|
|
|
Timestamp int64 `json:"timestamp"` |
|
|
|
} |
|
|
|
|
|
|
|
// HAMessage represents a Home Assistant integration payload. |
|
|
|
type HAMessage struct { |
|
|
|
ID string `json:"id"` |
|
|
|
BeaconName string `json:"name"` |
|
|
|
Distance float64 `json:"distance"` |
|
|
|
} |
|
|
|
|
|
|
|
// Beacon holds all relevant information about a tracked beacon device. |
|
|
|
type Beacon struct { |
|
|
|
Name string `json:"name"` |
|
|
|
@@ -132,21 +111,6 @@ type BeaconEvent struct { |
|
|
|
Event int |
|
|
|
} |
|
|
|
|
|
|
|
// Button represents a hardware button beacon device. |
|
|
|
type Button struct { |
|
|
|
Name string `json:"name"` |
|
|
|
ButtonID string `json:"button_id"` |
|
|
|
ButtonType string `json:"button_type"` |
|
|
|
ButtonLocation string `json:"button_location"` |
|
|
|
IncomingJSON BeaconAdvertisement `json:"incoming_json"` |
|
|
|
Distance float64 `json:"distance"` |
|
|
|
LastSeen int64 `json:"last_seen"` |
|
|
|
HSButtonCounter int64 `json:"hs_button_counter"` |
|
|
|
HSBattery int64 `json:"hs_button_battery"` |
|
|
|
HSRandomNonce string `json:"hs_button_random"` |
|
|
|
HSButtonMode string `json:"hs_button_mode"` |
|
|
|
} |
|
|
|
|
|
|
|
// BeaconsList holds all known beacons and their synchronization lock. |
|
|
|
type BeaconsList struct { |
|
|
|
Beacons map[string]Beacon `json:"beacons"` |
|
|
|
@@ -164,13 +128,6 @@ type LocationsList struct { |
|
|
|
Lock sync.RWMutex |
|
|
|
} |
|
|
|
|
|
|
|
// Message defines the WebSocket or broadcast message payload. |
|
|
|
type Message struct { |
|
|
|
Email string `json:"email"` |
|
|
|
Username string `json:"username"` |
|
|
|
Message string `json:"message"` |
|
|
|
} |
|
|
|
|
|
|
|
// RawReading represents an incoming raw sensor reading. |
|
|
|
type RawReading struct { |
|
|
|
Timestamp string `json:"timestamp"` |
|
|
|
@@ -185,15 +142,6 @@ type LatestBeaconsList struct { |
|
|
|
Lock sync.RWMutex |
|
|
|
} |
|
|
|
|
|
|
|
type HTTPLocationsList struct { |
|
|
|
Beacons []HTTPLocation `json:"beacons"` |
|
|
|
} |
|
|
|
|
|
|
|
type HTTPResultsList struct { |
|
|
|
HTTPResultsLock sync.RWMutex |
|
|
|
HTTPResults HTTPLocationsList |
|
|
|
} |
|
|
|
|
|
|
|
type ApiUpdate struct { |
|
|
|
Method string |
|
|
|
Beacon Beacon |
|
|
|
@@ -209,6 +157,3 @@ type KafkaWritersList struct { |
|
|
|
KafkaWritersLock sync.RWMutex |
|
|
|
KafkaWriters []*kafka.Writer |
|
|
|
} |
|
|
|
|
|
|
|
var HTTPHostPathPtr *string |
|
|
|
var HTTPWSHostPathPtr *string |