lobaro / lora-packet-forwarder-client

Go Client application for the LoRa Net Packet-Forwarder
MIT License
11 stars 4 forks source link

LoRa Packet Forwarder Client

Enables communication with the LoRa Packet Forarder from Semtech.

The code is based on the LoRa Gateway Bridge which is also used in the TTN Packet Forwarder Bridge but targets a more generic aproach to talk to the Gateway, e.g. you can receive packets with wrong CRC and there is no dependencie to LoRaWAN specifics like lorawan.EUI64.

Usage

Make sure you have a LoRa Packet Forarder configured to communicate with the client endpoint. You can find example configs and code in /examples: usage.go and local_conf.json

func main() {
    client, err := gateway.NewClient(
        ":1680",
        func(gwMac gateway.Mac) error {
            return nil
        },
        func(gwMac gateway.Mac) error {
            return nil
        },
    )

    if err != nil {
        panic(err)
    }

    defer client.Close()

    log.Info("Waiting for gateway packet ...")
    msg := <-client.RXPacketChan()
    log.Infof("Received packet from Gateway with phy payload %v", msg.PHYPayload)

    log.Info("Exit")
}

License

LoRa Gateway Bridge is distributed under the MIT license. See LICENSE.