示例#1
0
        private void Init()
        {
            // MetroLog
            LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new StreamingFileTarget());
            log = LogManagerFactory.DefaultLogManager.GetLogger <MainPage>();

            // Log by Api
            //loggerHelper = new LoggerHelper();

            // Iot Hub Device Info
            iotHubHelper = new IotHubHelper();

            // Beacon 模擬器初始化
            beaconSimulator = new BeaconSimulator();
            beaconSimulator.TurnOnBeaconSimulator();

            // IOT User Devices Info
            deviceInfoHelper    = new DevicesInfoHelpers();
            userDevicesInfoList = deviceInfoHelper.GetAllUserDevicesInfo();

            // Beacon 偵測初始化
            detector = new BLEDeviceDetector();
            detector.afterReceivedAction = new BLEDeviceDetector.AfterReceivedAction(AfterReceiveBleDevice);
            detector.watcher.Start();



#if (ARM)
            // Physical Controller
            phyDeviceController = new PhysicalDeviceController();
#endif



            // 更改UI
            var task = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                this.IP_ADDRESS.Text = String.Format("Device Ip:{0}", GetLocalIp());
            });
        }
示例#2
0
        public void StartBeacon()

        {
            _beaconManager = BeaconManager.GetInstanceForApplication(this);

            #region Set up Beacon Simulator for TEST USE
            // Beacon Simulator
            var beaconSimulator = new BeaconSimulator();
            beaconSimulator.CreateBasicSimulatedBeacons();
            BeaconManager.BeaconSimulator = beaconSimulator;
            // Beacon Simulator
            #endregion Set up Beacon Simulator for TEST USE


            _monitorNotifier        = new MonitorNotifier();
            _rangeNotifier          = new RangeNotifier();
            _dictionaryOfBeaconData = new Dictionary <string, BeaconDataModel>();

            //iBeacon
            BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(AppConstants.IBEACON_FORMAT);
            _beaconManager.BeaconParsers.Add(beaconParser);
            _beaconManager.Bind(this);
        }