Android Open Source - BLEMeshChat B L E Peripheral Response

From Project

Back to project page BLEMeshChat.


The source code is released under:

GNU General Public License

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;
//from   w  w  w .j a v a  2 s  .c  om
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattServer;

 * Created by davidbrodsky on 10/20/14.
public abstract class BLEPeripheralResponse {

    public static enum 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.
    public abstract byte[] 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.
    public int getExpectedPayloadLength() { return 0; }

Java Source Code List