OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #ifndef INCLUDE_SERVICE_API_H_ | 5 #ifndef INCLUDE_SERVICE_API_H_ |
6 #define INCLUDE_SERVICE_API_H_ | 6 #define INCLUDE_SERVICE_API_H_ |
7 | 7 |
8 #ifdef _MSC_VER | 8 #ifdef _MSC_VER |
9 // TODO(herhut): Do we need a __declspec here for Windows? | 9 // TODO(herhut): Do we need a __declspec here for Windows? |
10 #define FLETCH_VISIBILITY_DEFAULT | 10 #define DARTINO_VISIBILITY_DEFAULT |
11 #else | 11 #else |
12 #define FLETCH_VISIBILITY_DEFAULT __attribute__((visibility("default"))) | 12 #define DARTINO_VISIBILITY_DEFAULT __attribute__((visibility("default"))) |
13 #endif | 13 #endif |
14 | 14 |
15 #ifdef __cplusplus | 15 #ifdef __cplusplus |
16 #define FLETCH_EXPORT extern "C" FLETCH_VISIBILITY_DEFAULT | 16 #define DARTINO_EXPORT extern "C" DARTINO_VISIBILITY_DEFAULT |
17 #else | 17 #else |
18 #define FLETCH_EXPORT FLETCH_VISIBILITY_DEFAULT | 18 #define DARTINO_EXPORT DARTINO_VISIBILITY_DEFAULT |
19 #endif | 19 #endif |
20 | 20 |
21 #include <stddef.h> | 21 #include <stddef.h> |
22 | 22 |
23 typedef void* ServiceId; | 23 typedef void* ServiceId; |
24 typedef void* MethodId; | 24 typedef void* MethodId; |
25 | 25 |
26 typedef void (*ServiceApiCallback)(void* buffer); | 26 typedef void (*ServiceApiCallback)(void* buffer); |
27 | 27 |
28 static const ServiceId kNoServiceId = NULL; | 28 static const ServiceId kNoServiceId = NULL; |
29 static const MethodId kTerminateMethodId = NULL; | 29 static const MethodId kTerminateMethodId = NULL; |
30 | 30 |
31 // Setup must be called before using any of the other service API | 31 // Setup must be called before using any of the other service API |
32 // methods. | 32 // methods. |
33 FLETCH_EXPORT void ServiceApiSetup(); | 33 DARTINO_EXPORT void ServiceApiSetup(); |
34 | 34 |
35 // TearDown should be called when an application is done using the | 35 // TearDown should be called when an application is done using the |
36 // service API in order to free up resources. | 36 // service API in order to free up resources. |
37 FLETCH_EXPORT void ServiceApiTearDown(); | 37 DARTINO_EXPORT void ServiceApiTearDown(); |
38 | 38 |
39 FLETCH_EXPORT ServiceId ServiceApiLookup(const char* name); | 39 DARTINO_EXPORT ServiceId ServiceApiLookup(const char* name); |
40 | 40 |
41 FLETCH_EXPORT void ServiceApiInvoke(ServiceId service, | 41 DARTINO_EXPORT void ServiceApiInvoke(ServiceId service, |
42 MethodId method, | 42 MethodId method, |
43 void* buffer, | 43 void* buffer, |
44 int size); | 44 int size); |
45 | 45 |
46 FLETCH_EXPORT void ServiceApiInvokeAsync(ServiceId service, | 46 DARTINO_EXPORT void ServiceApiInvokeAsync(ServiceId service, |
47 MethodId method, | 47 MethodId method, |
48 ServiceApiCallback callback, | 48 ServiceApiCallback callback, |
49 void* buffer, | 49 void* buffer, |
50 int size); | 50 int size); |
51 | 51 |
52 FLETCH_EXPORT void ServiceApiTerminate(ServiceId service); | 52 DARTINO_EXPORT void ServiceApiTerminate(ServiceId service); |
53 | 53 |
54 #endif // INCLUDE_SERVICE_API_H_ | 54 #endif // INCLUDE_SERVICE_API_H_ |
OLD | NEW |