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
21 static internal class BluetoothErrorFactory
23 static internal void ThrowBluetoothException(int exception)
25 BluetoothError error = (BluetoothError)exception;
28 case BluetoothError.InvalidParameter:
29 throw new InvalidOperationException("Invalid parameter");
31 case BluetoothError.Cancelled:
32 throw new InvalidOperationException("Operation cancelled");
34 case BluetoothError.AlreadyDone:
35 throw new InvalidOperationException("Operation already done");
37 case BluetoothError.TimedOut:
38 throw new InvalidOperationException("Timeout error");
40 case BluetoothError.AuthFailed:
41 throw new InvalidOperationException("Authentication failed");
43 case BluetoothError.AuthRejected:
44 throw new InvalidOperationException("Authentication rejected");
46 case BluetoothError.NoData:
47 throw new InvalidOperationException("No data available");
49 case BluetoothError.NotEnabled:
50 throw new InvalidOperationException("Local adapter not enabled");
52 case BluetoothError.NotInitialized:
53 throw new InvalidOperationException("Local adapter not initialized");
55 case BluetoothError.NowInProgress:
56 throw new InvalidOperationException("Operation now in progress");
58 case BluetoothError.NotInProgress:
59 throw new InvalidOperationException("Operation not in progress");
61 case BluetoothError.NotSupported:
62 throw new NotSupportedException("Bluetooth is not supported");
64 case BluetoothError.OperationFailed:
65 throw new InvalidOperationException("Operation failed");
67 case BluetoothError.OutOfMemory:
68 throw new InvalidOperationException("Out of memory");
70 case BluetoothError.PermissionDenied:
71 throw new InvalidOperationException("Permission denied");
73 case BluetoothError.QuotaExceeded:
74 throw new InvalidOperationException("Quota exceeded");
76 case BluetoothError.RemoteDeviceNotBonded:
77 throw new InvalidOperationException("Remote device not bonded");
79 case BluetoothError.RemoteDeviceNotConnected:
80 throw new InvalidOperationException("Remote device not connected");
82 case BluetoothError.RemoteDeviceNotFound:
83 throw new InvalidOperationException("Remote device not found");
85 case BluetoothError.ResourceBusy:
86 throw new InvalidOperationException("Device or resource busy");
88 case BluetoothError.ResourceUnavailable:
89 throw new InvalidOperationException("Resource temporarily unavailable");
91 case BluetoothError.ServiceNotFound:
92 throw new InvalidOperationException("Service Not Found");
94 case BluetoothError.ServiceSearchFailed:
95 throw new InvalidOperationException("Service search failed");
98 throw new InvalidOperationException("Unknown exception");