Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-platform-linux-micro.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include "sol-common-buildopts.h"
22 #include "sol-platform.h"
23 #include "sol-platform-linux.h"
24 #include <stdbool.h>
25 #include <unistd.h>
26 #include <stdint.h>
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
44 #ifndef SOL_NO_API_VERSION
45 #define SOL_PLATFORM_LINUX_MICRO_MODULE_API_VERSION (1)
46  uint16_t api_version;
47 #endif
48  const char *name;
57  int (*init)(const struct sol_platform_linux_micro_module *module, const char *service);
58 
66  void (*shutdown)(const struct sol_platform_linux_micro_module *module, const char *service);
67 
74  int (*start)(const struct sol_platform_linux_micro_module *module, const char *service);
75 
82  int (*stop)(const struct sol_platform_linux_micro_module *module, const char *service, bool force_immediate);
83 
90  int (*restart)(const struct sol_platform_linux_micro_module *module, const char *service);
91 
98  int (*start_monitor)(const struct sol_platform_linux_micro_module *module, const char *service);
99 
106  int (*stop_monitor)(const struct sol_platform_linux_micro_module *module, const char *service);
108 
117 
118 #ifdef SOL_PLATFORM_LINUX_MICRO_MODULE_EXTERNAL
119 
134 #define SOL_PLATFORM_LINUX_MICRO_MODULE(_NAME, decl ...) \
135  SOL_API const struct sol_platform_linux_micro_module *SOL_PLATFORM_LINUX_MICRO_MODULE = &((const struct sol_platform_linux_micro_module) { \
136  SOL_SET_API_VERSION(.api_version = SOL_PLATFORM_LINUX_MICRO_MODULE_API_VERSION, ) \
137  decl \
138  })
139 #else
140 
155 #define SOL_PLATFORM_LINUX_MICRO_MODULE(_NAME, decl ...) \
156  const struct sol_platform_linux_micro_module SOL_PLATFORM_LINUX_MICRO_MODULE_ ## _NAME = { \
157  SOL_SET_API_VERSION(.api_version = SOL_PLATFORM_LINUX_MICRO_MODULE_API_VERSION, ) \
158  decl \
159  }
160 #endif
161 
162 #ifdef __cplusplus
163 }
164 #endif
void(* shutdown)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to shutdown the module.
Definition: sol-platform-linux-micro.h:66
struct sol_platform_linux_micro_module sol_platform_linux_micro_module
struct that describes the Linux micro module
const char * name
The module name.
Definition: sol-platform-linux-micro.h:48
int(* start)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to start the service.
Definition: sol-platform-linux-micro.h:74
int(* start_monitor)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to start a service monitor.
Definition: sol-platform-linux-micro.h:98
struct that describes the Linux micro module
Definition: sol-platform-linux-micro.h:43
int(* init)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to initialize the module.
Definition: sol-platform-linux-micro.h:57
int(* stop_monitor)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to stop a service monitor.
Definition: sol-platform-linux-micro.h:106
sol_platform_service_state
List of service states.
Definition: sol-platform.h:162
These routines are used for Soletta platform Linux interaction.
void sol_platform_linux_micro_inform_service_state(const char *service, enum sol_platform_service_state state)
Inform the service observers the current state of the service.
int(* restart)(const struct sol_platform_linux_micro_module *module, const char *service)
Callback used to restart the service.
Definition: sol-platform-linux-micro.h:90
These routines are used for Soletta platform interaction.
int(* stop)(const struct sol_platform_linux_micro_module *module, const char *service, bool force_immediate)
Callback used to stop the service.
Definition: sol-platform-linux-micro.h:82