當前位置: 首頁>>代碼示例>>Java>>正文


Java BluetoothGattService.getCharacteristic方法代碼示例

本文整理匯總了Java中com.samsung.android.sdk.bt.gatt.BluetoothGattService.getCharacteristic方法的典型用法代碼示例。如果您正苦於以下問題:Java BluetoothGattService.getCharacteristic方法的具體用法?Java BluetoothGattService.getCharacteristic怎麽用?Java BluetoothGattService.getCharacteristic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.samsung.android.sdk.bt.gatt.BluetoothGattService的用法示例。


在下文中一共展示了BluetoothGattService.getCharacteristic方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DummyReadForSecLevelCheck

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void DummyReadForSecLevelCheck(BluetoothDevice device) {
	boolean result = false;
	if (mBluetoothGatt != null && device != null) {
		BluetoothGattService disService = mBluetoothGatt.getService(device, DIS_UUID);
		if (disService == null) {
			showMessage("Dis service not found!");
			return;
		}

		BluetoothGattCharacteristic firmwareIdCharc = disService.getCharacteristic(FIRMWARE_REVISON_UUID);
		if (firmwareIdCharc == null) {
			showMessage("firmware revison charateristic not found!");
			return;
		}
		result = mBluetoothGatt.readCharacteristic(firmwareIdCharc);
		if (result == false) {
			showMessage("firmware revison reading is failed!");
		}
	}
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:21,代碼來源:HRPService.java

示例2: enableHRNotification

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void enableHRNotification(BluetoothDevice device) {
	boolean result = false;
	Log.i(TAG, "enableHRNotification ");
	isNoti = true;
	BluetoothGattService mHRP = mBluetoothGatt.getService(device, HRP_SERVICE);
	if (mHRP == null) {
		Log.e(TAG, "HRP service not found!");
		return;
	}
	BluetoothGattCharacteristic mHRMcharac = mHRP.getCharacteristic(HEART_RATE_MEASUREMENT_CHARAC);
	if (mHRMcharac == null) {
		Log.e(TAG, "HEART RATE MEASUREMENT charateristic not found!");
		return;
	}
	BluetoothGattDescriptor mHRMccc = mHRMcharac.getDescriptor(CCC);
	if (mHRMccc == null) {
		Log.e(TAG, "CCC for HEART RATE MEASUREMENT charateristic not found!");
		return;
	}
	result = mBluetoothGatt.readDescriptor(mHRMccc);
	if (result == false) {
		Log.e(TAG, "readDescriptor() is failed");
		return;
	}

}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:27,代碼來源:HRPService.java

示例3: ResetEnergyExpended

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void ResetEnergyExpended(BluetoothDevice device) {
	Log.i(TAG, "ResetEnergyExpended ");
	BluetoothGattService mHRP = mBluetoothGatt.getService(device, HRP_SERVICE);
	if (mHRP == null) {
		Log.e(TAG, "HRP service not found!");
		return;
	}
	BluetoothGattCharacteristic mHRCPcharac = mHRP.getCharacteristic(HeartRate_ControlPoint);
	if (mHRCPcharac == null) {
		Log.e(TAG, "HEART RATE Copntrol Point charateristic not found!");
		return;
	}

	byte[] value = new byte[1];
	value[0] = (byte) RESET_ENERGY_EXPANDED;
	mHRCPcharac.setValue(value);
	mBluetoothGatt.writeCharacteristic(mHRCPcharac);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:19,代碼來源:HRPService.java

示例4: disableNotification

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void disableNotification(BluetoothDevice device) {
	BluetoothGattService mHRP = mBluetoothGatt.getService(device, HRP_SERVICE);
	if (mHRP == null) {
		Log.e(TAG, "HRP service not found!");
		return;
	}
	BluetoothGattCharacteristic mHRMcharac = mHRP.getCharacteristic(HEART_RATE_MEASUREMENT_CHARAC);
	if (mHRMcharac == null) {
		Log.e(TAG, "HEART RATE MEASUREMENT charateristic not found!");
		return;
	}
	BluetoothGattDescriptor mHRMccc = mHRMcharac.getDescriptor(CCC);
	if (mHRMccc == null) {
		Log.e(TAG, "CCC for HEART RATE MEASUREMENT charateristic not found!");
		return;
	}
	byte[] value = mHRMccc.getValue();
	if (value != null && value[0] == BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE[0]) {
		enableNotification(false, mHRMcharac);
	}
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:22,代碼來源:HRPService.java

示例5: getBodySensorLoc

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void getBodySensorLoc(BluetoothDevice device) {
	Log.i(TAG, "getBodySensorLoc");
	BluetoothGattService mHRP = mBluetoothGatt.getService(device, HRP_SERVICE);
	if (mHRP == null) {
		Log.e(TAG, "getBodySensorLoc: mHRP = null");

		return;
	}
	BluetoothGattCharacteristic mBSLcharac = mHRP.getCharacteristic(BODY_SENSOR_LOCATION);
	if (mBSLcharac == null) {
		Log.e(TAG, "getBodySensorLoc: mBSLcharac = null");
		return;
	}
	mBluetoothGatt.readCharacteristic(mBSLcharac);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:16,代碼來源:HRPService.java

示例6: read_uuid_read_25

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void read_uuid_read_25(BluetoothDevice device) {
	Log.i(TAG, "read 0x2A25 uuid charachteristic");
	BluetoothGattService mDI = mBluetoothGatt.getService(device, DEVICE_INFORMATION);
	if (mDI == null) {
		Log.e(TAG, "Device Information Service Not Found!!!");
		return;
	}
	BluetoothGattCharacteristic mSNS = mDI.getCharacteristic(SERIAL_NUMBER_STRING);
	if (mSNS == null) {
		Log.e(TAG, "Serial Number String Characteristic Not Found!!!");
		return;
	}
	mBluetoothGatt.readCharacteristic(mSNS);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:15,代碼來源:HRPService.java

示例7: read_uuid_read_29

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void read_uuid_read_29(BluetoothDevice device) {
	Log.i(TAG, "read 0x2A29 uuid charachteristic");
	BluetoothGattService mDI = mBluetoothGatt.getService(device, DEVICE_INFORMATION);
	if (mDI == null) {
		Log.e(TAG, "Device Information Service Not Found!!!");
		return;
	}
	BluetoothGattCharacteristic mMNS = mDI.getCharacteristic(MANUFATURE_NAME_STRING);
	if (mMNS == null) {
		Log.e(TAG, "Manufacture Name String Characteristic Not Found!!!");
		return;
	}
	mBluetoothGatt.readCharacteristic(mMNS);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:15,代碼來源:HRPService.java

示例8: read_uuid_read_2A

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void read_uuid_read_2A(BluetoothDevice device) {
	Log.i(TAG, "read 0x2A2A uuid charachteristic");
	BluetoothGattService mDI = mBluetoothGatt.getService(device, DEVICE_INFORMATION);
	if (mDI == null) {
		Log.e(TAG, "Device Information Service Not Found!!!");
		return;
	}
	BluetoothGattCharacteristic mICDL = mDI.getCharacteristic(ICDL);
	if (mICDL == null) {
		Log.e(TAG, "IEEE Characteristic data string Not Found!!!");
		return;
	}
	mBluetoothGatt.readCharacteristic(mICDL);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:15,代碼來源:HRPService.java

示例9: disableHRNotification

import com.samsung.android.sdk.bt.gatt.BluetoothGattService; //導入方法依賴的package包/類
public void disableHRNotification(BluetoothDevice device) {
	BluetoothGattService mHRP = mBluetoothGatt.getService(device, HRP_SERVICE);
	if (mHRP == null) {
		Log.e(TAG, "HRP service not found!");
		return;
	}
	BluetoothGattCharacteristic mHRMcharac = mHRP.getCharacteristic(HEART_RATE_MEASUREMENT_CHARAC);
	if (mHRMcharac == null) {
		Log.e(TAG, "HEART RATE MEASUREMENT charateristic not found!");
		return;
	}
	enableNotification(false, mHRMcharac);
}
 
開發者ID:TheGenuine,項目名稱:BeaconScanner,代碼行數:14,代碼來源:HRPService.java


注:本文中的com.samsung.android.sdk.bt.gatt.BluetoothGattService.getCharacteristic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。