Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Confuse of ClassB Parameters set #549

Open
redwolf2019 opened this issue Sep 28, 2021 · 0 comments
Open

Confuse of ClassB Parameters set #549

redwolf2019 opened this issue Sep 28, 2021 · 0 comments

Comments

@redwolf2019
Copy link

File location:chirpstack-network-server/internal/data/data.go

Source code:

func setPingSlotParameters(ctx *dataContext) error {
	if !ctx.DeviceProfile.SupportsClassB {
		return nil
	}

	if classBPingSlotDR != ctx.DeviceSession.PingSlotDR || classBPingSlotFrequency != ctx.DeviceSession.PingSlotFrequency {
		block := maccommand.RequestPingSlotChannel(ctx.DeviceSession.DevEUI, classBPingSlotDR, classBPingSlotFrequency)
		ctx.MACCommands = append(ctx.MACCommands, block)
	}

	return nil
}

Bug:

if classBPingSlotDR != ctx.DeviceSession.PingSlotDR || classBPingSlotFrequency != ctx.DeviceSession.PingSlotFrequency {
		block := maccommand.RequestPingSlotChannel(ctx.DeviceSession.DevEUI, classBPingSlotDR, classBPingSlotFrequency)
		ctx.MACCommands = append(ctx.MACCommands, block)
}

According to my opinion,PingSlotDR/classBPingSlotFrequency always loading from chirpstack-network-server.toml, not loading from ctx.DeviceSession.

My Patch is:

        var classBPingSlotDRReal int
	if classBPingSlotDR != ctx.DeviceSession.PingSlotDR {
		classBPingSlotDRReal = ctx.DeviceSession.PingSlotDR
	}else {
		classBPingSlotDRReal = classBPingSlotDR
	}

	var classBPingSlotFrequencyReal uint32
	if classBPingSlotFrequency != ctx.DeviceSession.PingSlotFrequency {
		classBPingSlotFrequencyReal = ctx.DeviceSession.PingSlotFrequency
	}else {
		classBPingSlotFrequencyReal = classBPingSlotFrequency
	}

	block := maccommand.RequestPingSlotChannel(ctx.DeviceSession.DevEUI, classBPingSlotDRReal, classBPingSlotFrequencyReal)
	ctx.MACCommands = append(ctx.MACCommands, block)

Is my idea correct? Looking forward to your reply:)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant