Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

uplinkID in UplinkRXInfo is parsed wrong as json #43

Open
maxreb opened this issue Jul 27, 2021 · 0 comments
Open

uplinkID in UplinkRXInfo is parsed wrong as json #43

maxreb opened this issue Jul 27, 2021 · 0 comments

Comments

@maxreb
Copy link
Contributor

maxreb commented Jul 27, 2021

What happened?

When I try to connect with MQTT on my C# program and then want to read on the topic "application/123/device/+/event/up and parse the received bytes as UTF-8 string and then parse it with the google protobuf parser, then I get the following exception:

Google.Protobuf.InvalidProtocolBufferException: Invalid base64 data
---> System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

It happens on this field: gw.UplinkRXInfo.uplink_id with this data: d902040a-4859-41e3-aacc-a3f79de22e12

Steps to reproduce this issue

C# example:

string json = @"{""applicationID"":""4"",""applicationName"":""WetterStation"",""deviceName"":""0XXXXXXXXXXXX"",""devEUI"":""0101010101010101"",""rxInfo"":[{""gatewayID"":""1234567889141422"",""uplinkID"":""d902040a-4859-41e3-aacc-a3f79de22e12"",""name"":""XXXXXXXXXXXXX"",""time"":""2021-07-27T18:19:23.776381Z"",""rssi"":-106,""loRaSNR"":4,""location"":{""latitude"":54.31039,""longitude"":9.66927,""altitude"":228}},{""gatewayID"":""0000000000000000"",""uplinkID"":""11740492-1111-2222-3333-44444444444"",""name"":""xxxxxxxxxxx"",""time"":""2021-07-27T18:19:23.778124Z"",""rssi"":-114,""loRaSNR"":2,""location"":{""latitude"":0.00000,""longitude"":0.00000,""altitude"":43}}],""txInfo"":{""frequency"":868100000,""dr"":5},""adr"":false,""fCnt"":8706,""fPort"":1,""data"":""dGVzdA=="",""object"":{""Counter"":[299],""Voltage"":[3.406]}}";
UplinkEvent.Parser.ParseJson(json);

Steps to solve it:

When serializing the UplinkEvent in the application server it should parse it as base64 OR make gw.UplinkRXInfo.uplink_id a string:
In gw.proto:
string uplink_id = 16 [json_name = "uplinkID"];

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

No branches or pull requests

1 participant