From: Wootak Jung Date: Fri, 8 Jan 2021 00:47:07 +0000 (+0900) Subject: [Bluetooth][Non-ACR] Fix BluetoothDevice.Name converting issue (#2498) X-Git-Tag: accepted/tizen/unified/20210219.040944~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ae5db7f743d43f7962437d5230341c1421204d3;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Bluetooth][Non-ACR] Fix BluetoothDevice.Name converting issue (#2498) Signed-off-by: Wootak Jung --- diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs index 7ced7ef..af0744e 100644 --- a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs @@ -63,8 +63,7 @@ namespace Tizen.Network.Bluetooth /// /// The name of the device. /// - [MarshalAsAttribute(UnmanagedType.LPTStr)] - internal string Name; + internal IntPtr Name; /// /// The class of the device. @@ -241,6 +240,7 @@ namespace Tizen.Network.Bluetooth { internal static BluetoothDevice ConvertStructToDeviceClass(BluetoothDeviceStruct device) { + const int DeviceNameLengthMax = 248; BluetoothDevice resultDevice = new BluetoothDevice(); Collection uuidList = null; @@ -256,7 +256,7 @@ namespace Tizen.Network.Bluetooth } resultDevice.RemoteDeviceAddress = device.Address; - resultDevice.RemoteDeviceName = device.Name; + resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(device.Name, DeviceNameLengthMax); resultDevice.RemoteDeviceClass = new BluetoothClass(); resultDevice.Class.MajorType = device.Class.MajorDeviceClassType; resultDevice.Class.MinorType = device.Class.MinorDeviceClassType;