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.
18 using Tizen.Internals.Errors;
20 namespace Tizen.Multimedia
23 internal enum RadioError
25 None = ErrorCode.None,
26 OutOfMemory = ErrorCode.OutOfMemory,
27 InvalidParameter = ErrorCode.InvalidParameter,
28 InvalidOperation = ErrorCode.InvalidOperation,
29 PermissionDenied = ErrorCode.PermissionDenied,
30 NotSupported = ErrorCode.NotSupported,
32 InvalidState = -0x019A0000 | 0x01,
33 SoundPolicy = -0x019A0000 | 0x02,
34 NoAntenna = -0x019A0000 | 0x03,
37 internal static class RadioErrorExtensions
39 internal static void ThrowIfFailed(this RadioError err, string message)
41 if (err == RadioError.None)
46 string errMessage = $"{message}; {err}.";
49 case RadioError.PermissionDenied:
50 throw new UnauthorizedAccessException(errMessage);
52 case RadioError.InvalidParameter:
53 throw new ArgumentException(errMessage);
55 case RadioError.OutOfMemory:
56 throw new OutOfMemoryException(errMessage);
58 case RadioError.NotSupported:
59 case RadioError.NoAntenna:
60 throw new NotSupportedException(errMessage);
63 throw new InvalidOperationException(errMessage);