PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/bluecove-bluez/src/main/java/org/bluez/Error.java

https://github.com/hcarver/bluecove
Java | 353 lines | 167 code | 30 blank | 156 comment | 0 complexity | 64282f639e3bfcf3d28f1471ff539c52 MD5 | raw file
Possible License(s): Apache-2.0, GPL-3.0
  1. /**
  2. * BlueCove - Java library for Bluetooth
  3. * Copyright (C) 2007-2009 Vlad Skarzhevskyy
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one
  6. * or more contributor license agreements. See the NOTICE file
  7. * distributed with this work for additional information
  8. * regarding copyright ownership. The ASF licenses this file
  9. * to you under the Apache License, Version 2.0 (the
  10. * "License"); you may not use this file except in compliance
  11. * with the License. You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing,
  16. * software distributed under the License is distributed on an
  17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. * KIND, either express or implied. See the License for the
  19. * specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. * =======================================================================================
  23. *
  24. * BlueZ Java docs licensed under GNU Free Documentation License, Version 1.1 http://www.fsf.org
  25. * Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org>
  26. * Copyright (C) 2005-2006 Johan Hedberg <johan.hedberg@nokia.com>
  27. * Copyright (C) 2005-2006 Claudio Takahasi <claudio.takahasi@indt.org.br>
  28. * Copyright (C) 2006-2007 Luiz von Dentz <luiz.dentz@indt.org.br>
  29. *
  30. * @author vlads
  31. * @version $Id$
  32. */
  33. package org.bluez;
  34. import org.freedesktop.dbus.DBusInterface;
  35. import org.freedesktop.dbus.exceptions.DBusExecutionException;
  36. /**
  37. * Errors thrown by hcid or any bluetooth service.
  38. *
  39. * Created base on D-Bus API description for BlueZ bluez-utils-3.36/hcid/dbus-api.txt and
  40. * bluez-4.32/doc/*.txt
  41. *
  42. */
  43. public interface Error extends DBusInterface {
  44. /**
  45. * The remote device is either powered down or out of range.
  46. */
  47. @SuppressWarnings("serial")
  48. public class DeviceUnreachable extends DBusExecutionException {
  49. public DeviceUnreachable(String message) {
  50. super(message);
  51. }
  52. }
  53. /**
  54. * A connection request has been received on an already connected device.
  55. */
  56. @SuppressWarnings("serial")
  57. public class AlreadyConnected extends DBusExecutionException {
  58. public AlreadyConnected(String message) {
  59. super(message);
  60. }
  61. }
  62. /**
  63. * An unexpected error (other than DeviceUnreachable) error has occurred while
  64. * attempting a connection to a device.
  65. */
  66. @SuppressWarnings("serial")
  67. public class ConnectionAttemptFailed extends DBusExecutionException {
  68. public ConnectionAttemptFailed(String message) {
  69. super(message);
  70. }
  71. }
  72. /**
  73. * This is a the most generic error. It is thrown when something unexpected happens.
  74. *
  75. * The error messages is taken from the strerror(errno) function.
  76. *
  77. */
  78. @SuppressWarnings("serial")
  79. public class Failed extends DBusExecutionException {
  80. public Failed(String message) {
  81. super(message);
  82. }
  83. }
  84. /**
  85. * The DBUS request does not contain the right number of arguments with the right
  86. * type, or the arguments are there but their value is wrong, or does not makes sense
  87. * in the current context.
  88. */
  89. @SuppressWarnings("serial")
  90. public class InvalidArguments extends DBusExecutionException {
  91. public InvalidArguments(String message) {
  92. super(message);
  93. }
  94. }
  95. /**
  96. * Error returned when the caller of a method is not authorized. This might happen if
  97. * a caller tries to terminate a connection that it hasn't created.
  98. *
  99. * Hcid specific Error (Can be thrown by hcid only)
  100. */
  101. @SuppressWarnings("serial")
  102. public class NotAuthorized extends DBusExecutionException {
  103. public NotAuthorized(String message) {
  104. super(message);
  105. }
  106. }
  107. /**
  108. * Error returned when a memory allocation via malloc() fails. This error is similar
  109. * to ENOMEM.
  110. */
  111. @SuppressWarnings("serial")
  112. public class OutOfMemory extends DBusExecutionException {
  113. public OutOfMemory(String message) {
  114. super(message);
  115. }
  116. }
  117. /**
  118. * Error returned when the requested adapter doesn't exists. This error is similar to
  119. * ENODEV.
  120. *
  121. * Hcid specific Error (Can be thrown by hcid only)
  122. */
  123. @SuppressWarnings("serial")
  124. public class NoSuchAdapter extends DBusExecutionException {
  125. public NoSuchAdapter(String message) {
  126. super(message);
  127. }
  128. }
  129. /**
  130. * Error returned when the adapter is DOWN.
  131. *
  132. * Hcid specific Error (Can be thrown by hcid only)
  133. */
  134. @SuppressWarnings("serial")
  135. public class NotReady extends DBusExecutionException {
  136. public NotReady(String message) {
  137. super(message);
  138. }
  139. }
  140. /**
  141. * This is an experimental method.
  142. *
  143. * Hcid specific Error (Can be thrown by hcid only)
  144. */
  145. @SuppressWarnings("serial")
  146. public class UnknwownMethod extends DBusExecutionException {
  147. public UnknwownMethod(String message) {
  148. super(message);
  149. }
  150. }
  151. /**
  152. * Error returned when a specified record is not available.
  153. */
  154. @SuppressWarnings("serial")
  155. public class NotAvailable extends DBusExecutionException {
  156. public NotAvailable(String message) {
  157. super(message);
  158. }
  159. }
  160. /**
  161. * The remote device is not connected, while the method call would expect it to be, or
  162. * is not in the expected state to perform the action.
  163. */
  164. @SuppressWarnings("serial")
  165. public class NotConnected extends DBusExecutionException {
  166. public NotConnected(String message) {
  167. super(message);
  168. }
  169. }
  170. /**
  171. * One of the requested elements already exists
  172. *
  173. * Error returned if a record for a specific procedure already exists and it has been
  174. * tried create a new one. The error message however should indicate the procedure
  175. * that fails. For example "Bonding already exists"
  176. */
  177. @SuppressWarnings("serial")
  178. public class AlreadyExists extends DBusExecutionException {
  179. public AlreadyExists(String message) {
  180. super(message);
  181. }
  182. }
  183. /**
  184. * One of the requested elements does not exist
  185. *
  186. * Error returned if a record for a specific procedure doesn't exist. The error
  187. * message however should indicate the procedure that fails. For example
  188. * "Bonding does not exist".
  189. */
  190. @SuppressWarnings("serial")
  191. public class DoesNotExist extends DBusExecutionException {
  192. public DoesNotExist(String message) {
  193. super(message);
  194. }
  195. }
  196. /**
  197. * Error returned if an operation is in progress. Since this is a generic error that
  198. * can be used in various situations, the error message should be more clear about
  199. * what is in progress. For example "Bonding in progress".
  200. */
  201. @SuppressWarnings("serial")
  202. public class InProgress extends DBusExecutionException {
  203. public InProgress(String message) {
  204. super(message);
  205. }
  206. }
  207. /**
  208. * Rejected
  209. *
  210. * Hcid specific Error (Can be thrown by hcid only)
  211. */
  212. @SuppressWarnings("serial")
  213. public class Rejected extends DBusExecutionException {
  214. public Rejected(String message) {
  215. super(message);
  216. }
  217. }
  218. /**
  219. * The operation was canceled.
  220. */
  221. @SuppressWarnings("serial")
  222. public class Canceled extends DBusExecutionException {
  223. public Canceled(String message) {
  224. super(message);
  225. }
  226. }
  227. /**
  228. * The remote device does not support the expected feature.
  229. */
  230. @SuppressWarnings("serial")
  231. public class NotSupported extends DBusExecutionException {
  232. public NotSupported(String message) {
  233. super(message);
  234. }
  235. }
  236. /**
  237. * No Such Service.
  238. *
  239. * Hcid specific Error (Can be thrown by hcid only)
  240. */
  241. @SuppressWarnings("serial")
  242. public class NoSuchService extends DBusExecutionException {
  243. public NoSuchService(String message) {
  244. super(message);
  245. }
  246. }
  247. /**
  248. * Hcid specific Error (Can be thrown by hcid only)
  249. */
  250. @SuppressWarnings("serial")
  251. public class RequestDeferred extends DBusExecutionException {
  252. public RequestDeferred(String message) {
  253. super(message);
  254. }
  255. }
  256. /**
  257. * Not In Progress
  258. *
  259. * Hcid specific Error (Can be thrown by hcid only)
  260. */
  261. @SuppressWarnings("serial")
  262. public class NotInProgress extends DBusExecutionException {
  263. public NotInProgress(String message) {
  264. super(message);
  265. }
  266. }
  267. /**
  268. * Unsupported Device Class
  269. *
  270. * Hcid specific Error (Can be thrown by hcid only)
  271. */
  272. @SuppressWarnings("serial")
  273. public class UnsupportedMajorClass extends DBusExecutionException {
  274. public UnsupportedMajorClass(String message) {
  275. super(message);
  276. }
  277. }
  278. /**
  279. * Hcid specific Error (Can be thrown by hcid only)
  280. */
  281. @SuppressWarnings("serial")
  282. public class AuthenticationFailed extends DBusExecutionException {
  283. public AuthenticationFailed(String message) {
  284. super(message);
  285. }
  286. }
  287. /**
  288. * Hcid specific Error (Can be thrown by hcid only)
  289. */
  290. @SuppressWarnings("serial")
  291. public class AuthenticationTimeout extends DBusExecutionException {
  292. public AuthenticationTimeout(String message) {
  293. super(message);
  294. }
  295. }
  296. /**
  297. * Hcid specific Error (Can be thrown by hcid only)
  298. */
  299. @SuppressWarnings("serial")
  300. public class AuthenticationRejected extends DBusExecutionException {
  301. public AuthenticationRejected(String message) {
  302. super(message);
  303. }
  304. }
  305. /**
  306. * Hcid specific Error (Can be thrown by hcid only)
  307. */
  308. @SuppressWarnings("serial")
  309. public class AuthenticationCanceled extends DBusExecutionException {
  310. public AuthenticationCanceled(String message) {
  311. super(message);
  312. }
  313. }
  314. /**
  315. * Hcid specific Error (Can be thrown by hcid only)
  316. */
  317. @SuppressWarnings("serial")
  318. public class RepeatedAttempts extends DBusExecutionException {
  319. public RepeatedAttempts(String message) {
  320. super(message);
  321. }
  322. }
  323. }