简体   繁体   English

Java(J2SE)和蓝牙

[英]Java (J2SE) and Bluetooth

I want to write some small program. 我想写一些小程序。 It will run on my computer(laptop) with bluetooth adapter and then discover all the visible Bluetooth adapters (phones, printers, other computers, etc.), but I've not worked with bluetooth in Java before. 它将在我的计算机(笔记本电脑)上运行蓝牙适配器,然后发现所有可见的蓝牙适配器(电话,打印机,其他计算机等),但我以前没有使用过Java蓝牙。

Help me to find starting point, please. 请帮我找到起点。 What SDKs or libraries I must download first? 我必须首先下载哪些SDK或库? What literature to read? 要读什么文学?

I've googled BlueCove, but it doesn't support my Samsung D600, so I could not test my app. 我用谷歌搜索了BlueCove,但它不支持我的三星D600,所以我无法测试我的应用程序。

This java sample will discover all visible devices, and it works with both the BlueCove and Avetana libraries ( http://www.avetana-gmbh.de/avetana-gmbh/produkte/jsr82.eng.xml ): 这个java示例将发现所有可见的设备,它适用于BlueCove和Avetana库( http://www.avetana-gmbh.de/avetana-gmbh/produkte/jsr82.eng.xml ):

http://www.jsr82.com/jsr-82-sample-device-discovery/ http://www.jsr82.com/jsr-82-sample-device-discovery/

Bluecove tends to be the best supported lib, however, you will find that the various underlying native bluetooth stacks on Windows vary dramatically in quality. Bluecove往往是最受支持的lib,但是,您会发现Windows上的各种底层本机蓝牙堆栈的质量差别很大。 The native Windows stack is only marginally supported by the Java APIs. Java API仅略微支持本机Windows堆栈。 BlueSoleil is slightly better, and Widcomm is generally the preferred. BlueSoleil略胜一筹,Widcomm通常是首选。

However, neither BlueSoleil nor Widcomm are free if they didn't come with your adapter, though Widcomm can be hacked to work with non-officially supported adapters. 但是,如果没有配备适配器,BlueSoleil和Widcomm都不会免费,但Widcomm可以被黑客攻击与非官方支持的适配器一起使用。 The big limitation with it is that Bluecove does not support Widcomm on 64bit Windows. 最大的限制是Bluecove不支持64位Windows上的Widcomm。

Personally, I ended up just using Linux for Bluetooth development as it all just works there. 就个人而言,我最终只是使用Linux进行蓝牙开发,因为它只是在那里工作。 :) I have not tried Avetana at all. :)我根本没试过Avetana。

Ok, sorry for annoying. 好的,抱歉烦人。 I've found an answer and it is BlueCove. 我找到了答案,它是BlueCove。 After installing additional libs it works perfect on Linux Mint 7 now. 安装其他库后,它现在在Linux Mint 7上运行完美。 Even, not listed in compatibility list Samsung D600 was discovered perfectly. 甚至,没有在兼容性列表中列出三星D600被完美发现。 Test program output: 测试程序输出:

run:
BlueCove version 2.1.0 on bluez
Address: 0006C990021D
Name: hostname-0
Starting device inquiry...
Device discovered: 0015B95BEA0F
INQUIRY_COMPLETED
Device Inquiry Completed. 
Bluetooth Devices: 
1. 0015B95BEA0F (zl0-b0tan)
BlueCove stack shutdown completed
BUILD SUCCESSFUL (total time: 13 seconds)

here are some steps to help you out 这里有一些步骤来帮助你

at server side you need jdk version 6 or later , j2se, and wireless toolkit by sun and bluecove 2.1.1.jar put this jar file in 在服务器端你需要jdk版本6或更高版本,j2se和sun和bluecove 2.1.1.jar的无线工具包把这个jar文件放入

java/jdk/jre/lib/ext folder. java / jdk / jre / lib / ext文件夹。

to start java programming first you need to learn the bluetooth stack and inbuilt functions at bluecove site here ! 启动java编程首先你需要学习的蓝牙堆栈和内置功能在bluecove网站在这里

enjoiiiii!! enjoiiiii!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM