/// The type of the packet.
/// </summary>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use new methods with this type on BluetoothLeDevice.")]
public BluetoothLePacketType PacketType
{
get
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetServiceUuid() method on BluetoothLeDevice.")]
public IEnumerable<string> ServiceUuid
{
get
{
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- Log.Info(Globals.LogTag, "Retrieving Service uuid- ");
- return BluetoothLeImplAdapter.Instance.GetLeScanResultServiceUuids(_scanData, _packetType);
- }
- return null;
+ return GetServiceUuid(_packetType);
}
}
/// <summary>
+ /// Gets the service UUIDs list from the LE scan result information.
+ /// </summary>
+ /// <value> Gets the list of the string service UUIDs.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The service uuid value</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public IEnumerable<string> GetServiceUuid(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetLeScanResultServiceUuids(_scanData, packetType);
+ }
+
+ /// <summary>
/// Gets the device name from the LE scan result information.
/// </summary>
/// <value> Gets the device name.</value>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetDeviceName() method on BluetoothLeDevice.")]
public string DeviceName
{
get
{
- Log.Info(Globals.LogTag, "Retrieving device name- ");
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetLeScanResultDeviceName(_scanData, _packetType);
- }
- return null;
+ return GetDeviceName(_packetType);
}
}
+
+ /// <summary>
+ /// Gets the device name from the LE scan result information.
+ /// </summary>
+ /// <value> Gets the device name.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The device name value</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public string GetDeviceName(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetLeScanResultDeviceName(_scanData, packetType);
+ }
+
/// <summary>
/// Gets the transmission power level from the LE scan result information.
/// </summary>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetTxPowerLevel() method on BluetoothLeDevice.")]
public int TxPowerLevel
{
get
{
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetScanResultTxPowerLevel(_scanData, _packetType);
- }
- return -1;
+ return GetTxPowerLevel(_packetType);
}
}
/// <summary>
+ /// Gets the transmission power level from the LE scan result information.
+ /// </summary>
+ /// <value> Gets the transmission power level in dB.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The tx power level value</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public int GetTxPowerLevel(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetScanResultTxPowerLevel(_scanData, packetType);
+ }
+
+ /// <summary>
/// Gets the service solicitation UUID list from the scan result information.
/// </summary>
/// <value> Gets the list of the service solicitation UUIDs.</value>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetServiceSolicitationUuid() method on BluetoothLeDevice.")]
public IEnumerable<string> ServiceSolictationUuid
{
get
{
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetScanResultSvcSolicitationUuids(_scanData, _packetType);
- }
- return null;
+ return GetServiceSolicitationUuid(_packetType);
}
}
+
+ /// <summary>
+ /// Gets the service solicitation UUID list from the scan result information.
+ /// </summary>
+ /// <value> Gets the list of the service solicitation UUIDs.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The service solicitation uuid value</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public IEnumerable<string> GetServiceSolicitationUuid(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetScanResultSvcSolicitationUuids(_scanData, packetType);
+ }
+
/// <summary>
/// Gets the manufacturer data from the scan result information.
/// </summary>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetAppearance() method on BluetoothLeDevice.")]
public int Appearance
{
get
{
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetScanResultAppearance(_scanData, _packetType);
- }
- return -1;
+ return GetAppearance(_packetType);
}
}
+
+ /// <summary>
+ /// Gets the manufacturer data from the scan result information.
+ /// </summary>
+ /// <value> Gets the appearance value.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The appearance value</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public int GetAppearance(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetScanResultAppearance(_scanData, packetType);
+ }
+
/// <summary>
/// Gets the manufacturer data from the scan result information.
/// </summary>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>///
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetManufacturerData() method on BluetoothLeDevice.")]
public ManufacturerData ManufacturerData
{
get
{
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetScanResultManufacturerData(_scanData, _packetType);
- }
- return null;
+ return GetManufacturerData(_packetType);
}
}
/// <summary>
+ /// Gets the manufacturer data from the scan result information.
+ /// </summary>
+ /// <value> Gets the manufacturer data containing the manucturer data and ID information.</value>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The enumeration for BLE packet type.</param>
+ /// <returns>The manufacturer data object</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>///
+ /// <since_tizen> 6 </since_tizen>
+ public ManufacturerData GetManufacturerData(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetScanResultManufacturerData(_scanData, packetType);
+ }
+
+ /// <summary>
/// Gets the service data list from the scan result information.
/// </summary>
/// <remarks>
/// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
/// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
/// <since_tizen> 3 </since_tizen>
+ [Obsolete("Deprecated since API level 6. Please use GetServiceDataList() method on BluetoothLeDevice.")]
public IEnumerable<BluetoothLeServiceData> GetServiceDataList()
{
- int serviceCount = 0;
- if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
- {
- return BluetoothLeImplAdapter.Instance.GetScanResultServiceDataList(_scanData,
- _packetType, out serviceCount);
- }
- return null;
+ return GetServiceDataList(_packetType);
}
+ /// <summary>
+ /// Gets the service data list from the scan result information.
+ /// </summary>
+ /// <remarks>The Bluetooth must be enabled.</remarks>
+ /// <param name="packetType"> The packet type.</param>
+ /// <returns> Returns the service data list.</returns>
+ /// <feature>http://tizen.org/feature/network.bluetooth.le</feature>
+ /// <exception cref="NotSupportedException">Thrown when the Bluetooth LE is not supported.</exception>
+ /// <exception cref="InvalidOperationException">Thrown when the Bluetooth LE is not enabled.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public IEnumerable<BluetoothLeServiceData> GetServiceDataList(BluetoothLePacketType packetType)
+ {
+ return BluetoothLeImplAdapter.Instance.GetScanResultServiceDataList(_scanData, packetType);
+ }
/// <summary>
/// Creates a GATT connection with the remote device.
}
}
}
+
/// <summary>
/// Sets whether the device name has to be included in the advertise or the scan response data.
/// The maximum advertised or responded data size is 31 bytes including the data type and the system wide data.
internal IList<string> GetLeScanResultServiceUuids(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
+
+ IList<string> list = new List<string>();
IntPtr uuidListArray = IntPtr.Zero;
int count = -1;
-
BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
- int ret = Interop.Bluetooth.GetScanResultServiceUuid(ref scanDataStruct, packetType,
- ref uuidListArray, ref count);
+ int ret = Interop.Bluetooth.GetScanResultServiceUuid(ref scanDataStruct, packetType, ref uuidListArray, ref count);
if (ret != (int)BluetoothError.None)
{
Log.Info(Globals.LogTag, "Failed to service uuids list- " + (BluetoothError)ret);
- return null;
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
- Log.Info(Globals.LogTag, "count of uuids : " + count);
+ Log.Info(Globals.LogTag, "Count of UUIDs: " + count);
IntPtr[] uuidList = new IntPtr[count];
Marshal.Copy(uuidListArray, uuidList, 0, count);
- IList<string> list = new List<string>();
- foreach(IntPtr uuids in uuidList)
+ foreach (IntPtr uuids in uuidList)
{
list.Add(Marshal.PtrToStringAnsi(uuids));
Interop.Libc.Free(uuids);
}
Interop.Libc.Free(uuidListArray);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return list;
}
internal string GetLeScanResultDeviceName(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
- string deviceName;
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
- BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData);
+ string deviceName;
+ BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
int ret = Interop.Bluetooth.GetLeScanResultDeviceName(ref scanDataStruct, packetType, out deviceName);
- if (ret != (int)BluetoothError.None) {
+ if (ret != (int)BluetoothError.None)
+ {
Log.Error(Globals.LogTag, "Failed to get Device name- " + (BluetoothError)ret);
- return null;
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
- Log.Info (Globals.LogTag, "Device name " + deviceName);
+
+ Log.Info(Globals.LogTag, "DeviceName: " + deviceName);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return deviceName;
}
internal int GetScanResultTxPowerLevel(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
+
int powerLevel = -1;
- BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData);
+ BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
int ret = Interop.Bluetooth.GetScanResultTxPowerLevel(ref scanDataStruct, packetType, out powerLevel);
- if (ret != (int)BluetoothError.None) {
+ if (ret != (int)BluetoothError.None)
+ {
Log.Error(Globals.LogTag, "Failed to get tx power level- " + (BluetoothError)ret);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
- Log.Info (Globals.LogTag, "TxPowerLevel is --- " + powerLevel);
+
+ Log.Info (Globals.LogTag, "TxPowerLevel: " + powerLevel);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return powerLevel;
}
internal IList<string> GetScanResultSvcSolicitationUuids(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
+
+ IList<string> list = new List<string>();
IntPtr uuidListArray;
int count;
-
BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
- int ret = Interop.Bluetooth.GetScaResultSvcSolicitationUuids(ref scanDataStruct, packetType, out uuidListArray, out count);
- if (ret != (int)BluetoothError.None) {
+ int ret = Interop.Bluetooth.GetScanResultSvcSolicitationUuids(ref scanDataStruct, packetType, out uuidListArray, out count);
+ if (ret != (int)BluetoothError.None)
+ {
Log.Error(Globals.LogTag, "Failed to get service solicitation uuids " + (BluetoothError)ret);
- return null;
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
IntPtr[] uuidList = new IntPtr[count];
Marshal.Copy(uuidListArray, uuidList, 0, count);
- IList<string> list = new List<string>();
- foreach(IntPtr uuids in uuidList)
+ foreach (IntPtr uuids in uuidList)
{
list.Add(Marshal.PtrToStringAnsi(uuids));
Interop.Libc.Free(uuids);
}
Interop.Libc.Free(uuidListArray);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return list;
}
- internal IList<BluetoothLeServiceData> GetScanResultServiceDataList(BluetoothLeScanData scanData,
- BluetoothLePacketType packetType, out int serviceCount)
+ internal IList<BluetoothLeServiceData> GetScanResultServiceDataList(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
- int ret = 0;
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
+
IntPtr serviceListArray;
_serviceListCount = 0;
+ BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
- BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData);
-
- ret = Interop.Bluetooth.GetScanResultServiceDataList(ref scanDataStruct, packetType, out serviceListArray, out _serviceListCount);
+ int ret = Interop.Bluetooth.GetScanResultServiceDataList(ref scanDataStruct, packetType, out serviceListArray, out _serviceListCount);
Log.Info(Globals.LogTag, "ServiceListCount : " + _serviceListCount + " PacketType : " + packetType + " Error: " + (BluetoothError)ret);
if (ret != (int)BluetoothError.None)
{
Log.Info(Globals.LogTag, "Failed to get Service Data List, Error - " + (BluetoothError)ret);
- serviceCount = 0;
- Marshal.FreeHGlobal(serviceListArray);
Marshal.FreeHGlobal(scanDataStruct.AdvData);
Marshal.FreeHGlobal(scanDataStruct.ScanData);
- return null;
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
- BluetoothLeServiceDataStruct[] svcList = new BluetoothLeServiceDataStruct[_serviceListCount];
int sizePointerToABC = Marshal.SizeOf(new BluetoothLeServiceDataStruct());
for (int i = 0; i < _serviceListCount; i++)
{
- svcList[i] = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(new IntPtr(serviceListArray.ToInt32() + (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct));
- Log.Info(Globals.LogTag, " Uuid : " + svcList[i].ServiceUuid + "length : " + svcList[i].ServiceDataLength);
-
- _list.Add(BluetoothUtils.ConvertStructToLeServiceData(svcList[i]));
+ var svc = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(new IntPtr(serviceListArray.ToInt32() + (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct));
+ _list.Add(BluetoothUtils.ConvertStructToLeServiceData(svc));
}
- serviceCount = _serviceListCount;
-
Interop.Libc.Free(serviceListArray);
Marshal.FreeHGlobal(scanDataStruct.AdvData);
Marshal.FreeHGlobal(scanDataStruct.ScanData);
internal int GetScanResultAppearance(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
- int appearance;
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
- BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData);
+ int appearance = -1;
+ BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
int ret = Interop.Bluetooth.GetScanResultAppearance(ref scanDataStruct, packetType, out appearance);
- if (ret != (int)BluetoothError.None) {
+ if (ret != (int)BluetoothError.None)
+ {
Log.Error(Globals.LogTag, "Failed to get Appearance value- " + (BluetoothError)ret);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
+
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return appearance;
}
internal ManufacturerData GetScanResultManufacturerData(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
{
+ if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)
+ {
+ BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
+ }
+
+ ManufacturerData data = new ManufacturerData();
int dataId = 0;
int dataLength = 0;
IntPtr manufData;
+ BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData);
- BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData);
- ManufacturerData data = new ManufacturerData();
-
- int ret = Interop.Bluetooth.GetScanResultManufacturerData(ref scanDataStruct, packetType, out dataId,
- out manufData, out dataLength);
+ int ret = Interop.Bluetooth.GetScanResultManufacturerData(ref scanDataStruct, packetType, out dataId, out manufData, out dataLength);
if (ret != (int)BluetoothError.None)
{
Log.Error(Globals.LogTag, "Failed to get Manufacturer data - " + (BluetoothError)ret);
- return null;
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
+ BluetoothErrorFactory.ThrowBluetoothException(ret);
}
data.Id = dataId;
Marshal.Copy(manufData, data.Data, 0, data.DataLength);
}
+ Interop.Libc.Free(manufData);
+ Marshal.FreeHGlobal(scanDataStruct.AdvData);
+ Marshal.FreeHGlobal(scanDataStruct.ScanData);
return data;
}