If you think the Android project BLEMeshChat 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 pro.dbro.ble.transport.ble;
//fromwww.java2s.comimport android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattServer;
/**
* Created by davidbrodsky on 10/20/14.
*/publicabstractclass BLEPeripheralResponse {
publicstaticenum RequestType { READ, WRITE }
public BluetoothGattCharacteristic mCharacteristic;
public RequestType mRequestType;
public BLEPeripheralResponse(BluetoothGattCharacteristic characteristic, RequestType requestType) {
mCharacteristic = characteristic;
mRequestType = requestType;
}
/**
* @return any data sent in this response for caching purposes. Large requests/responses will be packetized
* over several requests, but BLEPeripheral will deliver the final recombined result.
*/publicabstractbyte[] respondToRequest(BluetoothGattServer localPeripheral, BluetoothDevice remoteCentral,
int requestId, BluetoothGattCharacteristic characteristic,
boolean preparedWrite, boolean responseNeeded, byte[] value);
/**
* Required for WRITE requests.
*
* @return the expected payload length in bytes. respondToRequest will be called when
* the received data from the Central matches the value returned here.
*/publicint getExpectedPayloadLength() { return 0; }
}