iot_server/internal/dtos/gateway.go

54 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 != ""
}