CBOR Payloads now decoded OK ... By our #Grafana Data Source for #TheThingsNetwork yay! 🎉
"LGBTIQ Website Censorship in Six Countries"
https://citizenlab.ca/2021/08/no-access-lgbtiq-website-censorship-in-six-countries/
"The Analog Thing (THAT) is a high-quality, low-cost, open-source, and not-for-profit cutting-edge analog computer"
"The Unbelievable Grimness of HermanCainAward, the Subreddit That Catalogs Anti-Vaxxer COVID Deaths"
https://slate.com/technology/2021/09/hermancainaward-subreddit-antivaxxer-deaths-cataloged.html
"any foreigner who traveled to Thailand in the last decade might have had their information exposed in the incident"
https://www.comparitech.com/blog/information-security/thai-traveler-data-leak/
@velartrill
it's a type assertion, because the values of the map are interface{}. the empty interface is fulfilled by _any_ type. you usually need to do type asserts if you want to do _more_ than is defined in the interface. you need the concrete type for that.
if you don't want to have a panic if the type doesn't match, you use the form with two return values. usually if the input is controlled by yourself you want panics because a non matching type is clearly a bug then. for parsing things like irregular JSON it's handy to have the two valued form. an alternative, especially if you have a set of possible types are type switches: https://tour.golang.org/methods/16
Linux Foundation survey shows companies desperate to hire #OpenSource talent
How our #Grafana Data Source transforms #TheThingsNetwork MQTT Messages ... Into Grafana Data Frames
https://github.com/lupyuen/the-things-network-datasource/blob/main/pkg/plugin/message.go#L46-L129
@lupyuen you might want to use the
x, ok := y.(type)
if !ok {
return fmt.Errorf("type assertion failed for: %v", x)
}
style of type assertions. by using the form with two return values you can prevent panics and instead return an error if you have malformed input data.
Cleaned up the CBOR Decoding ... In our #Grafana Data Source for #TheThingsNetwork
https://github.com/lupyuen/the-things-network-datasource/blob/main/pkg/plugin/message.go#L131-L189
How our #Grafana Data Source decodes CBOR Payloads from #TheThingsNetwork
https://github.com/lupyuen/the-things-network-datasource/blob/main/pkg/plugin/message.go#L100-L116
Remember that #LoRa Messages are super tiny ... We shall encode Sensor Data in CBOR ... And our #Grafana Data Source needs to decode the CBOR Payload
https://lupyuen.github.io/articles/ttn#fair-use-of-the-things-network
#Grafana Log shows our #TheThingsNetwork Data Source has extracted the Message Payload correctly yay!
https://github.com/lupyuen/the-things-network-datasource#grafana-log
Here's how our #Grafana Data Source extracts the Message Payload from #TheThingsNetwork MQTT ... Pardon my ghastly GoLang 🙏
https://github.com/lupyuen/the-things-network-datasource/blob/main/pkg/plugin/message.go#L43-L154
#TheThingsNetwork MQTT Messages are really complex ... Our #Grafana Data Source shall extract the Base64 Payload that's deep inside the message
https://github.com/lupyuen/the-things-network-datasource#mqtt-log
We'll take this brand new #Grafana Data Source for MQTT ... And mod it for the MQTT Server at #TheThingsNetwork
Why connect #Grafana to #TheThingsNetwork? So that we can instantly visualise the Sensor Data transmitted by IoT Devices
IoT Techie and Educator / Apache NuttX PMC