Skip to content

Commit

Permalink
feat(bluetooth): bluetooth/network/connect event
Browse files Browse the repository at this point in the history
  • Loading branch information
itsnebulalol committed Dec 17, 2024
1 parent d4c4d18 commit add152f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bluetooth/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ func (m *BluetoothManager) ConnectNetwork(address string) error {
return fmt.Errorf("bnep0 interface is not up")
}

if m.wsHub != nil {
m.wsHub.Broadcast(utils.WebSocketEvent{
Type: "bluetooth/network/connect",
Payload: utils.NetworkConnectedPayload{
Address: address,
},
})
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions utils/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ type DeviceDisconnectedPayload struct {

type DevicePairedPayload struct {
Device *BluetoothDeviceInfo `json:"device"`
}

type NetworkConnectedPayload struct {
Address string `json:"address"`
}

0 comments on commit add152f

Please sign in to comment.