getCurrentDevice method

TXDeviceInfo getCurrentDevice(
  1. TXMediaDeviceType type
)
override

Getting the device currently in use (for desktop OS)

Implementation

TXDeviceInfo getCurrentDevice(TXMediaDeviceType type) {
  if (_only_support_desktop) {
    TXDeviceInfo deviceInfo = new TXDeviceInfo();
    ffi.Pointer<TXDeviceInfoStruct> deviceInfoPointer = TXDeviceInfoStruct.create();
    _deviceFFIBindings.get_current_device(_nativePointer, type.value(), deviceInfoPointer);
    if (deviceInfoPointer != ffi.nullptr) {
      deviceInfo.devicePid = FFIConverter.getStringFromChar(deviceInfoPointer.ref.device_pid);
      deviceInfo.deviceName = FFIConverter.getStringFromChar(deviceInfoPointer.ref.device_name);
      deviceInfo.deviceProperties = FFIConverter.getStringFromChar(deviceInfoPointer.ref.device_properties);
    }
    return deviceInfo;
  } else {
    debugPrint("device-manager-api not support");
    return TXDeviceInfo();
  }
}