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 System.Runtime.InteropServices;
20 internal static partial class Interop
22 internal static partial class Badge
24 internal enum ErrorCode : int
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
39 internal enum Action : uint
48 internal delegate void ForeachCallback(string appId, uint count, IntPtr userData);
50 internal delegate void ChangedCallback(Action action, string appId, uint count, IntPtr userData);
52 [DllImport(Libraries.Badge, EntryPoint = "badge_add")]
53 internal static extern ErrorCode Add(string appId);
55 [DllImport(Libraries.Badge, EntryPoint = "badge_remove")]
56 internal static extern ErrorCode Remove(string appId);
58 [DllImport(Libraries.Badge, EntryPoint = "badge_set_count")]
59 internal static extern ErrorCode SetCount(string appId, uint count);
61 [DllImport(Libraries.Badge, EntryPoint = "badge_get_count")]
62 internal static extern ErrorCode GetCount(string appId, out uint count);
64 [DllImport(Libraries.Badge, EntryPoint = "badge_set_display")]
65 internal static extern ErrorCode SetDisplay(string appId, uint isDisplay);
67 [DllImport(Libraries.Badge, EntryPoint = "badge_get_display")]
68 internal static extern ErrorCode GetDisplay(string appId, out uint isDisplay);
70 [DllImport(Libraries.Badge, EntryPoint = "badge_foreach")]
71 internal static extern ErrorCode Foreach(ForeachCallback callback, IntPtr userData);
73 [DllImport(Libraries.Badge, EntryPoint = "badge_register_changed_cb")]
74 internal static extern ErrorCode SetChangedCallback(ChangedCallback callback, IntPtr userData);
76 [DllImport(Libraries.Badge, EntryPoint = "badge_unregister_changed_cb")]
77 internal static extern ErrorCode UnsetChangedCallback(ChangedCallback callback);