首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> Network >> 正文
Cobain: doing Bluetooth the easy way on Symbian OS/Series 60
作者:佚名    文章来源:不详    更新时间:2006-5-7 11:18:08

For those impatient, check out http://irssibot.777-team.org/cobain/. There is everything you need to get to know Cobain a bit more.

The following is basically the same text I posted on the Symbian DevNet forum.

We wrote a Bluetooth framework for a master’s project at our university, and after a lengthy process had it working and decided no one should be forced to go through the same process ;) The artifact of this work is a simple-to-use API for managing bluetooth connections. It features device/service discovery and connect/listen/read/write handling code.

A small example of how to fetch in-range service with, say, UUID = 0x123456


// create the API facade
CCobainLayer *cobain = CCobainLayer::NewL();

// fetch Bluetooth driver (Cobain will support other carriers too)
MNetworkDriver *driver = cobain->GetDriverL(EBluetooth);

// fetch peers synchronously - for demo purposes, normally
// we'd use asynchronous, of course
TPeerList *peerlist = driver->GetPeersL(0x123456);

// connect to the first peer found
CNetworkPeer *peer = (*peerlist)[0];
RCobainSocket *socket = peer->ConnectL();

// send some data
_LIT8(KData, "hello, world!");
socket->SendL(&KData);

// close & cleanup
socket->Close();
delete driver;
delete cobain;

That’s it.

The Cobain API is in its early stages; the functionality might seem clumsy at times. Although, the core has been tested quite extensively and is already running a couple of closed source products. The work on the API will continue and Cobain will evolve beyond being just an communications API - all design work is already done for a ad-hoc routing system, only thing missing is scatternet support in the devices.

happy hacking,

Matti

相关文章:
Carbide.c++: Setting up On Target Debugging
On Target Debugging using BlueTooth
Bluetooth: PC-Suite Configuration
Bluetooth: Pairing a mobile with an USB adapter
Bluetooth: Installation and Configuration of a Bluetooth USB adapter
gnuBox and Nokia 3230
Publish&Subscribe API and Bluetooth HCI Commands
Q&A: Connecting a Nokia 6600 to a TCP/IP Network via a Linux gateway using Bluetooth
 

站点地图 | 加入收藏 | 联系站长 | 广告服务 |
QQ:280529124  Tel:0592-8271361 辽ICP备05021703号