Etherios Cloud Connector very first porting for mbed. Tested in an LPC1768
Etherios Cloud Connector for Embedded v2.1.0.3 library for mbed. Early porting.
This port is centered mainly in the platform code. So it should work properly with the provided examples of send_data, device_request, data_points, RCI and firmware_update (stub implementation, not a real one... yet ;-)). Filesystem is not implemented yet, and some examples might need changes.
To run, it needs the following libraries: - mbed - mbed-rtos - EthernetInterface
Find more information (and the source code!) about Etherios Cloud Connector for Embedded here: http://www.etherios.com/products/devicecloud/support/connector and in: http://www.etherios.com
include/connector_api_os.h@1:908afea5a49d, 2013-12-03 (annotated)
- Committer:
- spastor
- Date:
- Tue Dec 03 14:10:48 2013 +0000
- Revision:
- 1:908afea5a49d
- Parent:
- 0:1c358ea10753
Use internal Thread.h instead of Threads.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spastor | 0:1c358ea10753 | 1 | /* |
spastor | 0:1c358ea10753 | 2 | * Copyright (c) 2013 Digi International Inc., |
spastor | 0:1c358ea10753 | 3 | * All rights not expressly granted are reserved. |
spastor | 0:1c358ea10753 | 4 | * |
spastor | 0:1c358ea10753 | 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
spastor | 0:1c358ea10753 | 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
spastor | 0:1c358ea10753 | 7 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
spastor | 0:1c358ea10753 | 8 | * |
spastor | 0:1c358ea10753 | 9 | * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 |
spastor | 0:1c358ea10753 | 10 | * ======================================================================= |
spastor | 0:1c358ea10753 | 11 | */ |
spastor | 0:1c358ea10753 | 12 | |
spastor | 0:1c358ea10753 | 13 | #ifndef CONNECTOR_API_OS_H |
spastor | 0:1c358ea10753 | 14 | #define CONNECTOR_API_OS_H |
spastor | 0:1c358ea10753 | 15 | |
spastor | 0:1c358ea10753 | 16 | /** |
spastor | 0:1c358ea10753 | 17 | * @defgroup connector_os_request_t OS Request IDs |
spastor | 0:1c358ea10753 | 18 | * @{ |
spastor | 0:1c358ea10753 | 19 | */ |
spastor | 0:1c358ea10753 | 20 | /** |
spastor | 0:1c358ea10753 | 21 | * Operating System Request ID passed to the application's callback for operating system interface. |
spastor | 0:1c358ea10753 | 22 | * The class id for this connector_os_request_t is connector_class_id_operating_system. |
spastor | 0:1c358ea10753 | 23 | */ |
spastor | 0:1c358ea10753 | 24 | typedef enum { |
spastor | 0:1c358ea10753 | 25 | connector_request_id_os_malloc, /**< Callback used to dynamically allocate memory.. */ |
spastor | 0:1c358ea10753 | 26 | connector_request_id_os_free, /**< Callback is called to free previous allocated memory. */ |
spastor | 0:1c358ea10753 | 27 | 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. */ |
spastor | 0:1c358ea10753 | 28 | 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. */ |
spastor | 0:1c358ea10753 | 29 | connector_request_id_os_reboot /**< Callback is called to reboot the system. */ |
spastor | 0:1c358ea10753 | 30 | } connector_request_id_os_t; |
spastor | 0:1c358ea10753 | 31 | /** |
spastor | 0:1c358ea10753 | 32 | * @} |
spastor | 0:1c358ea10753 | 33 | */ |
spastor | 0:1c358ea10753 | 34 | |
spastor | 0:1c358ea10753 | 35 | /** |
spastor | 0:1c358ea10753 | 36 | * @defgroup connector_os_malloc_t Malloc |
spastor | 0:1c358ea10753 | 37 | * @{ |
spastor | 0:1c358ea10753 | 38 | */ |
spastor | 0:1c358ea10753 | 39 | /** |
spastor | 0:1c358ea10753 | 40 | * Structure passed to connector_request_id_os_malloc callback. |
spastor | 0:1c358ea10753 | 41 | */ |
spastor | 0:1c358ea10753 | 42 | typedef struct { |
spastor | 0:1c358ea10753 | 43 | size_t CONST size; /**< Number of bytes to be allocated */ |
spastor | 0:1c358ea10753 | 44 | void * ptr; /**< Pointer to allocated memory */ |
spastor | 0:1c358ea10753 | 45 | } connector_os_malloc_t; |
spastor | 0:1c358ea10753 | 46 | /** |
spastor | 0:1c358ea10753 | 47 | * @} |
spastor | 0:1c358ea10753 | 48 | */ |
spastor | 0:1c358ea10753 | 49 | |
spastor | 0:1c358ea10753 | 50 | /** |
spastor | 0:1c358ea10753 | 51 | * @defgroup connector_os_free_t Free |
spastor | 0:1c358ea10753 | 52 | * @{ |
spastor | 0:1c358ea10753 | 53 | */ |
spastor | 0:1c358ea10753 | 54 | /** |
spastor | 0:1c358ea10753 | 55 | * Structure passed to connector_request_id_os_free callback. |
spastor | 0:1c358ea10753 | 56 | */ |
spastor | 0:1c358ea10753 | 57 | typedef struct { |
spastor | 0:1c358ea10753 | 58 | void * CONST ptr; /**< Pointer to memory to free */ |
spastor | 0:1c358ea10753 | 59 | } connector_os_free_t; |
spastor | 0:1c358ea10753 | 60 | /** |
spastor | 0:1c358ea10753 | 61 | * @} |
spastor | 0:1c358ea10753 | 62 | */ |
spastor | 0:1c358ea10753 | 63 | |
spastor | 0:1c358ea10753 | 64 | /** |
spastor | 0:1c358ea10753 | 65 | * @defgroup connector_os_system_up_time_t System Uptime |
spastor | 0:1c358ea10753 | 66 | * @{ |
spastor | 0:1c358ea10753 | 67 | */ |
spastor | 0:1c358ea10753 | 68 | /** |
spastor | 0:1c358ea10753 | 69 | * Structure passed to connector_request_id_os_system_up_time |
spastor | 0:1c358ea10753 | 70 | * callback. |
spastor | 0:1c358ea10753 | 71 | */ |
spastor | 0:1c358ea10753 | 72 | typedef struct { |
spastor | 0:1c358ea10753 | 73 | unsigned long sys_uptime; /**< Returned system uptime */ |
spastor | 0:1c358ea10753 | 74 | } connector_os_system_up_time_t; |
spastor | 0:1c358ea10753 | 75 | /** |
spastor | 0:1c358ea10753 | 76 | * @} |
spastor | 0:1c358ea10753 | 77 | */ |
spastor | 0:1c358ea10753 | 78 | |
spastor | 0:1c358ea10753 | 79 | /** |
spastor | 0:1c358ea10753 | 80 | * @defgroup connector_os_yield_t Yield Request |
spastor | 0:1c358ea10753 | 81 | * @{ |
spastor | 0:1c358ea10753 | 82 | */ |
spastor | 0:1c358ea10753 | 83 | /** |
spastor | 0:1c358ea10753 | 84 | * Structure passed to connector_request_id_os_yield callback. |
spastor | 0:1c358ea10753 | 85 | */ |
spastor | 0:1c358ea10753 | 86 | typedef struct { |
spastor | 0:1c358ea10753 | 87 | connector_status_t CONST status; /**< System status used to decide how to yield */ |
spastor | 0:1c358ea10753 | 88 | } connector_os_yield_t; |
spastor | 0:1c358ea10753 | 89 | /** |
spastor | 0:1c358ea10753 | 90 | * @} |
spastor | 0:1c358ea10753 | 91 | */ |
spastor | 0:1c358ea10753 | 92 | |
spastor | 0:1c358ea10753 | 93 | #if !defined _CONNECTOR_API_H |
spastor | 0:1c358ea10753 | 94 | #error "Illegal inclusion of connector_api_os.h. You should only include connector_api.h in user code." |
spastor | 0:1c358ea10753 | 95 | #endif |
spastor | 0:1c358ea10753 | 96 | |
spastor | 0:1c358ea10753 | 97 | #else |
spastor | 0:1c358ea10753 | 98 | #error "Illegal inclusion of connector_api_os.h. You should only include connector_api.h in user code." |
spastor | 0:1c358ea10753 | 99 | #endif |
spastor | 0:1c358ea10753 | 100 |