Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
|
8a80c8a609 | |
|
94940f66c9 | |
|
88ddf0d9c0 | |
|
95d3db9196 | |
|
b52c585528 | |
|
7810772cb5 | |
|
a693a92115 | |
|
7b85cb03bc | |
|
1de06f272c |
28
messages.go
28
messages.go
|
@ -28,7 +28,6 @@ package messages
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
|
@ -966,41 +965,38 @@ 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"`
|
||||
type BleDevice struct {
|
||||
Address string `json:"address,omitempty"`
|
||||
RSSI int16 `json:"rssi,omitempty"`
|
||||
Name string `json:"name,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"`
|
||||
Devices BleDevice `json:"device,omitempty"`
|
||||
Header MessageHeader `json:"header,omitempty"`
|
||||
Device 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
|
||||
|
|
Loading…
Reference in New Issue