Is there a way to customize the ADR algorithm

I mean by rewriting some relevant source code at github (I don’t know if they need to be compiled) to set the relevant content of ADR by myself.

I really need help.

Found this in the search, which Mr. Brocaar answers:

It is hard to understand and change the code.

It should be pretty straightforward, see this example:

You receive a req variable with all the parameters which you can use for your own ADR algorithm and then you return the DR, TX Power and NbTrans values that the NS must sent to the device.

My understanding is as follows:

The code you paste is an empty template, and I have to write codes at the My own codes part, which includes parameters like req.MaxDR, req.MinDR and So on.

If this is not an empty template, but a written example, it will be more conducive to modification. For example, there may include the default ADR code to show how to call parameters to process.

func (h *Handler) Handle(req adr.HandleRequest) (adr.HandleResponse, error) {

        ***My own codes***

	return adr.HandleResponse{
		DR:           req.DR,
		TxPowerIndex: req.TxPowerIndex,
		NbTrans:      req.NbTrans,
	}, nil

And if I understand correctly, how can I successfully execute the modified code by compiling?

You will find the default ADR implementation here:

This is an example how you can test your code:

You can compile the plugin file like any other Go binary :slight_smile:

1 Like

When I want to refer to external dependencies:

go get

go get: module found (v2.5.0
+incompatible), but does not contain package

Repeatedly report the following error, I wonder if there is something wrong with the URL in import:

go.go:7:2: no required module provides package; to add it:
	go get

Sorry, my fault. The example works since it is within the Go module, but since the version is v3.x.x, the Go module should have been named

This commit fixes this + updates all the imports:

When the next version is tagged, you will be able to run go get (where v3.y.z matches an actual version number).

1 Like
go get

go get invalid version: module contains a go.mod file, so ma
jor version must be compatible: should be v0 or v1, not v3

At present, the attempt is still unsuccessful. Is there any progress?