{
internal static BluetoothDevice ConvertStructToDeviceClass(BluetoothDeviceStruct device)
{
- const int DeviceNameLengthMax = 248;
- const int UuidLengthMax = 50;
-
BluetoothDevice resultDevice = new BluetoothDevice();
Collection<string> uuidList = null;
Log.Info(Globals.LogTag, "UUID Count: " + device.ServiceCount);
foreach (IntPtr extension in extensionList) {
if (extension != IntPtr.Zero) {
- string uuid = Marshal.PtrToStringAnsi (extension, UuidLengthMax);
+ string uuid = Marshal.PtrToStringAnsi (extension);
Log.Info(Globals.LogTag, "UUID: " + uuid);
uuidList.Add (uuid);
}
resultDevice.RemoteDeviceAddress = device.Address;
if (device.Name != IntPtr.Zero) {
- resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(device.Name, DeviceNameLengthMax);
+ resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(device.Name);
Log.Info(Globals.LogTag, "Device Name: " + resultDevice.RemoteDeviceName);
}
resultDevice.RemoteDeviceClass = new BluetoothClass();
{
BluetoothDevice resultDevice = new BluetoothDevice();
Collection<string> uuidList = null;
- const int DeviceNameLengthMax = 248;
- const int UuidLengthMax = 50;
if (structDevice.ServiceCount > 0) {
IntPtr[] extensionList = new IntPtr[structDevice.ServiceCount];
Log.Info(Globals.LogTag, "UUID Count: " + structDevice.ServiceCount);
foreach (IntPtr extension in extensionList) {
if (extension != IntPtr.Zero) {
- string uuid = Marshal.PtrToStringAnsi(extension, UuidLengthMax);
+ string uuid = Marshal.PtrToStringAnsi(extension);
Log.Info(Globals.LogTag, "UUID: " + uuid);
uuidList.Add(uuid);
}
resultDevice.RemoteDeviceAddress = structDevice.Address;
if (structDevice.Name != IntPtr.Zero) {
- resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(structDevice.Name, DeviceNameLengthMax);
+ resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(structDevice.Name);
Log.Info(Globals.LogTag, "Device Name: " + resultDevice.RemoteDeviceName);
}