-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathdev_info.go
39 lines (33 loc) · 1.3 KB
/
dev_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"strings"
//log "github.com/sirupsen/logrus"
//uj "github.com/nanoscopic/ujsonin/mod"
)
func getDeviceName( bridge BridgeDev ) (string) {
info := bridge.info( []string{ "DeviceName" } )
return info["DeviceName"]
}
func getAllDeviceInfo( bridge BridgeDev ) map[string] string {
mainKeys := "DeviceName,EthernetAddress,ModelNumber,HardwareModel,PhoneNumber,ProductType,ProductVersion,UniqueDeviceID,InternationalCircuitCardIdentity,InternationalMobileEquipmentIdentity,InternationalMobileSubscriberIdentity"
keyArr := strings.Split( mainKeys, "," )
return bridge.info( keyArr )
}
func getDeviceInfo( bridge BridgeDev, keyName string ) map[string] string {
if( keyName == "" ) {
keyName = "DeviceName,EthernetAddress,ModelNumber,HardwareModel,PhoneNumber,ProductType,ProductVersion,UniqueDeviceID,InternationalCircuitCardIdentity,InternationalMobileEquipmentIdentity,InternationalMobileSubscriberIdentity"
}
keyArr := strings.Split( keyName, "," )
return bridge.info( keyArr )
}
func getFirstDeviceId( root BridgeRoot ) ( string ) {
return getDeviceIds( root )[0]
}
func getDeviceIds( root BridgeRoot ) ( []string ) {
devs := root.list()
ids := []string{}
for _,dev := range devs {
ids = append( ids, dev.udid )
}
return ids
}