首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian >> Symbian开发 >> 正文
蓝牙源代码
作者:风生水起    文章来源:风生水起    更新时间:2006-7-30 10:48:41

 //判断蓝牙是否打开的函数
TBool CMessageClient::GetBluetoothOn()
{
  // Create and initialise an RHostResolver
   RHostResolver hr;
   TInt res = false;
   TBool ret;
  
   RSocketServ socketServer;
   User::LeaveIfError(socketServer.Connect());        
   CleanupClosePushL(socketServer);
  
   res =  hr.Open(socketServer, KBTAddrFamily, KBTLinkManager);
  
   if (KErrNone != res) {
      // if not success, this means bluetooth is not on
      ret = EFalse;
   }
  
   else
   {
      ret = ETrue; // Bluetooth is already ON
      hr.Close();
   }
  
   CleanupStack::PopAndDestroy(1); 
  
   return ret;
}

//打开蓝牙的函数
void CMessageClient::ProcessBTPowerON()
{
 TPckgBuf<TBool> pckg;
 RNotifier iNotifier;
 TPckgBuf<TBool> iNotifierResult;
 TRequestStatus status;

 User::LeaveIfError(iNotifier.Connect());
 iNotifier.StartNotifierAndGetResponse(status,KPowerModeSettingNotifierUid,pckg,iNotifierResult);
 User::WaitForRequest(status);
 User::LeaveIfError(status.Int());

 iNotifier.CancelNotifier(KPowerModeSettingNotifierUid);
 iNotifier.Close();
 User::LeaveIfError(iNotifierResult[0]);
}

相关文章:
如何在进程间共享文件句柄
蓝牙API指南
彻底解决Symbian全屏显示问题
能力(Capabilities)
在S60 3rd的手机上显示所有已安装程序的Uid
S60平台:Bluetooth API开发伙伴指南——搜索和发布
S60平台:Bluetooth API开发伙伴指南——服务搜索
S60平台:Bluetooth API开发伙伴指南——设备搜索
 

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