当前位置: 首页 > news >正文

如何用自家电脑做网站服务器关键词优化内容

如何用自家电脑做网站服务器,关键词优化内容,北京网站建设好不好天,企业网站策划方案网站建设方案零、基础知识 0.1、Android 应用可通过 Bluetooth API 执行以下操作 扫描其他蓝牙设备查询本地蓝牙适配器的配对蓝牙设备建立 RFCOMM 通道通过服务发现连接到其他设备与其他设备进行双向数据传输管理多个连接 0.2、蓝牙进行通信的四大必需任务 设置蓝牙查找局部区域内的配对…零、基础知识 0.1、Android 应用可通过 Bluetooth API 执行以下操作 扫描其他蓝牙设备查询本地蓝牙适配器的配对蓝牙设备建立 RFCOMM 通道通过服务发现连接到其他设备与其他设备进行双向数据传输管理多个连接 0.2、蓝牙进行通信的四大必需任务 设置蓝牙查找局部区域内的配对设备或可用设备连接设备在设备之间传输数据 0.3、动作 请求连接、接受连接和传输数据 蓝牙协议是适用于设备间蓝牙通信的无线接口规范。 如果手机要与无线耳机进行连接则两台设备都必须支持免提蓝牙协议。 0.4、协议 HFP协议Android 提供 BluetoothHeadset 类该类是用于控制蓝牙耳机服务的代理。其中包括蓝牙耳机和免提 (v1.5) 的协议。BluetoothHeadset 类包含对 AT 命令的支持。A2DP协议定义如何通过蓝牙连接和流式传输将高质量音频从一个设备传输至另一个设备。Android 提供 BluetoothA2dp 类该类是用于控制蓝牙 A2DP 服务的代理。蓝牙健康设备 (HDP)协议该协议允许您创建应用从而与支持蓝牙功能的健康设备例如心率监测仪、血糖仪、温度计、台秤等进行通信。 0.5、名词 RFCOMM 通道AT 命令耳机协议BluetoothHeadset类BluetoothSocket类SDP lookup of uuidSDP record 供应商特定的 AT 命令 从 Android 3.0API 级别 11开始应用可注册接收耳机发送的预定义供应商特定 AT 命令例如 Plantronics XEVENT 命令的系统广播。例如应用可接收指示所连接设备电池电量的广播并根据需要通知用户或采取其他操作。为 ACTION_VENDOR_SPECIFIC_HEADSET_EVENT Intent 创建广播接收器以处理耳机的供应商特定 AT 命令。 一、使用蓝牙 1.1 设置蓝牙 启用蓝牙 获取 BluetoothAdapter。 所有蓝牙 Activity 都需要 BluetoothAdapter。如要获取 BluetoothAdapter请调用静态的 getDefaultAdapter() 方法。此方法会返回一个 BluetoothAdapter 对象表示设备自身的蓝牙适配器蓝牙无线装置。整个系统只有一个蓝牙适配器并且您的应用可使用此对象与之进行交互。如果 getDefaultAdapter() 返回 null则表示设备不支持蓝牙。 BluetoothAdapter bluetoothAdapter BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter null) {// Device doesnt support Bluetooth } else {if (!bluetoothAdapter.isEnabled()) {Intent enableBtIntent new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);} }如果成功启用蓝牙您的 Activity 会在 onActivityResult() 回调中收到 RESULT_OK 结果代码。如果由于某个错误或用户响应“No”未成功启用蓝牙则结果代码为 RESULT_CANCELED。 1.2 查找设备 1.2.1 设备发现 如要开始发现设备只需调用 startDiscovery()。该进程为异步操作并且会返回一个布尔值指示发现进程是否已成功启动。发现进程通常包含约 12 秒钟的查询扫描随后会对发现的每台设备进行页面扫描以检索其蓝牙名称。 Override protected void onCreate(Bundle savedInstanceState) {...// Register for broadcasts when a device is discovered.IntentFilter filter new IntentFilter(BluetoothDevice.ACTION_FOUND);registerReceiver(receiver, filter); }// Create a BroadcastReceiver for ACTION_FOUND. private final BroadcastReceiver receiver new BroadcastReceiver() {public void onReceive(Context context, Intent intent) {String action intent.getAction();if (BluetoothDevice.ACTION_FOUND.equals(action)) {// Discovery has found a device. Get the BluetoothDevice// object and its info from the Intent.BluetoothDevice device intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);String deviceName device.getName();String deviceHardwareAddress device.getAddress(); // MAC address}} };Override protected void onDestroy() {super.onDestroy();...// Dont forget to unregister the ACTION_FOUND receiver.unregisterReceiver(receiver); }1.2.2 查询配对设备的列表 SetBluetoothDevice pairedDevices bluetoothAdapter.getBondedDevices();if (pairedDevices.size() 0) {// There are paired devices. Get the name and address of each paired device.for (BluetoothDevice device : pairedDevices) {String deviceName device.getName();String deviceHardwareAddress device.getAddress(); // MAC address} }1.2.3 启用可检测性 Intent discoverableIntent new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); // 可检测性开启300秒 startActivity(discoverableIntent);注意如果尚未在设备上启用蓝牙则启用设备可检测性会自动启用蓝牙。 1.2.4 已配对与已连接的区别 已配对是指两台设备知晓彼此的存在具有可用于身份验证的共享链路密钥并且能够与彼此建立加密连接。 已连接是指设备当前共享一个 RFCOMM 通道并且能够向彼此传输数据。当前的 Android Bluetooth API 要求规定只有先对设备进行配对然后才能建立 RFCOMM 连接。在使用 Bluetooth API 发起加密连接时系统会自动执行配对。 二、连接设备 2.1. 连接技术 2.1.1 作为服务器连接 private class AcceptThread extends Thread {private final BluetoothServerSocket mmServerSocket;public AcceptThread() {// Use a temporary object that is later assigned to mmServerSocket// because mmServerSocket is final.BluetoothServerSocket tmp null;try {// MY_UUID is the apps UUID string, also used by the client code.tmp bluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME, MY_UUID);} catch (IOException e) {Log.e(TAG, Sockets listen() method failed, e);}mmServerSocket tmp;}public void run() {BluetoothSocket socket null;// Keep listening until exception occurs or a socket is returned.while (true) {try {socket mmServerSocket.accept();} catch (IOException e) {Log.e(TAG, Sockets accept() method failed, e);break;}if (socket ! null) {// A connection was accepted. Perform work associated with// the connection in a separate thread.manageMyConnectedSocket(socket);mmServerSocket.close();break;}}}// Closes the connect socket and causes the thread to finish.public void cancel() {try {mmServerSocket.close();} catch (IOException e) {Log.e(TAG, Could not close the connect socket, e);}} }2.1.2 作为客户端连接 private class ConnectThread extends Thread {private final BluetoothSocket mmSocket;private final BluetoothDevice mmDevice;public ConnectThread(BluetoothDevice device) {// Use a temporary object that is later assigned to mmSocket// because mmSocket is final.BluetoothSocket tmp null;mmDevice device;try {// Get a BluetoothSocket to connect with the given BluetoothDevice.// MY_UUID is the apps UUID string, also used in the server code.tmp device.createRfcommSocketToServiceRecord(MY_UUID);} catch (IOException e) {Log.e(TAG, Sockets create() method failed, e);}mmSocket tmp;}public void run() {// Cancel discovery because it otherwise slows down the connection.bluetoothAdapter.cancelDiscovery();try {// Connect to the remote device through the socket. This call blocks// until it succeeds or throws an exception.mmSocket.connect();} catch (IOException connectException) {// Unable to connect; close the socket and return.try {mmSocket.close();} catch (IOException closeException) {Log.e(TAG, Could not close the client socket, closeException);}return;}// The connection attempt succeeded. Perform work associated with// the connection in a separate thread.manageMyConnectedSocket(mmSocket);}// Closes the client socket and causes the thread to finish.public void cancel() {try {mmSocket.close();} catch (IOException e) {Log.e(TAG, Could not close the client socket, e);}} }
http://www.hkea.cn/news/14528133/

相关文章:

  • 怎样建立网站免费的怎么做自己的网站弄商城佣金
  • 通过社交网站来做招聘决定安阳论坛网
  • 百度搜索这个网站为什么这么差wordpress $_file
  • php网站源码模板个人营销型网站
  • 做ssp用什么建网站wordpress 自动内链 代码
  • 本地网站后台管理建设杭州外贸网站制作
  • 有实力营销型网站建设广州网站开发小程序
  • 医疗网站建设多少钱wordpress栏目指定二级域名
  • phpcms如何发布网站网站查找工具
  • 四川网站备案核验单广州安全教育平台网
  • 软件程序员长沙官网seo
  • 福州网站建设方案服务自适应网站做多大尺寸的
  • 订阅号做影视网站永州网站建设优化
  • 如何做视频网站旗下账号家装设计师怎么学
  • 非常好的资讯网站设计北京文化馆设计公司怎么看
  • 网站建设文献综述模板网页制作图片怎么添加
  • 设计企业的网站基于wordpress建小程序JWT
  • 昆明seo网站推广poi player wordpress
  • 非主营电子商务企业网站有哪些创意灵感
  • 重庆商业网站有哪些微信小程序商城官网
  • 蚌埠市做网站网站建设的总体目标是什么
  • 青岛网站建设迅优网站页面怎么做导航
  • 普通网站建设计入什么科目免费自动推广手机软件
  • 群晖网站建设处理错误500wordpress 技巧
  • 邯郸北京网站建设任丘网站开发建设怎么选
  • 学做的网站基础蛋糕四川住房和城乡建设部网站首页
  • 做网站学哪方面知识线上商城介绍
  • 有没有做cad单的网站0453牡丹江信息网手机极速版
  • 东莞市主营网站建设服务机构大连手机模板建站
  • 辽阳网站推广无锡做网站企业