| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // Package protocol defines shared event types for ZMQ messages
- package protocol
- // EventType identifies the type of beacon event
- type EventType string
- const (
- EventIBeacon EventType = "ibeacon"
- EventAccel EventType = "my-beacon_acc"
- EventAccelFF EventType = "my-beacon_acc_ff"
- EventRelay EventType = "rt_mybeacon"
- EventWiFiProbe EventType = "wifi_probe"
- )
- // BLEEvent is the base structure for all BLE events
- type BLEEvent struct {
- Type EventType `json:"type"`
- MAC string `json:"mac"`
- RSSI int8 `json:"rssi"`
- TsMs int64 `json:"ts"`
- }
- // IBeaconEvent represents an iBeacon advertisement
- type IBeaconEvent struct {
- BLEEvent
- UUID string `json:"uuid"`
- Major uint16 `json:"major"`
- Minor uint16 `json:"minor"`
- }
- // AccelEvent represents my-beacon accelerometer data
- type AccelEvent struct {
- BLEEvent
- X int8 `json:"x"`
- Y int8 `json:"y"`
- Z int8 `json:"z"`
- Bat uint8 `json:"bat"`
- Temp int8 `json:"temp"`
- FF bool `json:"ff"`
- }
- // RelayEvent represents rt_mybeacon relay data
- type RelayEvent struct {
- BLEEvent
- RelayMAC string `json:"relay_mac"`
- RelayMaj uint16 `json:"relay_major"`
- RelayMin uint16 `json:"relay_minor"`
- RelayRSSI int8 `json:"relay_rssi"`
- RelayBat uint8 `json:"relay_bat"`
- IBMajor uint16 `json:"ib_major"`
- IBMinor uint16 `json:"ib_minor"`
- }
- // WiFiProbeEvent represents a WiFi probe request
- type WiFiProbeEvent struct {
- Type EventType `json:"type"`
- MAC string `json:"mac"`
- RSSI int8 `json:"rssi"`
- TsMs int64 `json:"ts"`
- SSID string `json:"ssid,omitempty"`
- }
|