diff --git a/LoRaMoteConf.json b/LoRaMoteConf.json index a42caef..0096255 100644 --- a/LoRaMoteConf.json +++ b/LoRaMoteConf.json @@ -6,11 +6,11 @@ "gatewayEui": "0102030405060708", "appEui": "0102030405060708", "devEui": "b92fd5d497cfcdbd", - "devAddr": "013adb35", + "devAddr": "01c6f8db", "appKey": "fe80c1f94e6cc62d5d6f72630b43c177", - "nwkSKey": "75153208348c4cca9b30d44c889fd52c", - "appSKey": "3cd17c408b5496756bcd122c9b0b318f", - "fCnt": 7, + "nwkSKey": "953f0cc2031d5fa30a6bb3bdc7e61fb8", + "appSKey": "3361732618283cc6097d564b83c257ca", + "fCnt": 13, "fPort": 2, "freq": 470.3, "dr": 0, @@ -35,7 +35,7 @@ "appKey": "", "nwkSKey": "33998df974421457437d986eff739ffa", "appSKey": "33998df974421457437d986eff739ffa", - "fCnt": 1295, + "fCnt": 1298, "fPort": 1, "freq": 470.3, "dr": 1, diff --git a/LoRaMoteMock.go b/LoRaMoteMock.go index 639f204..3f33dc9 100644 --- a/LoRaMoteMock.go +++ b/LoRaMoteMock.go @@ -284,7 +284,7 @@ func (mw *MoteMainWindow) Disconnect() { func (mw *MoteMainWindow) MoteConfig() { var dlg *walk.Dialog var name *walk.ComboBox - var otaa *walk.CheckBox + var otaa,join *walk.CheckBox var acceptPB, cancelPB *walk.PushButton var db *walk.DataBinder @@ -316,10 +316,25 @@ func (mw *MoteMainWindow) MoteConfig() { _ = db.Reset() }}, Label{Text:"入网方式:"}, - CheckBox{AssignTo: &otaa,Text:"OTAA入网",Checked:Bind("OTAA"),OnCheckStateChanged: func() { - mw.currentMoteConf.OTAA = otaa.Checked() - _ = db.Reset() - }}, + Composite{ + Layout: HBox{}, + Children: []Widget{ + CheckBox{AssignTo: &otaa,Text:"OTAA入网",Checked:Bind("OTAA"),OnCheckStateChanged: func() { + mw.currentMoteConf.OTAA = otaa.Checked() + _ = db.Reset() + }}, + CheckBox{AssignTo:&join,Text:"是否重新入网",Enabled:Bind("OTAA"),OnCheckStateChanged: func() { + if mw.currentMoteConf.OTAA && join.Checked() { + mw.currentMoteConf.DevAddr = "" + mw.currentMoteConf.NwkSKey = "" + mw.currentMoteConf.AppSKey = "" + mw.currentMoteConf.FCnt = 0 + _ = db.Reset() + } + }}, + }, + }, + Label{Text:"网关EUI:"}, LineEdit{Text:Bind("GatewayEui",Regexp{Pattern:"^[0-9a-fA-F]{16,16}$"})}, Label{Text:"应用EUI:",Visible:Bind("OTAA")}, @@ -329,11 +344,11 @@ func (mw *MoteMainWindow) MoteConfig() { Label{Text:"应用秘钥:",Visible:Bind("OTAA")}, LineEdit{Text:Bind("AppKey"),Visible:Bind("OTAA")}, Label{Text:"终端地址:"}, - LineEdit{Text:Bind("DevAddr",Regexp{Pattern:"^[0-9a-fA-F]{8,8}$"}),ReadOnly:Bind("OTAA")}, + LineEdit{Text:Bind("DevAddr"),ReadOnly:Bind("OTAA")}, Label{Text:"网络会话秘钥:"}, - LineEdit{Text:Bind("NwkSKey",Regexp{Pattern:"^[0-9a-fA-F]{32,32}$"}),ReadOnly:Bind("OTAA")}, + LineEdit{Text:Bind("NwkSKey"),ReadOnly:Bind("OTAA")}, Label{Text:"应用会话秘钥:"}, - LineEdit{Text:Bind("AppSKey",Regexp{Pattern:"^[0-9a-fA-F]{32,32}$"}),ReadOnly:Bind("OTAA")}, + LineEdit{Text:Bind("AppSKey"),ReadOnly:Bind("OTAA")}, Label{Text:"上行计数:"}, NumberEdit{Value:Bind("FCnt")}, }, @@ -412,6 +427,7 @@ func (mw *MoteMainWindow) MoteConfig() { mw.currentMoteConf.DevAddr = "" mw.currentMoteConf.NwkSKey = "" mw.currentMoteConf.AppSKey = "" + mw.currentMoteConf.FCnt = 0 } } mw.motesConf.Configs[mw.motesConf.Current] = mw.currentMoteConf