thethingsarchive / go-app-sdk Goto Github PK
View Code? Open in Web Editor NEWThe Things Network V2 Application SDK for Go
Home Page: https://www.thethingsnetwork.org
License: MIT License
The Things Network V2 Application SDK for Go
Home Page: https://www.thethingsnetwork.org
License: MIT License
Hi,
I don't know what happened, several weeks i was compliing and running my code without any problem, but now suddenly compilation throws errors:
# github.com/TheThingsNetwork/api/protocol/lorawan
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:57:26: cannot use cmd.MACCommand() (type lorawan.MACCommand) as type lorawan.Payload in append:
lorawan.MACCommand does not implement lorawan.Payload (UnmarshalBinary method has pointer receiver)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:83:58: cannot use cmd (type lorawan.Payload) as type lorawan.MACCommand in argument to MACCommandFromMACCommand
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:101:5: mac.AppEUI undefined (type lorawan.JoinRequestPayload has no field or method AppEUI)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:103:33: cannot convert m.DevNonce (type "github.com/TheThingsNetwork/ttn/core/types".DevNonce) to type lorawan.DevNonce
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:110:40: payload.AppEUI undefined (type *lorawan.JoinRequestPayload has no field or method AppEUI)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:112:36: cannot convert payload.DevNonce (type lorawan.DevNonce) to type "github.com/TheThingsNetwork/ttn/core/types".DevNonce
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:124:5: mac.AppNonce undefined (type lorawan.JoinAcceptPayload has no field or method AppNonce)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:124:17: undefined: lorawan.AppNonce
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:125:5: mac.NetID undefined (type lorawan.JoinAcceptPayload has no field or method NetID)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:132:17: cannot use m.CFList.Freq[0] (type uint32) as type lorawan.Payload in field value:
uint32 does not implement lorawan.Payload (missing MarshalBinary method)
/home/opoopo/go/pkg/mod/github.com/!the!things!network/[email protected]/protocol/lorawan/message_conversion.go:132:17: too many errors
FAIL gitlab.cap-net.cz/cvut_kyr/boom-spotter-web/pkg/ttn [build failed]
go version go1.15 linux/amd64
Conenten of go.mod
file
module gitlab.cap-net.cz/cvut_kyr/boom-spotter-web
go 1.15
require (
github.com/TheThingsNetwork/go-app-sdk v0.0.0-20191121100818-5bae20ae2b27
github.com/TheThingsNetwork/go-utils v0.0.0-20200807125606-b3493662e4bf
github.com/TheThingsNetwork/ttn/core/types v0.0.0-20200812084900-fce3ec703303
)
And when I run go get
command without -u
flag it throws the same error.
Any suggestion?
Thank you.
vgo
has been superseded by go 1.11
and commands have changed slightly.
These instructions seem to work;
$GOPATH
go mod <your-module-name>
github.com/TheThingsNetwork/go-app-sdk
go mod vendor
go run main.go
What I doubt still is whether this is the way it is supposed to work. go get github.com/TheThingsNetwork/go-app-sdk
fails with type compatibility issue with lorawan
package.
Hello
when requesting the devices as a list, the attribute LastSeen is nil. When using Get() to retrieve the device details it is correct.
Code (without error handling and defer):
client := config.NewClient(appID, appAccessKey)
devices, _ := client.ManageDevices()
deviceList, _ := devices.List(20, 0)
for _, dev := range deviceList {
if dev.DevID == "b30fa2b5-edd3-4c4f-aa4e-a3c725016468" {
fmt.Println(dev.AsDevice().LastSeen)
}
}
dev, _ := devices.Get("b30fa2b5-edd3-4c4f-aa4e-a3c725016468")
fmt.Println(dev.LastSeen)
Output:
0001-01-01 00:00:00 +0000 UTC
2020-10-09 20:07:25.73306538 +0200 CEST
Hi I am getting this instalation error
go get -u github.com/TheThingsNetwork/go-app-sdk/...
# github.com/TheThingsNetwork/api/protocol/lorawan
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:57:26: cannot use cmd.MACCommand() (type lorawan.MACCommand) as type lorawan.Payload in append:
lorawan.MACCommand does not implement lorawan.Payload (UnmarshalBinary method has pointer receiver)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:83:58: cannot use cmd (type lorawan.Payload) as type lorawan.MACCommand in argument to MACCommandFromMACCommand
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:101:5: mac.AppEUI undefined (type lorawan.JoinRequestPayload has no field or method AppEUI)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:103:33: cannot convert m.DevNonce (type "github.com/TheThingsNetwork/ttn/core/types".DevNonce) to type lorawan.DevNonce
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:110:40: payload.AppEUI undefined (type *lorawan.JoinRequestPayload has no field or method AppEUI)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:112:36: cannot convert payload.DevNonce (type lorawan.DevNonce) to type "github.com/TheThingsNetwork/ttn/core/types".DevNonce
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:124:5: mac.AppNonce undefined (type lorawan.JoinAcceptPayload has no field or method AppNonce)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:124:17: undefined: lorawan.AppNonce
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:125:5: mac.NetID undefined (type lorawan.JoinAcceptPayload has no field or method NetID)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:132:17: cannot use m.CFList.Freq[0] (type uint32) as type lorawan.Payload in field value:
uint32 does not implement lorawan.Payload (missing MarshalBinary method)
/home/opoopo/go/src/github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:132:17: too many errors
Any suggestions?
Thank you
go mod -init -module github.com/your-username/your-project
shoud be
go mod init github.com/your-username/your-project
Hey, I am trying to use this library but I get following errors:
~ » go get github.com/TheThingsNetwork/go-app-sdk
# github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:10:45: undefined: Band
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:11:23: undefined: MaxPayloadSize
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:14:22: undefined: MaxPayloadSize
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:33:22: undefined: MaxPayloadSize
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:53:10: undefined: Band
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:229:28: undefined: Channel
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:237:31: undefined: Channel
projects/go/src/github.com/TheThingsNetwork/ttn/vendor/github.com/brocaar/lorawan/band/band_au915_928.go:245:30: undefined: Channel
When running go get github.com/TheThingsNetwork/go-app-sdk
I am getting the following error:
../../github.com/TheThingsNetwork/api/protocol/lorawan/message_conversion.go:57:26: cannot use cmd.MACCommand() (type lorawan.MACCommand) as type lorawan.Payload in append:
Any ideas?
Probably should not vendor types that are returned from functions/used in interfaces etc, as it makes it this package impossible to use as intended. If they must be vendored there should be a way for the user to create the type that wraps the vendored type without side effects.
So that people do not get errors like this:
cannot use u (type *"github.com/TheThingsNetwork/go-app-sdk/vendor/github.com/TheThingsNetwork/ttn/core/types".UplinkMessage) as type *"github.com/TheThingsNetwork/ttn/core/types".UplinkMessage)
same applies to other types vendored from ttn/core/types that are required to use this pkg: DeviceEvent, Activation, DownlinkMessage, NwkSKey, AppSKey, DevAddr,AppEUI and DevEUI.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.