蓝牙C#问题. [英] Bluetooth C# question.

查看:91
本文介绍了蓝牙C#问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我想开发一个小型应用程序,该程序可以在计算机上运行并检测手机何时在范围内.
想法是让程序每30秒左右扫描一次,以简单地检查我是否在周围.
您认为以相对容易和简单的方式做到这一点吗?

我在32feet中找到了一个名为thethehand的C#蓝牙库.

感谢您的反馈
Simmi

Hi.
I want to develop a small application that runs on my computer and detects when my phone is within range.
The idea is to have the program scan every 30 seconds or so to simply check if I am around or not.
Do you think this is doable in a relatively easy and simple way?

I found a bluetooth lirary for C# called inthehand from 32feet.

Thanks for your feedback
Simmi

推荐答案

您好,

我不确定您是在问这是否可能,是否可以做到,还是只是问这是一个好主意.这是一个好主意,取决于您要使用它做什么(您没有说过).当然,可以简单地轮询USB蓝牙芯片以了解当前范围内的哪些设备(这应该是最容易的事情之一,尤其是在您已经找到要使用的库的情况下),然后只需检查该设备列表即可.它应该简单易行.

但是,如果您想将其用作检测您的状态的可靠方法,则从根本上来说是有缺陷的.获取范围内的设备名称列表可能是最简单的.但是,这将使任何与您的名字相同的设备看起来都与您的设备完全一样,从而欺骗了您的存在.您也许可以获取设备ID的列表,但这很容易遇到相同的问题(Id欺骗).因此,如果您出于安全目的等目的使用它,确实不是一个好主意.

如果您的手机是智能手机,则可以为其编写一个应用程序,该应用程序将在范围内与计算机通信,并为手机/计算机使用公钥/私钥加密和自己的证书系统.不幸的是,这既不简单也不容易.

希望这会有所帮助,
埃德

哦,顺便说一句,我查找了您正在使用的库.这是您想要的文档页面: http://32feet.codeplex.com/wikipage?title = Discovery& referringTitle =文档 [ ^ ]

只需将示例从VVB.Net转换为C#-并不是很难...
Hi there,

I''m not sure if you''re asking whether this is possible, and if so how to do it, or just asking if it''s a good idea. Whether it''s a good idea or not depends on what you''re trying to do with it (which you haven''t said). It is certainly possible to simply poll your USB Bluetooth chip for what devices are currently in range (should be one of the easiest things to do, especially if you have found a library for doing it) and then simply check in that list for your device. It should be simple and easy.

However, it is very fundamentally flawed if you are wanting to use this as a reliable way for detecting your presence. It is probably easiest to get a list of device names that are within range. However, this would allow any device with the same name as yours to look exactly like yours, thus spoofing your presence. You may be able to get a list of device Ids instead, but that is susceptible to the same problem (Id spoofing). So this really isn''t a good idea if you are trying to use it for security purposes etc.

If your phone is a smart phone you could write an app for it that will communicate with your computer when it is in range and use public key/private key encryption and your own certificates system for your phone/computer. Unfortunately this is then neither simple nor easy.

Hope this helps,
Ed

Oh by the way, I looked up the library you are using. Here''s the documentation page that you want: http://32feet.codeplex.com/wikipage?title=Discovery&referringTitle=Documentation[^]

Just convert the samples from VVB.Net to C# - not very hard...


我已经解决了我的问题.
如果有人想做同样的事情,那么请看此页面:
谢谢
I have solved my question.
If anyone wants to do the same then take a look at this page: http://32feet.codeplex.com/wikipage?title=Testing%20if%20a%20device%20is%20in%20range&referringTitle=Documentation[^]

I have written a small application that does exactly what I want it to do.
About the security issues that Ed was pointing at: I am not sure if it is needed. I use my devices address hardcoded into the software.

Basically I have a timer set to XX seconds/minutes that runs the code on that webpages and tells if the device is in range or not.

If someone knows how that could be exploited, "hacked", please do tell me.

Thanks


这篇关于蓝牙C#问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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