2dadd05ee851b0cfaaddcb02d243db5c0b0eed1c
[platform/core/csapi/badge.git] / Tizen.Applications.Badge / Interop / Interop.Badge.cs
1 // Copyright 2016 by Samsung Electronics, Inc.,
2 //
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
8
9 using System;
10 using System.Runtime.InteropServices;
11
12 internal static partial class Interop
13 {
14     internal static partial class Badge
15     {
16         internal enum ErrorCode : int
17         {
18             None = Tizen.Internals.Errors.ErrorCode.None,
19             InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
20             OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
21             PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
22             IoError = Tizen.Internals.Errors.ErrorCode.IoError,
23             FromDb = -0x01120000 | 0x01,
24             AlreadyExist = -0x01120000 | 0x02,
25             FromDbus = -0x01120000 | 0x03,
26             NotExist = -0x01120000 | 0x04,
27             ServiceNotReady = -0x01120000 | 0x05,
28             InvalidPackage = -0x01120000 | 0x06
29         }
30
31         internal enum Action : uint
32         {
33             Create = 0,
34             Remove,
35             Update,
36             ChangedDisplay,
37             ServiceReady
38         }
39
40         internal delegate void ForeachCallback(string appId, uint count, IntPtr userData);
41         internal delegate void ChangedCallback(Action action, string appId, uint count, IntPtr userData);
42
43         [DllImport(Libraries.Badge, EntryPoint = "badge_add")]
44         internal static extern ErrorCode Add(string appId);
45
46         [DllImport(Libraries.Badge, EntryPoint = "badge_remove")]
47         internal static extern ErrorCode Remove(string appId);
48
49         [DllImport(Libraries.Badge, EntryPoint = "badge_set_count")]
50         internal static extern ErrorCode SetCount(string appId, uint count);
51
52         [DllImport(Libraries.Badge, EntryPoint = "badge_get_count")]
53         internal static extern ErrorCode GetCount(string appId, out uint count);
54
55         [DllImport(Libraries.Badge, EntryPoint = "badge_set_display")]
56         internal static extern ErrorCode SetDisplay(string appId, uint isDisplay);
57
58         [DllImport(Libraries.Badge, EntryPoint = "badge_get_display")]
59         internal static extern ErrorCode GetDisplay(string appId, out uint isDisplay);
60
61         [DllImport(Libraries.Badge, EntryPoint = "badge_foreach")]
62         internal static extern ErrorCode Foreach(ForeachCallback callback, IntPtr userData);
63
64         [DllImport(Libraries.Badge, EntryPoint = "badge_register_changed_cb")]
65         internal static extern ErrorCode SetChangedCallback(ChangedCallback callback, IntPtr userData);
66
67         [DllImport(Libraries.Badge, EntryPoint = "badge_unregister_changed_cb")]
68         internal static extern ErrorCode UnsetChangedCallback(ChangedCallback callback);
69
70     }
71 }