58 lines
2.6 KiB
Go
58 lines
2.6 KiB
Go
package models
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
type MqttHeartRateRecord struct {
|
|
gorm.Model
|
|
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
|
Topic string `gorm:"size:255;index" json:"topic"`
|
|
RegionID uint32 `gorm:"index" json:"regionId"`
|
|
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
|
BandID uint32 `gorm:"index" json:"bandId"`
|
|
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
|
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
|
HeartRate int `gorm:"type:int" json:"heartRate"`
|
|
HrConfidence int `gorm:"type:int" json:"hrConfidence"`
|
|
IsActive bool `json:"isActive"`
|
|
IsOnSkin bool `json:"isOnSkin"`
|
|
Battery uint32 `json:"battery"`
|
|
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
|
SNR float64 `gorm:"type:double precision" json:"snr"`
|
|
HubBusID uint32 `json:"hubBusId"`
|
|
HubSubDevID uint32 `json:"hubSubDevId"`
|
|
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
|
}
|
|
|
|
type MqttStepCountRecord struct {
|
|
gorm.Model
|
|
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
|
Topic string `gorm:"size:255;index" json:"topic"`
|
|
RegionID uint32 `gorm:"index" json:"regionId"`
|
|
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
|
BandID uint32 `gorm:"index" json:"bandId"`
|
|
BeltAddr string `gorm:"size:64;index" json:"beltAddr"`
|
|
PacketNum uint32 `gorm:"index" json:"packetNum"`
|
|
StepCount uint32 `json:"stepCount"`
|
|
SignalRSSINeg float64 `gorm:"type:double precision" json:"signalRssiNeg"`
|
|
SNR float64 `gorm:"type:double precision" json:"snr"`
|
|
HubBusID uint32 `json:"hubBusId"`
|
|
HubSubDevID uint32 `json:"hubSubDevId"`
|
|
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
|
}
|
|
|
|
type MqttGatewayStatusRecord struct {
|
|
gorm.Model
|
|
Identifier string `gorm:"uniqueIndex;size:255" json:"identifier"`
|
|
Topic string `gorm:"size:255;index" json:"topic"`
|
|
RegionID uint32 `gorm:"index" json:"regionId"`
|
|
GatewayMAC string `gorm:"size:32;index" json:"gatewayMac"`
|
|
BootCount uint32 `json:"bootCount"`
|
|
UptimeMs uint32 `json:"uptimeMs"`
|
|
DurationMsSinceLastPacket uint32 `json:"durationMsSinceLastPacket"`
|
|
RxCount uint32 `json:"rxCount"`
|
|
BatteryVoltageMV uint32 `json:"batteryVoltageMv"`
|
|
BatterySOCPercentage uint32 `json:"batterySocPercentage"`
|
|
ChargingRatePercentage int32 `json:"chargingRatePercentage"`
|
|
ReceivedAt int64 `gorm:"type:bigint;index" json:"receivedAt"`
|
|
}
|