My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* BlueCove - Java library for Bluetooth
*
* Java docs licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @version $Id$
*/
package javax.bluetooth;

import java.io.IOException;

/**
* This {@code BluetoothConnectionException} is thrown when a Bluetooth
* connection (L2CAP, RFCOMM, or OBEX over RFCOMM) cannot be established
* successfully. The fields in this exception class indicate the cause of
* the exception. For example, an L2CAP connection may fail due to a
* security problem. This reason is passed on to the application through
* this class.
*
*/
public class BluetoothConnectionException extends IOException {

private static final long serialVersionUID = 1L;

/**
* Indicates the connection to the server failed because no service
* for the given PSM was registered.
* <p>
* The value for {@code UNKNOWN_PSM} is 0x0001 (1).
*/
public final static int UNKNOWN_PSM = 0x0001;

/**
* Indicates the connection failed because the security settings on
* the local device or the remote device were incompatible with the
* request.
* <p>
* The value for {@code SECURITY_BLOCK} is 0x0002 (2).
*/
public final static int SECURITY_BLOCK = 0x002;
/**
* Indicates the connection failed due to a lack of resources either
* on the local device or on the remote device.
* <p>
* The value for {@code NO_RESOURCES} is 0x0003 (3).
*/
public final static int NO_RESOURCES = 0x0003;

/**
* Indicates the connection to the server failed due to unknown
* reasons.
* <p>
* The value for {@code FAILED_NOINFO} is 0x0004 (4).
*/
public final static int FAILED_NOINFO = 0x0004;

/**
* Indicates the connection to the server failed due to a timeout.
* <p>
* The value for {@code TIMEOUT} is 0x0005 (5).
*/
public final static int TIMEOUT = 0x0005;

/**
* Indicates the connection failed because the configuration
* parameters provided were not acceptable to either the remote
* device or the local device.
* <p>
* The value for {@code UNACCEPTABLE_PARAMS} is 0x0006 (6).
*/
public final static int UNACCEPTABLE_PARAMS = 0x0006;


private int errorCode;

/**
* Creates a new {@code BluetoothConnectionException} with the error
* indicator specified.
*
* @param error indicates the exception condition; must be one
* of the constants described in this class
* @throws java.lang.IllegalArgumentException if the input value
* is not one of the constants in this class
*/
public BluetoothConnectionException(int error) {
super();
if(error < 1 || error > 6) {
throw new java.lang.IllegalArgumentException();
}
errorCode = error;
}

/**
* Creates a new {@code BluetoothConnectionException} with the error
* indicator and message specified.
*
* @param error indicates the exception condition; must be one of
* the constants described in this class
* @param msg a description of the exception; may by {@code null}
* @throws java.lang.IllegalArgumentException if the input value
* is not one of the constants in this class
*/
public BluetoothConnectionException(int error, String msg){
super(msg);
if (error < 1 || error > 6) {
throw new java.lang.IllegalArgumentException();
}
errorCode = error;
}
/**
* Gets the status set in the constructor that will indicate the
* reason for the exception.
*
* @return cause for the exception; will be one of the constants
* defined in this class
*/
public int getStatus() {
return errorCode;
}
}

Change log

r2530 by skarzhevskyy on Dec 9, 2008   Diff
sync package javax.bluetooth javadocs with
JSR-82 1.1.1
Go to: 
Project members, sign in to write a code review

Older revisions

r2471 by skarzhevskyy on Nov 30, 2008   Diff
Change license to Apache License,
Version 2.0, Update headers
r2408 by skarzhevskyy on Oct 9, 2008   Diff
organize product to modules
r781 by skarzhevskyy on Jul 19, 2007   Diff
throw BluetoothConnectionException
from JNI
All revisions of this file

File info

Size: 4475 bytes, 139 lines

File properties

svn:mime-type
text/plain
svn:eol-style
native
svn:keywords
Date Author Id Revision
Powered by Google Project Hosting