iot_server/internal/dtos/gateway.go

54 lines
1.3 KiB
Go
Raw Normal View History

2023-08-28 06:49:44 +00:00
package dtos
type NetIface struct {
Ifaces []string `json:"ifaces"`
}
type EdgeBaseConfig struct {
}
type EdgeGwConfig struct {
GwId string `json:"gwId"`
SecKey string `json:"secKey"`
LocalKey string `json:"localKey"`
Status bool `json:"status"`
}
type EdgeConfig struct {
//BaseConfig EdgeBaseConfig `yaml:"baseconfig"`
//GwConfig EdgeGwConfig `yaml:"gwconfig"`
//SubDeviceLimit int64 `yaml:"subdevicelimit"`
//ExpiryTime int64 `yaml:"expiry"`
//ActiveTime int64 `yaml:"activeTime"`
//LastExitTime int64 `yaml:"lastExitTime"`
//IsExpired bool `yaml:"isExpired"`
GwId string `yaml:"gwid"`
SecKey string `yaml:"seckey"`
Status bool `yaml:"status"`
ActiveTime string `yaml:"activetime"`
VersionNumber string `yaml:"versionnumber"`
SubDeviceLimit int64 `yaml:"subdevicelimit"`
}
func (c EdgeConfig) GetGatewayNumber() string {
switch c.VersionNumber {
case "ireland":
return "Ireland爱尔兰"
case "seattle":
return "Seattle西雅图"
case "kamakura镰仓":
return "Kamakura"
default:
return c.VersionNumber
}
}
func (c EdgeConfig) IsActivated() bool {
return c.Status
}
func (c EdgeConfig) CheckThingModelActiveGw() bool {
return c.GwId != "" && c.SecKey != ""
}