Compare commits

..

No commits in common. "main" and "v1.0.7" have entirely different histories.
main ... v1.0.7

1 changed files with 16 additions and 12 deletions

View File

@ -28,6 +28,7 @@ package messages
import (
"encoding/json"
"log"
"math"
"math/rand"
"os"
@ -965,38 +966,41 @@ 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 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"`
ManufacturerData []BleManufacturerData `json:"companies,omitempty"`
Advertisement BleAdvertisementPayload `json:"advertisement,omitempty"`
}
type BleAdvertisementMessage struct {
Header MessageHeader `json:"header,omitempty"`
Device BleDevice `json:"device,omitempty"`
Devices BleDevice `json:"device,omitempty"`
}
// noinspection GoUnusedExportedFunction
func CreateHeader(status int, location string) MessageHeader {
// Do we have a build version?
//
var build BuildVersion
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