fix: alarm sms forward data coding issue
This commit is contained in:
@@ -150,16 +150,6 @@ type DbConfig struct {
|
||||
Backup string `yaml:"backup"`
|
||||
}
|
||||
|
||||
//type codingType int
|
||||
|
||||
const (
|
||||
// Short message data coding type
|
||||
CODING_UCS2 int = iota
|
||||
CODING_ASCII
|
||||
CODING_LATIN1
|
||||
CODING_NODEF
|
||||
)
|
||||
|
||||
type AlarmConfig struct {
|
||||
SplitEventAlarm bool `yaml:"splitEventAlarm"`
|
||||
//ForwardAlarm bool `yaml:"forwardAlarm"`
|
||||
@@ -180,7 +170,7 @@ type AlarmConfig struct {
|
||||
SystemID string `yaml:"systemID" json:"systemID"`
|
||||
Password string `yaml:"password" json:"password"`
|
||||
SystemType string `yaml:"systemType" json:"systemType"`
|
||||
DataCoding int `yaml:"dataCoding" json:"dataCoding"`
|
||||
DataCoding byte `yaml:"dataCoding" json:"dataCoding"`
|
||||
ServiceNumber string `yaml:"serviceNumber" json:"serviceNumber"`
|
||||
} `yaml:"alarmSMSForward"`
|
||||
SMS struct {
|
||||
@@ -399,8 +389,10 @@ func UpdateStructFromMap(s any, updates map[string]any) {
|
||||
if field.Tag.Get("json") == key {
|
||||
structField := v.FieldByName(field.Name)
|
||||
if structField.IsValid() && structField.CanSet() {
|
||||
if structField.Type() == reflect.TypeOf(value) {
|
||||
structField.Set(reflect.ValueOf(value))
|
||||
// Convert value to the appropriate type if necessary
|
||||
convertedValue := reflect.ValueOf(value).Convert(structField.Type())
|
||||
if structField.Type() == convertedValue.Type() {
|
||||
structField.Set(convertedValue)
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
@@ -132,7 +132,8 @@ omc:
|
||||
# TLS Skip verify: true/false
|
||||
# email/sms
|
||||
# smProxy: sms(Short Message Service)/smsc(SMS Centre)
|
||||
# dataCoding: 0:UCS2, 1:ASCII, 2:LATIN1
|
||||
# dataCoding: 0:GSM7BIT, 1:ASCII, 2:BINARY8BIT1, 3:LATIN1,
|
||||
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
||||
alarm:
|
||||
alarmEmailForward:
|
||||
enable: true
|
||||
@@ -144,10 +145,10 @@ alarm:
|
||||
tlsSkipVerify: true
|
||||
alarmSMSForward:
|
||||
enable: true
|
||||
mobileList:
|
||||
smscAddr: "192.168.13.114:2775"
|
||||
systemID: "omc"
|
||||
password: "omc123"
|
||||
mobileList: "1006,1008"
|
||||
smscAddr: "192.168.14.212:2775"
|
||||
systemID: "123456"
|
||||
password: "123456"
|
||||
systemType: "UTRAN"
|
||||
dataCoding: 0
|
||||
serviceNumber: "OMC"
|
||||
|
||||
Reference in New Issue
Block a user