Compare commits
No commits in common. "main" and "v1.0.9" have entirely different histories.
24
messages.go
24
messages.go
|
@ -28,6 +28,7 @@ package messages
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
|
@ -965,25 +966,23 @@ type StatusMessage struct {
|
|||
States map[string]bool `json:"states,omitempty"`
|
||||
}
|
||||
|
||||
type BleServiceData struct {
|
||||
UUID string `json:"uuid,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Data []byte `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type BleManufacturerData struct {
|
||||
CompanyId uint16 `json:"company_id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Data []byte `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type BleDevice struct {
|
||||
Address string `json:"address,omitempty"`
|
||||
RSSI int16 `json:"rssi,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
type BleAdvertisementPayload struct {
|
||||
LocalName string `json:"localName,omitempty"`
|
||||
ManufacturerData []BleManufacturerData `json:"companies,omitempty"`
|
||||
}
|
||||
|
||||
type BleDevice struct {
|
||||
Address string `json:"address,omitempty"`
|
||||
RSSI int16 `json:"rssi,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Advertisement BleAdvertisementPayload `json:"advertisement,omitempty"`
|
||||
}
|
||||
|
||||
type BleAdvertisementMessage struct {
|
||||
Header MessageHeader `json:"header,omitempty"`
|
||||
Device BleDevice `json:"device,omitempty"`
|
||||
|
@ -997,6 +996,9 @@ func CreateHeader(status int, location string) MessageHeader {
|
|||
buildBytes, err := os.ReadFile("/opt/build_version.json")
|
||||
if err == nil {
|
||||
err = json.Unmarshal(buildBytes, &build)
|
||||
log.Println("[INFO] Reading version: ", string(buildBytes))
|
||||
} else {
|
||||
log.Println("[ERROR] Unable to read /opt/build_version.json file:", err)
|
||||
}
|
||||
|
||||
// Build Message Header
|
||||
|
|
Loading…
Reference in New Issue