//---------------------------------------------------------------
    // Load the Beacons from the Json File
    //---------------------------------------------------------------
    void LoadBeacons(string path)
    {
        path = Application.streamingAssetsPath + "/" + path;

        string jsonstring = File.ReadAllText(path);

        beaconsData = JsonUtility.FromJson <BeaconCollection> (jsonstring);

        try {
            if (beaconsData.beacons.Length != 0)
            {
                print("Loaded Beacon File: found  " + beaconsData.beacons.Length);

                foreach (BeaconData d in beaconsData.beacons)
                {
                    Beacon bd = Instantiate(prefab, transform);
                    bd.transform.parent = transform;
                    bd.SetBeaconData(d);
                    beacons.Add(bd);
                }
            }
            else
            {
            }
        }
        catch (System.Exception ex) {
            Debug.LogException(ex, this);
        }
    }
        public async void BeaconEngine_Discovered(BluetoothLEAdvertisementReceivedEventArgs args)
        {
            //System.Diagnostics.Debug.WriteLine("Found Beacon : " + args.BluetoothAddress);

            //the test is progressing, so we do minimun amount of work here
            //and simply mark the beacon we got as seen during this test cycle
            if (_periodicTimer != null)
            {
                foreach (Beacon beacon in tmpCollection)
                {
                    if (beacon.BluetoothAddress == args.BluetoothAddress)
                    {
                        if (_listeningCycleCounter < beacon.DiscoveryTestData.Length)
                        {
                            beacon.DiscoveryTestData[_listeningCycleCounter] = true;
                            return;
                        }
                    }
                }
                //if it was some beacon we do not have in our list, then we simply ignore it
                return;
            }

            //beaconlist is only updated while we are not doing test
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Beacon beacon = BeaconFactory.BeaconFromBluetoothLEAdvertisementReceivedEventArgs(args);
                if (beacon == null)
                {
                    return;
                }

                bool existingBeaconUpdated = false;

                foreach (Beacon existingBeacon in BeaconCollection)
                {
                    if (existingBeacon.Update(beacon))
                    {
                        existingBeaconUpdated = true;
                        beacon.Dispose();
                    }
                }

                if (!existingBeaconUpdated)
                {
                    BeaconCollection.Add(beacon);
                }
            });
        }