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
private/rci_binary_string.h@0:1c358ea10753, 2013-12-03 (annotated)
- Committer:
- spastor
- Date:
- Tue Dec 03 13:34:02 2013 +0000
- Revision:
- 0:1c358ea10753
First commit
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 | static uint8_t const * rcistr_data(rcistr_t const * const string) |
spastor | 0:1c358ea10753 | 14 | { |
spastor | 0:1c358ea10753 | 15 | return string->data; |
spastor | 0:1c358ea10753 | 16 | } |
spastor | 0:1c358ea10753 | 17 | |
spastor | 0:1c358ea10753 | 18 | static void clear_rcistr(rcistr_t * const string) |
spastor | 0:1c358ea10753 | 19 | { |
spastor | 0:1c358ea10753 | 20 | string->data = NULL; |
spastor | 0:1c358ea10753 | 21 | string->length = 0; |
spastor | 0:1c358ea10753 | 22 | } |
spastor | 0:1c358ea10753 | 23 | |
spastor | 0:1c358ea10753 | 24 | static connector_bool_t rcistr_valid(rcistr_t const * const string) |
spastor | 0:1c358ea10753 | 25 | { |
spastor | 0:1c358ea10753 | 26 | return connector_bool((string->data != NULL) && (string->length != 0)); |
spastor | 0:1c358ea10753 | 27 | } |
spastor | 0:1c358ea10753 | 28 | |
spastor | 0:1c358ea10753 | 29 | static void adjust_char_pointer(uint8_t * const new_base, uint8_t const * const old_base, uint8_t * * const pointer) |
spastor | 0:1c358ea10753 | 30 | { |
spastor | 0:1c358ea10753 | 31 | size_t const offset = (size_t)(*pointer - old_base); |
spastor | 0:1c358ea10753 | 32 | |
spastor | 0:1c358ea10753 | 33 | *pointer = (new_base + offset); |
spastor | 0:1c358ea10753 | 34 | } |
spastor | 0:1c358ea10753 | 35 | |
spastor | 0:1c358ea10753 | 36 | static void adjust_rcistr(uint8_t * const new_base, uint8_t const * const old_base, rcistr_t * const string) |
spastor | 0:1c358ea10753 | 37 | { |
spastor | 0:1c358ea10753 | 38 | uint8_t * pointer = (uint8_t *) string->data; |
spastor | 0:1c358ea10753 | 39 | |
spastor | 0:1c358ea10753 | 40 | adjust_char_pointer(new_base, old_base, &pointer); |
spastor | 0:1c358ea10753 | 41 | string->data = pointer; |
spastor | 0:1c358ea10753 | 42 | } |
spastor | 0:1c358ea10753 | 43 | |
spastor | 0:1c358ea10753 | 44 | |
spastor | 0:1c358ea10753 | 45 | |
spastor | 0:1c358ea10753 | 46 |