1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.clj.fastble.exception;
 
import java.io.Serializable;
 
 
public abstract class BleException implements Serializable {
    private static final long serialVersionUID = 8004414918500865564L;
 
    public static final int ERROR_CODE_TIMEOUT = 100;
    public static final int ERROR_CODE_GATT = 101;
    public static final int ERROR_CODE_OTHER = 102;
    public static final int ERROR_CODE_NOT_FOUND_DEVICE = 103;
    public static final int ERROR_CODE_BLUETOOTH_NOT_ENABLE = 104;
    public static final int ERROR_CODE_SCAN_FAILED = 105;
 
 
    private int code;
    private String description;
 
    public BleException(int code, String description) {
        this.code = code;
        this.description = description;
    }
 
    public int getCode() {
        return code;
    }
 
    public BleException setCode(int code) {
        this.code = code;
        return this;
    }
 
    public String getDescription() {
        return description;
    }
 
    public BleException setDescription(String description) {
        this.description = description;
        return this;
    }
 
    @Override
    public String toString() {
        return "BleException { " +
               "code=" + code +
               ", description='" + description + '\'' +
               '}';
    }
}