Sebastián Pastor / EtheriosCloudConnector
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers connector_api_os.h Source File

connector_api_os.h

00001 /*
00002  * Copyright (c) 2013 Digi International Inc.,
00003  * All rights not expressly granted are reserved.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
00007  * You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
00010  * =======================================================================
00011  */
00012 
00013 #ifndef CONNECTOR_API_OS_H
00014 #define CONNECTOR_API_OS_H
00015 
00016  /**
00017  * @defgroup connector_os_request_t OS Request IDs
00018  * @{
00019  */
00020  /**
00021  * Operating System Request ID passed to the application's callback for operating system interface.
00022  * The class id for this connector_os_request_t is connector_class_id_operating_system.
00023  */
00024 typedef enum {
00025     connector_request_id_os_malloc,            /**< Callback used to dynamically allocate memory.. */
00026     connector_request_id_os_free,              /**< Callback is called to free previous allocated memory. */
00027     connector_request_id_os_system_up_time,    /**< Callback is called to return system up time in seconds. It is the time that a device has been up and running. */
00028     connector_request_id_os_yield,             /**< Callback is called with @ref connector_status_t to relinquish for other task to run when @ref connector_run is used. */
00029     connector_request_id_os_reboot            /**< Callback is called to reboot the system. */
00030 } connector_request_id_os_t;
00031 /**
00032 * @}
00033 */
00034 
00035 /**
00036 * @defgroup connector_os_malloc_t Malloc 
00037 * @{ 
00038 */
00039 /**
00040 * Structure passed to connector_request_id_os_malloc callback. 
00041 */
00042 typedef struct {
00043     size_t CONST size;            /**< Number of bytes to be allocated */
00044     void * ptr;                   /**< Pointer to allocated memory */
00045 } connector_os_malloc_t;
00046 /**
00047 * @}
00048 */
00049 
00050 /**
00051 * @defgroup connector_os_free_t Free
00052 * @{ 
00053 */
00054 /**
00055 * Structure passed to connector_request_id_os_free callback. 
00056 */
00057 typedef struct {
00058     void * CONST ptr;              /**< Pointer to memory to free */
00059 } connector_os_free_t;
00060 /**
00061 * @}
00062 */
00063 
00064 /**
00065 * @defgroup connector_os_system_up_time_t System Uptime 
00066 * @{
00067 */
00068 /**
00069 * Structure passed to connector_request_id_os_system_up_time 
00070 * callback. 
00071 */
00072 typedef struct {
00073     unsigned long sys_uptime;             /**< Returned system uptime */
00074 } connector_os_system_up_time_t;
00075 /**
00076 * @}
00077 */
00078 
00079 /**
00080 * @defgroup connector_os_yield_t  Yield Request
00081 * @{
00082 */
00083 /**
00084 * Structure passed to connector_request_id_os_yield callback. 
00085 */
00086 typedef struct {
00087     connector_status_t CONST status;      /**< System status used to decide how to yield */
00088 } connector_os_yield_t;
00089 /**
00090 * @}
00091 */
00092 
00093 #if !defined _CONNECTOR_API_H
00094 #error  "Illegal inclusion of connector_api_os.h. You should only include connector_api.h in user code."
00095 #endif
00096 
00097 #else
00098 #error  "Illegal inclusion of connector_api_os.h. You should only include connector_api.h in user code."
00099 #endif
00100