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

Commit 73538ab

Browse files
committed
Implement UplinkMsgWifi + wifi stream record workaround.
1 parent eb3b08e commit 73538ab

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

internal/integration/loracloud/client/das/structs.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ type UplinkMsgGNSS struct {
4949
GNSSUse2DSolver bool `json:"gnss_use_2D_solver,omitempty"`
5050
}
5151

52+
// UplinkMsgWifi implements the LoRa Cloud UplinkMsg object containing a wifi payload.
53+
type UplinkMsgWifi struct {
54+
MsgType string `json:"msgtype"` // Must be set to "wifi"
55+
Payload helpers.HEXBytes `json:"payload"`
56+
Timestamp float64 `json:"timestamp"` // Seconds since UTC
57+
}
58+
5259
// UplinkMsgJoining implements the LoRa Cloud UplinkMsg object indicating a session reset.
5360
type UplinkMsgJoining struct {
5461
MsgType string `json:"msgtype"` // Must be set to "joining"

internal/integration/loracloud/loracloud.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,8 @@ func (i *Integration) streamGeolocWorkaround(ctx context.Context, vars map[strin
659659
continue
660660
}
661661

662-
// gnss with pcb || gnss with patch antenna
663662
if p[0] == 0x06 || p[0] == 0x07 {
663+
// gnss with pcb || gnss with patch antenna
664664
msg := das.UplinkMsgGNSS{
665665
MsgType: "gnss",
666666
Payload: helpers.HEXBytes(p[2:]),
@@ -684,6 +684,26 @@ 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)
688+
if err != nil {
689+
return errors.Wrap(err, "handle das response error")
690+
}
691+
} else if p[0] == 0x08 {
692+
// wifi
693+
msg := das.UplinkMsgWifi{
694+
MsgType: "wifi",
695+
Payload: helpers.HEXBytes(p[2:]),
696+
Timestamp: float64(helpers.GetTimestamp(pl.RxInfo).UnixNano()) / float64(time.Second),
697+
}
698+
699+
client := das.New(i.dasURI, i.config.DASToken)
700+
resp, err := client.UplinkSend(ctx, das.UplinkRequest{
701+
helpers.EUI64(devEUI): msg,
702+
})
703+
if err != nil {
704+
return errors.Wrap(err, "das error")
705+
}
706+
687707
err = i.handleDASResponse(ctx, vars, devEUI, resp, ii, pl)
688708
if err != nil {
689709
return errors.Wrap(err, "handle das response error")

0 commit comments

Comments
 (0)