36 lines
962 B
Go
36 lines
962 B
Go
package storage
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"database/sql"
|
|
|
|
"src.dualinventive.com/go/dinet/rpc"
|
|
)
|
|
|
|
// Device is the table structure for a legacy device
|
|
type Device struct {
|
|
ID int `gorm:"column:id"`
|
|
Type int `gorm:"column:device"`
|
|
IMEI string `gorm:"column:imei"`
|
|
IMSI string `gorm:"column:imsi"`
|
|
TelephoneNR string `gorm:"column:telefoonnr"`
|
|
HWVersion string `gorm:"column:pcb_versie"`
|
|
SMSOperator sql.NullInt64 `gorm:"column:sms_mo"`
|
|
}
|
|
|
|
// DeviceUID returns the MTinfo 3000 V5 device UID
|
|
func (d Device) DeviceUID() (string, error) {
|
|
return rpc.GenerateDeviceUID(rpc.DeviceUIDPrefixLegacy, strconv.Itoa(d.ID))
|
|
}
|
|
|
|
// VodafoneM2mAPIEnabled returns true when the device reset should go via Vodafone M2MAPI
|
|
func (d Device) VodafoneM2mAPIEnabled() bool {
|
|
return d.SMSOperator.Valid
|
|
}
|
|
|
|
// TableName returns the legacy table-name
|
|
func (Device) TableName() string {
|
|
return "zkl"
|
|
}
|