AndroidRuntime.cpp 610 B

1234567891011121314151617181920212223242526
  1. #include "AndroidRuntime.h"
  2. #include "il2cpp-config.h"
  3. #include "utils/StringUtils.h"
  4. namespace il2cpp
  5. {
  6. namespace vm
  7. {
  8. static Il2CppAndroidUpStateFunc s_func = NULL;
  9. void AndroidRuntime::SetNetworkUpStateFunc(Il2CppAndroidUpStateFunc func)
  10. {
  11. s_func = func;
  12. }
  13. bool AndroidRuntime::GetNetworkInterfaceUpState(Il2CppString* ifName, bool* isUp)
  14. {
  15. if (s_func)
  16. {
  17. std::string name = utils::StringUtils::Utf16ToUtf8(utils::StringUtils::GetChars(ifName));
  18. return s_func(name.c_str(), (uint8_t*)isUp);
  19. }
  20. return false;
  21. }
  22. }
  23. }