Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.AttrRegister.nc

Interface: AttrRegister

Interface for registering attributes.

See lib/Attributes/... for examples of components that register attributes

See interfaces/Attr.h for the data structures used in this interface. See docs/tinyschema.pdf for more detailed documentation.

Implemented by lib/Attr.td

Author: Wei Hong (wei.hong@intel-research.net)

Components providing this interface:
tos.lib.Attr

Components requiring this interface:
tos.lib.Attributes.AttrAccelM
tos.lib.Attributes.AttrGlobalM
tos.lib.Attributes.AttrMagM
tos.lib.Attributes.AttrMicM
tos.lib.Attributes.AttrPhotoM
tos.lib.Attributes.AttrPotM
tos.lib.Attributes.AttrTempM
tos.lib.Attributes.AttrVoltageM
tos.lib.TinyDB.NetworkC

Commands

Events

Commands - Details

registerAttr

result_t registerAttr(char *name, TOSType attrType, uint8_t attrLen)

Register an attribute with the specified name, type, and length.

Parameters:

name - The name of the attribute to register.

attrType - The type of the attribute to register (see SchemaType.h for a list of types.)

attrLen - The length (in bytes) of the attribute.


getAttrDone

result_t getAttrDone(char *name, char *resultBuf, SchemaErrorNo errorNo)

Should be called when a split-phase attribute get has completed.

Parameters:

name - The name of the attribute that was fetched

resultBuf - The buffer where the value of the result was written

errorNo - An error code

Events - Details

getAttr

result_t getAttr(char *name, char *resultBuf, SchemaErrorNo *errorNo)

The provider (client) receives this event when a request for an attribute value is made. See AttrUse.td. The provider must fetch the value of the attribute (and/or set the errorNo.) If this is a split phase get, the client must call getAttrDone() once the fetch is complete.

Parameters:

name - The name of the attribute to get

resultBuf - The buffer to write the result into

errorNo - (on return) The error code, if any (see SchemaType.h)