Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
exosite.h
00001 /***************************************************************************** 00002 * 00003 * exosite.h - Exosite Activator Library 00004 * Copyright (C) 2015 Exosite LLC 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * Neither the name of Texas Instruments Incorporated nor the names of 00019 * its contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 *****************************************************************************/ 00035 00036 #ifndef EXOSITE_H 00037 #define EXOSITE_H 00038 00039 #include <stdint.h> 00040 #include "exosite_pal.h" 00041 00042 00043 // DEFINES 00044 #define CIK_LENGTH 40 00045 00046 // ENUMS 00047 typedef enum exo_error 00048 { 00049 EXO_OK = 0, 00050 EXO_GENERAL_ERROR, 00051 EXO_OUT_OF_SPACE, 00052 EXO_FATAL_ERROR_PAL, 00053 } exo_error; 00054 00055 typedef enum exo_state 00056 { 00057 EXO_IDLE, 00058 EXO_WAITING, 00059 EXO_BUSY, 00060 EXO_NEW_RESPONSE, 00061 EXO_ERROR, 00062 EXO_CONNECTION_ERROR, 00063 EXO_DEVICE_NOT_ENABLED, 00064 EXO_DEVICE_DOES_NOT_EXIST, 00065 } exo_state; 00066 00067 typedef enum exo_data_format 00068 { 00069 EXO_STRING, 00070 EXO_FLOAT, 00071 EXO_INTEGER 00072 } exo_data_format; 00073 00074 typedef enum exo_device_state 00075 { 00076 EXO_STATE_UNINITIALIZED, 00077 EXO_STATE_INITIALIZED, 00078 EXO_STATE_GOOD, 00079 EXO_STATE_BAD_CIK, 00080 } exo_device_state; 00081 00082 typedef enum exo_request_type 00083 { 00084 EXO_NULL = 0, 00085 EXO_WRITE, 00086 EXO_READ, 00087 EXO_SUBSCRIBE, 00088 EXO_ACTIVATE, 00089 } exo_request_type; 00090 00091 typedef enum exo_request_state 00092 { 00093 EXO_REQUEST_NULL, 00094 EXO_REQUEST_NEW, 00095 EXO_REQUEST_PENDING, 00096 EXO_REQUEST_SUBSCRIBED, 00097 EXO_REQUEST_SUB_ACK, 00098 EXO_REQUEST_SUB_ACK_NEW, 00099 EXO_REQUEST_SUCCESS, 00100 EXO_REQUEST_ERROR, 00101 } exo_request_state; 00102 00103 typedef struct exo_op 00104 { 00105 exo_request_type type; 00106 exo_request_state state; 00107 const char * alias; 00108 char * value; 00109 size_t value_max; 00110 uint16_t mid; 00111 uint32_t obs_seq; 00112 uint8_t tkl; 00113 uint64_t token; 00114 uint64_t timeout; 00115 uint8_t retries; 00116 } exo_op; 00117 00118 // PUBLIC FUNCTIONS 00119 exo_error exo_init(const char * vendor, const char *model, const char *sn); 00120 00121 void exo_write(exo_op *op, const char * alias, const char * value); 00122 void exo_read(exo_op *op, const char * alias, char * value, const size_t value_max); 00123 void exo_subscribe(exo_op *op, const char * alias, char * value, const size_t value_max); 00124 00125 void exo_op_init(exo_op *op); 00126 void exo_op_done(exo_op *op); 00127 00128 uint8_t exo_is_op_valid(exo_op *op); 00129 uint8_t exo_is_op_success(exo_op *op); 00130 uint8_t exo_is_op_finished(exo_op *op); 00131 uint8_t exo_is_op_read(exo_op *op); 00132 uint8_t exo_is_op_subscribe(exo_op *op); 00133 uint8_t exo_is_op_write(exo_op *op); 00134 00135 exo_state exo_operate(exo_op * ops, uint8_t count); 00136 00137 00138 #endif 00139 00140 00141
Generated on Tue Jul 12 2022 18:09:07 by
1.7.2