xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 10KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-12
  • 語言: Java
  • 標(biāo)簽:

資源簡介

最簡單、功能最全的藍(lán)牙類,只需要繼承藍(lán)牙activity實(shí)現(xiàn)接口即可。讓藍(lán)牙開發(fā)變得簡單高效。

資源截圖

代碼片段和文件信息

package?com.mypeam.cjwddz.mpeam;

import?android.app.Activity;
import?android.bluetooth.BluetoothAdapter;
import?android.bluetooth.BluetoothDevice;
import?android.bluetooth.BluetoothSocket;
import?android.content.BroadcastReceiver;
import?android.content.Context;
import?android.content.Intent;
import?android.content.IntentFilter;
import?android.os.Bundle;

import?java.io.IOException;
import?java.io.InputStream;
import?java.io.OutputStream;
import?java.util.UUID;

/**
?*?Created?by?cjwddz?on?2016/8/21.
?*/
public?abstract?class?BleActivity?extends?Activity{

????public?static?BluetoothAdapter?bleadt?=BluetoothAdapter.getDefaultAdapter();
????private?static?final?UUID?PRIVATE_UUID?=?UUID.fromString(“00001101-0000-1000-8000-00805F9B34FB“);
????private?static?BluetoothSocket?socket=null;
????private?static?InputStream?in=null;
????private?static?OutputStream?out=null;

????BroadcastReceiver?blebroadcast=new?BroadcastReceiver()?{
????????@Override
????????public?void?onReceive(Context?context?Intent?intent)?{
????????????switch?(intent.getAction()){
????????????????case?BluetoothAdapter.ACTION_DISCOVERY_FINISHED:
????????????????????finishSearch();
????????????????????break;
????????????????case?BluetoothDevice.ACTION_ACL_CONNECTED:
???????????????????connectedSuccess();
????????????????????break;
????????????????case?BluetoothDevice.ACTION_ACL_DISCONNECTED:
????????????????????lostconnect();
????????????????????break;
????????????????case?BluetoothDevice.ACTION_FOUND:
????????????????????BluetoothDevice?device?=?intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
????????????????????deviceFound(device);
????????????????????break;
????????????}
????????}
????};
????@Override
????protected?void?onCreate(Bundle?savedInstanceState)?{
????????super.onCreate(savedInstanceState);
????????bleadt?=BluetoothAdapter.getDefaultAdapter();
????????IntentFilter?filter=new?IntentFilter();
????????filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
????????filter.addAction(BluetoothDevice.ACTION_FOUND);
????????filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
????????filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
????????registerReceiver(blebroadcastfilter);

????????if(islinking())
????????????reciveThread();
????}

????@Override
????protected?void?onDestroy()?{
????????unregisterReceiver(blebroadcast);
????????close();
????????super.onDestroy();
????}

????public?abstract?void?finishSearch();
????public?abstract?void?connectedSuccess();
????public?abstract?void?lostconnect();
????public?abstract?void?deviceFound(BluetoothDevice?device);
????public?abstract?void?connectFailed();
????public?abstract?void?bleMsg(byte[]?msg);


????//打開藍(lán)牙
????public?void?enableBle(boolean?force)
????{
????????if(!bleadt.isEnabled())
????????{
????????????if(force)
????????????????bleadt.enable();
????????????else
????????????{
????????????????Intent?enabler?=?new?I

評(píng)論

共有 條評(píng)論

相關(guān)資源