2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Tizen.Network.Bluetooth
22 /// A class which is used to Throw the Bluetooth Error exceptions.
24 static internal class BluetoothErrorFactory
27 /// Exceptions for Bluetooth Errors.
29 /// <exception cref="InvalidOperationException">Thrown when the Bluetooth Error happens.</exception>
30 static internal void ThrowBluetoothException(int exception)
32 BluetoothError error = (BluetoothError)exception;
35 case BluetoothError.InvalidParameter:
36 throw new InvalidOperationException("Invalid parameter");
38 case BluetoothError.Cancelled:
39 throw new InvalidOperationException("Operation cancelled");
41 case BluetoothError.AlreadyDone:
42 throw new InvalidOperationException("Operation already done");
44 case BluetoothError.TimedOut:
45 throw new InvalidOperationException("Timeout error");
47 case BluetoothError.AuthFailed:
48 throw new InvalidOperationException("Authentication failed");
50 case BluetoothError.AuthRejected:
51 throw new InvalidOperationException("Authentication rejected");
53 case BluetoothError.NoData:
54 throw new InvalidOperationException("No data available");
56 case BluetoothError.NotEnabled:
57 throw new InvalidOperationException("Local adapter not enabled");
59 case BluetoothError.NotInitialized:
60 throw new InvalidOperationException("Local adapter not initialized");
62 case BluetoothError.NowInProgress:
63 throw new InvalidOperationException("Operation now in progress");
65 case BluetoothError.NotInProgress:
66 throw new InvalidOperationException("Operation not in progress");
68 case BluetoothError.NotSupported:
69 throw new NotSupportedException("Bluetooth is not supported");
71 case BluetoothError.OperationFailed:
72 throw new InvalidOperationException("Operation failed");
74 case BluetoothError.OutOfMemory:
75 throw new InvalidOperationException("Out of memory");
77 case BluetoothError.PermissionDenied:
78 throw new InvalidOperationException("Permission denied");
80 case BluetoothError.QuotaExceeded:
81 throw new InvalidOperationException("Quota exceeded");
83 case BluetoothError.RemoteDeviceNotBonded:
84 throw new InvalidOperationException("Remote device not bonded");
86 case BluetoothError.RemoteDeviceNotConnected:
87 throw new InvalidOperationException("Remote device not connected");
89 case BluetoothError.RemoteDeviceNotFound:
90 throw new InvalidOperationException("Remote device not found");
92 case BluetoothError.ResourceBusy:
93 throw new InvalidOperationException("Device or resource busy");
95 case BluetoothError.ResourceUnavailable:
96 throw new InvalidOperationException("Resource temporarily unavailable");
98 case BluetoothError.ServiceNotFound:
99 throw new InvalidOperationException("Service Not Found");
101 case BluetoothError.ServiceSearchFailed:
102 throw new InvalidOperationException("Service search failed");
105 throw new InvalidOperationException("Unknown exception");