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.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 <stdlib.h>
22 
23 #include "sol-vector.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
52 const char *sol_platform_get_board_name(void);
53 
66 const char *sol_platform_get_machine_id(void);
67 
80 const uint8_t *sol_platform_get_machine_id_as_bytes(void);
81 
92 const char *sol_platform_get_serial_number(void);
93 
100 const char *sol_platform_get_sw_version(void);
101 
109 const char *sol_platform_get_os_version(void);
110 
121 };
122 
130 int sol_platform_get_state(void);
131 
143 int sol_platform_add_state_monitor(void (*cb)(void *data,
144  enum sol_platform_state state),
145  const void *data);
146 
155 int sol_platform_del_state_monitor(void (*cb)(void *data,
156  enum sol_platform_state state),
157  const void *data);
158 
170 };
171 
190 };
191 
202 
215 int sol_platform_add_service_monitor(void (*cb)(void *data, const char *service,
216  enum sol_platform_service_state state),
217  const char *service,
218  const void *data);
219 
229 int sol_platform_del_service_monitor(void (*cb)(void *data, const char *service,
230  enum sol_platform_service_state state),
231  const char *service,
232  const void *data);
233 
241 int sol_platform_start_service(const char *service);
242 
250 int sol_platform_stop_service(const char *service);
251 
259 int sol_platform_restart_service(const char *service);
260 
261 #define SOL_PLATFORM_TARGET_DEFAULT "default"
262 #define SOL_PLATFORM_TARGET_RESCUE "rescue"
263 #define SOL_PLATFORM_TARGET_EMERGENCY "emergency"
264 #define SOL_PLATFORM_TARGET_POWER_OFF "poweroff"
265 #define SOL_PLATFORM_TARGET_REBOOT "reboot"
266 #define SOL_PLATFORM_TARGET_SUSPEND "suspend"
275 int sol_platform_set_target(const char *target);
276 
285 
295 int sol_platform_unmount(const char *mpoint, void (*cb)(void *data, const char *mpoint, int error), const void *data);
296 
304 const char *sol_platform_get_hostname(void);
305 
315 int sol_platform_set_hostname(const char *name);
316 
328 int sol_platform_add_hostname_monitor(void (*cb)(void *data, const char *hostname), const void *data);
329 
340 int sol_platform_del_hostname_monitor(void (*cb)(void *data, const char *hostname), const void *data);
341 
352 int sol_platform_set_system_clock(int64_t timestamp);
353 
363 int64_t sol_platform_get_system_clock(void);
364 
376 int sol_platform_add_system_clock_monitor(void (*cb)(void *data, int64_t timestamp), const void *data);
377 
387 int sol_platform_del_system_clock_monitor(void (*cb)(void *data, int64_t timestamp), const void *data);
388 
400 int sol_platform_set_timezone(const char *tzone);
401 
409 const char *sol_platform_get_timezone(void);
410 
419 int sol_platform_add_timezone_monitor(void (*cb)(void *data, const char *timezone), const void *data);
420 
429 int sol_platform_del_timezone_monitor(void (*cb)(void *data, const char *timezone), const void *data);
430 
448 int sol_platform_set_locale(enum sol_platform_locale_category category, const char *locale);
449 
458 const char *sol_platform_get_locale(enum sol_platform_locale_category category);
459 
471 int sol_platform_add_locale_monitor(void (*cb)(void *data, enum sol_platform_locale_category category, const char *locale), const void *data);
472 
481 int sol_platform_del_locale_monitor(void (*cb)(void *data, enum sol_platform_locale_category category, const char *locale), const void *data);
482 
494 
504 
509 #ifdef __cplusplus
510 }
511 #endif
int sol_platform_del_locale_monitor(void(*cb)(void *data, enum sol_platform_locale_category category, const char *locale), const void *data)
Remove a locale monitor.
Definition: sol-platform.h:184
Definition: sol-platform.h:189
const uint8_t * sol_platform_get_machine_id_as_bytes(void)
Retrieves the machine-id present in the file system as a byte array.
Definition: sol-platform.h:187
const char * sol_platform_get_machine_id(void)
Retrieves the machine-id present in the file system as a string.
Stopping.
Definition: sol-platform.h:119
Failed.
Definition: sol-platform.h:166
int sol_platform_add_locale_monitor(void(*cb)(void *data, enum sol_platform_locale_category category, const char *locale), const void *data)
Add a locale monitor.
Definition: sol-platform.h:178
const char * sol_platform_get_serial_number(void)
Retrieves, in number, the platform's main board serial number/identifier.
int sol_platform_add_system_clock_monitor(void(*cb)(void *data, int64_t timestamp), const void *data)
Add a callback to monitor system clock changes.
Definition: sol-platform.h:188
Definition: sol-platform.h:181
const char * sol_platform_get_sw_version(void)
Retrieves the version of Soletta that is running.
Degraded.
Definition: sol-platform.h:117
int sol_platform_get_mount_points(struct sol_ptr_vector *vector)
List mount points mounted by us on hotplug events.
int sol_platform_add_state_monitor(void(*cb)(void *data, enum sol_platform_state state), const void *data)
Adds a state monitor.
const char * sol_platform_get_timezone(void)
Get the current timezone.
int sol_platform_add_service_monitor(void(*cb)(void *data, const char *service, enum sol_platform_service_state state), const char *service, const void *data)
Adds a service monitor.
int sol_platform_restart_service(const char *service)
Restarts a given service.
Unknown.
Definition: sol-platform.h:120
String slice type.
Definition: sol-str-slice.h:84
int64_t sol_platform_get_system_clock(void)
Get the current system time.
Definition: sol-platform.h:176
Activating.
Definition: sol-platform.h:167
int sol_platform_set_hostname(const char *name)
Changes the hostname to name.
int sol_platform_start_service(const char *service)
Starts a given service.
Definition: sol-platform.h:182
enum sol_platform_service_state sol_platform_get_service_state(const char *service)
Retrieves the state of a given service.
int sol_platform_del_timezone_monitor(void(*cb)(void *data, const char *timezone), const void *data)
Remove a timezone monitor.
int sol_platform_del_state_monitor(void(*cb)(void *data, enum sol_platform_state state), const void *data)
Removes a state monitor.
Definition: sol-platform.h:186
sol_platform_service_state
List of service states.
Definition: sol-platform.h:162
const char * data
Slice data.
Definition: sol-str-slice.h:86
sol_platform_state
List of platform states.
Definition: sol-platform.h:114
Deactivating.
Definition: sol-platform.h:168
int sol_platform_del_system_clock_monitor(void(*cb)(void *data, int64_t timestamp), const void *data)
Delete a register system_clock monitor.
int sol_platform_set_system_clock(int64_t timestamp)
Set the system wide time.
int sol_platform_unmount(const char *mpoint, void(*cb)(void *data, const char *mpoint, int error), const void *data)
Umount a mpoint.
int sol_platform_del_service_monitor(void(*cb)(void *data, const char *service, enum sol_platform_service_state state), const char *service, const void *data)
Removes a service monitor.
Unknown.
Definition: sol-platform.h:169
int sol_platform_set_locale(enum sol_platform_locale_category category, const char *locale)
Set locale for a category.
int sol_platform_apply_locale(enum sol_platform_locale_category category)
Apply the locale category to the process.
int sol_platform_get_state(void)
Retrieves the current platform state.
const char * sol_platform_get_hostname(void)
Gets the hostname.
sol_platform_locale_category
A locale category.
Definition: sol-platform.h:175
Maintenance.
Definition: sol-platform.h:118
struct sol_str_slice sol_platform_get_appname(void)
Get current app name.
const char * sol_platform_get_os_version(void)
Retrieves the operating system's version that Soletta is running on top of.
Soletta pointer vector is a wrapper around vector with an API more convenient to handle pointers...
Definition: sol-vector.h:310
Definition: sol-platform.h:180
int sol_platform_stop_service(const char *service)
Stops a given service.
int sol_platform_set_timezone(const char *tzone)
Set the system timezone.
int sol_platform_add_hostname_monitor(void(*cb)(void *data, const char *hostname), const void *data)
Adds a hostname monitor.
const char * sol_platform_get_board_name(void)
Retrieves the name of the board on which Soletta is running.
Definition: sol-platform.h:183
Definition: sol-platform.h:177
Definition: sol-platform.h:185
Running.
Definition: sol-platform.h:116
These are routines that Soletta provides for its vector implementation.
Inactive.
Definition: sol-platform.h:165
Definition: sol-platform.h:179
Initializing.
Definition: sol-platform.h:115
Active.
Definition: sol-platform.h:163
Reloading.
Definition: sol-platform.h:164
int sol_platform_del_hostname_monitor(void(*cb)(void *data, const char *hostname), const void *data)
Remove a hostname monitor.
int sol_platform_add_timezone_monitor(void(*cb)(void *data, const char *timezone), const void *data)
Add a timezone monitor.
const char * sol_platform_get_locale(enum sol_platform_locale_category category)
Get the current locale of a given category.