Bristol Wearable Computing

[ Home | Plans | Meetings | Members | Search | Papers | Links | CyberWear | LocoSoft]


Note Server


Purpose

The Note Server is a cental administerative server that keeps a track of note files under the Locomedia system.  The Note Server also provides a mechanism for associating attributes with note files, without affecting the note-files themselves.

API

/***********************************************************/
/*Notes Server Interface API Header 1.00                   */
/*Michael McTernan mm7323@Bris.Ac.Uk                       */
/*   Started 1/9/98                                        */
/*Notes:                                                   */
/*                                                         */
/***********************************************************/
#ifndef NOTESERVERAPIHEADER
#define NOTESERVERAPIHEADER
/*---NSAttribSet---*/
struct NSAttribSet {
  long NoteID;
  char *Prefix;
  char *Action;
  char *Expression;  
};


/*---NSAddNote---
PROTOTYPE                                                  */
  long NSAddNote(char *Filename);                          /*
  
DESCRIPTION
  Adds the note Filename to the Notes Server.  If the note
  is added without any errors, the newly added note's ID is 
  returned.  This note ID will be unique to the note on this 
  note server.
RETURNS
  -1 if an error occured at any stage, otherwise the ID of the
  newly added note is returned.
*/  


/*---NSRemoveNote---
PROTOTYPE                                                  */
  int NSRemoveNote(long NoteID);                           /*
  
DESCRIPTION
  This function will remove a note identified by NoteID
  from the Notes Server.
RETURNS
  -1 If an error occured at any stage.
   0 Success.
*/ 


/*---NSAddAttribute---
PROTOTYPE                                                  */
  int NSAddAttribute(long NoteID,char *Prefix,char *Action,char *Expression); /*
  
DESCRIPTION
  This adds the attributes stated in Prefix, Action and
  Expression to the note identified by NoteID.
RETURNS
  -1 If an error occured at any stage.
   0 Success.
*/  


/*---NSRemoveAttribute---
PROTOTYPE                                                  */
  int NSRemoveAttribute(long NoteID,char *Prefix,char *Action,char *Expression); /*
  
DESCRIPTION
  This removes the attributes stated in Prefix, Action and
  Expression to the note identified by NoteID.
  Note that wildcards are allowed with this function, so that
  all attributes may be removed by stating * * *.
RETURNS
  -1 If an error occured at any stage, otherwise the number of
  removed attributes is returned.
*/  


/*---NSGetAttributes---
PROTOTYPE                                                  */                    
  int NSGetAttributes(long NoteID,struct NSAttribSet **RetArray); /*
DESCRIPTION
  This function gets all attributes associated with the note
  identified by NoteID and returns them in an array that
  is dynamically allocated.  Elements of the array can then be
  directly accessed using the period ('.') operator.
  
  e.g.
           NSGetAttributes(Note,&AttrArray);
           t=strcmp(AttrArray[0].Action, "render");
           
RETURNS
  -1 for error, otherwise the number of elements that have been
     made in the return array.  Note that this value may be 0 if 
     not attributes are associated with the note, in which case
     RetArray will be NULL.  
NOTES
  It is important the the user frees all memory allocated by this 
  function, noting that not only RetArray needs to be freed,
  but all of the data in each element.
  The NSFreeAttributes function has been supplied for this
  purpose.
*/


/*---NSFreeAttributes---
PROTOTYPE                                                  */
  void NSFreeAttributes(struct NSAttribSet *Array, int Num);      /*
  
DESCRIPTION
  This function frees all memory that was allocated for the
  return data when NSGetAttributes was called.
  It is safe to pass it NULL, however, care should
  be taken that the Num passed to it is correct.
*/


/*---NSGetFile---
PROTOTYPE                                                  */
  char *GetFile(long NoteID);                              /*
  
DESCRIPTION
  This function returns the filename of the file that stores
  the note identified by NoteID.  Memory is allocated
  using strdup and it is the responsibility of the calling
  process to free this memory after it is used.
RETURNS
  NULL If an error occured at any stage, otherwise the string
       that is the filename of the note.
*/  


/*---NSSearch---
PROTOTYPE                                                  */
  int NSSearch(const char *Prefix, const char *Action,const char *SensedExpr,const char *UserExpr,long *NoteIDs[])/*
  
DESCRIPTION
  This function searches the Notes Server for notes that match
  the supplied boolean expressions SensedExpr and UserExpr.
  The user may also supply Prefix and Action, noting that these parameters
  may be supplied as the wildcard "*" to indicate all prefixes
  and actions.  Memory for an array will be allocated and the
  ID's of the notes that match the supplied parameters will
  be returned in this array. (It is the users responsibility to
  free this memory.)
RETURNS
  -1 if an error occured at any stage, otherwise the number of
  NoteID that have been placed in the array NoteID, noting
  that this value may be 0 is no notes matched the search 
  expressions.
*/


/*---NSSearchAttribute---
PROTOTYPE                                                  */
  int NSSearchAttribute(const char *Prefix, const char *Action,const char *SensedExpr,const char *UserExpr,struct NSAttribSet *RetAttrs[]);/*
  
DESCRIPTION
  This function searches the Notes Server for notes that match
  the supplied boolean expressions SensedExpr and UserExpr,
  and returns the matching notes ID's, and the attributes that
  cause the note to be matched.  The user may supply Prefix
  and Action, noting that these parameters may be
  supplied as the wildcard "*" to indicate all prefixes and
  actions.  Memory for an array will be allocated and data
  about matched attributes of notes will be placed in this
  array.  It is the users responsibility to free this memory.
RETURNS
  -1 if an error occured at any stage, otherwise the number of
  attributes that have been placed in the array RetAttrs[],
  noting that this value may be 0 is no notes matched the search 
  expressions.
*/

#endif

 


unicrest.gif (4191 bytes)

The material displayed is provided 'as is' and is subject to use restrictions.
For problems or questions regarding this web contact Cliff Randell.
Last updated: January 14, 2000.
logoep.gif (1404 bytes)
ęCopyright Hewlett-Packard 1997-2000.