Compare commits

...

8 Commits
v1.0.8 ... main

Author SHA1 Message Date
henry 8a80c8a609 Don't do this:
log.Println("[INFO] Reading version: ", string(buildBytes))
	} else {
		log.Println("[ERROR] Unable to read /opt/build_version.json file:", err)
Generates too much spam
2025-03-02 21:52:30 -08:00
henry 94940f66c9 syncing up BLE between Go and Python 2024-12-29 16:33:06 -08:00
Henry Seurer 88ddf0d9c0 Merge remote-tracking branch 'origin/main' 2024-12-17 20:36:55 -08:00
Henry Seurer 95d3db9196 Cleaning up BLE messages 2024-12-17 20:36:50 -08:00
henry b52c585528 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	messages.go
2024-12-08 08:51:38 -08:00
henry 7810772cb5 Added Services 2024-12-08 08:50:20 -08:00
Henry Seurer a693a92115 Added Company Name 2024-11-21 09:42:31 -08:00
Henry Seurer 7b85cb03bc Typo Devices => Device 2024-11-21 09:25:13 -08:00
1 changed files with 13 additions and 16 deletions

View File

@ -28,7 +28,6 @@ package messages
import ( import (
"encoding/json" "encoding/json"
"log"
"math" "math"
"math/rand" "math/rand"
"os" "os"
@ -966,40 +965,38 @@ type StatusMessage struct {
States map[string]bool `json:"states,omitempty"` 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 { type BleManufacturerData struct {
CompanyId uint16 `json:"company_id,omitempty"` CompanyId uint16 `json:"company_id,omitempty"`
Name string `json:"name,omitempty"`
Data []byte `json:"data,omitempty"` Data []byte `json:"data,omitempty"`
} }
type BleAdvertisementPayload struct { type BleDevice struct {
LocalName string `json:"localName,omitempty"` Address string `json:"address,omitempty"`
RSSI int16 `json:"rssi,omitempty"`
Name string `json:"name,omitempty"`
ManufacturerData []BleManufacturerData `json:"companies,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 { type BleAdvertisementMessage struct {
Header MessageHeader `json:"header,omitempty"` Header MessageHeader `json:"header,omitempty"`
Devices BleDevice `json:"device,omitempty"` Device BleDevice `json:"device,omitempty"`
} }
// noinspection GoUnusedExportedFunction // noinspection GoUnusedExportedFunction
func CreateHeader(status int, location string) MessageHeader { func CreateHeader(status int, location string) MessageHeader {
// Do we have a build version? // Do we have a build version?
// //
var build BuildVersion var build BuildVersion
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