Skip to content

Commit

Permalink
rpc: support adb controller v2
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-para committed Oct 24, 2023
1 parent 2230e3b commit 9df21f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/Interface/proto/controller.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ message AdbControllerRequest {
optional string adb_serial = 3;
optional uint32 adb_type = 4;
optional string adb_config = 5;
optional string agent_path = 6;
}

message ControllerSetOptionRequest {
Expand Down
14 changes: 11 additions & 3 deletions source/MaaRpc/implement/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ Status ControllerImpl::create_adb(::grpc::ServerContext* context, const ::maarpc
}

auto id = make_uuid();
handles_.add(id,
MaaAdbControllerCreate(request->adb_path().c_str(), request->adb_serial().c_str(), request->adb_type(),
request->adb_config().c_str(), callback_impl, cb_state.get()));

if (request->has_agent_path()) {
handles_.add(id, MaaAdbControllerCreateV2(request->adb_path().c_str(), request->adb_serial().c_str(),
request->adb_type(), request->adb_config().c_str(),
request->agent_path().c_str(), callback_impl, cb_state.get()));
}
else {
handles_.add(id, MaaAdbControllerCreate(request->adb_path().c_str(), request->adb_serial().c_str(),
request->adb_type(), request->adb_config().c_str(), callback_impl,
cb_state.get()));
}

response->set_handle(id);

Expand Down

0 comments on commit 9df21f0

Please sign in to comment.