Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Development
  4. Bluetooth with UWP

Bluetooth with UWP

Scheduled Pinned Locked Moved Windows Development
helpquestioncsharpjson
6 Posts 3 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10650102
    wrote on last edited by
    #1

    Hello I am starting on a UWP app that requires a bluetooth connection. I'm using VS2015 with update2. I have looked at RFCOMM and tried to implement it however I get this error : "cannot find type System.Net.EndPoint in module System.dll" Can someone help me in solving this. What is the best bluetooth API to use? Thanks, Ron

    L P 2 Replies Last reply
    0
    • U User 10650102

      Hello I am starting on a UWP app that requires a bluetooth connection. I'm using VS2015 with update2. I have looked at RFCOMM and tried to implement it however I get this error : "cannot find type System.Net.EndPoint in module System.dll" Can someone help me in solving this. What is the best bluetooth API to use? Thanks, Ron

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      System.Net.EndPoint should be available in the framework libraries as described in EndPoint Class (System.Net)[^]. How are you referring to it?

      U 1 Reply Last reply
      0
      • L Lost User

        System.Net.EndPoint should be available in the framework libraries as described in EndPoint Class (System.Net)[^]. How are you referring to it?

        U Offline
        U Offline
        User 10650102
        wrote on last edited by
        #3

        here is the code I'm working with, Trying to find paired devices

        using System;
        using Windows.UI.Xaml;
        using Windows.UI.Xaml.Controls;
        using Windows.Devices.Bluetooth.Rfcomm;
        using Windows.Devices.Enumeration;

        // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

        namespace GI_MobileApp.Pages
        {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class BTDevicesPage : Page
        {
        private DeviceInformationCollection ServiceDeviceCollection = null;
        public static readonly Guid RfcommChatServiceUuid = Guid.Parse("00001101-0000-1000-8000-00805f9b34fb");

            public BTDevicesPage()
            {
                this.InitializeComponent();
                InitialPara();
        
            }
        
           
            private void tbtnConnect\_Changed(object sender, RoutedEventArgs e)
            {
                on\_off();
            }
        
            /// <summary>
            /// Method for connect and disconnect
            /// </summary>
            private void on\_off()
            {
                switch (this.tbtnConnect.IsChecked)
                {
                    case null:
                        this.tbtnConnect.Content = "Connect";
                        break;
                    case true:
                        this.tbtnConnect.Content = "Disconnect";
                        break;
                    case false:
                        this.tbtnConnect.Content = "Connect";
                        scan();
                        break;
        
                }
            }
        
          
            private async void scan()
            {
                //Find all paired devices and display them in a list
                ServiceDeviceCollection = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
        
                if (ServiceDeviceCollection.Count > 0)
                {
                    tbRxData.Text = "";
                    foreach (var btDeviceice in ServiceDeviceCollection)
                    {
                        tbRxData.Text = (btDeviceice.Name);
                    }
                    tbRxData.Visibility = Visibility;
                }
                else
                {
                   
                }
            }
        
            
            /// <summary>
            /// Method Initialising parameters
            /// </summary>
            private void InitialPara()
            {
                this.tbtnConnect.IsChecked
        
        L 1 Reply Last reply
        0
        • U User 10650102

          here is the code I'm working with, Trying to find paired devices

          using System;
          using Windows.UI.Xaml;
          using Windows.UI.Xaml.Controls;
          using Windows.Devices.Bluetooth.Rfcomm;
          using Windows.Devices.Enumeration;

          // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

          namespace GI_MobileApp.Pages
          {
          /// <summary>
          /// An empty page that can be used on its own or navigated to within a Frame.
          /// </summary>
          public sealed partial class BTDevicesPage : Page
          {
          private DeviceInformationCollection ServiceDeviceCollection = null;
          public static readonly Guid RfcommChatServiceUuid = Guid.Parse("00001101-0000-1000-8000-00805f9b34fb");

              public BTDevicesPage()
              {
                  this.InitializeComponent();
                  InitialPara();
          
              }
          
             
              private void tbtnConnect\_Changed(object sender, RoutedEventArgs e)
              {
                  on\_off();
              }
          
              /// <summary>
              /// Method for connect and disconnect
              /// </summary>
              private void on\_off()
              {
                  switch (this.tbtnConnect.IsChecked)
                  {
                      case null:
                          this.tbtnConnect.Content = "Connect";
                          break;
                      case true:
                          this.tbtnConnect.Content = "Disconnect";
                          break;
                      case false:
                          this.tbtnConnect.Content = "Connect";
                          scan();
                          break;
          
                  }
              }
          
            
              private async void scan()
              {
                  //Find all paired devices and display them in a list
                  ServiceDeviceCollection = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
          
                  if (ServiceDeviceCollection.Count > 0)
                  {
                      tbRxData.Text = "";
                      foreach (var btDeviceice in ServiceDeviceCollection)
                      {
                          tbRxData.Text = (btDeviceice.Name);
                      }
                      tbRxData.Visibility = Visibility;
                  }
                  else
                  {
                     
                  }
              }
          
              
              /// <summary>
              /// Method Initialising parameters
              /// </summary>
              private void InitialPara()
              {
                  this.tbtnConnect.IsChecked
          
          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          What is the question?

          U 1 Reply Last reply
          0
          • L Lost User

            What is the question?

            U Offline
            U Offline
            User 10650102
            wrote on last edited by
            #5

            When I run the code above I get this error : cannot find type System.Net.EndPoint in module System.dll. I need help solving this error? Thanks

            1 Reply Last reply
            0
            • U User 10650102

              Hello I am starting on a UWP app that requires a bluetooth connection. I'm using VS2015 with update2. I have looked at RFCOMM and tried to implement it however I get this error : "cannot find type System.Net.EndPoint in module System.dll" Can someone help me in solving this. What is the best bluetooth API to use? Thanks, Ron

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              For UWP apps, I believe you're going to have to use the Bluetooth GATT[^] classes. System.Net.EndPoint isn't present in UWP.

              This space for rent

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups