Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
add system version, memory, cpuinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Dec 22, 2017
1 parent 541e9b7 commit ee41a69
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ REM adb install app-debug-androidTest.apk

adb push atx-agent /data/local/tmp
adb shell chmod 777 /data/local/tmp/atx-agent
adb shell /data/local/tmp/atx-agent -d -t 10.240.187.224:8080 -nouia
adb shell /data/local/tmp/atx-agent -d -t 10.240.187.224:8000 -nouia
REM adb shell /data/local/tmp/atx-agent -d -t 10.246.46.160:8200 -nouia
REM pause
22 changes: 22 additions & 0 deletions tunnelproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"log"
"os"
"strconv"
"strings"
"time"

Expand All @@ -21,15 +22,36 @@ func getDeviceInfo() *proto.DeviceInfo {
Serial: getProperty("ro.serialno"),
Brand: getProperty("ro.product.brand"),
Model: getProperty("ro.product.model"),
Version: getProperty("ro.build.version.release"),
AgentVersion: version,
}
devInfo.Sdk, _ = strconv.Atoi(getProperty("ro.build.version.sdk"))
devInfo.HWAddr, _ = androidutils.HWAddrWLAN()
display, _ := androidutils.WindowSize()
devInfo.Display = &display
battery := androidutils.Battery{}
battery.Update()
devInfo.Battery = &battery

memory, err := androidutils.MemoryInfo()
if err != nil {
log.Println("get memory error:", err)
} else {
devInfo.Memory = &proto.MemoryInfo{
Total: memory["MemTotal"],
}
}

hardware, processors, err := androidutils.ProcessorInfo()
if err != nil {
log.Println("get cpuinfo error:", err)
} else {
devInfo.Cpu = &proto.CpuInfo{
Hardware: hardware,
Cores: len(processors),
}
}

// Udid is ${Serial}-${MacAddress}-${model}
udid := getProperty("ro.serialno") + "-" + devInfo.HWAddr + "-" + strings.Replace(getProperty("ro.product.model"), " ", "_", -1)
devInfo.Udid = udid
Expand Down

0 comments on commit ee41a69

Please sign in to comment.