Esempio n. 1
0
        void Adapter_DeviceConnected(object sender, DeviceConnectionEventArgs e)
        {
            Debug.WriteLine("Device Connected");

            this.Device = e.Device;

            //if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("932"))
            //{
            //	Debug.WriteLine("Instantiating PE932 Handler");
            //	this.syncDeviceHandler = SyncDeviceHandler932.GetInstance();
            //}
            /*else */
            if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("961"))
            {
                Debug.WriteLine("Instantiating PE/FT961 Handler");
                this.SyncDeviceHandler = SyncDeviceHandler961.GetInstance();
            }
            else if (this.Device.Name.StartsWith("H25FE2"))
            {
                this.SyncDeviceHandler = SyncDeviceHandlerStriiv.GetInstance();
            }

            this.SyncDeviceHandler.IncrementProgressBar += UpdateProgressBar;
            this.SyncDeviceHandler.SyncDone             += DoneSyncing;

            this.SyncDeviceHandler.SetAdapter(this.Adapter);
            this.SyncDeviceHandler.SetDevice(this.Device);
            this.SyncDeviceHandler.SetWebService(this.WebService);

            e.Device.ServicesDiscovered += Services_Discovered;
            //this.Adapter.CommandResponse += SyncDeviceHandler.ReceiveResponse;
            e.Device.DiscoverServices();
        }
Esempio n. 2
0
        //**********EVENTS RECEIVED FROM BLE - End

        private void startSyncProcess()
        {
            if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("932"))
            {
                this.syncDeviceHandler = SyncDeviceHandler932.GetInstance();
            }
            else if (this.Device.Name.Replace("PE", "").Replace("FT", "").StartsWith("961"))
            {
                this.syncDeviceHandler = SyncDeviceHandler961.GetInstance();
            }

            this.syncDeviceHandler.SetAdapter(this.Adapter);
            this.syncDeviceHandler.SetDevice(this.Device);
            this.syncDeviceHandler.StartSync();
        }