This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Master Emulator Scan Response Packet

How do I get data from a scan response packet using master emulator?

I do know about

BtScanParameters scanParams = new BtScanParameters();
scanParams.ScanType = BtScanType.ActiveScanning;

But this doesn't seem to be enough.

I am working off of the example code from the "HealthThermoDemo" I want to access the ManufacturerSpecificData from a scan response packet so that I can use that data to add to the list of available devices in the OnDeviceDiscovered function.

What do I need to do?

(Note: the ManufacturerSpecificData is only in scan response packet not in both places so I don't have to worry about this)

Edit: This is my OnDeviceDiscovered() function:

void OnDeviceDiscovered(object sender, ValueEventArgs<BtDevice> e)
        {
            this.BeginInvoke((MethodInvoker)delegate()
            {
                dgvDeviceDiscovery.Enabled = true;
                dgvDeviceDiscovery.Visible = true;

                BtDevice dev = e.Value;
                string deviceName = "";
                IDictionary<DeviceInfoType, string> deviceInfo = dev.DeviceInfo;
                if (deviceInfo.ContainsKey(DeviceInfoType.CompleteLocalName))
                {
                    deviceName = deviceInfo[DeviceInfoType.CompleteLocalName];
                }
                else if (deviceInfo.ContainsKey(DeviceInfoType.ShortenedLocalName))
                {
                    deviceName = deviceInfo[DeviceInfoType.ShortenedLocalName];
                }
                else
                {
                    return;
                }

                string manufData = "";
                if (deviceInfo.ContainsKey(DeviceInfoType.ManufacturerSpecificData))
                {
                    manufData = deviceInfo[DeviceInfoType.ManufacturerSpecificData];
                }


                string key = deviceName + " (adr: " + dev.DeviceAddress + ")" + " (MSD: " + manufData + ")";
                discoveredDevicesList[key] = dev;
                dgvDeviceDiscovery.RowCount = discoveredDevicesList.Count;

            });
        }
Related