vapourismo / knx-go

KNX clients and protocol implementation in Go
MIT License
88 stars 58 forks source link

Making use of the Datapoint interface #92

Closed pakerfeldt closed 2 weeks ago

pakerfeldt commented 2 weeks ago

In the application I'm writing I'd like refer to datapoints I create by the Datapoint interface. However, due to the fact that Unpack has pointer receiver, I cannot simply cast it, e.g.dpt.Datapoint(dpt.DPT_1001(value)).

cannot convert dpt.DPT_1001(value) (value of type dpt.DPT_1001) to type dpt.Datapoint: dpt.DPT_1001 does not implement dpt.Datapoint (method Unpack has pointer receiver)

Is there some other workaround I can take to accomplish this? Sorry if there's some obvious golang way of doing this. I know go enough to build myself an application but I don't know it by heart.