Browse Source

改用tabpage的高级设置,及改为数据绑定方式

master
lihua 5 years ago
parent
commit
14e0bab78e
  1. 20
      LoRaMoteConf.json
  2. 281
      LoRaMoteMock.go
  3. 2
      model.go

20
LoRaMoteConf.json

@ -3,15 +3,15 @@
"configs": { "configs": {
"mote1": { "mote1": {
"otaa": true, "otaa": true,
"gatewayId": "0102030405060708", "gatewayEui": "0102030405060708",
"appEui": "0102030405060708", "appEui": "0102030405060708",
"devEui": "b92fd5d497cfcdbd", "devEui": "b92fd5d497cfcdbd",
"devAddr": "00530747", "devAddr": "013adb35",
"appKey": "fe80c1f94e6cc62d5d6f72630b43c177", "appKey": "fe80c1f94e6cc62d5d6f72630b43c177",
"nwkSKey": "4f862983a453cc50336284fd3c62aba5", "nwkSKey": "75153208348c4cca9b30d44c889fd52c",
"appSKey": "2bc9217655160b2c1229b5ecb469242f", "appSKey": "3cd17c408b5496756bcd122c9b0b318f",
"fCnt": 513, "fCnt": 7,
"fPort": 1, "fPort": 2,
"freq": 470.3, "freq": 470.3,
"dr": 0, "dr": 0,
"chan": 0, "chan": 0,
@ -28,17 +28,17 @@
}, },
"mote2": { "mote2": {
"otaa": false, "otaa": false,
"gatewayId": "0102030405060708", "gatewayEui": "0102030405060708",
"appEui": "0102030405060708", "appEui": "0102030405060708",
"devEui": "6ef1881ba5541419", "devEui": "6ef1881ba5541419",
"devAddr": "00c18699", "devAddr": "00c18699",
"appKey": "", "appKey": "fe80c1f94e6cc62d5d6f72630b43c177",
"nwkSKey": "33998df974421457437d986eff739ffa", "nwkSKey": "33998df974421457437d986eff739ffa",
"appSKey": "33998df974421457437d986eff739ffa", "appSKey": "33998df974421457437d986eff739ffa",
"fCnt": 1293, "fCnt": 1295,
"fPort": 1, "fPort": 1,
"freq": 470.3, "freq": 470.3,
"dr": 0, "dr": 1,
"chan": 0, "chan": 0,
"lsnr": 7, "lsnr": 7,
"rssi": -50, "rssi": -50,

281
LoRaMoteMock.go

@ -68,8 +68,7 @@ func main() {
PushButton{Text:"断开连接", AssignTo:&mw.disconnect, Enabled:false, OnClicked: mw.Disconnect}, PushButton{Text:"断开连接", AssignTo:&mw.disconnect, Enabled:false, OnClicked: mw.Disconnect},
CheckBox{Text:"开启SSL/TLS",AssignTo:&mw.ssl,OnClicked:mw.SSL}, CheckBox{Text:"开启SSL/TLS",AssignTo:&mw.ssl,OnClicked:mw.SSL},
PushButton{Text:"证书配置",Enabled:false,AssignTo:&mw.caConf,OnClicked: mw.ConnectConfig}, PushButton{Text:"证书配置",Enabled:false,AssignTo:&mw.caConf,OnClicked: mw.ConnectConfig},
PushButton{Text:"终端基本配置",OnClicked: mw.MoteConfig}, PushButton{Text:"终端配置",OnClicked: mw.MoteConfig},
PushButton{Text:"终端高级配置",OnClicked: mw.MoteAdvancedConfig},
PushButton{Text:"清空数据",OnClicked: mw.Clean}, PushButton{Text:"清空数据",OnClicked: mw.Clean},
}, },
}, },
@ -166,7 +165,15 @@ func main() {
_ = mw.username.SetText(mw.connConf.Username) _ = mw.username.SetText(mw.connConf.Username)
_ = mw.password.SetText(mw.connConf.Password) _ = mw.password.SetText(mw.connConf.Password)
} }
//default
mw.currentMoteConf.AppEui = "0102030405060708" mw.currentMoteConf.AppEui = "0102030405060708"
mw.currentMoteConf.MType = uint8(lorawan.UnconfirmedDataUp)
mw.currentMoteConf.FPort = 1
mw.currentMoteConf.Freq = 470.3
mw.currentMoteConf.RSSI = -50
mw.currentMoteConf.LSNR = 7
mw.currentMoteConf.FCtrl.ADR = true
mw.moteConfFileName = dir + "/LoRaMoteConf.json" mw.moteConfFileName = dir + "/LoRaMoteConf.json"
mw.motesConf.Configs = make(map[string]MoteConfig) mw.motesConf.Configs = make(map[string]MoteConfig)
data, err = ioutil.ReadFile(mw.moteConfFileName) data, err = ioutil.ReadFile(mw.moteConfFileName)
@ -182,11 +189,13 @@ func main() {
go mw.ConnectCheck() go mw.ConnectCheck()
mw.Run() mw.Run()
if mw.motesConf.Current != "" {
var confData bytes.Buffer var confData bytes.Buffer
mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf
d,_ := json.Marshal(&mw.motesConf) d,_ := json.Marshal(&mw.motesConf)
_ = json.Indent(&confData, d, "", "\t") _ = json.Indent(&confData, d, "", "\t")
_ = ioutil.WriteFile(mw.moteConfFileName,confData.Bytes(),0644) _ = ioutil.WriteFile(mw.moteConfFileName,confData.Bytes(),0644)
}
} }
func (mw *MoteMainWindow) ConnectCheck() { func (mw *MoteMainWindow) ConnectCheck() {
@ -276,181 +285,105 @@ func (mw *MoteMainWindow) MoteConfig() {
var dlg *walk.Dialog var dlg *walk.Dialog
var name *walk.ComboBox var name *walk.ComboBox
var otaa *walk.CheckBox var otaa *walk.CheckBox
var gatewayId,appEUI,devEUI,devAddr,appKey,appSKey,nwkSKey *walk.LineEdit
var fCnt *walk.NumberEdit
var acceptPB, cancelPB *walk.PushButton var acceptPB, cancelPB *walk.PushButton
var db *walk.DataBinder
_ = Dialog{ _ = Dialog{
Title: "终端配置", Title: "终端配置",
Icon: mw.icon, Icon: mw.icon,
Layout: VBox{}, Layout: VBox{},
AssignTo: &dlg, AssignTo: &dlg,
DataBinder: DataBinder{
AssignTo:&db,
Name:"config",
DataSource: &mw.currentMoteConf,
ErrorPresenter: ToolTipErrorPresenter{},
},
DefaultButton: &acceptPB, DefaultButton: &acceptPB,
CancelButton: &cancelPB, CancelButton: &cancelPB,
MinSize: Size{400, 200}, MinSize: Size{400, 200},
Children: []Widget{ Children: []Widget{
Composite{ TabWidget{
Pages:[]TabPage{
{
Title:"基础配置",
Layout:Grid{Columns: 2}, Layout:Grid{Columns: 2},
Children:[]Widget{ Children:[]Widget{
Label{Text: "终端名称:"}, Label{Text: "配置名称:"},
ComboBox{AssignTo: &name,Editable: true,OnCurrentIndexChanged: func() { ComboBox{AssignTo: &name,Editable: true, OnCurrentIndexChanged: func() {
mw.motesConf.Current = name.Text() mw.motesConf.Current = name.Text()
mw.currentMoteConf = mw.motesConf.Configs[mw.motesConf.Current] mw.currentMoteConf = mw.motesConf.Configs[mw.motesConf.Current]
otaa.SetChecked(mw.currentMoteConf.OTAA) _ = db.Reset()
_ = gatewayId.SetText(mw.currentMoteConf.GatewayId)
_ = devEUI.SetText(mw.currentMoteConf.DevEui)
_ = devAddr.SetText(mw.currentMoteConf.DevAddr)
_ = appKey.SetText(mw.currentMoteConf.AppKey)
_ = appSKey.SetText(mw.currentMoteConf.AppSKey)
_ = nwkSKey.SetText(mw.currentMoteConf.NwkSKey)
_ = fCnt.SetValue(float64(mw.currentMoteConf.FCnt))
}}, }},
Label{Text:"入网方式:"}, Label{Text:"入网方式:"},
CheckBox{AssignTo: &otaa,Text:"OTAA入网",OnClicked: func() { CheckBox{AssignTo: &otaa,Text:"OTAA入网",Checked:Bind("OTAA"),OnCheckStateChanged: func() {
if otaa.Checked() { mw.currentMoteConf.OTAA = otaa.Checked()
appKey.SetEnabled(true) _ = db.Reset()
devAddr.SetEnabled(false)
appSKey.SetEnabled(false)
nwkSKey.SetEnabled(false)
_ = devAddr.SetText("")
}else{
appKey.SetEnabled(false)
devAddr.SetEnabled(true)
appSKey.SetEnabled(true)
nwkSKey.SetEnabled(true)
}
}}, }},
Label{Text:"网关ID:"}, Label{Text:"网关EUI:"},
LineEdit{AssignTo:&gatewayId}, LineEdit{Text:Bind("GatewayEui")},
Label{Text:"应用EUI:"}, Label{Text:"应用EUI:",Visible:Bind("OTAA")},
LineEdit{AssignTo:&appEUI,Text:"0102030405060708"}, LineEdit{Text:Bind("AppEui"),Visible:Bind("OTAA")},
Label{Text:"终端EUI:"}, Label{Text:"终端EUI:"},
LineEdit{AssignTo:&devEUI}, LineEdit{Text:Bind("DevEui")},
Label{Text:"应用秘钥:",Visible:Bind("OTAA")},
LineEdit{Text:Bind("AppKey"),Visible:Bind("OTAA")},
Label{Text:"终端地址:"}, Label{Text:"终端地址:"},
LineEdit{AssignTo:&devAddr}, LineEdit{Text:Bind("DevAddr"),ReadOnly:Bind("OTAA")},
Label{Text:"应用秘钥:"},
LineEdit{AssignTo:&appKey,Enabled:false},
Label{Text:"网络会话秘钥:"}, Label{Text:"网络会话秘钥:"},
LineEdit{AssignTo:&nwkSKey}, LineEdit{Text:Bind("NwkSKey"),ReadOnly:Bind("OTAA")},
Label{Text:"应用会话秘钥:"}, Label{Text:"应用会话秘钥:"},
LineEdit{AssignTo:&appSKey}, LineEdit{Text:Bind("AppSKey"),ReadOnly:Bind("OTAA")},
Label{Text:"上行计数:"}, Label{Text:"上行计数:"},
NumberEdit{AssignTo:&fCnt}, NumberEdit{Value:Bind("FCnt")},
},
},
Composite{
Layout: HBox{},
Children: []Widget{
HSpacer{},
PushButton{
AssignTo: &acceptPB,
Text: "确定",
OnClicked: func() {
mw.currentMoteConf.OTAA = otaa.Checked()
mw.currentMoteConf.GatewayId = gatewayId.Text()
mw.currentMoteConf.AppEui = appEUI.Text()
mw.currentMoteConf.DevEui = devEUI.Text()
mw.currentMoteConf.DevAddr = devAddr.Text()
mw.currentMoteConf.AppKey = appKey.Text()
mw.currentMoteConf.AppSKey = appSKey.Text()
mw.currentMoteConf.NwkSKey = nwkSKey.Text()
mw.currentMoteConf.FCnt = uint32(fCnt.Value())
mw.motesConf.Current = name.Text()
_,ok := mw.motesConf.Configs[mw.motesConf.Current]
if !ok {
//default
mw.currentMoteConf.FPort = 1
mw.currentMoteConf.Freq = 470.3
mw.currentMoteConf.RSSI = -50
mw.currentMoteConf.LSNR = 7
mw.currentMoteConf.FCtrl.ADR = true
}
mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf
var confData bytes.Buffer
d,_ := json.Marshal(&mw.motesConf)
_ = json.Indent(&confData, d, "", "\t")
_ = ioutil.WriteFile(mw.moteConfFileName,confData.Bytes(),0644)
dlg.Accept()
},
},
PushButton{
AssignTo: &cancelPB,
Text: "取消",
OnClicked: func() { dlg.Cancel() },
}, },
}, },
}, {
}, Title:"高级配置",
}.Create(mw)
var names []string
for k,_ := range mw.motesConf.Configs {
names = append(names,k)
}
_ = name.SetModel(names)
_ = name.SetText(mw.motesConf.Current)
otaa.SetChecked(mw.currentMoteConf.OTAA)
_ = gatewayId.SetText(mw.currentMoteConf.GatewayId)
_ = appEUI.SetText(mw.currentMoteConf.AppEui)
_ = devEUI.SetText(mw.currentMoteConf.DevEui)
_ = devAddr.SetText(mw.currentMoteConf.DevAddr)
_ = appKey.SetText(mw.currentMoteConf.AppKey)
_ = appSKey.SetText(mw.currentMoteConf.AppSKey)
_ = nwkSKey.SetText(mw.currentMoteConf.NwkSKey)
_ = fCnt.SetValue(float64(mw.currentMoteConf.FCnt))
dlg.Run()
}
func (mw *MoteMainWindow) MoteAdvancedConfig() {
if mw.motesConf.Current == "" || len(mw.motesConf.Configs) <= 0 {
msg := "请先配置终端基础配置"
walk.MsgBox(mw, "错误", msg, walk.MsgBoxIconError)
return
}
var dlg *walk.Dialog
var mType,sf *walk.ComboBox
var fPort,freq,ch,lsnr,rssi *walk.NumberEdit
var adr,req,ack,fPending,classB *walk.CheckBox
var acceptPB, cancelPB *walk.PushButton
_ = Dialog{
Title: "终端高级配置",
Icon: mw.icon,
Layout: VBox{},
AssignTo: &dlg,
DefaultButton: &acceptPB,
CancelButton: &cancelPB,
MinSize: Size{400, 200},
Children: []Widget{
Composite{
Layout:Grid{Columns: 2}, Layout:Grid{Columns: 2},
Children:[]Widget{ Children:[]Widget{
Label{Text:"消息类型:"}, Label{Text:"消息类型:"},
ComboBox{AssignTo:&mType,Model:[]string{"UnconfirmedDataUp","ConfirmedDataUp"},Value:"UnconfirmedDataUp"}, ComboBox{Model:[]struct {
Id uint8
Name string
}{
{2,"UnconfirmedDataUp"},
{4,"ConfirmedDataUp"},
},BindingMember: "Id", DisplayMember: "Name", Value: Bind("MType")},
Label{Text:"扩频因子:"}, Label{Text:"扩频因子:"},
ComboBox{AssignTo:&sf,Model:[]string{"SF12","SF11","SF10","SF9","SF8","SF7"},Value:"SF12"}, ComboBox{Model:[]struct{
Id uint8
Name string
}{
{0,"SF12"},
{1,"SF11"},
{2,"SF10"},
{3,"SF9"},
{4,"SF8"},
{5,"SF7"},
},BindingMember: "Id", DisplayMember: "Name",Value:Bind("DR")},
Label{Text:"端口:"}, Label{Text:"端口:"},
NumberEdit{AssignTo:&fPort}, NumberEdit{Value:Bind("FPort")},
Label{Text:"频率:"}, Label{Text:"频率:"},
NumberEdit{AssignTo:&freq,Decimals:2}, NumberEdit{Decimals:2,Value:Bind("Freq")},
Label{Text:"信道:"}, Label{Text:"信道:"},
NumberEdit{AssignTo:&ch}, NumberEdit{Value:Bind("Chan")},
Label{Text:"信号强度:"}, Label{Text:"信号强度:"},
NumberEdit{AssignTo:&rssi}, NumberEdit{Value:Bind("RSSI")},
Label{Text:"信噪比:"}, Label{Text:"信噪比:"},
NumberEdit{AssignTo:&lsnr}, NumberEdit{Value:Bind("LSNR")},
Label{Text:"帧控制:"}, Label{Text:"帧控制:"},
GroupBox{ GroupBox{
Title:"FCtrl", Title:"FCtrl",
Layout:Grid{Columns: 3}, Layout:Grid{Columns: 3},
Children:[]Widget{ Children:[]Widget{
CheckBox{AssignTo:&adr,Text:"adr"}, CheckBox{Text:"adr",Checked:Bind("FCtrl.ADR")},
CheckBox{AssignTo:&req,Text:"req"}, CheckBox{Text:"req",Checked:Bind("FCtrl.ADRACKReq")},
CheckBox{AssignTo:&ack,Text:"ack"}, CheckBox{Text:"ack",Checked:Bind("FCtrl.ACK")},
CheckBox{AssignTo:&fPending,Text:"fPending"}, CheckBox{Text:"fPending",Checked:Bind("FCtrl.FPending")},
CheckBox{AssignTo:&classB,Text:"classB"}, CheckBox{Text:"classB",Checked:Bind("FCtrl.ClassB")},
},
},
}, },
}, },
}, },
@ -463,26 +396,22 @@ func (mw *MoteMainWindow) MoteAdvancedConfig() {
AssignTo: &acceptPB, AssignTo: &acceptPB,
Text: "确定", Text: "确定",
OnClicked: func() { OnClicked: func() {
switch mType.CurrentIndex() { mw.motesConf.Current = name.Text()
case 0: if mw.motesConf.Current == "" {
mw.currentMoteConf.MType = uint8(lorawan.UnconfirmedDataUp) msg := "配置名称不能为空"
case 1: walk.MsgBox(mw, "错误", msg, walk.MsgBoxIconError)
mw.currentMoteConf.MType = uint8(lorawan.ConfirmedDataUp) return
} }
mw.currentMoteConf.DR = uint8(sf.CurrentIndex()) _ = db.Submit()
mw.currentMoteConf.FPort = uint8(fPort.Value()) v,ok := mw.motesConf.Configs[mw.motesConf.Current]
mw.currentMoteConf.Freq = freq.Value() if ok {
mw.currentMoteConf.Chan = uint8(ch.Value()) if mw.currentMoteConf.OTAA && v.OTAA != mw.currentMoteConf.OTAA {
mw.currentMoteConf.RSSI = int16(rssi.Value()) mw.currentMoteConf.DevAddr = ""
mw.currentMoteConf.LSNR = lsnr.Value() mw.currentMoteConf.NwkSKey = ""
mw.currentMoteConf.FCtrl.ADR = adr.Checked() mw.currentMoteConf.AppSKey = ""
mw.currentMoteConf.FCtrl.ADRACKReq = req.Checked() }
mw.currentMoteConf.FCtrl.ACK = ack.Checked() }
mw.currentMoteConf.FCtrl.FPending = fPending.Checked()
mw.currentMoteConf.FCtrl.ClassB = classB.Checked()
mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf
var confData bytes.Buffer var confData bytes.Buffer
d,_ := json.Marshal(&mw.motesConf) d,_ := json.Marshal(&mw.motesConf)
_ = json.Indent(&confData, d, "", "\t") _ = json.Indent(&confData, d, "", "\t")
@ -499,24 +428,12 @@ func (mw *MoteMainWindow) MoteAdvancedConfig() {
}, },
}, },
}.Create(mw) }.Create(mw)
switch lorawan.MType(mw.currentMoteConf.MType) { var names []string
case lorawan.UnconfirmedDataUp: for k,_ := range mw.motesConf.Configs {
_ = mType.SetCurrentIndex(0) names = append(names,k)
case lorawan.ConfirmedDataUp: }
_ = mType.SetCurrentIndex(1) _ = name.SetModel(names)
} _ = name.SetText(mw.motesConf.Current)
_ = sf.SetCurrentIndex(int(mw.currentMoteConf.DR))
_ = fPort.SetValue(float64(mw.currentMoteConf.FPort))
_ = freq.SetValue(mw.currentMoteConf.Freq)
_ = ch.SetValue(float64(mw.currentMoteConf.Chan))
_ = rssi.SetValue(float64(mw.currentMoteConf.RSSI))
_ = lsnr.SetValue(mw.currentMoteConf.LSNR)
adr.SetChecked(mw.currentMoteConf.FCtrl.ADR)
req.SetChecked(mw.currentMoteConf.FCtrl.ADRACKReq)
ack.SetChecked(mw.currentMoteConf.FCtrl.ACK )
fPending.SetChecked(mw.currentMoteConf.FCtrl.FPending )
classB.SetChecked(mw.currentMoteConf.FCtrl.ClassB)
dlg.Run() dlg.Run()
} }
@ -737,7 +654,7 @@ func (mw *MoteMainWindow) sendMsg() error{
} }
if mw.currentMoteConf.OTAA && mw.currentMoteConf.DevAddr == ""{ if mw.currentMoteConf.OTAA && mw.currentMoteConf.DevAddr == ""{
mw.currentMoteConf.devNonce = lorawan.DevNonce(rand.Uint32()) mw.currentMoteConf.devNonce = lorawan.DevNonce(rand.Uint32())
packet,phy,err := BuildJoin(mw.currentMoteConf.GatewayId,mw.currentMoteConf.AppEui, packet,phy,err := BuildJoin(mw.currentMoteConf.GatewayEui,mw.currentMoteConf.AppEui,
mw.currentMoteConf.DevEui,mw.currentMoteConf.AppKey,mw.currentMoteConf.DR, mw.currentMoteConf.DevEui,mw.currentMoteConf.AppKey,mw.currentMoteConf.DR,
mw.currentMoteConf.Chan,mw.currentMoteConf.Freq,mw.currentMoteConf.LSNR, mw.currentMoteConf.Chan,mw.currentMoteConf.Freq,mw.currentMoteConf.LSNR,
mw.currentMoteConf.RSSI, mw.currentMoteConf.devNonce) mw.currentMoteConf.RSSI, mw.currentMoteConf.devNonce)
@ -754,7 +671,7 @@ func (mw *MoteMainWindow) sendMsg() error{
Direction:"uplink", Direction:"uplink",
DevEUI:mw.currentMoteConf.DevEui, DevEUI:mw.currentMoteConf.DevEui,
MType:phy.MHDR.MType.String(), MType:phy.MHDR.MType.String(),
GatewayID:mw.currentMoteConf.GatewayId, GatewayID:mw.currentMoteConf.GatewayEui,
Rssi:packet.Payload.RXPK[0].RSSI, Rssi:packet.Payload.RXPK[0].RSSI,
LoRaSNR:packet.Payload.RXPK[0].LSNR, LoRaSNR:packet.Payload.RXPK[0].LSNR,
Frequency:packet.Payload.RXPK[0].Freq, Frequency:packet.Payload.RXPK[0].Freq,
@ -766,7 +683,7 @@ func (mw *MoteMainWindow) sendMsg() error{
_ = mw.tv.SetSelectedIndexes([]int{}) _ = mw.tv.SetSelectedIndexes([]int{})
frames,_:= packet.GetUplinkFrames(true,false) frames,_:= packet.GetUplinkFrames(true,false)
for j := range frames { for j := range frames {
mw.PushData(mw.currentMoteConf.GatewayId,"up",&frames[j]) mw.PushData(mw.currentMoteConf.GatewayEui,"up",&frames[j])
} }
fmt.Println("push join ") fmt.Println("push join ")
for cnt := 0;mw.currentMoteConf.DevAddr == "" && cnt < 5;cnt ++ { for cnt := 0;mw.currentMoteConf.DevAddr == "" && cnt < 5;cnt ++ {
@ -795,7 +712,7 @@ func (mw *MoteMainWindow) sendMsg() error{
if mw.currentMoteConf.FPort == 0 { if mw.currentMoteConf.FPort == 0 {
key = mw.currentMoteConf.NwkSKey key = mw.currentMoteConf.NwkSKey
} }
packet,phy,err := BuildUpData(mw.currentMoteConf.GatewayId,mw.currentMoteConf.DevAddr,key, packet,phy,err := BuildUpData(mw.currentMoteConf.GatewayEui,mw.currentMoteConf.DevAddr,key,
mw.currentMoteConf.NwkSKey,mw.currentMoteConf.FCnt,mw.currentMoteConf.FPort, mw.currentMoteConf.NwkSKey,mw.currentMoteConf.FCnt,mw.currentMoteConf.FPort,
mw.currentMoteConf.DR,mw.currentMoteConf.Chan,mw.currentMoteConf.Freq,mw.currentMoteConf.LSNR, mw.currentMoteConf.DR,mw.currentMoteConf.Chan,mw.currentMoteConf.Freq,mw.currentMoteConf.LSNR,
lorawan.MType(mw.currentMoteConf.MType),mw.currentMoteConf.FCtrl,mw.currentMoteConf.RSSI,bmsg) lorawan.MType(mw.currentMoteConf.MType),mw.currentMoteConf.FCtrl,mw.currentMoteConf.RSSI,bmsg)
@ -813,7 +730,7 @@ func (mw *MoteMainWindow) sendMsg() error{
DevEUI:mw.currentMoteConf.DevEui, DevEUI:mw.currentMoteConf.DevEui,
DevAddr:mw.currentMoteConf.DevAddr, DevAddr:mw.currentMoteConf.DevAddr,
MType:phy.MHDR.MType.String(), MType:phy.MHDR.MType.String(),
GatewayID:mw.currentMoteConf.GatewayId, GatewayID:mw.currentMoteConf.GatewayEui,
Rssi:packet.Payload.RXPK[0].RSSI, Rssi:packet.Payload.RXPK[0].RSSI,
LoRaSNR:packet.Payload.RXPK[0].LSNR, LoRaSNR:packet.Payload.RXPK[0].LSNR,
Frequency:packet.Payload.RXPK[0].Freq, Frequency:packet.Payload.RXPK[0].Freq,
@ -829,7 +746,7 @@ func (mw *MoteMainWindow) sendMsg() error{
_ = mw.tv.SetSelectedIndexes([]int{}) _ = mw.tv.SetSelectedIndexes([]int{})
frames,_:= packet.GetUplinkFrames(true,false) frames,_:= packet.GetUplinkFrames(true,false)
for j := range frames { for j := range frames {
mw.PushData(mw.currentMoteConf.GatewayId,"up",&frames[j]) mw.PushData(mw.currentMoteConf.GatewayEui,"up",&frames[j])
} }
mw.currentMoteConf.FCnt ++ mw.currentMoteConf.FCnt ++
return nil return nil

2
model.go

@ -18,7 +18,7 @@ type ConnectConfig struct {
type MoteConfig struct { type MoteConfig struct {
OTAA bool `json:"otaa"` OTAA bool `json:"otaa"`
GatewayId string `json:"gatewayId"` GatewayEui string `json:"gatewayEui"`
AppEui string `json:"appEui"` AppEui string `json:"appEui"`
DevEui string `json:"devEui"` DevEui string `json:"devEui"`
DevAddr string `json:"devAddr"` DevAddr string `json:"devAddr"`

Loading…
Cancel
Save