Fix coding style
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Badge / Interop / Interop.Badge.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19
20 internal static partial class Interop
21 {
22     internal static partial class Badge
23     {
24         internal enum ErrorCode : int
25         {
26             None = Tizen.Internals.Errors.ErrorCode.None,
27             InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
28             OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
29             PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
30             IoError = Tizen.Internals.Errors.ErrorCode.IoError,
31             FromDb = -0x01120000 | 0x01,
32             AlreadyExist = -0x01120000 | 0x02,
33             FromDbus = -0x01120000 | 0x03,
34             NotExist = -0x01120000 | 0x04,
35             ServiceNotReady = -0x01120000 | 0x05,
36             InvalidPackage = -0x01120000 | 0x06
37         }
38
39         internal enum Action : uint
40         {
41             Create = 0,
42             Remove,
43             Update,
44             ChangedDisplay,
45             ServiceReady
46         }
47
48         internal delegate void ForeachCallback(string appId, uint count, IntPtr userData);
49
50         internal delegate void ChangedCallback(Action action, string appId, uint count, IntPtr userData);
51
52         [DllImport(Libraries.Badge, EntryPoint = "badge_add")]
53         internal static extern ErrorCode Add(string appId);
54
55         [DllImport(Libraries.Badge, EntryPoint = "badge_remove")]
56         internal static extern ErrorCode Remove(string appId);
57
58         [DllImport(Libraries.Badge, EntryPoint = "badge_set_count")]
59         internal static extern ErrorCode SetCount(string appId, uint count);
60
61         [DllImport(Libraries.Badge, EntryPoint = "badge_get_count")]
62         internal static extern ErrorCode GetCount(string appId, out uint count);
63
64         [DllImport(Libraries.Badge, EntryPoint = "badge_set_display")]
65         internal static extern ErrorCode SetDisplay(string appId, uint isDisplay);
66
67         [DllImport(Libraries.Badge, EntryPoint = "badge_get_display")]
68         internal static extern ErrorCode GetDisplay(string appId, out uint isDisplay);
69
70         [DllImport(Libraries.Badge, EntryPoint = "badge_foreach")]
71         internal static extern ErrorCode Foreach(ForeachCallback callback, IntPtr userData);
72
73         [DllImport(Libraries.Badge, EntryPoint = "badge_register_changed_cb")]
74         internal static extern ErrorCode SetChangedCallback(ChangedCallback callback, IntPtr userData);
75
76         [DllImport(Libraries.Badge, EntryPoint = "badge_unregister_changed_cb")]
77         internal static extern ErrorCode UnsetChangedCallback(ChangedCallback callback);
78     }
79 }