MCPcopy Create free account
hub / github.com/baldurk/renderdoc / GetDevices

Method GetDevices

renderdoc/android/android.cpp:1046–1094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044
1045 rdcstr GetProtocolName() override { return "adb"; }
1046 rdcarray<rdcstr> GetDevices() override
1047 {
1048 rdcarray<rdcstr> ret;
1049
1050 Invoke([this, &ret]() {
1051 rdcarray<rdcstr> activedevices = Android::EnumerateDevices();
1052
1053 // reset all devices to inactive
1054 for(auto it = devices.begin(); it != devices.end(); ++it)
1055 it->second.active = false;
1056
1057 // process the list of active devices, find matches and activate them, or add a new entry
1058 for(const rdcstr &d : activedevices)
1059 {
1060 auto it = devices.find(d);
1061 if(it != devices.end())
1062 {
1063 it->second.active = true;
1064
1065 // silently forward the ports now. These may be refreshed but this will allow us to
1066 // connect
1067 Android::adbForwardPorts(it->second.portbase, d, 0, 0, true);
1068 continue;
1069 }
1070
1071 // not found - add a new device
1072 Device dev;
1073 dev.active = true;
1074 dev.name = Android::GetFriendlyName(d);
1075 if(!Android::IsSupported(d))
1076 dev.name += " - (Android 5.x)";
1077 dev.portbase = uint16_t(RenderDoc_ForwardPortBase + RenderDoc::Inst().GetForwardedPortSlot() *
1078 RenderDoc_ForwardPortStride);
1079
1080 // silently forward the ports now. These may be refreshed but this will allow us to connect
1081 Android::adbForwardPorts(dev.portbase, d, 0, 0, true);
1082
1083 devices[d] = dev;
1084 }
1085
1086 for(auto it = devices.begin(); it != devices.end(); ++it)
1087 {
1088 if(it->second.active)
1089 ret.push_back(it->first);
1090 }
1091 });
1092
1093 return ret;
1094 }
1095
1096 rdcstr GetFriendlyName(const rdcstr &URL) override
1097 {

Callers 3

remote_capture.pyFile · 0.80
connectMethod · 0.80

Calls 10

InvokeFunction · 0.85
EnumerateDevicesFunction · 0.85
adbForwardPortsFunction · 0.85
GetFriendlyNameFunction · 0.85
GetForwardedPortSlotMethod · 0.80
IsSupportedFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected