Copyright (c) 2014, Ratio LLC.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
...
If you think the Android project BLEService listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.ratio.deviceService.receivers;
/*www.java2s.com*/import java.util.ArrayList;
import java.util.List;
import com.ratio.deviceService.BTCharacteristicProfile;
import com.ratio.deviceService.BTDescriptorProfile;
import com.ratio.deviceService.BTServiceProfile;
import com.ratio.deviceService.DeviceService;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
* broadcast receiver which receives the response from IDeviceCommand.readDescriptor()
* @author matt2
*
*/publicabstractclass RSSIReceiver extends BroadcastReceiver {
@Override
publicvoid onReceive(Context context, Intent intent) {
String deviceAddress = intent.getStringExtra(DeviceService.EXTRA_DEVICE_ADDRESS);
int rssi = intent.getIntExtra(DeviceService.EXTRA_RSSI, 0);
int status = intent.getIntExtra(DeviceService.EXTRA_STATUS, 0);
onRSSI(deviceAddress, rssi, status);
}
/**
* implement this to receive the rssi from the device
* @param deviceAdress String of the device MAC address
* @param status status code 0: good, otherwise bad things happened
*/publicabstractvoid onRSSI(String deviceAdress,
int rssi,
int status);
}