Skip to content

Commit

Permalink
docs: 📚 updates documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Vieira <[email protected]>
  • Loading branch information
lucasvmx committed May 10, 2024
1 parent bc13a67 commit cdb6623
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ A simple library to get WarThunder data provided by the localhost server
go get -u github.com/lucasvmx/WarTelemetry/telemetry
```

## Example
## Example (localhost)

```go
package main

Expand All @@ -26,21 +27,57 @@ import (
)

func main() {
// Not needed if war thunder is running on localhost
wartelemetry.Initialize("192.168.1.35")
// Use this to collect data from remote computer
wartelemetry.InitializeRemote("192.168.1.35")

// Enable internal debug logging (disabled by default)
logger.EnableDebug()

for {

data, err := wartelemetry.GetTelemetryData()
if err != nil {
log.Printf("failed to collect data: %v", err)
time.Sleep(time.Second * 3)
continue
} else {
log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
}
}
}

```

## Example (Remote Host)

```go

package main

import (
"log"
"time"

"github.com/lucasvmx/WarTelemetry/logger"
wartelemetry "github.com/lucasvmx/WarTelemetry/telemetry"
)

func main() {
// Use this for localhost
wartelemetry.InitializeLocalHost()

// Enable internal debug logging (disabled by default)
// Enable internal debug logging (disabled by default)
logger.EnableDebug()

for {

t, err := wartelemetry.GetTelemetryData()
data, err := wartelemetry.GetTelemetryData()
if err != nil {
log.Printf("failed to collect data: %v", err)
time.Sleep(time.Second * 3)
continue
} else {
log.Printf("Aircraft Name: %v", t.Indicators.AircraftName)
log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
}
}
}
Expand Down

0 comments on commit cdb6623

Please sign in to comment.