Innomatix Support / InnomatixSupport
Committer:
Innomatix
Date:
Wed Sep 06 19:18:48 2017 +0000
Revision:
11:b28c0d6773bf
Parent:
0:b9e1003fbee7
Innomatix Support Library v1.0.7 (additional files)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Innomatix 0:b9e1003fbee7 1 /*******************************************************************
Innomatix 0:b9e1003fbee7 2 *
Innomatix 0:b9e1003fbee7 3 * File: RemoteDataStoreAPI.h
Innomatix 0:b9e1003fbee7 4 *
Innomatix 0:b9e1003fbee7 5 * Description: Remote DataStore API definition
Innomatix 0:b9e1003fbee7 6 *
Innomatix 0:b9e1003fbee7 7 * Copyright 2015 Innomatix, LLC., All Rights Reserved
Innomatix 0:b9e1003fbee7 8 *
Innomatix 0:b9e1003fbee7 9 * THIS DOCUMENT AND ITS CONTENTS ARE INTELLECTUAL PROPERTY
Innomatix 0:b9e1003fbee7 10 * OF INNOMATIX, LLC. ANY DUPLICATION IN PART OR WHOLE
Innomatix 0:b9e1003fbee7 11 * WITHOUT PRIOR WRITTEN CONSENT IS STRICTLY PROHIBITED.
Innomatix 0:b9e1003fbee7 12 *
Innomatix 0:b9e1003fbee7 13 *******************************************************************/
Innomatix 0:b9e1003fbee7 14 #ifndef _REMOTEDATASTOREAPI_H_
Innomatix 0:b9e1003fbee7 15 #define _REMOTEDATASTOREAPI_H_
Innomatix 0:b9e1003fbee7 16
Innomatix 0:b9e1003fbee7 17 typedef enum
Innomatix 0:b9e1003fbee7 18 {
Innomatix 0:b9e1003fbee7 19 rdsSuccess,
Innomatix 0:b9e1003fbee7 20 rdsNoConnection,
Innomatix 0:b9e1003fbee7 21 rdsNotAllowed,
Innomatix 0:b9e1003fbee7 22 rdsServerFull,
Innomatix 0:b9e1003fbee7 23 rdsInvalidBin,
Innomatix 0:b9e1003fbee7 24 rdsNoData,
Innomatix 0:b9e1003fbee7 25 rdsTooBig,
Innomatix 0:b9e1003fbee7 26 rdsBadParameter,
Innomatix 0:b9e1003fbee7 27 rdsIncompatibleType,
Innomatix 0:b9e1003fbee7 28 rdsInUse,
Innomatix 0:b9e1003fbee7 29 rdsReadOnly,
Innomatix 0:b9e1003fbee7 30 rdsGeneralError
Innomatix 0:b9e1003fbee7 31 }RdsResults_e;
Innomatix 0:b9e1003fbee7 32
Innomatix 0:b9e1003fbee7 33
Innomatix 0:b9e1003fbee7 34 // Information about a data bin
Innomatix 0:b9e1003fbee7 35 typedef struct
Innomatix 0:b9e1003fbee7 36 {
Innomatix 0:b9e1003fbee7 37 unsigned int BinId;
Innomatix 0:b9e1003fbee7 38 unsigned char BinDataType; // Store as uchar instead of DataType so
Innomatix 0:b9e1003fbee7 39 // we dont have to include rdsdefinds.h
Innomatix 0:b9e1003fbee7 40 char BinName[ 64 ]; /* NULL terminated */
Innomatix 0:b9e1003fbee7 41
Innomatix 0:b9e1003fbee7 42 }BinInfoStruct_t;
Innomatix 0:b9e1003fbee7 43
Innomatix 0:b9e1003fbee7 44
Innomatix 0:b9e1003fbee7 45 // Since storage for the data bin is a short,
Innomatix 0:b9e1003fbee7 46 #define BinId_None ((unsigned int)-1)
Innomatix 0:b9e1003fbee7 47
Innomatix 0:b9e1003fbee7 48
Innomatix 0:b9e1003fbee7 49 /**
Innomatix 0:b9e1003fbee7 50 * Initialize the Remote DataStore API and establish a connection to the server
Innomatix 0:b9e1003fbee7 51 *
Innomatix 0:b9e1003fbee7 52 * @retval RdsResults_e -
Innomatix 0:b9e1003fbee7 53 * • rdsSuccess – a connection was established
Innomatix 0:b9e1003fbee7 54 * • rdsNoConnection – the timeout expired without a connection
Innomatix 0:b9e1003fbee7 55 ***************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 56 RdsResults_e DataStoreInit( const char *addr, unsigned short port );
Innomatix 0:b9e1003fbee7 57
Innomatix 0:b9e1003fbee7 58 /**
Innomatix 0:b9e1003fbee7 59 * Close the host connection and shut down the Remote DataStore API
Innomatix 0:b9e1003fbee7 60 **************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 61 void DataStoreClose();
Innomatix 0:b9e1003fbee7 62
Innomatix 0:b9e1003fbee7 63 /**
Innomatix 0:b9e1003fbee7 64 * Retrieve information from the server about the named data bin
Innomatix 0:b9e1003fbee7 65 *
Innomatix 0:b9e1003fbee7 66 * @param binName - name of bin of interest
Innomatix 0:b9e1003fbee7 67 * @param BinInfoStruct - structure to be populated with the data bin info
Innomatix 0:b9e1003fbee7 68 * @retval RdsResults_e -
Innomatix 0:b9e1003fbee7 69 * • rdsSuccess – the BinInfoStruct has been filled with information about the requested data bin
Innomatix 0:b9e1003fbee7 70 * • resNoConnection – the connection has been lost, or the timeout expired with no response
Innomatix 0:b9e1003fbee7 71 * from the server
Innomatix 0:b9e1003fbee7 72 * • rdsInvalidDataBin – a data bin with the given name does not exist
Innomatix 0:b9e1003fbee7 73 * • rdsGeneralError – an unknown or unspecified error has occurred
Innomatix 0:b9e1003fbee7 74 *
Innomatix 0:b9e1003fbee7 75 **************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 76 RdsResults_e GetDataBinInfo(const char *Name, BinInfoStruct_t *Info);
Innomatix 0:b9e1003fbee7 77
Innomatix 0:b9e1003fbee7 78 /**
Innomatix 0:b9e1003fbee7 79 * Retrieve the current value from a data bin
Innomatix 0:b9e1003fbee7 80 *
Innomatix 0:b9e1003fbee7 81 * @param BinId - Bin ID as returned by GetBinInfo
Innomatix 0:b9e1003fbee7 82 * @param Value - value retrieved from the data bin
Innomatix 0:b9e1003fbee7 83 * @param Timestamp - system-relative timestamp that the data bin was last udpated
Innomatix 0:b9e1003fbee7 84 * NOTE: the value may not coorelate to clock-time. Checking
Innomatix 0:b9e1003fbee7 85 * the value against a previously-saved timestamp indicates
Innomatix 0:b9e1003fbee7 86 * the data bin has been updated since the previous timestamp
Innomatix 0:b9e1003fbee7 87 * was saved.
Innomatix 0:b9e1003fbee7 88 * @retval RdsResults_e -
Innomatix 0:b9e1003fbee7 89 * • rdsSuccess – the Value and Timestamp parameters have been filled
Innomatix 0:b9e1003fbee7 90 * • rdsNoConnection – the connection has been lost, or the timeout expired with no response from the server
Innomatix 0:b9e1003fbee7 91 * • rdsInvalidBin – a data bin with the given ID does not exist
Innomatix 0:b9e1003fbee7 92 * • rdsIncompatibleType – the specified data bin is not of the requested type and the data bin value cannot
Innomatix 0:b9e1003fbee7 93 * be convereted to the requested type.
Innomatix 0:b9e1003fbee7 94 * • rdsNoData – the specified data bin has not been written to yet
Innomatix 0:b9e1003fbee7 95 * • rdsBadParameter – the value buffer pointer is NULL
Innomatix 0:b9e1003fbee7 96 * • rdsTooBig – the value buffer is not big enough to hold the retrieved data, the value buffer is left unchanged
Innomatix 0:b9e1003fbee7 97 * • rdsInUse – the requested data bin is in use by another application or client and cannot be read
Innomatix 0:b9e1003fbee7 98 * • rdsGeneralError – an unknown or unspecified error has occurred
Innomatix 0:b9e1003fbee7 99 ***************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 100 RdsResults_e GetSignedInteger(unsigned int BinId, int *Value, unsigned int *Timestamp);
Innomatix 0:b9e1003fbee7 101 RdsResults_e GetUnsignedInteger(unsigned int BinId, unsigned int *Value, unsigned int *Timestamp);
Innomatix 0:b9e1003fbee7 102 RdsResults_e GetDouble(unsigned int BinId, double *Value, unsigned int *Timestamp);
Innomatix 0:b9e1003fbee7 103 RdsResults_e GetString(unsigned int BinId, char *Str, unsigned short MaxStrLen,unsigned int *Timestamp);
Innomatix 0:b9e1003fbee7 104 RdsResults_e GetBlob( unsigned int BinId, unsigned char *Blob, unsigned short MaxBlobLen, unsigned short *ActualBlobLen, unsigned int *Timestamp);
Innomatix 0:b9e1003fbee7 105
Innomatix 0:b9e1003fbee7 106 /**
Innomatix 0:b9e1003fbee7 107 * Put a new value into the data bin
Innomatix 0:b9e1003fbee7 108 *
Innomatix 0:b9e1003fbee7 109 * @param BinId - Bin ID to update, as retrieved from GetBinInfo()
Innomatix 0:b9e1003fbee7 110 * @param Value - new value for the data bin
Innomatix 0:b9e1003fbee7 111 * @retval RdsResults_e -
Innomatix 0:b9e1003fbee7 112 * • rdsSuccess – the Value and Timestamp parameters have been filled
Innomatix 0:b9e1003fbee7 113 * • rdsNoConnection – the connection has been lost, or the timeout expired with no response from the server
Innomatix 0:b9e1003fbee7 114 * • rdsInvalidBin – a data bin with the given ID does not exist
Innomatix 0:b9e1003fbee7 115 * • rdsIncompatibleType – the specified data bin is not of the requested type and the data bin value cannot
Innomatix 0:b9e1003fbee7 116 * be convereted to the requested type.
Innomatix 0:b9e1003fbee7 117 * • rdsNoData – the specified data bin has not been written to yet
Innomatix 0:b9e1003fbee7 118 * • rdsBadParameter – the value buffer pointer is NULL
Innomatix 0:b9e1003fbee7 119 * • rdsTooBig – the value buffer is not big enough to hold the retrieved data, the value buffer is left unchanged
Innomatix 0:b9e1003fbee7 120 * • rdsInUse – the requested data bin is in use by another application or client and cannot be read
Innomatix 0:b9e1003fbee7 121 * • rdsGeneralError – an unknown or unspecified error has occurred
Innomatix 0:b9e1003fbee7 122 *
Innomatix 0:b9e1003fbee7 123 * example function call: PutSignedInteger( BinId, SignedValue )
Innomatix 0:b9e1003fbee7 124 ******************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 125 RdsResults_e PutSignedInteger(unsigned int BinId, int Value);
Innomatix 0:b9e1003fbee7 126 RdsResults_e PutUnsignedInteger(unsigned int BinId, unsigned int Value);
Innomatix 0:b9e1003fbee7 127 RdsResults_e PutDouble(unsigned int BinId, double Value);
Innomatix 0:b9e1003fbee7 128 RdsResults_e PutString(unsigned int BinId, char *Str);
Innomatix 0:b9e1003fbee7 129 RdsResults_e PutBlob( unsigned int BinId, unsigned char *Blob, unsigned short BlobLen );
Innomatix 0:b9e1003fbee7 130
Innomatix 0:b9e1003fbee7 131
Innomatix 0:b9e1003fbee7 132 /**
Innomatix 0:b9e1003fbee7 133 * Helper function to send a string to a pre-defined "debug log" data bin
Innomatix 0:b9e1003fbee7 134 *
Innomatix 0:b9e1003fbee7 135 * @param String - the message to send
Innomatix 0:b9e1003fbee7 136 * @retval RdsResults_e - same as PutString()
Innomatix 0:b9e1003fbee7 137 ******************************************************************************************************************************/
Innomatix 0:b9e1003fbee7 138 RdsResults_e PutDebug( char *Str );
Innomatix 0:b9e1003fbee7 139
Innomatix 0:b9e1003fbee7 140
Innomatix 0:b9e1003fbee7 141 #endif // _REMOTEDATASTOREAPI_H_