注册代理以处理事件(BluetoothLE) [英] Registering a delegate to handle an event (BluetoothLE)

查看:329
本文介绍了注册代理以处理事件(BluetoothLE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在论坛的正确部分没有提出这个问题我很抱歉。

I apologize if this question is not asked in correct part of the forum.

这个问题涉及  BluetoothLEAdvertisementWatcher.Received Event。 我将不胜感激任何帮助,因为我无法得到它工作。 

This question is regarding to BluetoothLEAdvertisementWatcher.Received Event. I would appreciate any help, since I can't get it to work. 

我在注册委托处理事件时遇到问题。我是这类编程的新手,我完全迷失了。我有一个C#代码没有问题,但是当谈到C ++ / WinRT
时它完全不同。首先,我正在启动一个广告观察者,并将扫描模式设置为激活:

I'm having trouble registering a delegate to handle an event. I'm new to this type of programming and I'm completely lost. I have a C# code working with no problem, but when it comes to C++/WinRT it's completely different. First, I'm starting an advertisement watcher, and setting a scanning mode to active:

BluetoothLEAdvertisementWatcher watcher = BluetoothLEAdvertisementWatcher();
watcher.ScanningMode(BluetoothLEScanningMode::Active);

这是有效的,因为我已经检查了ScanningMode等。然后我尝试注册:

watcher.Received({ this, &Handlers::OnAdvertisementReceivedAsync });

这可能不是这样做的,但就像我提到的那样,我没有如何从这一点开始。

OnAdvertisementReceivedAsync  函数:

void Handlers::OnAdvertisementReceivedAsync(BluetoothLEAdvertisementWatcher const& watcher, BluetoothLEAdvertisementReceivedEventArgs const& eventArgs)







推荐答案

您好,

感谢您在此处发帖。

>>注册代表处理event(BluetoothLE)

Hers是一个关于注册代表来处理c ++ / Win RT事件的文档。你可以参考它。

Hers is a document about registering a delegate to handle an event with c++/Win RT. You could refer to it.

https://docs.microsoft.com/ en-us / windows / uwp / cpp-and-winrt-apis / handle-events

此外,请提供有关您项目的更多信息。是吗桌面应用程序或UWP应用程序?如果您的应用程序是UWP应用程序,我会将其移至UWP论坛以获得更好的支持。

Besides, please provide more information about your project. Is it a desktop application or UWP app? If your app is an UWP app, I will move it to UWP forum for better support.

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最好的问候,

Baron Bi

Baron Bi


这篇关于注册代理以处理事件(BluetoothLE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆