本文介绍了[Windows :: Devices :: Bluetooth :: Advertisement]在Win10中使用VS2015 C ++获得了BluetoothError :: OtherError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

C#示例(https://github.com/andijakl/universal-beacon/ tree / master / UniversalBeaconLibrary)在我的电脑上运行良好,可以接收广告包。

The C# sample (https://github.com/andijakl/universal-beacon/tree/master/UniversalBeaconLibrary) run well on my PC and can receive advertisement packet.

我自己开发的C ++项目总是得到BluetoothError :: OtherError。

The C++ project developed by myself always got BluetoothError::OtherError.

有人可以帮忙吗?

Windows 10 Professional X64 / Visual Studio Professional 2015

Windows 10 Professional X64 / Visual Studio Professional 2015

代码片段

使用命名空间Windows :: Devices :: Bluetooth;

使用命名空间Windows :: Devices :: Bluetooth: :广告;

using namespace Windows::Devices::Bluetooth;
using namespace Windows::Devices::Bluetooth::Advertisement;

void App :: WatcherOnReceived(BluetoothLEAdvertisementWatcher ^ sender,BluetoothLEAdvertisementReceivedEventArgs ^ eventArgs)

{}

void App::WatcherOnReceived(BluetoothLEAdvertisementWatcher^ sender, BluetoothLEAdvertisementReceivedEventArgs^ eventArgs)
{}

void App :: WatcherOnStopped(BluetoothLEAdvertisementWatcher ^ sender,BluetoothLEAdvertisementWatcherStoppedEventArgs ^ eventArgs)

{}

void App::WatcherOnStopped(BluetoothLEAdvertisementWatcher^ sender, BluetoothLEAdvertisementWatcherStoppedEventArgs ^ eventArgs)
{}

void App :: StartBeacon()

void App::StartBeacon()

{

BluetoothLEAdvertisementWatcher ^ watcher;

BluetoothLEAdvertisementWatcher^ watcher;

watcher = ref新的BluetoothLEAdvertisementWatcher();

watcher = ref new BluetoothLEAdvertisementWatcher();

watcher-> ScanningMode = BluetoothLEScanningMode :: Active;

watcher->ScanningMode = BluetoothLEScanningMode::Active;

watcher->收到+ = ref新的TypedEventHandler< BluetoothLEAdvertisementWatcher ^,BluetoothLEAdvertisementReceivedEventArgs ^>(此,& App :: WatcherOnReceived);

     watcher->已停止+ = ref新的TypedEventHandler< BluetoothLEAdvertisementWatcher ^,BluetoothLEAdvertisementWatcherStoppedEventArgs ^>(此,& App :: WatcherOnStopped);

watcher->Received += ref new TypedEventHandler<BluetoothLEAdvertisementWatcher^, BluetoothLEAdvertisementReceivedEventArgs^>(this, &App::WatcherOnReceived);
    watcher->Stopped += ref new TypedEventHandler<BluetoothLEAdvertisementWatcher^, BluetoothLEAdvertisementWatcherStoppedEventArgs ^>(this, &App::WatcherOnStopped);

watcher-> Start();

watcher->Start();

}

干杯

推荐答案

此论坛是关于visual studio IDE的,因为您的问题与您的项目有关,它将与
相关,我帮助您将此案例移至开发通用Windows应用程序论坛以获得专门支持。感谢您的理解。

This forum is about visual studio IDE, as your issue is related to your project, it would be related toDeveloping Universal Windows apps , I help you move this case to developing universal windows apps forum for dedicated support. Thank you for your understanding.

最诚挚的问候,


这篇关于[Windows :: Devices :: Bluetooth :: Advertisement]在Win10中使用VS2015 C ++获得了BluetoothError :: OtherError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 08:55