btnut/btnode/include/eepromdb/btn-eepromdb.h File Reference


Detailed Description

Provides support for storing and retrieving 'features' of the particular BTnode the software is running. This can be used to store, how much memory is availabe, or what the user readable name of this device is. Or what sensors are connected to it.

Author:
Martin Hinz <btnode@hinz.ch>
Features are addressed using a four byte identifier 'xxxx'. For string features, the last byte has to be '=', so all string feature id look like 'xxx=' followed by the string in the eeprom.

The feature data is stored in the EEPROM of the device. The first implementation supports Int32 and strings (len <= 16) feature data.

To create such a feature ID, you can use the macro FOURCC(a,b,c,d) that takes four characters and creates a 4 char constant. The simple use of 'abcd' is deprecated.

#include <io.h>

Defines

#define BTN_EEPROMDB_ID_SIZE   4
#define BTN_EEPROMDB_INT_SIZE   4
#define BTN_EEPROMDB_STRING_SIZE   16
#define FOURCC(a, b, c, d)   ( (u_long) a << 24 | (u_long) b << 16 | (u_long) c << 8 | (u_long) d )
 Create a 32 constant from 4 single characters.

Functions

u_char btn_eepromdb_delete (u_long id)
 Delete a value in the eeprom database in the EEPROM of the BTnode.
u_short btn_eepromdb_get (u_long id, u_short size, void *data)
 Get a value in the eeprom database in the EEPROM of the BTnode.
u_long btn_eepromdb_get_by_index (u_short index)
 Get the value id of value nr index. This is used to enumerate the eeprom database.
u_short btn_eepromdb_store (u_long id, u_short size, void *data)
 Stores into the eepromdb on the EEPROM of the BTnode.


Define Documentation

#define FOURCC ( a,
b,
c,
 )     ( (u_long) a << 24 | (u_long) b << 16 | (u_long) c << 8 | (u_long) d )

Create a 32 constant from 4 single characters.

Parameters:
a,b,c,d id characters
Returns:
32 bit integer constant


Function Documentation

u_char btn_eepromdb_delete ( u_long  id  ) 

Delete a value in the eeprom database in the EEPROM of the BTnode.

Parameters:
id 32 bit value id. String features have to be 'xxx='"
Returns:
1 ok or 0 to indicate an error.

u_short btn_eepromdb_get ( u_long  id,
u_short  size,
void *  data 
)

Get a value in the eeprom database in the EEPROM of the BTnode.

Parameters:
id 32 bit value id. String value have to be 'xxx='"
size Max size of the data buffer. Only used for strings.
data Pointer the data buffer
Returns:
Size of the data retrieved (strlen in case of string) or 0 to indicate an error.
Note:
: To retrieve a string with len=16, a buffer of size=17 is needed as the terminating '' is always added.

u_long btn_eepromdb_get_by_index ( u_short  index  ) 

Get the value id of value nr index. This is used to enumerate the eeprom database.

Parameters:
index Index of value id to get
Returns:
Value ID or 0 for last value

u_short btn_eepromdb_store ( u_long  id,
u_short  size,
void *  data 
)

Stores into the eepromdb on the EEPROM of the BTnode.

Parameters:
id 32 bit Feature id. String id have to be 'xxx='"
size Size of the data to store. (Only relevant with string values, maximal BTN_EEPROMDB_STRING_SIZE bytes
data Pointer the data to be stored (string or pointer of long)
Returns:
Size of the data successfully stored or 0 to indicate an error.


Generated on Wed Apr 29 11:12:29 2009 for BTnut System Software by doxygen 1.5.1
!!! Dieses Dokument stammt aus dem ETH Web-Archiv und wird nicht mehr gepflegt !!!
!!! This document is stored in the ETH Web archive and is no longer maintained !!!