I can't get the bluetooth device to connect to my UWP application?

  • Thread starter Thread starter EKH10
  • Start date Start date
E

EKH10

Guest
Hi!

I can't get the SparkFun Bluetooth Mate Silver bluetooth device to connect to my UWP application.

Here is my code.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.Maker.RemoteWiring;
using Microsoft.Maker.Serial;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace Test_bluetooth
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
IStream connection;
RemoteDevice arduino;
public MainPage()
{
this.InitializeComponent();

connection = new BluetoothSerial("RNBT-07A2");
arduino = new RemoteDevice(connection);

arduino.DeviceReady += Setup;

connection.begin(115200, SerialConfig.SERIAL_8N1);

}
public void Setup()
{
testTextBlock.Text = "CONNECTED!!";
}
}
}

Here is my Capabilities settings.

1488211.jpg

Here is my Package.appxmanifest file.

<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">

<Identity
Name="7ff866dd-4861-4c80-89b7-b3bbd9e0b429"
Publisher="CN=Admin"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="7ff866dd-4861-4c80-89b7-b3bbd9e0b429" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>Test_bluetooth</DisplayName>
<PublisherDisplayName>Admin</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="Test_bluetooth.App">
<uap:VisualElements
DisplayName="Test_bluetooth"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="Test_bluetooth"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="bluetooth"/>
</Capabilities>
</Package>

What is still missing to get the bluetooth device to work?

I have also install the windows arduino remote nuget package.

But when I test the bluetooth device with Windows arduino remote experience it works fine.

Continue reading...
 

Similar threads

Back
Top