Commit c83cd99f authored by Orne Brocaar's avatar Orne Brocaar
Browse files

Implement new wifi payload (0x0e type).

parent f23c9048
......@@ -698,7 +698,7 @@ func (i *Integration) streamGeolocWorkaround(ctx context.Context, vars map[strin
return errors.Wrap(err, "handle das response error")
}
} else if p[0] == 0x08 {
// wifi
// wifi (legacy)
msg := das.UplinkMsgWifi{
MsgType: "wifi",
Payload: helpers.HEXBytes(append([]byte{0x01}, p[2:]...)),
......@@ -713,6 +713,31 @@ func (i *Integration) streamGeolocWorkaround(ctx context.Context, vars map[strin
return errors.Wrap(err, "das error")
}
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_GEO_RESOLVER_WIFI)
if err != nil {
return errors.Wrap(err, "handle das response error")
}
} else if p[0] == 0x0e {
// validate that p is at least 7 bytes we have to skip the tag, length + first 5 bytes
if len(p) < 7 {
continue
}
// wifi
msg := das.UplinkMsgWifi{
MsgType: "wifi",
Payload: helpers.HEXBytes(append([]byte{0x01}, p[7:]...)),
Timestamp: float64(helpers.GetTimestamp(pl.RxInfo).UnixNano()) / float64(time.Second),
}
client := das.New(i.dasURI, i.config.DASToken)
resp, err := client.UplinkSend(ctx, das.UplinkRequest{
helpers.EUI64(devEUI): msg,
})
if err != nil {
return errors.Wrap(err, "das error")
}
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_GEO_RESOLVER_WIFI)
if err != nil {
return errors.Wrap(err, "handle das response error")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment