Skip to content
This repository was archived by the owner on May 2, 2025. It is now read-only.

Commit e65ff0f

Browse files
committed
Fix wifi payload by prepending it with 0x01. Fix geoloc source.
1 parent 6337d6b commit e65ff0f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/integration/loracloud/loracloud.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ func (i *Integration) dasModem(ctx context.Context, vars map[string]string, devE
456456

457457
loRaCloudAPIDuration("das_v1_uplink_send").Observe(float64(time.Since(start)) / float64(time.Second))
458458

459-
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
459+
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_UNKNOWN)
460460
if err != nil {
461461
return errors.Wrap(err, "handle das response error")
462462
}
@@ -507,7 +507,7 @@ func (i *Integration) dasGNSS(ctx context.Context, vars map[string]string, devEU
507507

508508
loRaCloudAPIDuration("das_v1_uplink_send").Observe(float64(time.Since(start)) / float64(time.Second))
509509

510-
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
510+
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_GEO_RESOLVER_GNSS)
511511
if err != nil {
512512
return errors.Wrap(err, "handle das response error")
513513
}
@@ -538,7 +538,7 @@ func (i *Integration) dasUplinkMetaData(ctx context.Context, vars map[string]str
538538
return errors.Wrap(err, "das error")
539539
}
540540

541-
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
541+
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_UNKNOWN)
542542
if err != nil {
543543
return errors.Wrap(err, "handle das response error")
544544
}
@@ -548,7 +548,7 @@ func (i *Integration) dasUplinkMetaData(ctx context.Context, vars map[string]str
548548
return nil
549549
}
550550

551-
func (i *Integration) handleDASResponse(ctx context.Context, vars map[string]string, devEUI lorawan.EUI64, dasResp das.UplinkResponse, ii models.Integration, pl integration.UplinkEvent) error {
551+
func (i *Integration) handleDASResponse(ctx context.Context, vars map[string]string, devEUI lorawan.EUI64, dasResp das.UplinkResponse, ii models.Integration, pl integration.UplinkEvent, ls common.LocationSource) error {
552552
devResp, ok := dasResp.Result[helpers.EUI64(devEUI)]
553553
if !ok {
554554
return errors.New("no response for deveui")
@@ -614,7 +614,7 @@ func (i *Integration) handleDASResponse(ctx context.Context, vars map[string]str
614614
Latitude: ps.LLH[0],
615615
Longitude: ps.LLH[1],
616616
Altitude: ps.LLH[2],
617-
Source: common.LocationSource_GEO_RESOLVER_GNSS,
617+
Source: ls,
618618
Accuracy: uint32(ps.Accuracy),
619619
},
620620
}
@@ -684,15 +684,15 @@ func (i *Integration) streamGeolocWorkaround(ctx context.Context, vars map[strin
684684
return errors.Wrap(err, "das error")
685685
}
686686

687-
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
687+
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_GEO_RESOLVER_GNSS)
688688
if err != nil {
689689
return errors.Wrap(err, "handle das response error")
690690
}
691691
} else if p[0] == 0x08 {
692692
// wifi
693693
msg := das.UplinkMsgWifi{
694694
MsgType: "wifi",
695-
Payload: helpers.HEXBytes(p[2:]),
695+
Payload: helpers.HEXBytes(append([]byte{0x01}, p[2:]...)),
696696
Timestamp: float64(helpers.GetTimestamp(pl.RxInfo).UnixNano()) / float64(time.Second),
697697
}
698698

@@ -704,7 +704,7 @@ func (i *Integration) streamGeolocWorkaround(ctx context.Context, vars map[strin
704704
return errors.Wrap(err, "das error")
705705
}
706706

707-
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
707+
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl, common.LocationSource_GEO_RESOLVER_WIFI)
708708
if err != nil {
709709
return errors.Wrap(err, "handle das response error")
710710
}

0 commit comments

Comments
 (0)