login method
登录指令
Implementation
Future<LoginResult?> login(String username, String password,
{int timeout = 5}) async {
if (p2pConnectState != ClientConnectState.CONNECT_STATUS_ONLINE) {
return null;
}
int clientPtr = await getClientPtr();
bool ret = await AppP2PApi().clientLogin(clientPtr, username, password);
if (ret == true) {
CommandResult result = await waitCommandResult((int cmd, Uint8List data) {
return cmd == 24736 || cmd == 24577;
}, timeout);
if (result.isSuccess) {
return LoginResult.form(result);
}
}
return null;
}