Format and content of a Gateway Bridge to Network Server messages

Hi,

Can someone send me the format and content of the exact package of the gateway bridge to loraserver when you send join request from node !

I’m trying to publish mqtt subject like gateway bridge and emulate join request of lora node, the node are created on the lora app server, but not yet activated ! but i’m not sur of the encode data that gateway bridge send to loraserver, this is what i try :

Python script :

import paho.mqtt.client as paho
import time
import json

broker="127.0.0.1"
port=1883
#with open("data.json", "r") as jsonFile:
#        data = json.load(jsonFile)
#data = '{"rxInfo":{"mac":"a10b20c20d30e40f","time":"2019-11 25T13:45:30.937991Z","timestamp":2223916764,"frequency":868100000,"channel":0,"rfChain":1,"crcStatus":1,"codeRate":"4/5","rssi":-80,"loRaSNR":12.8,"size":23,"dataRate":{"modulation":"LORA","spreadFactor":12,"bandwidth":125},"board":0,"antenna":0},"phyPayload":"AAgHBgUEAwIBGIo3czg1MTHDwzrxBX4="}'
data =  "AAEBAQEBAQEBLRIAu8zd7v+bu7Gn4ts="
while 1:
 
    def on_publish(client,userdata,result):             #create function for callback
        print("data published \n")
        pass

    client1= paho.Client("abcdef1.....1010")                           #create client object
    client1.on_publish = on_publish                          #assign function to callback
    client1.connect("127.0.0.1",1883,60)                                 #establish connection
    ret= client1.publish("gateway/abcdef1.....1010/event/up",data)
    time.sleep(10)

But the response of loraserver is clear, he can’t decode the message :

Loraserver Frame Log :

       ERRO[1617] gateway/mqtt: unmarshal uplink frame error    data_base64="MDExMTExMTExNDUxODAxODcyMDQyMjEyMzgyNTUxNTUxODcxNzcxNjcyMjYyMTk=" error="unexpected EOF"

Thanks

The current version of the ChirpStack Network Server and ChirpStack Gateway Bridge are using Protobuf definitions, that you can find here: https://github.com/brocaar/chirpstack-api/tree/master/protobuf/gw

These definitions can be used for binary Protobuf encoding, but can also used for JSON encoding/decoding (see also: https://developers.google.com/protocol-buffers/docs/proto3#json).

1 Like

Thanks ! i will check the doc

1 Like