Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

sharpdev 5 & winrt & ble bluetooth

$
0
0

How do I avoid errors like this

The type or namespace name 'GattDeviceService' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

The type or namespace name 'Bluetooth' does not exist in the namespace 'Windows.Devices' (are you missing an assembly reference?) (CS0234) -

Changed the target to 8.0 in csproj file

Code is

Using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Windows.Devices.Enumeration;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;

namespace SensorTagTest
{
    class Program
    {
        /// <summary>
        /// DeviceInformationServiceのUUID
        /// </summary>
        private static readonly Guid DeviceInformationServiceUuid = GattDeviceService.ConvertShortIdToUuid(0x180a);
        /// <summary>
        ///
        /// </summary>
        private static readonly Guid KeyInputServiceUuid = GattDeviceService.ConvertShortIdToUuid(0xffe0);
        /// <summary>
        ///CharacteristicsのUUID
        /// </summary>
        private static readonly Guid KeyInputCharacteristicUuid = GattDeviceService.ConvertShortIdToUuid(0xffe1);

        static void Main(string[ args)
        {
            var cancellationTokenSource = new CancellationTokenSource();

            var task = UpdateServiceAsync(cancellationTokenSource.Token);

            Console.ReadKey();
            cancellationTokenSource.Cancel();
            task.Wait();
        }

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles