コード例 #1
0
        private async void BuzzButton_ClickOff(object sender, RoutedEventArgs e)
        {
            Button butt = (Button)sender;

            if (butt != null)
            {
                switch (butt.Name.Replace("IOButton", ""))
                {
                case "AllOff":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.AllOff, 0);

                    break;

                case "Enable":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Enable, 0);

                    break;

                case "Disable":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Disable, 0);

                    break;
                }
            }
        }
コード例 #2
0
        private async void chkEnableIOTButton2_Checked(object sender, RoutedEventArgs e)
        {
            string action = "";

            if (chkEnableIOTButton2.IsChecked == true)
            {
                action = "EnableIO";
            }
            else
            {
                action = "DisableIO";
            }

            switch (action)
            //from BuzzButton_ClickOf()
            {
            case "AllOff":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.AllOff, 0);

                break;

            case "EnableIO":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Enable, 0);

                break;

            case "DisableIO":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Disable, 0);

                break;
            }
        }
コード例 #3
0
        private async void BuzzButton_ClickOn(object sender, RoutedEventArgs e)
        {
            Button butt = (Button)sender;

            if (butt != null)
            {
                switch (butt.Name.Substring(0, 4))
                {
                case "LED1":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 1);

                    break;

                case "LED2":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 2);

                    break;

                case "BUZZ":
                    await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 4);

                    break;
                }
            }
        }
コード例 #4
0
        public MainPage()
        {
            this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            this.InitializeComponent();
            CC2650SensorTag.SetUp();

            UserOut.Text = "Searching for Bluetooth LE Devices...";
            resultsListView.IsEnabled = false;
            PairButton.IsEnabled      = false;

            ResultCollection = new ObservableCollection <DeviceInformationDisplay>();

            DataContext = this;
            //Start Watcher for pairable/paired devices
            CC2650SensorTag_BLEWatcher = new TICC2650SensorTag_BLEWatcher(this.UpdateButtons_WhenSensorsAreReady_CallBack, this.CallMeBackTemp, this.initSensor);
            StartWatcher();
        }
コード例 #5
0
        private async void BuzzButton_ClickOff(object sender, RoutedEventArgs e)
        {
            //HideMenu();
            string name = "";

            if (sender is Button)
            {
                Button butt = (Button)sender;

                if (butt != null)
                {
                    name = butt.Name.Replace("IOButton", "");
                }
            }
            else if (sender is TextBlock)
            {
                TextBlock tb = (TextBlock)sender;

                if (tb != null)
                {
                    name = tb.Text.Replace(" ", "");
                }
            }

            switch (name)

            {
            case "AllOff":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.AllOff, 0);

                break;

            case "EnableIO":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Enable, 0);

                break;

            case "DisableIO":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.Disable, 0);

                break;
            }
        }
コード例 #6
0
        private async void BuzzButton_ClickOn(object sender, RoutedEventArgs e)
        {
            //HideMenu();
            string name = "";

            if (sender is Button)
            {
                Button butt = (Button)sender;

                if (butt != null)
                {
                    name = butt.Name.Substring(0, 4);
                }
            }
            else if (sender is TextBlock)
            {
                TextBlock tb = (TextBlock)sender;

                if (tb != null)
                {
                    name = tb.Text.Replace(" ", "");
                }
            }

            switch (name)
            {
            case "LED1":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 1);

                break;

            case "LED2":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 2);

                break;

            case "Buzz":
                await CC2650SensorTag.GlobalActionIO(CC2650SensorTag.IOActions.On, 4);

                break;
            }
        }
コード例 #7
0
        public MainPage2()
        {
            this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            this.InitializeComponent();
            CC2650SensorTag.SetUp_SensorsLists();

            UserOut.Text = "Searching for Bluetooth LE Devices...";
            resultsListView.IsEnabled = false;
            PairButton.IsEnabled      = false;

            ResultCollection = new ObservableCollection <DeviceInformationDisplay>();

            DataContext = this;
            //Start Watcher for pairable/paired devices

            SysInfo.GetInfo();
            txtCompany.Text           += "    OS Version: " + SysInfo.SystemVersion;
            CountUpdateDataEvents      = false;
            CC2650SensorTag_BLEWatcher = new TICC2650SensorTag_BLEWatcher(this.UpdateButtons_WhenSensorsAreReady_CallBack, this.CallMeBackTemp, this.initSensor);
            var res = Task <bool> .Run(() => StartWatcher());
        }
コード例 #8
0
        private async Task  DoGetProp(bool doBattery)
        {
            System.Collections.Generic.Dictionary <CC2650SensorTag.SensorTagProperties, byte[]> props = await CC2650SensorTag.GetProperties(doBattery);

            int count = 0;

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                foreach (CC2650SensorTag.SensorTagProperties val in props.Keys)
                {
                    byte[] bytes  = props[val];
                    string Valstr = "";
                    if (bytes != null)
                    {
                        count++;
                        TextBlock PropBlock  = (TextBlock)FindName("Name" + count.ToString());
                        TextBlock ValueBlock = (TextBlock)this.FindName("Value" + count.ToString());
                        if (!CC2650SensorTag.showbytes.Contains(val))
                        {
                            Valstr = System.Text.Encoding.UTF8.GetString(bytes);
                            if (Valstr != null)
                            {
                                if (Valstr != "")
                                {
                                    PropBlock.Text  = val.ToString();
                                    ValueBlock.Text = Valstr;
                                }
                            }
                        }
                        else
                        {
                            if (bytes != null)
                            {
                                PropBlock.Text = val.ToString() + "[" + bytes.Length.ToString() + "]";

                                for (int i = 0; i < bytes.Length; i++)
                                {
                                    Valstr += " " + bytes[i].ToString("X2");
                                }
                                ValueBlock.Text = Valstr;
                            }
                            //NB:
                            //    Re: PNP_ID App got: pnp_id[7] { 01 0D 00 00 00 10 01 }
                            //    From:
                            //    https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/p/434053/1556237
                            //
                            //    In devinfoservice.c, you can find vendor ID and product ID information below where TI's vendor ID is 0x000D.
                            //    static uint8 devInfoPnpId[DEVINFO_PNP_ID_LEN] ={
                            //    1, // Vendor ID source (1=Bluetooth SIG)
                            //    LO_UINT16(0x000D), HI_UINT16(0x000D), // Vendor ID (Texas Instruments)
                            //    LO_UINT16(0x0000), HI_UINT16(0x0000), // Product ID (vendor-specific)
                            //    LO_UINT16(0x0110), HI_UINT16(0x0110) // Product version (JJ.M.N)};
                            //
                        }
                    }
                }
            });
        }//End of fn