Compare commits

..

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

1 changed files with 13 additions and 11 deletions

View File

@ -28,6 +28,7 @@ package messages
import ( import (
"encoding/json" "encoding/json"
"log"
"math" "math"
"math/rand" "math/rand"
"os" "os"
@ -965,23 +966,21 @@ type StatusMessage struct {
States map[string]bool `json:"states,omitempty"` States map[string]bool `json:"states,omitempty"`
} }
type BleServiceData struct { type BleManufacturerData struct {
UUID string `json:"uuid,omitempty"` CompanyId uint16 `json:"company_id,omitempty"`
Name string `json:"name,omitempty"`
Data []byte `json:"data,omitempty"` Data []byte `json:"data,omitempty"`
} }
type BleManufacturerData struct { type BleAdvertisementPayload struct {
CompanyId uint16 `json:"company_id,omitempty"` LocalName string `json:"localName,omitempty"`
Name string `json:"name,omitempty"` ManufacturerData []BleManufacturerData `json:"companies,omitempty"`
Data []byte `json:"data,omitempty"`
} }
type BleDevice struct { type BleDevice struct {
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
RSSI int16 `json:"rssi,omitempty"` RSSI int16 `json:"rssi,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
ManufacturerData []BleManufacturerData `json:"companies,omitempty"` Advertisement BleAdvertisementPayload `json:"advertisement,omitempty"`
} }
type BleAdvertisementMessage struct { type BleAdvertisementMessage struct {
@ -997,6 +996,9 @@ func CreateHeader(status int, location string) MessageHeader {
buildBytes, err := os.ReadFile("/opt/build_version.json") buildBytes, err := os.ReadFile("/opt/build_version.json")
if err == nil { if err == nil {
err = json.Unmarshal(buildBytes, &build) 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 // Build Message Header